BETA

Difficulty Level:

Basic

Total Submissions: 3214 Accuracy:

25.89%

Count triplets with sum smaller than X
     

Given an array of distinct integers and a sum value. Find count of triplets with sum smaller than given sum value.
Note: Expected time complexity O(n^2).

Input:
First line consists of T test cases. First line of every test case consists of N and X, denoting the number of elements in array and Sum Value respectively. Second line consists of elements of Array.

Output:
Single line output, print the count of Triplets.

Constraints:
1<=T<=100
1<=N<=10^4

Example:
Input:

2
4 2
-2 0 1 3
5 12
5 1 4 3 7
Output:
2
4

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.