Language: C++

#include<bits/stdc++.h>
typedef complex<double> P;
const double eps = 1e-8;
double dot(P a, P b) { return real(conj(a) * b); }
double cross(P a, P b) { return imag(conj(a) * b); }
int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if (cross(b, c) > eps) return 1;
    if (cross(b, c) < -eps) return -1;
    if (dot(b, c) < -eps) return 2;
    if (norm(c) > norm(b)) return -2;
    return 0;
}
bool intersectSS(P p1, P p2, P p3, P p4) {
    return ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0;
}
int n,m;long double ax[1000],ay[1000],bx[1000],by[1000],dist[1000];
vector<pair<int,long double>>x[1000];
long double dijkstra(int s,int t){
	priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>>Q;
	Q.push(make_pair(0.0L,s));for(int i=0;i<1000;i++)dist[i]=1e9;dist[s]=0.0L;
	while(!Q.empty()){
		long double a1=Q.top().first;int a2=Q.top().second;Q.pop();
		for(int i=0;i<x[a2].size();i++){
			if(dist[x[a2][i].first]>a1+x[a2][i].second){
				dist[x[a2][i].first]=a1+x[a2][i].second;
				Q.push(make_pair(dist[x[a2][i].first],x[a2][i].first));
			}
		}
	}
	return dist[t];
}
int main(){
	cin>>n>>m;for(int i=0;i<n;i++)cin>>ax[i]>>ay[i];
	for(int i=0;i<m;i++)cin>>bx[i]>>by[i];
	for(int i=0;i<1000;i++)x[i].clear();
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(intersectSS(P(ax[i],ay[i]),P(ax[j],ay[j]),P(bx[0],by[0]),P(bx[1],by[1]))==0){
				long double dst1=sqtrl((ax[i]-ax[j])*(ax[i]-ax[j])+(ay[i]-ay[j])*(ay[i]-ay[j]));
				x[i].push_back(make_pair(j,dst1));
				x[j].push_back(make_pair(i,dst1));
			}
		}
	}
	long double r1=dijkstra(0,1);
	for(int i=0;i<1000;i++)x[i].clear();
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(intersectSS(P(bx[i],by[i]),P(bx[j],by[j]),P(ax[0],ay[0]),P(ax[1],ay[1]))==0){
				long double dst1=sqtrl((bx[i]-bx[j])*(bx[i]-bx[j])+(by[i]-by[j])*(by[i]-by[j]));
				x[i].push_back(make_pair(j,dst1));
				x[j].push_back(make_pair(i,dst1));
			}
		}
	}
	long double r2=dijkstra(0,1);
	printf("%.15Lf\n",min(p1,p2));
	return 0;
}

Compiler output:
a.cc:2:9: error: 'complex' does not name a type
    2 | typedef complex<double> P;
      |         ^~~~~~~
a.cc:4:12: error: 'P' was not declared in this scope
    4 | double dot(P a, P b) { return real(conj(a) * b); }
      |            ^
a.cc:4:17: error: 'P' was not declared in this scope
    4 | double dot(P a, P b) { return real(conj(a) * b); }
      |                 ^
a.cc:4:20: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | double dot(P a, P b) { return real(conj(a) * b); }
      |                    ^
a.cc:5:14: error: 'P' was not declared in this scope
    5 | double cross(P a, P b) { return imag(conj(a) * b); }
      |              ^
a.cc:5:19: error: 'P' was not declared in this scope
    5 | double cross(P a, P b) { return imag(conj(a) * b); }
      |                   ^
a.cc:5:22: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | double cross(P a, P b) { return imag(conj(a) * b); }
      |                      ^
a.cc:6:9: error: 'P' was not declared in this scope
    6 | int ccw(P a, P b, P c) {
      |         ^
a.cc:6:14: error: 'P' was not declared in this scope
    6 | int ccw(P a, P b, P c) {
      |              ^
a.cc:6:19: error: 'P' was not declared in this scope
    6 | int ccw(P a, P b, P c) {
      |                   ^
a.cc:6:22: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | int ccw(P a, P b, P c) {
      |                      ^
a.cc:14:18: error: 'P' was not declared in this scope
   14 | bool intersectSS(P p1, P p2, P p3, P p4) {
      |                  ^
a.cc:14:24: error: 'P' was not declared in this scope
   14 | bool intersectSS(P p1, P p2, P p3, P p4) {
      |                        ^
a.cc:14:30: error: 'P' was not declared in this scope
   14 | bool intersectSS(P p1, P p2, P p3, P p4) {
      |                              ^
a.cc:14:36: error: 'P' was not declared in this scope
   14 | bool intersectSS(P p1, P p2, P p3, P p4) {
      |                                    ^
a.cc:14:40: error: expression list treated as compound expression in initializer [-fpermissive]
   14 | bool intersectSS(P p1, P p2, P p3, P p4) {
      |                                        ^
a.cc:18:1: error: 'vector' does not name a type
   18 | vector<pair<int,long double>>x[1000];
      | ^~~~~~
a.cc: In function 'long double dijkstra(int, int)':
a.cc:20:9: error: 'priority_queue' was not declared in this scope; did you mean 'std::priority_queue'?
   20 |         priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>>Q;
      |         ^~~~~~~~~~~~~~
      |         std::priority_queue
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:496:11: note: 'std::priority_queue' declared here
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
a.cc:20:24: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   20 |         priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>>Q;
      |                        ^~~~
      |                        std::pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:20:29: error: expected primary-expression before 'long'
   20 |         priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>>Q;
      |                             ^~~~
a.cc:21:9: error: 'Q' was not declared in this scope
   21 |         Q.push(make_pair(0.0L,s));for(int i=0;i<1000;i++)dist[i]=1e9;dist[s]=0.0L;
      |         ^
a.cc:21:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   21 |         Q.push(make_pair(0.0L,s));for(int i=0;i<1000;i++)dist[i]=1e9;dist[s]=0.0L;
      |                ^~~~~~~~~
      |                std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:24:31: error: 'x' was not declared in this scope
   24 |                 for(int i=0;i<x[a2].size();i++){
      |                               ^
a.cc: In function 'int main()':
a.cc:34:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   34 |         cin>>n>>m;for(int i=0;i<n;i++)cin>>ax[i]>>ay[i];
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:36:32: error: 'x' was not declared in this scope
   36 |         for(int i=0;i<1000;i++)x[i].clear();
      |                                ^
a.cc:39:40: error: 'P' was not declared in this scope
   39 |                         if(intersectSS(P(ax[i],ay[i]),P(ax[j],ay[j]),P(bx[0],by[0]),P(bx[1],by[1]))==0){
      |                                        ^
a.cc:39:99: error: 'intersectSS' cannot be used as a function
   39 |                         if(intersectSS(P(ax[i],ay[i]),P(ax[j],ay[j]),P(bx[0],by[0]),P(bx[1],by[1]))==0){
      |                                                                                                   ^
a.cc:40:50: error: 'sqtrl' was not declared in this scope; did you mean 'sqrtl'?
   40 |                                 long double dst1=sqtrl((ax[i]-ax[j])*(ax[i]-ax[j])+(ay[i]-ay[j])*(ay[i]-ay[j]));
      |                                                  ^~~~~
      |                                                  sqrtl
a.cc:41:33: error: 'x' was not declared in this scope
   41 |                                 x[i].push_back(make_pair(j,dst1));
      |                                 ^
a.cc:41:48: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   41 |                                 x[i].push_back(make_pair(j,dst1));
      |                                                ^~~~~~~~~
      |                                                std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:47:32: error: 'x' was not declared in this scope
   47 |         for(int i=0;i<1000;i++)x[i].clear();
      |                                ^
a.cc:50:40: error: 'P' was not declared in this scope
   50 |                         if(intersectSS(P(bx[i],by[i]),P(bx[j],by[j]),P(ax[0],ay[0]),P(ax[1],ay[1]))==0){
      |                                        ^
a.cc:50:99: error: 'intersectSS' cannot be used as a function
   50 |                         if(intersectSS(P(bx[i],by[i]),P(bx[j],by[j]),P(ax[0],ay[0]),P(ax[1],ay[1]))==0){
      |                                                                                                   ^
a.cc:51:50: error: 'sqtrl' was not declared in this scope; did you mean 'sqrtl'?
   51 |                                 long double dst1=sqtrl((bx[i]-bx[j])*(bx[i]-bx[j])+(by[i]-by[j])*(by[i]-by[j]));
      |                                                  ^~~~~
      |                                                  sqrtl
a.cc:52:33: error: 'x' was not declared in this scope
   52 |                                 x[i].push_back(make_pair(j,dst1));
      |                                 ^
a.cc:52:48: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   52 |                                 x[i].push_back(make_pair(j,dst1));
      |                                                ^~~~~~~~~
      |                                                std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:58:31: error: 'p1' was not declared in this scope; did you mean 'r1'?
   58 |         printf("%.15Lf\n",min(p1,p2));
      |                               ^~
      |                               r1
a.cc:58:34: error: 'p2' was not declared in this scope; did you mean 'r2'?
   58 |         printf("%.15Lf\n",min(p1,p2));
      |                                  ^~
      |                                  r2
a.cc:58:27: error: 'min' was not declared in this scope; did you mean 'std::min'?
   58 |         printf("%.15Lf\n",min(p1,p2));
      |                           ^~~
      |                           std::min
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~