Mr. Modulo comes up with another problem related to modulo and this time he is interested in finding all the possible pairs a and b in the array a such that a % b = k where k is a given integer. The array given will have distinct elements.
You are required to print how many such pairs exist.
The first line of input contains an integer T denoting the number of test cases. Each test case contains two integers n and k, where n is the number of elements in the array a. Next line contains space separated n elements in the array a.
Print an integer which is the total number of such pairs in the array.
2 3 5 4 7
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.