#P1538C. Number of Pairs
Number of Pairs
No submission language available for this problem.
Description
You are given an array of integers. Find the number of pairs () where the sum of is greater than or equal to and less than or equal to (that is, ).
For example, if , , and , then two pairs are suitable:
- and ();
- and ().
The first line contains an integer (). Then test cases follow.
The first line of each test case contains three integers (, ) — the length of the array and the limits on the sum in the pair.
The second line contains integers ().
It is guaranteed that the sum of overall test cases does not exceed .
For each test case, output a single integer — the number of index pairs (), such that .
Input
The first line contains an integer (). Then test cases follow.
The first line of each test case contains three integers (, ) — the length of the array and the limits on the sum in the pair.
The second line contains integers ().
It is guaranteed that the sum of overall test cases does not exceed .
Output
For each test case, output a single integer — the number of index pairs (), such that .