Number of pairs - 2
Easy
Execution time limit is 10 seconds
Runtime memory usage limit is 256 megabytes
You are given n points on a plane. Your task is to answer queries regarding the number of pairs of points that have a specific distance between them.
Input
The first line contains an integer N (1 ≤ N ≤ 10^6). The following n lines each describe a point with two integers x_i and y_i, representing the coordinates of the point (0 ≤ x_i, y_{i }< 10^3). It is guaranteed that all points are distinct. The next line contains the integer q, the number of queries (1 ≤ q ≤ 10^6). Each of the subsequent q lines contains a single integer k_i (0 ≤ k ≤ 10^9), representing a query.
Output
Output exactly q lines. For the i-th line, provide the answer to the query: "How many pairs of points have a distance equal to the given value?".
Examples
Input #1
Answer #1
Submissions 118
Acceptance rate 3%