题目描述
Saurav has put up Chinese food stall in the college fest. He has arranged everything but he was not able to find chop-sticks in any shop. He decided to make some himself. After hours of efforts, he was able to collect a few ice cream sticks that resembled chop sticks. The problem was that they were not in pair.
Saurav decided that if the difference in length of two chop sticks is not more than D, he will consider these two sticks as a pair of chopsticks. Given the length of each ice-cream stick, can you tell the final number of pairs that he can make?
Input
The first line contains T, the number of test cases. Description of T test cases follows.
The first line of each test case contains two space-separated integers N and D. The next N lines contain one integer each, the ith line giving the value of L[i].
Output
For each test case, output a single line containing the maximum number of pairs of chopsticks Saurav can form.
Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 10^5
0 ≤ D ≤ 10^18
1 ≤ L[i] ≤ 10^18 for all integers i from 1 to N
SAMPLE INPUT
1
2 5
1
6
SAMPLE OUTPUT
1
输入格式
见题面
输出格式
见题面