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

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int Inf = 1 << 30;
const int maxx = 1e5 + 7;
int n, m;
int ans;

struct PP {
	int a, b;
} p[maxx];

bool Cmp(PP x, PP y) { return x.b < y.b; }

int main() {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; i++) scanf("%d %d", &p[i].a, &p[i].b);
	sort(p + 1, p + m + 1, Cmp);
	int t = 0;
	for(int i = 1; i <= m; i++) {
		if(p[i].a >= t){
			t = p[i].b; ans++;
		}
	}
	printf("%d\n", sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:24: error: 'sum' was not declared in this scope
   36 |         printf("%d\n", sum);
      |                        ^~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int Inf = 1 << 30;
const int maxx = 1e5 + 7;
int n, m;
int ans;

struct PP {
	int a, b;
} p[maxx];

bool Cmp(PP x, PP y) { return x.b < y.b; }

int main() {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; i++) scanf("%d %d", &p[i].a, &p[i].b);
	sort(p + 1, p + m + 1, Cmp);
	int t = 0;
	for(int i = 1; i <= m; i++) {
		if(z[i].a >= t){
			t = z[i].b;
			ans++;
		}
	}
	printf("%d\n", sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:20: error: 'z' was not declared in this scope
   32 |                 if(z[i].a >= t){
      |                    ^
a.cc:37:24: error: 'sum' was not declared in this scope
   37 |         printf("%d\n", sum);
      |                        ^~~
Language: Java

import java.util.Scanner;

public class A {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String Nb1 = scan.next();
		int N = Integer.valueOf(Nb1);
		String Nb1 = scan.next();
		int M = Integer.valueOf(Nb2);
		int[] nb1 = new int[M];
		int[] nb2 = new int[M];

		for (int i = 0; i < M; i++) {
			nb1[i] = scan.nextInt();
			nb2[i] = scan.nextInt();
		}
		int count=0;
		for (int j = 0; j < N; j++) {
			int v1=nb1[j];
			int	v2=nb2[j];
			for (int i = j; i < N; i++) {
				if(nb2[i]<v1||v2<nb[i]) {
				count++;
				}
			}
		}

		System.out.println(count);

	}
}

Compiler output:
Main.java:3: error: class A is public, should be declared in a file named A.java
public class A {
       ^
Main.java:9: error: variable Nb1 is already defined in method main(String[])
		String Nb1 = scan.next();
		       ^
Main.java:10: error: cannot find symbol
		int M = Integer.valueOf(Nb2);
		                        ^
  symbol:   variable Nb2
  location: class A
Main.java:23: error: cannot find symbol
				if(nb2[i]<v1||v2<nb[i]) {
				                 ^
  symbol:   variable nb
  location: class A
4 errors
Language: C++

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}

template<typename T>
T gcd(T x, T y){
    if (x == 0 || y == 0) {
        return 0;
    }

    while (x != y){
        if (x > y) {
            x -= y;
        }else{
            y -= x;
        }
    }
    return x;
}

// }}}
/* vim:set foldmethod=marker: */

void solve(){
    ll n,m;
    cin >> n >> m;
    
    vector<ll> vec(n-1,0);
    for (int i = 0; i < m; i++) {
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        vec[a]++;
        vec[b-1]++;
    }
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    sort(all(vec));
    ll ans=0;
    for (auto i : v) {
        if (i == 0) {
            ans++;
        }
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
//     cout << "key" << itr->first << " value" << itr->second << endl;
// }


Compiler output:
a.cc: In function 'void solve()':
a.cc:92:19: error: 'v' was not declared in this scope
   92 |     for (auto i : v) {
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,ans=0;
vector <pair<int,int> > v;
int main() {
	cin>>n>>m;
	for (int i=0; i<m; i++) {
		int x,y;
		cin>>x>>y;
		if (x>y) swap (x,y);
		v.push_back(make_pair(x,y));
	}
	sort (v.begin(),v.end());
	int t=v[0].first;
	int p=v[0].second;
	for(int i=1; i<m; i++) {
		if(t!=v[i].first) t=v[i].first;
		if(p>v[i].second) p=v[i].second;
		if(t>=p) {
			ans++;
			t=v[i].first;
			p=v[i].second;
		}
	cout<<ans+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef std::pair<int,int> ipair;


int main()
{
  
  int n,m;
  cin>>n>>m;
   int sum = 0;
  std::vector<int> a,b,c;
  std::vector<bool> con;
  
for(int i=0;i<m;i++)
{
 
  int temp an,bn;
  cin>>an>>bn;
  c.push_back(i);
  a.push_back(an);
  b.push_back(bn);
  if(i<m-1){
  con.push_back(true);
  } // d.push_back(bn-an);
}
   std::vector<ipair> y;
  for(int i=0;i<m;i++)
{
 y.push_back(ipair(i, a[i]));
}
  sort(y.begin(),y.end()); 
  
  bool true;
  std::vector<bool> check ;
  int sum =0;
  for(int i =1;i<m;)
  {
    int j = i;
    if(con[i]==false) break;
    std::vector<int> temp;
     while(a[i]==j)
     {
       temp.push_back(b[y.second]);
       i++;
     }
    sort(temp.begin(),temp.end());
    con[temp[0]-1]=false;
    temp.clear;
    sum++;
  }

  cout<<sum;
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: expected initializer before 'an'
   19 |   int temp an,bn;
      |            ^~
a.cc:20:8: error: 'an' was not declared in this scope; did you mean 'a'?
   20 |   cin>>an>>bn;
      |        ^~
      |        a
a.cc:20:12: error: 'bn' was not declared in this scope; did you mean 'b'?
   20 |   cin>>an>>bn;
      |            ^~
      |            b
a.cc:33:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |   sort(y.begin(),y.end());
      |   ^~~~
      |   short
a.cc:35:8: error: expected unqualified-id before 'true'
   35 |   bool true;
      |        ^~~~
a.cc:37:7: error: redeclaration of 'int sum'
   37 |   int sum =0;
      |       ^~~
a.cc:12:8: note: 'int sum' previously declared here
   12 |    int sum = 0;
      |        ^~~
a.cc:45:27: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   45 |        temp.push_back(b[y.second]);
      |                           ^~~~~~
a.cc:50:10: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::clear() [with _Tp = int; _Alloc = std::allocator<int>]'
   50 |     temp.clear;
      |     ~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1607:7: note: declared here
 1607 |       clear() _GLIBCXX_NOEXCEPT
      |       ^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
#define FOR(i,a,b) for (size_t i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (size_t i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define INF 1e7

int N, M;
int map<int, int> mp;

int main()
{
  cin>>N>>M;
  REP(i,M) {
    int a, b;
    cin>>a>>b;
    if (mp[a] > b || mp[a] == 0) mp[a] = b;
  }

  int l, r = INF, ans = 0;
  FOR(l,1,N-1) {
    if (mp[l] != 0) {
      r = min(mp[l], r);
    }

    if (l>=r) {
      ans++;
      r = INF;
    }
  }

  cout<<ans;

  return 0;
}


Compiler output:
a.cc:12:19: error: invalid declarator before 'mp'
   12 | int map<int, int> mp;
      |                   ^~
a.cc: In function 'int main()':
a.cc:20:9: error: 'mp' was not declared in this scope
   20 |     if (mp[a] > b || mp[a] == 0) mp[a] = b;
      |         ^~
a.cc:25:9: error: 'mp' was not declared in this scope
   25 |     if (mp[l] != 0) {
      |         ^~
Language: C++

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;

struct conflict{
  int a;
  int b;
};


int main(){
  int N, M;
  cin >> N >> M;

  vector<conflict> conflicts;

  for(int i=0; i<M;i++){
    int a,b;
    cin >> a >> b;
    conflicts.push_back({a,b});
  }

  sort(conflicts.begin(), conflicts.end(),
     [](const conflict& x, const conflict& y) { return (x.a != y.b) ? (x.a < y.a) : (x.b < y.b) ;});

  int result = 0;
  int leftnum = 0;
  int rightnum = 0;
  int left = conflicts[0].a;
  int right = conflicts[0].b;
  while(num < M){
    if(right >= conflicts[i].b){
      left = conflicts[i].a;
      right = conflicts[i].b;
      leftnum++;
      rightnum++;
    }else if(right <= conflicts[i].a){
      result++;
      left = conflicts[i].a;
      right = conflicts[i].b;
      num++;
      rightnum++;
    }else{
      while(leftnum < M && conflicts[leftnum].a < right){
        left = conflicts[leftnum].a;
        leftnum++;
        rightnum++;
        result++;
      }

    }
  }

/*
   for(int i=0; i<M;i++){
     cout << conflicts[i].a << " " << conflicts[i].b << endl;
   }
*/
   cout << result << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   34 |   while(num < M){
      |         ^~~
      |         enum
a.cc:35:27: error: 'i' was not declared in this scope
   35 |     if(right >= conflicts[i].b){
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,ans=0;
vector <pair<int,int> > v;
int main() {
	cin>>n>>m;
	for (int i=0; i<m; i++) {
		int x,y;
		cin>>x>>y;
		if (x>y) swap (x,y);
		v.push_back(make_pair(x,y));
	}
	sort (v.begin(),v.end());
	int t=v[0].first;
	int p=v[0].second;
	for(int i=1; i<m; i++) {
		if(t!=v[i].first) t=v[i].first;
		if(p>v[i].second) p=v[i].second;
		if(t>=p) {
			ans++;
			t=v[i].first;
			p=v[i].second;
	cout<<ans+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:16:32: note: to match this '{'
   16 |         for(int i=1; i<m; i++) {
      |                                ^
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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

int main(void){
  int N,M;
  cin >> N >> M;
  int A[M],B[M];
  int C[M-1];
  int D[M];
  for(int i = 0;i < M;i++){
    cin >> A[i] >> B[i];
    D[i] = abs(A[i] - B[i]);
  }
  for(int i = 0;i < M-1;i++){
    C[i]=1;
  }
  int count = 0;
  for(int i = 0;i < M;i++){
      if(max(A) <= B[i]){
        count ++;
      }
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: no matching function for call to 'max(int [M])'
   20 |       if(max(A) <= B[i]){
      |          ~~~^~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:20:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'int*'
   20 |       if(max(A) <= B[i]){
      |          ~~~^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: Java

import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] start = new int[n];
    int[] end = new int[n];

    for (int i=0; i < m; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();

      start[a-1] += 1;
      end[b-1] += 1;
    }

    int ans = 0;
    int flag = 1;
    int tmp_count = 0;

    for (int i=0; i < n; i ++) {
      if (flag == 1) {
        if (start[i] > 0) {
          flag = -1;
          tmp_count = start[i]
        }
      } else if (flag == -1) {
        if (end[i] > 0) {
          ans++;
          tmp_count - end[i];
          if (tmp_count == 0 && start[i] > 0) {
            flag = 1;
          }
        }
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:28: error: ';' expected
          tmp_count = start[i]
                              ^
Main.java:33: error: not a statement
          tmp_count - end[i];
                    ^
2 errors
Language: C++

#include <bits/stdc++.h>

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;


int main(){
    int n,m;
    vector<pair<int, int>> bri;
    int ta,tb;//vectorに置くデータの仮置き
    vector<int> brkb;

    cin >> n >> m;

    REP(i, m){
        cin >> ta >> tb;
        bri.pb(make_pair(n, m));
    }
    sort(bri.begin(), bri.end());

    brkb.pb(bri.first.end());
    
    REP(j, m){
        if(bri.second.begin()+j < brkb[2*j]){
            brkb.pb(bri.second.begin()+j);
        }
        if(bri.first.end()-(1+j) > brkb[1+2*j]){
            brkb.pb(bri.first.end()-(1+j))
        }
    }
    cout << brkb.size() << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   27 |     brkb.pb(bri.first.end());
      |                 ^~~~~
a.cc:30:16: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   30 |         if(bri.second.begin()+j < brkb[2*j]){
      |                ^~~~~~
a.cc:31:25: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   31 |             brkb.pb(bri.second.begin()+j);
      |                         ^~~~~~
a.cc:33:16: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   33 |         if(bri.first.end()-(1+j) > brkb[1+2*j]){
      |                ^~~~~
a.cc:34:25: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   34 |             brkb.pb(bri.first.end()-(1+j))
      |                         ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;


int main(){
	int n,m;
	int a[100000];
	int b[100000];

	scanf("%d %d", &n,&m);
	for(int i=0;i<m;i++){
		scanf("%d %d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
	}

	vector<P> v;
	for(int i=0;i<m;i++){
		bool found = false;
		for(int j=0;j<v.size();j++){
			if(b[i]<=v[j].first||v[j].second<=a[i]) continue;
			v[j] = make_pair(max(a[i],v[j].first),min(b[i],v[j].second));
			found = true;
			break;
		}
		if(!found){
			v.push_back(make_pair(a[i],b[i]));
		}
	}
	int ans = v.size();
	for(int i=0;i<v.size();i++){
		if(v[i].first==v[i].second) ans--;
		//printf("v:%d %d\n", v[i].first,v[i].second);
	}
	for(int i=0;i<v.size();i++){
		//printf("v:%d %d\n", v[i].first,v[i].second);
	}

	printf("%d\n", ans;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:27: error: expected ')' before ';' token
   50 |         printf("%d\n", ans;
      |               ~           ^
      |                           )
Language: C++

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

int main(){
  int N,M;
  cin>>N>>M;
  int o[M][2];
  int ans=0,cou=0;
  int b[N-1];
  
  for(int i=0;i<N-1;i++)b[i]=0;
  for(int i=0;i<M;i++)cin>>o[i][0]>>o[i][1];
  for(int i=0;i<M;i++){
    for(int j=o[i][0];j<o[i][1];j++){
      b[j]+=1;
    }
  }

  sort(b,b+(N-1))
  int j=N-2;
  while(cou<M){
    cou+=b[j];
    j--;
    ans+=1;
  }

  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before 'int'
   20 |   sort(b,b+(N-1))
      |                  ^
      |                  ;
   21 |   int j=N-2;
      |   ~~~             
a.cc:23:12: error: 'j' was not declared in this scope
   23 |     cou+=b[j];
      |            ^
Language: Java



import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class D {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] c = new int[n + 1];
        List<Integer> aList = new ArrayList<>();
        List<Integer> bList = new ArrayList<>();
        int aMin = n;
        int bMax = 0;

        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            aList.add(a);
            bList.add(b);
            if (aMin > a) {
                aMin = a;
            }
            if (bMax < b) {
                bMax = b;
            }
            for (int j = a; j <= b; j++) {
                c[j]++;
            }
        }

        int answer = 0;
        while (aList.size() > 0) {
            answer++;
            //get max
            List<Integer> list = new ArrayList<>();
            int max = 0;
            int index = 0;
            for (int i = aMin; i <= bMax; i++) {
                if (max < c[i]) {
                    max = c[i];
                    index = i;
                }
                list.add(c[i]);
            }
            c[index] = 0;
            if (max == aList.size()) {
                break;
            }
            //済んだやつは消してく
            List<Integer> aList2 = new ArrayList<>();
            List<Integer> bList2 = new ArrayList<>();
            aMin = n;
            bMax = 0;
            for (int i = 0; i < aList.size(); i++) {
                int a = aList.get(i);
                int b = bList.get(i);
                if (a <= index && b > index) {
                    continue;
                }
                aList2.add(a);
                if (aMin > a) {
                    aMin = a;
                }
                bList2.add(b);
                if (bMax < b) {
                    bMax = b;
                }
            }
            aList = aList2;
            bList = bList2;
        }
        System.out.println(answer);
    }
}


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

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

int main() {

int N, M, a, b, sum = 0, count = 0;
cin >> N >> M;

for(i = 1; i < N + 1; i++){
  for(int j = 0; j < M; j++){
    cin >> a >> b;

    if(i = a || i = b){
      sum += 1;
    }
    else{
      continue;
    }
  }
  if(count <= sum){
    cout = sum;
  }
  else{
    continue;
  }
  cout << count << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'i' was not declared in this scope
    9 | for(i = 1; i < N + 1; i++){
      |     ^
a.cc:21:12: error: no match for 'operator=' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
   21 |     cout = sum;
      |            ^~~
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/ostream:458:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  458 |       operator=(basic_ostream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:458:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
  458 |       operator=(basic_ostream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define yn(a) cout <<((a)?"Yes":"No")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {
    
    int N,M,hymaxi=1,hasicnt=0,yobozen=1;
    cin >>N>>M;
    vi a(M+1),b(M+1);
    vi hasi(N,0);
    vi hasiyo(N,0);
    vi yobo(M+1,0);
    vi hasiyobod(N,0);
    FOR(i,1,M) {
        cin >>a[i]>>b[i];
    }
    
    FOR(hasaa,1,N-1) {
        FOR(i,1,N-1) {
            hasiyo[i]=0;
        }
        FOR(i,1,M) {
            FOR(j,a[i],b[i]-1) {
                if(yobo[i]==0) hasiyo[j]++;
            }
        }
        hymaxi=1;
        FOR(i,1,N-1) {
            if(hasiyobod[i]==1) continue;
            if((hasiyo[hymaxi]<hasiyo[i])&&()) hymaxi=i;
        }
        hasiyobod[hymaxi]=1;
//        cout <<hymaxi<<endl;
        hasicnt++;
        yobozen=1;
        FOR(i,1,M) {
            if(yobo[i]==1) continue;
//            cout <<"sa"<<a[i]<<" "<<b[i]<<endl;
            if((hymaxi>=a[i])&&(hymaxi<b[i])) {
                yobo[i]=1;
            }else{
                yobozen=0;
            }
        }
        if(yobozen==1) break;
    }
    
    cout <<hasicnt<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:45: error: expected primary-expression before ')' token
   58 |             if((hasiyo[hymaxi]<hasiyo[i])&&()) hymaxi=i;
      |                                             ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
#define ll long long
int main(){
	ll N,M;
	cin >> N >> M;
	ll s[N];
    ll i;
    ll a,b;
    for(i=0;i<N;i++){
    	s[i]=N+1;
    }
    for (i=0;i<M;i++){
    	cin >> a >> b;
    	if(s[a-1]>b-1){
    		s[a-1]=b-1;
    	}
    }
    ll fin=N+1;
    ll ans =0;
    for (i=0;i<N;i++){
    	if(fin==i){
    		fin=N+1;
    		ans++;
    	}
    	if(s[i]<fin){
    		fin=s[i];
    		flag=1;
    	}
    }
    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'flag' was not declared in this scope
   31 |                 flag=1;
      |                 ^~~~
Language: C++

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

int main() {

int N, M, a, b, i, sum[i] = 0, sum;
cin >> N >> M;

for(i = 1; i < N + 1; i++){
  for(int j = 0; j < M; j++){
    cin >> a >> b;

    if(i = a || i = b){
      sum[i] += 1;
    }
    else{
      continue;
    }
  }
  if(sum[i] <= sum[i + 1]){
    sum = sum[i + 1];
  }
  else{
    sum = sum[i];
  }
}
cout << sum << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:29: error: array must be initialized with a brace-enclosed initializer
    6 | int N, M, a, b, i, sum[i] = 0, sum;
      |                             ^
a.cc:6:32: error: conflicting declaration 'int sum'
    6 | int N, M, a, b, i, sum[i] = 0, sum;
      |                                ^~~
a.cc:6:20: note: previous declaration as 'int sum [i]'
    6 | int N, M, a, b, i, sum[i] = 0, sum;
      |                    ^~~
a.cc:13:14: error: lvalue required as left operand of assignment
   13 |     if(i = a || i = b){
      |            ~~^~~~
a.cc:21:9: error: incompatible types in assignment of 'int' to 'int [i]'
   21 |     sum = sum[i + 1];
      |     ~~~~^~~~~~~~~~~~
a.cc:24:9: error: incompatible types in assignment of 'int' to 'int [i]'
   24 |     sum = sum[i];
      |     ~~~~^~~~~~~~
Language: C

#include<cstdio>

int main()
{
	int n, m, a[10000], b[10000], brid[10000] = { }, max = 0, flag = 1;
	int count = 0;
	bool com[10000] = { };
	scanf("%d%d", &n, &m);
	n--;
	for (int i = 0; i < m; i++)
	{
		scanf("%d%d", a + i, b + i);
		a[i]--; b[i]--;
		for (int j = a[i]; j < b[i]; j++)
			brid[j]++;
	}
	while (flag)
	{
		max = 0;
		for (int i = 0; i < n; i++)
		{
			if (brid[i] > brid[max])
				max = i;
		}
		for (int i = 0; i < m; i++)
			if ((!com[i]) && a[i] <= max && b[i] > max)
			{
				com[i] = true;
				for (int j = a[i]; j < b[i]; j++)
					brid[j]--;
			}
		flag = 0;
		for (int i = 0; i < m; i++)
			if (!com[i]) {
				flag = 1;
				break;
			}
		count++;
	}

	printf("%d\n", count);
	return 0;
}

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

#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
const int MaxN = 1e5 + 5;
struct NOOD {
	int x, y;
}a[MaxN];
bool cmp(NOOD a, NOOD b){
	//if(a.y == b.y) return a.x < b.x;
	return a.x < b.x;
}
int main(){
	int n, m;
	cin>>n>>m;
	for(int i = 1; i <= m; i++){
		cin>>a[i].x>>a[i].y;
	}int ans = 1;
	int u, v;
	sort(a+1,a+1+m,cmp);
	u = a[1].x; v = a[1].y;
	for(int i = 2; i <= m; i++){
		if(a[i].x > u && a[i].y < v && a[i].x <= v){
			u = max(u, a[i].x); v = min(v, a[i].y);
		}
		else if(a[i].x > u && a[i].y > v && a[i].x > v) {
			ans++;
			u = a[i].x; v = a[i].u;
		}
	}
	cout<<min(ans, n-1)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:46: error: 'struct NOOD' has no member named 'u'
   31 |                         u = a[i].x; v = a[i].u;
      |                                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
bool p[100004][100004];
typedef pair<int,int> pii;
pii a[100004];
vector <pii> b[100004];
int n,m;
bool conti(){
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			if (p[i][j]) return true;
	return false;
}
int search(int x){
	int num=0;
	for (int i=0;i<b[x].size();i++)
		if (p[b[x][i].fs][b[x][i].sc])
			num++;
	return num;
}
int main() {
	cin>>n>>m;
	for (int i=0; i<m; i++){
		cin>>a[i].fs>>a[i].sc;
		p[a[i].fs][a[i].sc]=true;
		for (int j=a[i].fs;j<a[i].sc;j++){
			b[j].push_back(mp(a[i].fs,a[i].sc));
		}
	}
	int ans=0;
	while (conti){
		ans++;
		int cnt=0,go=0;
		for (int i=1;i<n;i++){
			if (search[i]>cnt){cnt=search(i);go=i;}
		}
		for (int i=0;i<b[go].size();i++)
			p[b[go][i].fs][b[go][i].sc]=0;
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:35: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   38 |                         if (search[i]>cnt){cnt=search(i);go=i;}
      |                                   ^
Language: C++

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

#pragma comment(linker, "/STACK:102400000,102400000")
#define __m int mid=(l+r)>>1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1 
template<class T>
inline bool rd(T &num) {
    char in;
    bool IsN = false;
    while(in = getchar(), in != '-' && (in < '0' || in > '9'))if(in == EOF)return false;
    in == '-' ? (IsN = true, num = 0) : num = in - '0';
    while(in = getchar(), in >= '0' && in <= '9')num = num * 10 + in - '0';
    return IsN ? num = -num : num, true;
}

#define rep(i,a,b) for(register int i = (a); i< (b); i++)
#define per(i,a,b) for(register int i = (a); i> (b); i--)
#define clr(a) memset(a,0,sizeof(a));
#define inf(a) memset(a,0x3f,sizeof(a));
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define rd2(a,b) rd(a)&&rd(b)
#define rd3(a,b,c) rd(a)&&rd(b)&&rd(c)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

string nico;
#ifdef LOCAL
#define bug(x) cout<<#x<<" : "<<x<<endl
#define infile(x) freopen(x,"r",stdin)
#define outfile(x) freopen(x,"w",stdout)
#else
#define bug(x)
#define infile(x)
#define outfile(x)
#endif

const int maxn = 1e5 + 7;
const int inf  = 0x3f3f3f3f;
const LL linf  = (LL)inf << 32 | inf;
const int mod  = 1e9 + 7;

int n,m;
struct Edge{
    int x,id;
    operator < (Edge b){
        return x<b.x;
    }
}edge[maxn];
set<int>need;
int main(){
	IO;
	cin>>n>>m;
    int tot=0;
	rep(i,1,m+1){
		int a,b;
		cin>>a>>b;
        edge[tot].x=a;
        edge[tot++].id=i;
        edge[tot].x=b;
        edge[tot++].id=i;
	}
    sort(edge,edge+tot);
    int ans=0;
    rep(i,0,tot){
        if(need.find(edge[i].id)!=need.end()){
            need.clear();
            ans++;
        } else need.insert(edge[i].id);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:50:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   50 |     operator < (Edge b){
      |     ^~~~~~~~
a.cc: In function 'int main()':
a.cc:59:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   59 |         rep(i,1,m+1){
      |             ^
a.cc:19:37: note: in definition of macro 'rep'
   19 | #define rep(i,a,b) for(register int i = (a); i< (b); i++)
      |                                     ^
a.cc:69:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   69 |     rep(i,0,tot){
      |         ^
a.cc:19:37: note: in definition of macro 'rep'
   19 | #define rep(i,a,b) for(register int i = (a); i< (b); i++)
      |                                     ^
Language: C++

#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
	return x;
    else
	return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
	if(m%2)
	    r=(r*n)%p;
	n=(n*n)%p;
	m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
	if (n%i == 0 || n%(i+2) == 0)
	   return false;
 
    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
	if (i <= r)
	    z[i] = min (r - i + 1, z[i - l]);
	while (i + z[i] < n && s[z[i]] == s[i + z[i]])
	    ++z[i];
	if (i + z[i] - 1 > r)
	    l = i, r = i + z[i] - 1;
    }
    return z;
}
int f(int x,vector<int>&a)
{
	int p=0;
	for(int i=0;i<a.size();i++)
	{
		p=p+x%a[i];
	}
	return p;
}
int32_t main()
{
   IOS;
   /*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/     
   int n,m;
   cin>>n>>m;
   vector<int>a(n+1);
   map<int,int>p;
   for(int i=0;i<m;i++)
   {
   	int x,y;
   	cin>>x>>y;
   	x--,y--;
   	a[x]++;
   	a[y]--;
   }
   int ans=0,c=0;
   for(auto x: p)
   {
   	c=c+p.ss;
   	ans=max(ans,c);
   }
   ans=m-ans;
   cout<<ans<<endl;
}      	


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:6:12: error: 'class std::map<long long int, long long int>' has no member named 'second'
    6 | #define ss second
      |            ^~~~~~
a.cc:102:15: note: in expansion of macro 'ss'
  102 |         c=c+p.ss;
      |               ^~
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
 
class demand implements Comparable{
  int from;
  int to;
 
  public int compareTo(Object other){
    demand otherdemand = (demand)other;
    return to - otherdemand.to;
  }
}
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    int m = sc.nextInt();


    demand[] demands = new demand[m];

    for(int i = 0; i < m; i++){
      demand newdemand = new demand();
      newdemand.from = sc.nextInt();
      newdemand.to = sc.nextInt();
      demands[i] = newdemand;
    }

    Arrays.sort(demands);

    int ans = 0;
    int nowclear = 0;
    for(int i = 0; i < m; i++){
      int nowfrom = demands[i].from;
      int nowto = demands[i].to;
      if(nowclear < nowfrom){
        ans++;
        nowclear = nowto - 1;
      }
    }

    System.out.println(ans);
 
  }
} 

Compiler output:
Main.java:21: error: cannot find symbol
    InputReader sc = new InputReader(System.in);
    ^
  symbol:   class InputReader
  location: class Main
Main.java:21: error: cannot find symbol
    InputReader sc = new InputReader(System.in);
                         ^
  symbol:   class InputReader
  location: class Main
2 errors
Language: Java

import java.util.*;
 
class demand implements Comparable{
  int from;
  int to;
 
  public int compareTo(Object other){
    demand otherdemand = (demand)other;
    return to - otherdemand.to;
  }
}

public class Main {
  public static void main(String[] args) {
 	Scanner sc = new Scanner(System.in);
 
  int n = sc.nextInt();
  int m = sc.nextInt();


  demand[] demands = new demand[m];

  for(int i = 0; i < m; i++){
    demand newdemand = new demand();
    newdemand.from = sc.nextInt();
    newdemand.to = sc.nextInt();
    demands[i] = newdemand;
  }

  Arrays.sort(demands);

  int ans = 0;
  int nowclear = 0;
  for(int i = 0; i < m; i++){
    int nowfrom = demands[i].from;
    int nowto = demands[i].to;
    if(nowclear < nowfrom){
      ans++;
      nowclear = nowto - 1;
    }
  }

  System.out.println(ans);
}

Compiler output:
Main.java:44: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
const int N=100003;
struct node{
    int v,w;
    node(int _v,int _w){
        v=_v;
        w=_w;
    }
};
vector<node> g[N];
int n,m,vis[N],dis[N];
void spfa(int s){
    queue<int> q;
    for(int i=1;i<=n;i++) dis[i]=N<<2;
    memset(vis,0,sizeof vis);
    q.push(s);
    dis[s]=0;
    vis[s]=1;
    while(!q.empty()){
        int u=q.front();
        q.pop();
        vis[u]=0;
        for(int i=0;i<g[u].size();i++){
            int v=g[u][i].v;
            if(dis[v]>dis[u]+g[u][i].w){
                dis[v]=dis[u]+g[u][i].w;
                if(!vis[v]){
                    vis[v]=1;
                    q.push(v);
                }
            }
        }
    }
    cout<<-dis[n]<<endl;
}
int main(){
    cin>>n>>m;
    for(int i=1;i<n;i++) g[i].push_back(node(i+1,0));
    for(int i=n;i>1;i--) g[i].push_back(node(i-1,1));
    for(int i=1;i<=m;i++){
        int u,v;
        cin>>u>>v;
        g[u].push_back(node(v,-1));
    }
    spfa(1);
    return 0;
}


Compiler output:
a.cc: In function 'void spfa(int)':
a.cc:19:5: error: 'memset' was not declared in this scope
   19 |     memset(vis,0,sizeof vis);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | #include<vector>
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int func(const VVI& a, int left, int right);

int main() {
	int n, m;
	cin >> n >> m;
	list<PAIR> a;
	REP(i, m) {
		int x, y;
		cin >> x >> y;
		--x; --y;
		a.push_back({ x,y });
	}

	int count = 0;
	while (!a.empty()) {
		++count;
		VI brige = VI(n - 1, 0);
		REPC(v, a) {
			FOR(i, v.first, v.second) {
				++brige[i];
			}
		}

		int maxItr = max_element(ALL(brige)) - brige.begin();

		vector<list<PAIR>::iterator> eraseList;
		for (auto& itr = a.begin(); itr != a.end(); ++itr) {
			if ((*itr).first <= maxItr && maxItr < (*itr).second) {
				eraseList.push_back(itr);
			}
		}

		REPC(itr, eraseList) {
			a.erase(itr);
		}

		//for (auto& itr = a.begin(); itr != a.end(); ++itr) {
		//	cout << (*itr).first << " " << (*itr).second << endl;
		//}
	}

	cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:41: error: cannot bind non-const lvalue reference of type 'std::_List_iterator<std::pair<int, int> >&' to an rvalue of type 'std::__cxx11::list<std::pair<int, int> >::iterator'
   54 |                 for (auto& itr = a.begin(); itr != a.end(); ++itr) {
      |                                  ~~~~~~~^~
Language: C++

#include<iostream>
#include<set>
#include<vector>
#include<string.h>
#include<map>
#define f first
#define s second
using namespace std;
pair<int,int> a[100001];
int main(){
  int cnt=0;
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>a[i].f>>a[i].s;
    if(a[i].f>a[i].s)
      swap(a[i].f,a[i].s);
  }
  sort(a,a+m);
  int s=0,e=0;
  int go=0;
  while(go<m){
    s=a[go].f,e=a[go].s;
    go++;
    while(go<m){
      if(a[go].f>=e || a[go].s<=s)
        break;
      s=max(a[go].f,s);
      e=min(a[go].s,e);
      go++;
    }
    cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  int a,b;
  long long int now=100000,ans=0;
  int mp[100001];
  for(int i=0;i<100001;i++){
    mp[i]=100000;
  }
  cin>>N>>M;
  for(int i=0;i<M;i++){
    cin>>a>>b;
    mp[a]=min(mp[a],b);
  }
  for(int i=1;i<=N;i++){
    if(now==i){
      ans++;
      now=100000;
    }
     now=min(now,mp[i]);
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: no matching function for call to 'min(long long int&, int&)'
   21 |      now=min(now,mp[i]);
      |          ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:21:13: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   21 |      now=min(now,mp[i]);
      |          ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:21:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |      now=min(now,mp[i]);
      |          ~~~^~~~~~~~~~~
Language: C

#include<stdio.h>
int main(){
  int n,m,a[100001],b[100001],minb,ans=1;
  scanf("%d%d",&n,&m);
  minb=m;
  for(i=1;i<=m;i++){
    scanf("%d%d",&a[i],&b[i]);
    if(minb>b[i])minb=b[i];
  }
  for(i=1;i<=m;i++){
    if(minb<=a[i])
      ans+=1;
  }
  printf("%d\n",ans);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:7: error: 'i' undeclared (first use in this function)
    6 |   for(i=1;i<=m;i++){
      |       ^
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
using namespace std;
vector <pair<int, int> > bridges;
int a, b, n, m;
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		bridges.push_back(make_pair(b, a));
	}
	sort(bridges.rbegin(), bridges.rend());
	int ans = 0;
	while (!bridges.empty()) {
		int cut = bridges[bridges.size() - 1].first - 1;
		ans++;
		while (bridges[bridges.size() - 1].second <= cut && cut <= bridges[bridges.size() - 1].first && !bridges.empty())
			bridges.pop_back();
	}
	cout << ans << endl;
}

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

#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;

using Segment = pair<int, int>; // (右端, 左端)

int main() {
    int N, M;
    cin >> N >> M;

    vector<Segment> segments;
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;

        segments.emplace_back(b, a);
    }

    sort(segments.begin(), segments.end());
    int last = -1,
        ans  = 0;
    for (auto seg : segments) {
        if (seg.first <= last or seg.second < last) continue;
        last = seg.first;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<Segment> segments;
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:12:19: error: expected primary-expression before '>' token
   12 |     vector<Segment> segments;
      |                   ^
a.cc:12:21: error: 'segments' was not declared in this scope; did you mean 'Segment'?
   12 |     vector<Segment> segments;
      |                     ^~~~~~~~
      |                     Segment
Language: C++

#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <vector>

using namespace std;
int main(void){
    int N,M;
    scanf("%d%d",&N,&M);
    vector<int> B;
    vector<pair<int,int> > po;
    for(int i=0;i<M;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        B.push_back(b);
        po.push_back(make_pair(a,b));
    }
    sort(B.begin(),B.end());
    sort(po.begin(),po.end());
    int ans=1;
    int count=0;
    while(count<M&&po[count].first<B[0]&&p)count++;
    for(int i=1;i<B.size();i++){
        int flag=0;
        if(B[i]!=B[i-1])flag=1;
        while(count<M&&po[count].first<B[i]){count++;if(flag==1)flag=2;}
        if(flag==2)ans++;
    }
    printf("%d",ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:42: error: 'p' was not declared in this scope; did you mean 'po'?
   23 |     while(count<M&&po[count].first<B[0]&&p)count++;
      |                                          ^
      |                                          po
Language: C++

#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;

using PP = pair<int, int>;

int n, m;
int c;
PP p[100000];
int main() {
  cin >> n >> m;
  
  int mn = -1;
  for (int i = 0; i < m; ++i) {
    cin >> p[i].first >> p[i].second;
  }
  
  sort(p, p + m);
  int mn = -1;
  for (int i = 0; i < m; ++i) {
    if (mn <= p[i].first) {
      ++c;
      mn = p[i].second;
    } else {
      mn = min(mn, p[i].second);
    }
  }
  cout << c << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: redeclaration of 'int mn'
   20 |   int mn = -1;
      |       ^~
a.cc:14:7: note: 'int mn' previously declared here
   14 |   int mn = -1;
      |       ^~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main()
{
	int n; 
  	cin >> n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++)c
      in >> arr[i];

	int count=0;

	for(int i = 0; i < n;) {
		int j = i;
		while(arr[j] == arr[i] && j < n) {
			j++;
		}
		count += (j - i) / 2;
		i = j;
	}
	cout<<count;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:35: error: 'c' was not declared in this scope
   12 |         for(int i = 0; i < n; i++)c
      |                                   ^