Submit Best Submissions All Submissions

201. Flirt With Girls


Problem Statement:
Esso (aka multisystem) is a naughty boy. He once was walking and noticed that there are N girls around him. Being naughty, he decided to send them some flirting messages via bluetooth.

Unfortunately, after checking his phone manual, he found that the range bluetooth can reach is within a circle of radius R. In other words, he can only flirt with girls who are close enough to be within a circle of radius R of him (he can flirt with a girl exactly on the boundary of that circle). So he made up his mind and checked the locations of the N girls via GPS. He now has their locations in terms of (x,y) points. Esso's position is point (0,0).

Unfortunately, being naughty he didn't pay much attention to his programming courses. That's why he sucks at programming and needs your help. Write a program that takes as input the number of girls around him, their locations and the range his phone bluetooth can work with, and print the number of girls he can flirt with.


Input Format:
Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 <= T <= 100). The first line of each test case contains two integers, N the number of girls around him (1 <= N <= 1000), R the radius of the circle (1 <= R <= 1000). Following are N lines containing the location of each of the N girls. The i-th line consists of two integers: the x,y coordinates of the i-th girl (0 <= x,y <= 1000).


Output Format:
For each test case, print on a single line one integer, the number of girls he can flirt with.


Sample Input:
3 2 2 1 1 2 2 1 1 2 2 3 1 1 0 0 1 1 1


Sample Output:
1 0 2





Added by: ahmed_aly
Added at: 2014-08-23 14:00:00 UTC
Time Limit: 1 second
Partial score: No
Source:A2OJ FCI-CU Tournament 2014 - Final Round