Language: C++

#include<bits/stdc++.h>
#define f first
#define s second 
using namespace std;
typedef pair p;
typedef pair P;
int n,used[1000],ans,w;
P c[2000];
int main(){ 
cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
return 0;
} 

Compiler output:
a.cc:5:9: error: typedef declared 'auto'
    5 | typedef pair p;
      |         ^~~~
a.cc:6:9: error: typedef declared 'auto'
    6 | typedef pair P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:10:33: error: 'c' was not declared in this scope
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |                                 ^
a.cc:10:74: error: expected ')' before ';' token
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |            ~                                                             ^
      |                                                                          )
a.cc: At global scope:
a.cc:10:82: error: expected constructor, destructor, or type conversion before '(' token
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |                                                                                  ^
a.cc:10:93: error: expected unqualified-id before 'for'
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |                                                                                             ^~~
a.cc:10:105: error: 'i' does not name a type
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |                                                                                                         ^
a.cc:10:111: error: 'i' does not name a type
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |                                                                                                               ^
a.cc:10:188: error: 'cout' does not name a type
   10 | cin>>n; for(int i=0,a,b;i>a>>b; c[i*2]=P(p(a,-b),i),c[i*2+1]=P(p(b,-a),i); } sort(c,c+2*n); for(int i=0;i<2*n;i++) if(!used[c[i].s]&&c[i].f.f>w) used[c[i].s]=1,ans+=-c[i].f.s,w=c[i].f.f; cout<<ans<<endl;
      |                                                                                                                                                                                            ^~~~
a.cc:11:1: error: expected unqualified-id before 'return'
   11 | return 0;
      | ^~~~~~
a.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^