Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef pair<int, int> P;
#define X first
#define Y second
vector<P> A[100010],B[100010];
int main(){
	while(1){
		int an,bn,r,ans=0,n=0;
		int x,y;
		vector<P>::iterator it1;
		vector<P>::iterator it2;
		cin>>an>>bn>>r;
		if(an==0 && bn==0 && r==0)
		break;
		
		for(int i=0;i<an;i++){
			cin>>x>>y;
			A[i].X=x;
			A[i].Y=y;
		}
		for(int i=0;i<bn;i++){
			cin>>x>>y;
			B[x].push_back(P(x,y));
		}
		for(int i=0;i<100010;i++){
			sort(B[i].begin(),B[i].end());
			B[i].push_back(P(i,10000));
		}
		
		for(int i=0;i<an;i++){
			for(int j=-4*r;j<=4*r;j++){
				n=sqrt(4*r*4*r-j*j);
				if(A[i].X+j>=0 && A[i].X+j<=10000 && B[A[i].X+j].size()!=0){
					it1=lower_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y-n));
					
					it2=upper_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y+n));
					
					if(B[A[i].X+j].begin()<=it1  && it1< B[A[i].X+j].end() && B[A[i].X+j].begin() <=it2 && it2 < B[A[i].X+j].end()){
						ans+=it2-it1;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:22:30: note: in expansion of macro 'X'
   22 |                         A[i].X=x;
      |                              ^
a.cc:8:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
    8 | #define Y second
      |           ^~~~~~
a.cc:23:30: note: in expansion of macro 'Y'
   23 |                         A[i].Y=y;
      |                              ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:37:41: note: in expansion of macro 'X'
   37 |                                 if(A[i].X+j>=0 && A[i].X+j<=10000 && B[A[i].X+j].size()!=0){
      |                                         ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:37:56: note: in expansion of macro 'X'
   37 |                                 if(A[i].X+j>=0 && A[i].X+j<=10000 && B[A[i].X+j].size()!=0){
      |                                                        ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:37:77: note: in expansion of macro 'X'
   37 |                                 if(A[i].X+j>=0 && A[i].X+j<=10000 && B[A[i].X+j].size()!=0){
      |                                                                             ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:38:64: note: in expansion of macro 'X'
   38 |                                         it1=lower_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y-n));
      |                                                                ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:38:84: note: in expansion of macro 'X'
   38 |                                         it1=lower_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y-n));
      |                                                                                    ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:38:102: note: in expansion of macro 'X'
   38 |                                         it1=lower_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y-n));
      |                                                                                                      ^
a.cc:8:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
    8 | #define Y second
      |           ^~~~~~
a.cc:38:111: note: in expansion of macro 'Y'
   38 |                                         it1=lower_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y-n));
      |                                                                                                               ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:40:64: note: in expansion of macro 'X'
   40 |                                         it2=upper_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y+n));
      |                                                                ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:40:84: note: in expansion of macro 'X'
   40 |                                         it2=upper_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y+n));
      |                                                                                    ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:40:102: note: in expansion of macro 'X'
   40 |                                         it2=upper_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y+n));
      |                                                                                                      ^
a.cc:8:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
    8 | #define Y second
      |           ^~~~~~
a.cc:40:111: note: in expansion of macro 'Y'
   40 |                                         it2=upper_bound(B[A[i].X+j].begin(),B[A[i].X+j].end(),P(A[i].X+j,A[i].Y+n));
      |                                                                                                               ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:42:51: note: in expansion of macro 'X'
   42 |                                         if(B[A[i].X+j].begin()<=it1  && it1< B[A[i].X+j].end() && B[A[i].X+j].begin() <=it2 && it2 < B[A[i].X+j].end()){
      |                                                   ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:42:85: note: in expansion of macro 'X'
   42 |                                         if(B[A[i].X+j].begin()<=it1  && it1< B[A[i].X+j].end() && B[A[i].X+j].begin() <=it2 && it2 < B[A[i].X+j].end()){
      |                                                                                     ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:42:106: note: in expansion of macro 'X'
   42 |                                         if(B[A[i].X+j].begin()<=it1  && it1< B[A[i].X+j].end() && B[A[i].X+j].begin() <=it2 && it2 < B[A[i].X+j].end()){
      |                                                                                                          ^
a.cc:7:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 | #define X first
      |           ^~~~~
a.cc:42:141: note: in expansion of macro 'X'
   42 |                                         if(B[A[i].X+j].begin()<=it1  && it1< B[A[i].X+j].end() && B[A[i].X+j].begin() <=it2 && it2 < B[A[i].X+j].end()){
      |                                                                                                                                             ^