Vicinity
This is one of the most basic geometry proximity problems. We are given n points in the plane and we should determine which points are in the vicinity of a particular point.
Let the set of points P = {p_1, p_2 , …, p_n}, where p_i has coordinates (x_i, y_i). We use d(p_i, p_j) to denote the distance between the two points. A point p_j is in the vicinity of point p_i if d(p_i, p_j) ≤ d_v. We may call d_v the vicinity distance. Given a set of points P, point p_i and d_v, your task is to write a program to calculate the number of points which are in the vicinity of point p_i.
Input
The first line contains an integer n (2 ≤ n ≤ 1000) which determines the number of points. The following n lines contain two integers which correspond to the coordinates (x_i, y_i) of each point (-10^6 ≤ x_i, y_i ≤ 10^6). Then, the following line includes t (1 ≤ t ≤ 50) indicating the number of test cases, followed by t lines and each line contains 2 positive integers i (1 ≤ i ≤ n) and d_v (1 ≤ d_v ≤ 100) which indicate the point p_i and its vicinity distance, respectively.
Output
For each test case, print out in a line the number of points in the vicinity of the corresponding point.