criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <algorithm>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n, m;
  cin>>n>>m;
  int a[m], b[m];
  REP(i, m) cin>>a[i]>>b[i];
  
  typedef pair<int, int> P;
  vector<P> ab;
  REP(i, m) ab.push_back(P(a[i], b[i]));
  auto cmp = [](P l, P r) -> bool{
    return l.second <= r.second;
  };
  sort(ALL(ab), cmp);
  
  int x = 0;
  int ans = 0;
  REP(i, m){
    int ta = ab[i].first;
    int tb = ab[i].second;
    if(x <= 0){
      x = tb - 1;
      ans++;
    }else{
      if(ta <= x){
        continue;
      }else{
        x = tb - 1;
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'bool prime_(int)':
a.cc:42:25: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   42 |     for(int i=2;i<=std::sqrt(n);i++){
      |                         ^~~~
      |                         sort
a.cc: In function 'int main()':
a.cc:78:3: error: 'vector' was not declared in this scope
   78 |   vector<P> ab;
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | //#include <boost/multiprecision/cpp_int.hpp>
a.cc:78:11: error: expected primary-expression before '>' token
   78 |   vector<P> ab;
      |           ^
a.cc:78:13: error: 'ab' was not declared in this scope; did you mean 'b'?
   78 |   vector<P> ab;
      |             ^~
      |             b
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n, m;
  cin>>n>>m;
  int a[m], b[m];
  REP(i, m) cin>>a[i]>>b[i];
  
  typedef pair<int, int> P;
  vector<P> ab;
  REP(i, m) ab.push_back(P(a[m], b[m]));
  auto cmp = [](P l, P r) -> bool{
    return l.second <= r.second;
  }
  sort(ALL(ab));
  
  int x = 0;
  int ans = 0;
  REP(i, m){
    int ta = ab[i].first;
    int tb = ab[i].second;
    if(x <= 0){
      x = tb - 1;
      ans++;
    }else{
      if(ta <= x){
        continue;
      }else{
        x = tb - 1;
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:3: error: expected ',' or ';' before 'sort'
   82 |   sort(ALL(ab));
      |   ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> v(m);
  rep(i,m) {
    cin >> v[i].second >> v[i].first;
    v[i].second--; v[i].first--;
  }
  sort(v.begin(),v.end());
  int now = -1LL;
  int ans = 0LL;
  rep(i,m) {
    if(v[i].second<=now) continue;
    now = v[i].first-1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
using P = pair<int,int>;

int main()
{
    int N,M;
    cin>>N>>M;
    P r[100010];
    rep(i,M){
        int a,b;
        cin>>a>>b;
        r[i] = make_pair(b-1,a-1);
    }

    sort(r,r+M);

    int ans=1,min=0;
    for(int i=1;i<M;i++){
        if(r[min].first<=r[i].second){
            ans++;
            min=i;
        }
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |     sort(r,r+M);
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl '\n'
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const int INF=1LL<<30;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int M;
    cin >> M;
    vector<int> r(N+1,INF);
	for(int i = 1; i <= M; i++) {
        int x;
        cin >> x;
        int y;
        cin >> y;
        chmin(r[x],y);
	}
	int cur=INF,ans=0;
	for(int i = 1; i <= N; i++) {
		if(r[i] != INF) chmin(cur,r[i]);
		if(i == cur){cur=r[i],;ans++;}
	}
    prt(ans)
    return 0;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:39: error: expected primary-expression before ';' token
   42 |                 if(i == cur){cur=r[i],;ans++;}
      |                                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main() {
    int n,m;
    cin >> n >> m;
    pair<int,int> p[m];
    for(int i = 0; i < m; i++) {
        cin >> p[i].second >> p[i].first;
    }
    sort(p,p+m);
    int MAX=0;
    int ans=0;
    for(i=0;i<m;i++){
        if(p[i].second>MAX){
            ans++;
            MAX=p[i].second-1;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'i' was not declared in this scope
   14 |     for(i=0;i<m;i++){
      |         ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int> > ba(M);
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        ba[i] = make_pair(b, a);
    }

    std::sort(ba.begin(), ba.end());
    int cur = 1e9;
    int res = 0;
    for(int i=0; i<M; i++){
        if(cur < ba[i].second || ba[i].first <= cur){
            cur = ba[i].first - 1;
            res++;
        }
    }

    cout << res << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |     std::sort(ba.begin(), ba.end());
      |          ^~~~
      |          qsort
Language: C++

#include<iostream>
#include<vector>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int> > ba(M);
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        ba[i] = make_pair(b, a);
    }

    sort(ba.begin(), ba.end());
    int cur = 1e9;
    int res = 0;
    for(int i=0; i<M; i++){
        if(cur < ba[i].second || ba[i].first <= cur){
            cur = ba[i].first - 1;
            res++;
        }
    }

    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(ba.begin(), ba.end());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

bool sortbysec(const pair<i64,i64> &a, const pair<i64,i64> &b)
{
  return(a.second<b.second);
}

void Main()
{
  i64 N, M;
  cin >> N >> M;
  v(pair<i64,i64>) B;
  i64 a,b;
  rep(i,M){
    cin >> a >> b;
    a--;
    b--;
    B.emplace_back(make_pair(a,b));
  }
  sort(rng(B),sortbysec);
  i64 x = -1;
  i64 ans = 0;
  for(auto &p:B){
    if(B.first>x){
      x = B.second-1;
      ans++;
    }
  }
  cout << ans << "\n";

}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

Compiler output:
a.cc:46:18: error: macro "v" passed 2 arguments, but takes just 1
   46 |   v(pair<i64,i64>) B;
      |                  ^
a.cc:22:9: note: macro "v" defined here
   22 | #define v(T) vector<T>
      |         ^
a.cc: In function 'void Main()':
a.cc:46:3: error: 'v' was not declared in this scope
   46 |   v(pair<i64,i64>) B;
      |   ^
a.cc:52:5: error: 'B' was not declared in this scope
   52 |     B.emplace_back(make_pair(a,b));
      |     ^
a.cc:54:12: error: 'B' was not declared in this scope
   54 |   sort(rng(B),sortbysec);
      |            ^
a.cc:17:16: note: in definition of macro 'rng'
   17 | #define rng(a) a.begin(),a.end()
      |                ^
Language: C++

#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,m;
  cin >> n >> m;
  vector<P>vec(m+1);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    vec[i]=P(b,a);
  }
  vec[m]=P(INF,INF)
  sort(vec.begin(),vec.end());
  ll cnt=0;
  ll now=vec[0].first;
  rep(i,m){
    if(i==0)continue;
    if(now<=vec[i+1].second){
      cnt++;
      now=vec[i+1].first;
    }
  }
  cout << cnt << endl;
        
  return 0;     
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:20: error: expected ';' before 'sort'
   40 |   vec[m]=P(INF,INF)
      |                    ^
      |                    ;
   41 |   sort(vec.begin(),vec.end());
      |   ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<pair> itv(M);
  rep (i, M) {
    int a, b;
    cin >> a >> b;
    pair<int, int> p(b, a);
    itv[i] = p;
  }
  
  sort(itv.first(), itv.end());
  
  int start = 0;
  int res = 0;
  for (int i = 0; i < M; i++) {
    if (itv[i].second >= start) {
      res ++;
      start = itv[i].first;
    }
  }
  
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
    9 |   vector<pair> itv(M);
      |              ^
a.cc:9:14: note:   expected a type, got 'pair'
a.cc:9:14: error: template argument 2 is invalid
a.cc:14:8: error: invalid types 'int[int]' for array subscript
   14 |     itv[i] = p;
      |        ^
a.cc:17:12: error: request for member 'first' in 'itv', which is of non-class type 'int'
   17 |   sort(itv.first(), itv.end());
      |            ^~~~~
a.cc:17:25: error: request for member 'end' in 'itv', which is of non-class type 'int'
   17 |   sort(itv.first(), itv.end());
      |                         ^~~
a.cc:22:12: error: invalid types 'int[int]' for array subscript
   22 |     if (itv[i].second >= start) {
      |            ^
a.cc:24:18: error: invalid types 'int[int]' for array subscript
   24 |       start = itv[i].first;
      |                  ^
Language: C++

/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)



int main(){ FastIO;

int i,j,k,n,m;cin>>n>>m;
vector<pair<int,int> > vec;
for(i=0;i<m;i++)
{
	int a,b;cin>>a>>b;
	vec.pb(mk(a,b));
}
sort(vec.begin(),vec.end());
int l=vec[0].first,r=vec[0].second=,c=1;
for(i=1;i<m;i++)
{
	l=vec[i].first;
	if(l>=r)
	{
		c++;r=vec[i].second;
	}
	else
	{
		if(vec[i].second<r){
			r=vec[i].second;
		}
	}
}
cout<<c;




return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:36: error: expected primary-expression before ',' token
   43 | int l=vec[0].first,r=vec[0].second=,c=1;
      |                                    ^
a.cc:49:17: error: 'c' was not declared in this scope
   49 |                 c++;r=vec[i].second;
      |                 ^
a.cc:58:7: error: 'c' was not declared in this scope
   58 | cout<<c;
      |       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
using ll = int64_t;
using P = pair<int, int>;

int main(){
    int n, m; cin >> n >> m;
    P p[m];
    rep(i, m) int a, b; cin >> p[i].second >> p[i].first;
    sort(p, p+m);

    int ans = 0;
    int pre_b = -1;
    rep(i, m){
        if(p[i].second > pre_b) {
            pre_b = p[i].first-1;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:34: error: 'i' was not declared in this scope
   11 |     rep(i, m) int a, b; cin >> p[i].second >> p[i].first;
      |                                  ^
Language: C

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
 
class War{
    public:
    int l,r;
    War(){}
    War(int l,int r):l(l),r(r){}
    bool operator < (const War &w)const{
        return r!=w.r ? r<w.r : l<w.l;
    }
    bool operator == (const War &w)const{
        return r==w.r && l==w.l;
    }
};

int main(){
    int n,m;
    vector<War> w;

    cin>>n>>m;
    for(int i=0; i<m; i++){
        int l,r;
        cin>>l>>r;
        w.push_back(War(l,r));
    }

    sort(w.begin(),w.end());

    int ans=1;
    int t=w[0].r;
    for(int i=1; i<m; i++){
        if(t<=w[i].l){
            t=w[i].r;
            ans++;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
usimg pii = pair<int,int>;

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> q(m);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        q[i].first = b;
        q[i].second = a;
    }
    sort(q.begin(),q.end());
    int ans = 1;
    int t = q[0].first;
    rep(i,m){
        if(t <= q[i].second){
            ans++;
            t = q[i].first;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:5:1: error: 'usimg' does not name a type
    5 | usimg pii = pair<int,int>;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:10:12: error: 'pii' was not declared in this scope
   10 |     vector<pii> q(m);
      |            ^~~
a.cc:10:15: error: template argument 1 is invalid
   10 |     vector<pii> q(m);
      |               ^
a.cc:10:15: error: template argument 2 is invalid
a.cc:14:10: error: invalid types 'int[int]' for array subscript
   14 |         q[i].first = b;
      |          ^
a.cc:15:10: error: invalid types 'int[int]' for array subscript
   15 |         q[i].second = a;
      |          ^
a.cc:17:12: error: request for member 'begin' in 'q', which is of non-class type 'int'
   17 |     sort(q.begin(),q.end());
      |            ^~~~~
a.cc:17:22: error: request for member 'end' in 'q', which is of non-class type 'int'
   17 |     sort(q.begin(),q.end());
      |                      ^~~
a.cc:19:14: error: invalid types 'int[int]' for array subscript
   19 |     int t = q[0].first;
      |              ^
a.cc:21:18: error: invalid types 'int[int]' for array subscript
   21 |         if(t <= q[i].second){
      |                  ^
a.cc:23:18: error: invalid types 'int[int]' for array subscript
   23 |             t = q[i].first;
      |                  ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)

int compare(const void *b1, const void *b2){ // 昇順
    if(((War*)b1)->b > ((War*)b2)->b) return 1;
    else if(((War*)b1)->b < ((War*)b2)->b) return -1;
    else return 0;
}

typedef struct{
    int a;
    int b;
} War;


int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    
    War data[m];
    F(i,0,m){
        scanf("%d%d",&(data[i].a),&(data[i].b));
    }
    
    qsort(data,m,sizeof(War),compare);

    int rem_num=0;
    F(j,0,m){
        if(data[j].b != 0){
            F(k,j+1,m){
                if(data[k].a<data[j].b){
                    data[k].a=0;
                    data[k].b=0;
                }
            }
            rem_num++;
        }
    }
    printf("%d\n",rem_num);
    return 0;
}

Compiler output:
main.c: In function 'compare':
main.c:8:10: error: 'War' undeclared (first use in this function)
    8 |     if(((War*)b1)->b > ((War*)b2)->b) return 1;
      |          ^~~
main.c:8:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:14: error: expected expression before ')' token
    8 |     if(((War*)b1)->b > ((War*)b2)->b) return 1;
      |              ^
main.c:8:30: error: expected expression before ')' token
    8 |     if(((War*)b1)->b > ((War*)b2)->b) return 1;
      |                              ^
main.c:9:19: error: expected expression before ')' token
    9 |     else if(((War*)b1)->b < ((War*)b2)->b) return -1;
      |                   ^
main.c:9:35: error: expected expression before ')' token
    9 |     else if(((War*)b1)->b < ((War*)b2)->b) return -1;
      |                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int n, m, i, mem = 0, count = 0;
    cin >> n >> m;
    for(i=0; i<m; i++){
        cin >> a[i].second >> a[i].first;
    }
    sort(a, a+m);
    for(i=0; i<m; i++){
        if(a[i].second > mem){
            mem = a[i].first-1;
            count++;
        }
    }
    cout << count << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a[i].second >> a[i].first;
      |                ^
a.cc:13:10: error: 'a' was not declared in this scope
   13 |     sort(a, a+m);
      |          ^
Language: C++

#include <iostream>
#include <vector>

class Connection
{
public:
    Connection(int from, int to)
    {
        From = from;
        To = to;
    }

    int From;
    int To;
};

int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> lapDuplicationTable(N-1, 0);
    std::vector<Connection*> connections;
    std::vector<int> cutTable;

    for (int i=0; i<M; ++i)
    {
        int ai, bi;
        std::cin >> ai >> bi;
        connections.emplace_back(new Connection(ai, bi));
    }

    sort(connections.begin(), connections.end(),
        [&](Connection* c1, Connection* c2)
        {
            return c1->To < c2->To;
        });

    for (int i=0; i<connections.size(); ++i)
    {
        bool isSatisfied = false;
        for (int k=0; k<cutTable.size(); ++k)
        {
            int cut = cutTable[k];
            if (connections[i]->From <= cut && cut < connections[i]->To)
                isSatisfied = true;
        }

        if (isSatisfied)
            continue;

        cutTable.emplace_back(connections[i]->To-1);
    }

    std::cout << cutTable.size();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |     sort(connections.begin(), connections.end(),
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N,M; cin>>N>>M;
  vector<pii> A(M);
  rep(i,0,M) cin>>A[i].second>>A[i].first;
  sort(ALL(A));
  queue<int> Q;
  int ans=1;
  Q.push(A[0].first);
  rep(i,1,M){
    while(Q.size()>0){
      bool flag=0;
      if(Q.front()<A[i].second){
        Q.pop();
        flag=1;
      }
      else
        break;
    }
    if(flag){
      Q.push(A[i].first);
      ans++;  
    }
  }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:36:8: error: 'flag' was not declared in this scope
   36 |     if(flag){
      |        ^~~~
Language: C++

#include <iostream>
#include <queue>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    pair<int, int> a[M];
    for(int i=0; i<M; i++){
        cin >> a[i].first >> a[i].second;
        a[i].first--; a[i].second--; 
    }
    sort(a, a + M);
    priority_queue<int, vector<int>, greater<int> > q;
    int ans = 0;
    int cnt = 0;
    for(int i=0; i<N; i++){
        if(!q.empty() && i == q.top()){
            ans ++;
            while(!q.empty()){
                q.pop();
            }
        }
        while(i == a[cnt].first && cnt < M) {
            q.push(a[cnt].second);
            cnt ++;
        }
        
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(a, a + M);
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  vector<pll> p(m);
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    p[i]=mp(b,a);
  }
  sort(all(p));
  ll k=p[0].F;
  ll ans=1;
  for(int i=1;i<m;i++){
    if(t<=p[i].S){
      ans++;
      t=p[i].F;
    }
  }COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:8: error: 't' was not declared in this scope
   53 |     if(t<=p[i].S){
      |        ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
	ll N = 1050000;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu[c] = i;
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

bool A[100010];
int B[100010];
vector<int>graph[100010];
int main() {
	m0(A);m0(B);
	int N,M;
	cin >> N>>M;
	bool exist=0;
	REP(i,M){
		int a,b;
		int >> a>>b;
		a--;b--;
		A[a]=true;
		graph[a].pb(b);
	}
	REP(i,N){
		if(A[i]){
			VSORT(graph[i]);
			B[graph[i][0]]++;
		}
	}
	ll ans = 0 ;
	ll cnt =0;
	REP(i,N){
		if(exist){
			if(B[i]>0){
				for(int j=cnt;j<i;j++)if(A[j])B[graph[j][0]]--;
				ans++;
				exist=false;
				cnt=i;
			}
		}
		if(A[i])exist=true;
	}
	p(ans);
}//もじゃさんの写経


Compiler output:
a.cc: In function 'int main()':
a.cc:127:21: error: expected unqualified-id before '>>' token
  127 |                 int >> a>>b;
      |                     ^~
Language: C++

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}
bool cmp(pint a, pint b) { return a.second < b.second; }
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<pint> v(n);
  rep(i,n){
    ll x,ll y;cin>>x>>y;
    v[i].first=x-y;
    v[i].second=x+y;
  }
  sort(ALL(v),cmp);
  ll ans=0;
  ll endtime=0;
  rep(i,n){
    if(v[i].first>=endtime){
      endtime=v[i].second;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:144:13: error: expected initializer before 'y'
  144 |     ll x,ll y;cin>>x>>y;
      |             ^
a.cc:144:23: error: 'y' was not declared in this scope
  144 |     ll x,ll y;cin>>x>>y;
      |                       ^
Language: Java

import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class ABC103D {
  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
  static ArrayList<int[]> list = new ArrayList<int[]>();
  
	public static void main (String[] args) throws IOException {    
    String[] first = br.readLine().split(" ");
    int N = Integer.parseInt(first[0]);
    int M = Integer.parseInt(first[1]);
    int[][] arr = new int[M][2];
    
    for(int i = 0; i < M; i++) {
      String[] line = br.readLine().split(" ");
      arr[i][0] = Integer.parseInt(line[0]);
      arr[i][1] = Integer.parseInt(line[1]);
    }

    Arrays.sort(arr, new Comparator<int[]>() {
      public int compare(int[] a, int[] b) {
        return Integer.compare(a[1]-a[0], b[1]-b[0]);
      }
    });

    // for(int[] curr : arr) {
    //   System.out.println(Arrays.toString(curr));
    // }
    
    list.add(arr[0]);
    for(int i = 1; i < M; i++) {
      addToList(arr[i], 0, list.size());
    }

    // for(int[] curr : list) {
    //   System.out.print(Arrays.toString(curr) + ", ");
    // }
    // System.out.println();

    System.out.println(list.size());
    
    bw.close();
	}
  
  public static void addToList(int[] target, int L, int R) {
    if(L >= R) {
      list.add(L, target);
    }
    int M = (L+R)/2;
    int[] mid = list.get(M);
    // System.out.println(Arrays.toString(target) + " " + Arrays.toString(mid));
    // // System.out.println(Arrays.toString(list.get(M)));
    // for(int[] curr : list) {
    //   System.out.print(Arrays.toString(curr) + ", ");
    // }
    int status = intersectionStatus(mid, target);
    // System.out.println(status);
    switch(status) {
      case 0:
        list.set(M, target);
        break;
      case 1:
        int[] newArr = {target[0], mid[1]};
        list.set(M, newArr);
        break;
      case 2:
        int[] newArr2 = {mid[0], target[1]};
        list.set(M, newArr2);
        break;
      case 3:
        break;
      case -1:
        if(target[0] > mid[0]) {
          addToList(target, M+1, R);
        }
        else {
          addToList(target, L, M);
        }
    }
  }
  
  public static int intersectionStatus(int[] mid, int[] target) {
    // Target is totally inside mid
    if(mid[0] <= target[0] && mid[1] >= target[1]) {
      return 0;
    }
    // Target partially intersects with mid (right)
    if((target[0] < mid[1] && target[0] >= mid[0])) {
      return 1;
    }
    // Target partially intersects with mid (left)
    if((target[1] <= mid[1] && target[1] > mid[0])) {
      return 2;
    }
    // Mid is totally inside target
    if(mid[0] > target[0] && mid[1] < target[1]) {
      return 3;
    }

    // Target does not intersect with mid
    return -1;
  }
}


Compiler output:
Main.java:5: error: class ABC103D is public, should be declared in a file named ABC103D.java
public class ABC103D {
       ^
1 error
Language: C++

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

struct startend {
  long long start;
  long long end;
};

int main(){
  long long N, M;
  scanf("%lld", &N);
  scanf("%lld", &M);

  std::vector<startend > war;
  std::vector<startend > ans;
  long long temp1, temp2;
  for (long long i=0; i<M; i++){
    scanf("%lld", &temp1);
    scanf("%lld", &temp2);
    temp1--; temp2--;
    war.push_back((startend){temp1, temp2});
  }

  ans.push_back((startend){war[0].start, war[0].end});
  for (long long i=1; i<M; i++){
    //printf("i=%d\n", i);
    long long j = 0;
    while(j<ans.size()){
      //printf("ans[%d].start=%d\n", j, ans[j].start);
      //printf("ans[%d].end=%d\n", j, ans[j].end);
      //printf("war[%d].start=%d\n", i, war[i].start);
      //printf("war[%d].end=%d\n", i, war[i].end);
      if (ans[j].end <= war[i].start || war[i].end <= ans[j].start){
        j++; // j番目の回答候補は使えない
        //printf("not use\n");
      } else { // j番目の回答候補が使える
        //printf("can use\n");
        ans[j].start = long long(fmax(ans[j].start, war[i].start));
        ans[j].end = long long(fmin(ans[j].end, war[i].end));
        break;
      }
      if (j==ans.size()){
        ans.push_back((startend){war[i].start, war[i].end});
        break;
      }
    }
  }
  printf("%ld\n", ans.size());
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:24: error: expected primary-expression before 'long'
   45 |         ans[j].start = long long(fmax(ans[j].start, war[i].start));
      |                        ^~~~
a.cc:46:22: error: expected primary-expression before 'long'
   46 |         ans[j].end = long long(fmin(ans[j].end, war[i].end));
      |                      ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

struct startend {
  long long start;
  long long end;
};

int main(){
  long long N, M;
  scanf("%d", &N);
  scanf("%d", &M);

  std::vector<startend > war;
  std::vector<startend > ans;
  long long temp1, temp2;
  for (long long i=0; i<M; i++){
    scanf("%d", &temp1);
    scanf("%d", &temp2);
    temp1--; temp2--;
    war.push_back((startend){temp1, temp2});
  }

  ans.push_back((startend){war[0].start, war[0].end});
  for (long long i=1; i<M; i++){
    //printf("i=%d\n", i);
    long long j = 0;
    while(j<ans.size()){
      //printf("ans[%d].start=%d\n", j, ans[j].start);
      //printf("ans[%d].end=%d\n", j, ans[j].end);
      //printf("war[%d].start=%d\n", i, war[i].start);
      //printf("war[%d].end=%d\n", i, war[i].end);
      if (ans[j].end <= war[i].start || war[i].end <= ans[j].start){
        j++; // j番目の回答候補は使えない
        //printf("not use\n");
      } else { // j番目の回答候補が使える
        //printf("can use\n");
        ans[j].start = long long(fmax(ans[j].start, war[i].start));
        ans[j].end = long long(fmin(ans[j].end, war[i].end));
        break;
      }
      if (j==ans.size()){
        ans.push_back((startend){war[i].start, war[i].end});
        break;
      }
    }
  }
  printf("%ld\n", ans.size());
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:24: error: expected primary-expression before 'long'
   45 |         ans[j].start = long long(fmax(ans[j].start, war[i].start));
      |                        ^~~~
a.cc:46:22: error: expected primary-expression before 'long'
   46 |         ans[j].end = long long(fmin(ans[j].end, war[i].end));
      |                      ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc103/tasks/abc103_d

int main() {
    int N, M; cin >> N >> M;
    P ab[M];
    REP(i, M) {
        int a, b; cin >> a >> b;
        ab[i] = {b, a};
    }
    sort(ab, ab + M);

    int now = 0;
    int cnt = 0;
    REP(i, M) {
        int l = ab[i].second;
        int r = ab[i].first;
        if (l >= now) {
            cnt++;
            now = r;
        }
    }

    cout << cnt << "\n";

    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:69:14: error: expected '}' at end of input
   69 |     return 0;
      |              ^
a.cc:47:12: note: to match this '{'
   47 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin >> N >> M;
  typedef pair<int,int> P;
  vector<P> vec(M);
  for (int i=0; i<M; ++i) {
    cin >> vec.at(i).second >> vec.at(i).first;
  }
  
  sort(vec);
  int k=1;
  M = vec.at(0).first;
  for (int j=0; j<M; ++j) {
    if (vec.at(j+1).second >= M) {
      ++k;
      M = vec.at(j+1).first;
    }
  }
  cout << k << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: no matching function for call to 'sort(std::vector<std::pair<int, int> >&)'
   13 |   sort(vec);
      |   ~~~~^~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin >> N >> M;
  typedef pair<int,int> P;
  vector<P> vec(M);
  for (int i=0; i<M; ++i) {
    cin >> vec.at(i).second >> vec.at(i).first;
  }
  
  int k=1;
  M = vec.at(0).first
  for (int j=0; j<M; ++j) {
    if (vec.at(j+1).second >= M) {
      ++k;
      M = vec.at(j+1).first;
    }
  }
  cout << k << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: expected ';' before 'for'
   14 |   M = vec.at(0).first
      |                      ^
      |                      ;
   15 |   for (int j=0; j<M; ++j) {
      |   ~~~                 
a.cc:15:17: error: 'j' was not declared in this scope
   15 |   for (int j=0; j<M; ++j) {
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin >> N >> M;
  typedef pair<int,int> P;
  vector<P> vec(M);
  for (int i=0; i<M; ++i) {
    cin >> vec.at(i).second >> vec.at(i).first;
  }
  
  int k=1;
  int M = vec.at(0).first
  for (int j=0; j<M; ++j) {
    if (vec.at(j+1).second >= M) {
      ++k;
      M = vec.at(j+1).first;
    }
  }
  cout << k << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: redeclaration of 'int M'
   14 |   int M = vec.at(0).first
      |       ^
a.cc:5:9: note: 'int M' previously declared here
    5 |   int N,M;
      |         ^
a.cc:15:17: error: 'j' was not declared in this scope
   15 |   for (int j=0; j<M; ++j) {
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,M;
  cin >> N >> M;
  typedef pair<int,int> P;
  vector<P> vec(M);
  for (int i=0; i<M; ++i) {
    cin >> vec.at(i).second >> vec.at(i).first;
  }
  sort(vec.begin(),vec.end());
  int k=1;
  int M = vec.at(0).first
  for (int j=0; j<M; ++j) {
    if (vec.at(j+1).second >= M) {
      ++k;
      M = vec.at(j+1).first;
    }
  }
  cout << k << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: redeclaration of 'int M'
   14 |   int M = vec.at(0).first
      |       ^
a.cc:5:9: note: 'int M' previously declared here
    5 |   int N,M;
      |         ^
a.cc:15:17: error: 'j' was not declared in this scope
   15 |   for (int j=0; j<M; ++j) {
      |                 ^