Is it Random?
A friend of yours has created a random number generator and he wants you to check it. Your friend will give you n numbers and the value k.
There will be a certain number of pairs which have an absolute difference being equal to k. If this number exceeds half the value of n then the numbers generated are not random.
The first line of input contains the number of test cases : t.
Each test case contains two lines of input : the first specifying the values of n and k, and the second specifying the n distinct numbers generated.
One line containing either YES or NO stating whether the numbers are random or not.
5 3 1 2 4
6 2 8 1 9 4 5
1<=n,k. They fit into the value of signed integer.
Problem Setter : Neesha Sinha