시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB5000.000%

문제

During a programming contest, teams can’t sit close to each other, because then a team might copy the solution of another team. You are given the locations of the teams and the minimum required Euclidian distance between two teams. You have to find the number of pairs of teams that sit too close to each other.

입력

On the first line an integer t (1 ≤ t ≤ 100): the number of test cases. Then for each test case:

  • One line with two integers n (1 ≤ n ≤ 100000) and d (1 ≤ d ≤ 50): the number of teams and the minimum distance between two teams.
  • n lines with two integers xi (0 ≤ xi ≤ 1000000000) and yi (0 ≤ yi ≤ 1000000000): the coordinates of the i-th team. No two teams will have the same coordinates.

출력

For each test case:

  • One line with the number of pairs of teams that sit too close to each other.

예제 입력 1

1
6 3
0 0
0 3
2 1
2 3
3 0
3 1

예제 출력 1

8