Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long MAXN = 1e5+5;
vector<pair<pair<long long,long long>,long long>> polong longs;
vector<pair<pair<long long,long long>,long long>> polong longs2;
vector<pair<long long,pair<long long,long long>>> edges;
long long par[MAXN];
long long ans;


long long findpar(long long a){
    if(par[a] == a){
        return a;
    }
    return par[a] = findpar(par[a]);
}
void merge(long long a,long long b){
    a = findpar(a);
    b = findpar(b);
    if(a==b){
        return;
    }
    par[b] = a;
}
int main(){
    long long n;
    cin>>n;
    for(long long i=1;i<=n;i++){
        long long x,y;
        cin>>x>>y;
        polong longs.push_back(make_pair(make_pair(x,y),i));
        polong longs2.push_back(make_pair(make_pair(y,x),i));
    }
    sort(polong longs.begin(),polong longs.end());
    sort(polong longs2.begin(),polong longs2.end());
    for(long long i=1;i<n;i++){
        edges.push_back(make_pair(abs(polong longs[i].first.first-polong longs[i-1].first.first),make_pair(polong longs[i-1].second,polong longs[i].second)));
        edges.push_back(make_pair(abs(polong longs2[i].first.first-polong longs2[i-1].first.first),make_pair(polong longs2[i-1].second,polong longs2[i].second)));

    }
    sort(edges.begin(),edges.end());
    for(long long i=1;i<=n;i++){
        par[i] = i;
    }
    for(auto i:edges){
        long long w = i.first;
       
        long long x = i.second.first;
        long long y = i.second.second;
        
        if(findpar(x)!=findpar(y)){
            merge(x,y);
            ans+=w;
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc:6:58: error: expected initializer before 'longs'
    6 | vector<pair<pair<long long,long long>,long long>> polong longs;
      |                                                          ^~~~~
a.cc:7:58: error: expected initializer before 'longs2'
    7 | vector<pair<pair<long long,long long>,long long>> polong longs2;
      |                                                          ^~~~~~
a.cc: In function 'int main()':
a.cc:33:9: error: 'polong' was not declared in this scope; did you mean 'ulong'?
   33 |         polong longs.push_back(make_pair(make_pair(x,y),i));
      |         ^~~~~~
      |         ulong
a.cc:34:15: error: expected ';' before 'longs2'
   34 |         polong longs2.push_back(make_pair(make_pair(y,x),i));
      |               ^~~~~~~
      |               ;
a.cc:36:10: error: 'polong' was not declared in this scope; did you mean 'ulong'?
   36 |     sort(polong longs.begin(),polong longs.end());
      |          ^~~~~~
      |          ulong
a.cc:36:37: error: expected ')' before 'longs'
   36 |     sort(polong longs.begin(),polong longs.end());
      |         ~                           ^~~~~~
      |                                     )
a.cc:37:16: error: expected ')' before 'longs2'
   37 |     sort(polong longs2.begin(),polong longs2.end());
      |         ~      ^~~~~~~
      |                )
a.cc:37:38: error: expected ')' before 'longs2'
   37 |     sort(polong longs2.begin(),polong longs2.end());
      |         ~                            ^~~~~~~
      |                                      )
a.cc:39:45: error: expected ')' before 'longs'
   39 |         edges.push_back(make_pair(abs(polong longs[i].first.first-polong longs[i-1].first.first),make_pair(polong longs[i-1].second,polong longs[i].second)));
      |                                      ~      ^~~~~~
      |                                             )
a.cc:39:114: error: expected ')' before 'longs'
   39 |         edges.push_back(make_pair(abs(polong longs[i].first.first-polong longs[i-1].first.first),make_pair(polong longs[i-1].second,polong longs[i].second)));
      |                                                                                                           ~      ^~~~~~
      |                                                                                                                  )
a.cc:39:139: error: expected ')' before 'longs'
   39 |         edges.push_back(make_pair(abs(polong longs[i].first.first-polong longs[i-1].first.first),make_pair(polong longs[i-1].second,polong longs[i].second)));
      |                                                                                                           ~                               ^~~~~~
      |                                                                                                                                           )
a.cc:40:45: error: expected ')' before 'longs2'
   40 |         edges.push_back(make_pair(abs(polong longs2[i].first.first-polong longs2[i-1].first.first),make_pair(polong longs2[i-1].second,polong longs2[i].second)));
      |                                      ~      ^~~~~~~
      |                                             )
a.cc:40:116: error: expected ')' before 'longs2'
   40 |         edges.push_back(make_pair(abs(polong longs2[i].first.first-polong longs2[i-1].first.first),make_pair(polong longs2[i-1].second,polong longs2[i].second)));
      |                                                                                                             ~      ^~~~~~~
      |                                                                                                                    )
a.cc:40:142: error: expected ')' before 'longs2'
   40 |         edges.push_back(make_pair(abs(polong longs2[i].first.first-polong longs2[i-1].first.first),make_pair(polong longs2[i-1].second,polong longs2[i].second)));
      |                                                                                                             ~                                ^~~~~~~
      |                                                                                                                                              )