Triplets

4.5

2 votes
Medium
Problem

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.

Example:

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

Output:
2
4

Time Limit: 1
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?