Timer is Running

Count triplets with sum smaller than X
##### Submissions: 11420   Accuracy: 44.97%   Difficulty: Basic   Marks: 1

Given an array A of distinct integers and a sum value X. Find count of triplets with sum smaller than given sum value X.

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 array elements.

Output:
For each testcase, output the count of Triplets.

Constraints:
1 <= T <= 100
1 <= N <= 107

1 <= Ai <= 108
1 <= X <= 1010

Example:
Input:

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

Output:
2
4

Explanation:
Testcase 1:
-2, 0, 1 and -2, 3, 0 makes triplets with sum less than 2.

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

Contributor: Saksham Raj Seth
Author: saksham seth

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.