Space
Time limit1sMemory limit128 MB
Count, for each test case, the pairs of up to 100000 points whose Euclidean distance is strictly less than d.
Problem
Teams at a programming contest cannot sit close to one another, because a team could copy the solution of the team next to it. You are given the position of every team and the minimum Euclidean distance required between two teams. Count the pairs of teams that sit too close to each other.
Two teams sit too close when the Euclidean distance between them is smaller than . A pair at distance exactly does not count.
Input
The first line contains one integer (), the number of test cases. Each test case is given as follows.
- One line with two integers () and (), the number of teams and the minimum distance between two teams.
- lines with two integers () and (), the coordinates of the -th team. No two teams share the same coordinates.
Output
For each test case, print one line with the number of pairs of teams that sit too close to each other.