Language: C++

#include <map>

using namespace std;

multimap<double,int> mp;

struct bir {
	double x,y,m;
	int to[1001],fr;
};

bir b[1000];

multimap<double,int>::iterator it;

int search(int s,int e) {
	int n,i;
	double m,k;
	b[s].m=0; b[s].fr=-1; 
	mp.insert(multimap<double,int>::value_type(0,s));
	while(!mp.empty()) {
		it=mp.begin();
		n=(*it).second; m=(*it).first;
		mp.erase(it);
		for (i=0;b[n].to[i]>=0;i++) {
			k=sqrt((b[n].x-b[b[n].to[i]].x)*(b[n].x-b[b[n].to[i]].x)+(b[n].y-b[b[n].to[i]].y)*(b[n].y-b[b[n].to[i]].y));
			if (b[b[n].to[i]].m>b[n].m+k) {
				mp.insert(multimap<double,int>::value_type(b[n].m+k,b[n].to[i]));
				b[b[n].to[i]].fr=n; b[b[n].to[i]].m=b[n].m+k;
			}
		}
	}
    if (b[e].m==999999999) return 0;
	return 1;
}

int main() {
 int bn,g,i,j,k,n,s,e,an[1000],num[1000],rn[1000];
 while(cin >> bn) {
	 if (bn==0) break;
	 for (i=0;i<bn;i++) { cin >> num[i] >> b[i].x >> b[i].y; rn[num[i]]=i;}
	 for (i=0;i<bn;i++) {
		 for (j=0,k=0;j<bn;j++) if (i!=j) if ((b[i].x-b[j].x)*(b[i].x-b[j].x)+(b[i].y-b[j].y)*(b[i].y-b[j].y)<=2500) b[i].to[k++]=j; 
		 b[i].to[k]=-1; b[i].m=999999999;
	 }
     cin >> n;
	 for (i=0;i<n;i++) {
		 cin >> s >> e;
		 s=rn[s]; e=rn[e];
		 if (search(s,e)==1) {
			 j=0;
			 while(e>=0) {an[j++]=num[e]; e=b[e].fr;}
			 for (;j>0;j--) { cout << an[j-1]; if (j>1) cout << ' ';}
			 cout << endl;
		 } else cout << "NA" << endl;
	 }
 }
return 0;
 }

Compiler output:
a.cc: In function 'int search(int, int)':
a.cc:26:27: error: 'sqrt' was not declared in this scope
   26 |                         k=sqrt((b[n].x-b[b[n].to[i]].x)*(b[n].x-b[b[n].to[i]].x)+(b[n].y-b[b[n].to[i]].y)*(b[n].y-b[b[n].to[i]].y));
      |                           ^~~~
a.cc: In function 'int main()':
a.cc:39:8: error: 'cin' was not declared in this scope
   39 |  while(cin >> bn) {
      |        ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <map>
  +++ |+#include <iostream>
    2 | 
a.cc:53:43: error: 'cout' was not declared in this scope
   53 |                          for (;j>0;j--) { cout << an[j-1]; if (j>1) cout << ' ';}
      |                                           ^~~~
a.cc:53:43: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:26: error: 'cout' was not declared in this scope
   54 |                          cout << endl;
      |                          ^~~~
a.cc:54:26: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:34: error: 'endl' was not declared in this scope
   54 |                          cout << endl;
      |                                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <map>
  +++ |+#include <ostream>
    2 | 
a.cc:55:25: error: 'cout' was not declared in this scope
   55 |                  } else cout << "NA" << endl;
      |                         ^~~~
a.cc:55:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:55:41: error: 'endl' was not declared in this scope
   55 |                  } else cout << "NA" << endl;
      |                                         ^~~~
a.cc:55:41: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'