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

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> w(n);
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        w.at(i) = make_pair(a, b);
    }

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

    int index = 0;
    priority_queue<int> q;
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        while (index < n && w.at(index).first <= i) q.push(w.at(index++).second);

        ans += q.top(); q.pop();
    }
    cout << ans << endl;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n >> m;
      |     ^~~
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<pair<int, int>> w(n);
      |     ^~~~~~
a.cc:7:12: error: 'pair' was not declared in this scope
    7 |     vector<pair<int, int>> w(n);
      |            ^~~~
a.cc:7:17: error: expected primary-expression before 'int'
    7 |     vector<pair<int, int>> w(n);
      |                 ^~~
a.cc:11:9: error: 'w' was not declared in this scope
   11 |         w.at(i) = make_pair(a, b);
      |         ^
a.cc:11:19: error: 'make_pair' was not declared in this scope
   11 |         w.at(i) = make_pair(a, b);
      |                   ^~~~~~~~~
a.cc:14:10: error: 'w' was not declared in this scope
   14 |     sort(w.begin(), w.end());
      |          ^
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(w.begin(), w.end());
      |     ^~~~
      |     short
a.cc:17:5: error: 'priority_queue' was not declared in this scope
   17 |     priority_queue<int> q;
      |     ^~~~~~~~~~~~~~
a.cc:17:20: error: expected primary-expression before 'int'
   17 |     priority_queue<int> q;
      |                    ^~~
a.cc:20:53: error: 'q' was not declared in this scope
   20 |         while (index < n && w.at(index).first <= i) q.push(w.at(index++).second);
      |                                                     ^
a.cc:22:16: error: 'q' was not declared in this scope
   22 |         ans += q.top(); q.pop();
      |                ^
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << ans << endl;
      |     ^~~~
a.cc:24:20: error: 'endl' was not declared in this scope
   24 |     cout << ans << endl;
      |                    ^~~~
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}



int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int n, m;
  cin >> n >> m;

  vector<P> ab(n);

  priority_queue<int> pq;

  REP(i,n) cin >> ab[i].first >> ab[i].second;

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

  int p=0, res=0;
  FOR(i,1,m+1){
    while(p < n && ab[p].first <= i) pq.push(a[p++].second);

    if(!pq.empty()){
      res+=pq.top();
      pq.pop();
    }
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:67:46: error: 'a' was not declared in this scope
   67 |     while(p < n && ab[p].first <= i) pq.push(a[p++].second);
      |                                              ^
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

bool visited[1000100];


int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int n, m;
  cin >> n >> m;

  vector<P> ab(n);

  priority_queue<int> pq;

  REP(i,n) cin >> ab[i].first >> ab[i].second;

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

  int p=0, res=0;
  FOR(i,1,m+1){
    while(p < n && ab[p].first <= i) pq.push(A[p++].second);

    if(!pq.empty()){
      res+=pq.top();
      pq.pop();
    }
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:68:46: error: 'A' was not declared in this scope
   68 |     while(p < n && ab[p].first <= i) pq.push(A[p++].second);
      |                                              ^
Language: C++

n,m = gets.split.map(&:to_i)
h = Hash.new{[0]}
n.times {|a|
  a,b = gets.split.map(&:to_i)
  (h[a]=h[a]) << b  if a <= m
}
h.values.each {|v| v.sort!}
a = Array.new(m)
1.upto(m) {|i|
  x = i
  i.downto(1) {|j|
    x = j  if h[j][-1] > h[x][-1]
  }
  a[-i] = h[x].pop
}
p a.inject(&:+)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,m = gets.split.map(&:to_i)
      | ^
a.cc:3:1: error: 'n' does not name a type
    3 | n.times {|a|
      | ^
a.cc:7:1: error: 'h' does not name a type
    7 | h.values.each {|v| v.sort!}
      | ^
a.cc:8:1: error: 'a' does not name a type
    8 | a = Array.new(m)
      | ^
a.cc:16:1: error: 'p' does not name a type
   16 | p a.inject(&:+)
      | ^
Language: C++

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

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int A,B;
    int N,M;
    int i,j;
    ULL ans;
    vector<int> reward[100000];
    int *serchs;
    int num_of_serchs;

    cin >> N >> M;
    serchs = new int[N];
    for(i=0;i<N;i++){
        cin >> A >> B;
        reward[A-1].push_back(B);
    }
    num_of_serchs = 0;
    for(i=0;i<M;i++){
        sort(reward[i].begin(),reward[i].end(),std::greater<int>());
        for(j=0;j < M-i && reward[i].size(); j++){
            serchs[num_of_serchs++] = reward[i][j];
        }
    }
   sort(serchs, serchs + num_of_serchs,std::greater<LL>() );
   ans = 0;
   for(i=0;i<num_of_serchs && i < M;i++){
       ans += (ULL)serchs[i];
   }
    cout << ans << endl;
}
#include<iostream>
#include<algorithm>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int A,B;
    int N,M;
    int i,j;
    ULL ans;
    vector<int> reward[100000];
    int *serchs;
    int num_of_serchs;

    cin >> N >> M;
    serchs = new int[N];
    for(i=0;i<N;i++){
        cin >> A >> B;
        reward[A-1].push_back(B);
    }
    num_of_serchs = 0;
    for(i=0;i<M;i++){
        sort(reward[i].begin(),reward[i].end(),std::greater<int>());
        for(j=0;j < M-i && reward[i].size(); j++){
            serchs[num_of_serchs++] = reward[i][j];
        }
    }
   sort(serchs, serchs + num_of_serchs,std::greater<LL>() );
   ans = 0;
   for(i=0;i<num_of_serchs && i < M;i++){
       ans += (ULL)serchs[i];
   }
    cout << ans << endl;
}


Compiler output:
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main(){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(){
      |     ^~~~
Language: C++

#include <iostream>
#include <utility>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n, m;
    cin >> n >> m;
    int a[100002], b[100002];
    P p[100002];
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
        p[i] = P(a[i], b[i]);
    }
    sort(p, p + n);
    priority_queue<P> que;
    int now = 0;
    ll ans = 0;
    for(int i = 1; i <= m; i++){
        while(now < n && p[now].first <= i){
            que.push(P(p[now].second, p[now].first));
            now++;
        }
        if(!que.empty()){
            ans += que.top().first;
            que.pop();
        }
    }
    cout << ans << endl;
}

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

#include <stdio.h>
#include <stdlib.h>
 
typedef struct Data{
  long time;
  long money;
}Data;
 
int compare(const void *a,const void *b){
  Data *A = (Data *)a;
  Data *B = (Data *)b;
  long ta = A->time;
  long tb = B->time;
  long ma = A->money;
  long mb = B->money;
  if((mb*100001+tb) - (ma*100001+ta) > 0){
    return 1;
  }else if((mb*100001+tb) - (ma*100001+ta) < 0){
    return -1;
  }else{
    return 0;
  }
}
 
int main(){
  long n,m;
  scanf("%ld %ld",&n,&m);
  Data info[100000];
  long a,b;
  for(int i=0;i<n;i++){
    scanf("%ld %ld",&a,&b);
    info[i].time = a - 1;
    info[i].money = b;
  }
  qsort(info,n,sizeof(Data),compare);
  /*
  for(int i=0;i<n;i++){
    a = info[i].time;
    b = info[i].money;
    printf("%ld %ld\n",a,b);
  }
  */
  long reward = 0;
  long task = 0;
  bool sche[100000];
  int tmp;
  bool done;
  int ref[100000];
  for(int i=0;i<m;i++){
    sche[i] = true;
    ref[i] = i;
  }
  for(int i=0;i<n;i++){
    a = info[i].time;
    b = info[i].money;
    tmp = ref[a];
    if(sche[tmp]){
      sche[tmp] = false;
      reward += b 
      ref[tmp] = ref[tmp+1];
      task++;
    }
    tmp = ref[tmp];
    if(task == m) break;
  }
  printf("%ld\n",reward);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:18: error: expected ';' before 'ref'
   59 |       reward += b
      |                  ^
      |                  ;
   60 |       ref[tmp] = ref[tmp+1];
      |       ~~~
Language: C++

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

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int A,B;
    int N,M;
    int i,j;
    ULL ans;
    vector<int> *reward;
    int *serchs;
    int num_of_serchs;

    cin >> N >> M;
    reward = new vector<int>[N];
    serchs = new int[N];
    for(i=0;i<N;i++){
        cin >> A >> B;
        reward[A-1].push_back(B);
    }
    for(i=0;i<M;i++){
        sort(reward[i].begin(),reward[i].end(),std::greater<int>()
        for(j=0;j < M-i && reward[i].size(); j++){
            serchs[num_of_serchs++] = reward[i][j];
        }
    }

    num_of_serchs = 0;

   sort(serchs, serchs + num_of_serchs,std::greater<LL>() );
   ans = 0;
   for(i=0;i<num_of_serchs && i < M;i++){
       ans += (ULL)serchs[i];
   }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:67: error: expected ')' before 'for'
   27 |         sort(reward[i].begin(),reward[i].end(),std::greater<int>()
      |             ~                                                     ^
      |                                                                   )
   28 |         for(j=0;j < M-i && reward[i].size(); j++){
      |         ~~~                                                        
a.cc:28:49: error: expected ';' before ')' token
   28 |         for(j=0;j < M-i && reward[i].size(); j++){
      |                                                 ^
      |                                                 ;
Language: C++

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

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int A,B;
    int N,M;
    int i,j;
    ULL ans;
    vector<int> *reward;
    int *serchs;
    int num_of_serchs;

    cin >> N >> M;
    reward = new vector<int> N];
    serchs = new int[N];
    for(i=0;i<N;i++){
        cin >> A >> B;
        reward[A-1].push_back(B);
    }
    for(i=0;i<M;i++){
        sort(reward[i].begin(),reward[i].end(),std::greater<int>()
        for(j=0;j < M-i && reward[i].size(); j++){
            serchs[num_of_serchs++] = reward[i][j];
        }
    }

    num_of_serchs = 0;

   sort(serchs, serchs + num_of_serchs,std::greater<LL>() );
   ans = 0;
   for(i=0;i<num_of_serchs && i < M;i++){
       ans += (ULL)serchs[i];
   }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:29: error: expected ';' before 'N'
   20 |     reward = new vector<int> N];
      |                             ^~
      |                             ;
a.cc:27:67: error: expected ')' before 'for'
   27 |         sort(reward[i].begin(),reward[i].end(),std::greater<int>()
      |             ~                                                     ^
      |                                                                   )
   28 |         for(j=0;j < M-i && reward[i].size(); j++){
      |         ~~~                                                        
a.cc:28:49: error: expected ';' before ')' token
   28 |         for(j=0;j < M-i && reward[i].size(); j++){
      |                                                 ^
      |                                                 ;
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>>ab(n);
    vector<pair<int,int>>ba(n);
    for (int i=0;i<ab.size();i++){
        cin>>ab.at(i).second>>ab.at(i).first;
        ba[i].first=ab[i].second;
        ba[i].second=ab[i].first;
    }
    sort(ab.begin(),ab.end());
    sort(ba.begin(),ba.end());
    
    int c=0;
    int s=0;
    for(int i=n-1;i>-1&&c<=m;i--){
        if(ab.at(i).second+c<=m){
            s+=ab.at(i).first;
            c++;
        }
    }
    int ss=0;
    int c=0;
     for(int i=n-1;i>-1&&c<=m;i--){
        if(ba.at(i).first+c<=m){
            ss+=ba.at(i).second;
            c++;
        }
    }

    cout<<max(s,ss)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: redeclaration of 'int c'
   30 |     int c=0;
      |         ^
a.cc:21:9: note: 'int c' previously declared here
   21 |     int c=0;
      |         ^
Language: C

#include <stdio.h>
 
int main()
{
    int N,M,i,j,day,ibest;
    int Nmax = 10^5;
    int Mmax = 10^5;
    int A[Nmax+1],B[Nmax+1];
    int Selected[Nmax+1];
    int tmp=0,sum=0;
    

    // 入力読込
    scanf("%d", &N);
    scanf("%d", &M);
    
    for(i=1;i<=N;i++){
        scanf("%d", &A[i]);
        scanf("%d", &B[i]);
        Selected[i]=0;
    }
    
    for(day=1;day<=M;day++){
        
        //今日する仕事を選択
        tmp =0;
        for(i=1;i<=N;i++){
            if( (A[i]>=(M-day) &&
                (B[i]>tmp) &&
                (Selected[i]==0)
               ){
                tmp = B[i];
                ibest = i;
            }           
        }
               
        sum += B[ibest];
        Selected[ibest] = 1;
               
    }
    
  
    printf("%d \n", sum);
  
  return 0;
   
}

Compiler output:
main.c: In function 'main':
main.c:6:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    6 |     int Nmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:6:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    6 |     int Nmax = 10^5;
      |                ^~
      |                0xa
main.c:7:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    7 |     int Mmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:7:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    7 |     int Mmax = 10^5;
      |                ^~
      |                0xa
main.c:31:17: error: expected ')' before '{' token
   31 |                ){
      |                 ^
      |                 )
main.c:28:15: note: to match this '('
   28 |             if( (A[i]>=(M-day) &&
      |               ^
main.c:35:9: error: expected expression before '}' token
   35 |         }
      |         ^
Language: C

#include <stdio.h>
 
int main()
{
    int N,M,i,j,day,ibest;
    int Nmax = 10^5;
    int Mmax = 10^5;
    int A[Nmax+1],B[Nmax+1];
    int Selected[Nmax+1]={0};
    int tmp=0,sum=0;
    

    // 入力読込
    scanf("%d", &N);
    scanf("%d", &M);
    
    for(i=1;i<=N;i++){
        scanf("%d", &A[i]);
        scanf("%d", &B[i]);
        Selected[i]=0;
    }
    
    for(day=1;day<=M;day++){
        
        //今日する仕事を選択
        tmp =0;
        for(i=1;i<=N;i++){
            if( (A[i]>=(M-day) &&
                (B[i]>tmp) &&
                (Selected[i]==0)
               ){
                tmp = B[i];
                ibest = i;
            }           
        }
               
        sum += B[ibest];
        Selected[ibest] = 1;
               
    }
    
  
    printf("%d \n", sum);
  
  return 0;
   
}

Compiler output:
main.c: In function 'main':
main.c:6:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    6 |     int Nmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:6:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    6 |     int Nmax = 10^5;
      |                ^~
      |                0xa
main.c:7:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    7 |     int Mmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:7:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    7 |     int Mmax = 10^5;
      |                ^~
      |                0xa
main.c:9:26: error: variable-sized object may not be initialized except with an empty initializer
    9 |     int Selected[Nmax+1]={0};
      |                          ^
main.c:31:17: error: expected ')' before '{' token
   31 |                ){
      |                 ^
      |                 )
main.c:28:15: note: to match this '('
   28 |             if( (A[i]>=(M-day) &&
      |               ^
main.c:35:9: error: expected expression before '}' token
   35 |         }
      |         ^
Language: C

#include <stdio.h>
 
int main()
{
    int N,M,i,j,day,ibest;
    int Nmax = 10^5;
    int Mmax = 10^5;
    int A[Nmax+1],B[Nmax+1];
    int Selected[Nmax+1]={0};
    int tmp=0,sum=0;
    

    // 入力読込
    scanf("%d", &N);
    scanf("%d", &M);
    
    for(i=1;i<=N;i++){
        scanf("%d", &A[i]);
        scanf("%d", &B[i]);
    }
    
    for(day=1;day<=M;day++){
        
        //今日する仕事を選択
        tmp =0;
        for(i=1;i<=N;i++){
            if( (A[i]>=(M-day) &&
                (B[i]>tmp) &&
                (Selected[i]==0)
               ){
                tmp = B[i];
                ibest = i;
            }           
        }
               
        sum += B[ibest];
        Selected[ibest] = 1;
               
    }
    
  
    printf("%d \n", sum);
  
  return 0;
   
}

Compiler output:
main.c: In function 'main':
main.c:6:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    6 |     int Nmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:6:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    6 |     int Nmax = 10^5;
      |                ^~
      |                0xa
main.c:7:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    7 |     int Mmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:7:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    7 |     int Mmax = 10^5;
      |                ^~
      |                0xa
main.c:9:26: error: variable-sized object may not be initialized except with an empty initializer
    9 |     int Selected[Nmax+1]={0};
      |                          ^
main.c:30:17: error: expected ')' before '{' token
   30 |                ){
      |                 ^
      |                 )
main.c:27:15: note: to match this '('
   27 |             if( (A[i]>=(M-day) &&
      |               ^
main.c:34:9: error: expected expression before '}' token
   34 |         }
      |         ^
Language: C++

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

int main(){
  int N, M; cin >> N >> M;
  vector<pair<int,int>> MY(N);
  for(int i=0;i<N;i++){
    cin >> MY.at(i).first >> MY.at(i).second;
    MY.at(i).second*=-1;
  }
  sort(MY.begin(),MY.end());
  long long ans=0;
  vector<int> k={0};
  int now=1;
  for(int i=0;i<N-1;i++){
    if(now<MY.at(i).first){
      now++;
    }
    if(now==MY.at(i).first){
      if(k.size()>1)
      if(k[0]<=MY.at(i).second){
        ans-=k[0];
        k.erase(k.begin());
        it=k.begin();
        it=k.insert(it,MY.at(i).second);
      }
      else ans-=MY.at(i).second;
      now++;
    }
    if(now>MY.at(i).first){
      k.push_back(MY.at(i).second);
    }
    sort(k.begin(),k.end());
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'it' was not declared in this scope; did you mean 'i'?
   24 |         it=k.begin();
      |         ^~
      |         i
Language: C++

n,m = gets.split.map(&:to_i)
h = {} #Hash.new{[]}
n.times {|a|
  a,b = gets.split.map(&:to_i)
  (h[a]||=[]) << b  if a <= m
}
a = Array.new(m)
1.upto(m) {|i|
  x = i
  i.downto(1) {|j|
    if (h[j]||[0])[-1] > (h[x]||[0])[-1]
      x = j
      break
    end
  }
  a[-i] = (h[x]||[0])[-1]
}
p a.inject(0){|s,x| s+x}

Compiler output:
a.cc:2:8: error: stray '#' in program
    2 | h = {} #Hash.new{[]}
      |        ^
a.cc:1:1: error: 'n' does not name a type
    1 | n,m = gets.split.map(&:to_i)
      | ^
a.cc:2:9: error: 'Hash' does not name a type
    2 | h = {} #Hash.new{[]}
      |         ^~~~
a.cc:3:1: error: 'n' does not name a type
    3 | n.times {|a|
      | ^
a.cc:7:1: error: 'a' does not name a type
    7 | a = Array.new(m)
      | ^
a.cc:18:1: error: 'p' does not name a type
   18 | p a.inject(0){|s,x| s+x}
      | ^
Language: C++

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

int main(){
ll N,M;
cin>>N>>M;
vector<pair<ll,ll>> w(N);

ll tmp,tmp1;

ll aaa;

for(ll i=0;i<N;i++){
cin>>tmp>>tmp1;
w[i]=make_pair(tmp,tmp1);
}
sort(w.begin(),w.end());
//reverse(w.begin(),w.end());
ll ans =0;
ll tt = 0,point=-100;

vector<ll> hhh;

for(ll i=0;i<M;i++){
for(ll j=point+1;j<N;j++){
  if(w[j].first<=i+1){
  hhh.push_back(w[j].second);
  point=j;
  }
}
else
break;
}
for(ll i=0;i<hhh.size();i++){
  sort(hhh.begin(),hhh.end());
  ll ss= hhh.size();
  ans += hhh[ss-1];
  hhh.pop_back();
}

}
cout<<ans<<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:1: error: 'else' without a previous 'if'
   32 | else
      | ^~~~
a.cc: At global scope:
a.cc:43:1: error: 'cout' does not name a type
   43 | cout<<ans<<endl;
      | ^~~~
a.cc:44:1: error: expected unqualified-id before 'return'
   44 | return 0;
      | ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first > b.first;
        
    }else{
        return a.second > b.second;
    }
}
int main(){
    int N ,M;
    cin >>N>> M;
    vector<pair<int, int> > pairs(N);
    ll ans = 0;
    rep(i,N){
        int a, b;
        cin >> a >> b;
        pairs[i] = make_pair(a,b);
        //cout << pairs[i].first << ' ' << pairs[i].second<< endl;
    }
    
    sort(pairs.begin(),pairs.end(), compare_by_b);
    rep(i,N){
        cout << pairs[i].first << ' ' << pairs[i].second<< endl;
    }
    mx[100003];
    int tmo = pairs[0].first;
    int x =0,cnt = 0;
    rep(i,N){
        if(pairs[i].first == tmp && cnt < M-pairs[i].first){
            mx[x] = pairs[i].second;
            x++;
            cnt++;
        }else{
            cnt = 0;
            tmp = pairs[i].first;
        }
    }
    sort(mx, mx + N, greater<int>()); 
    rep(i,M){
        ans +=mx[i];
    }
    cout << ans << endl;
    
    return 0;
    

}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'mx' was not declared in this scope
   34 |     mx[100003];
      |     ^~
a.cc:38:30: error: 'tmp' was not declared in this scope; did you mean 'tmo'?
   38 |         if(pairs[i].first == tmp && cnt < M-pairs[i].first){
      |                              ^~~
      |                              tmo
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;

typedef long long ll;

int main() {
  ll n, m;
  cin >> n >> m;
  vector<pair<ll, ll> > a(n);
  for (int i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    a[i].first = x;
    a[i].second = -y;
  }
  if (n == 1) {
    if (a[0].first <= m) {
      cout << -a[0].second << endl;
    }
    else {
      cout << 0 << endl;
    }
    return 0;
  }
  sort(a.begin(), a.end());
  ll ans = 0;
  if (a[0].first > m) {
    cout << 0 << endl;
    return 0;
  }
  priority_queue<ll> q;
  q.push(-a[0].second);
  for (ll i = 1; i < n; i = i) {
    ll tmp = a[i].first;
    ll j = i + 1;
    if (tmp > m) {
      break;
    }
    q.push(-a[i].second)
    while (1) {
      if (tmp != a[j].first || j >= n) {
        i = j;
        if (!q.empty()) {
          ans += q.top();
          q.pop();
        }
        break;
      }
      q.push(-a[j].second);
      j++;
    }
  }
  ans += q.top();
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:25: error: expected ';' before 'while'
   44 |     q.push(-a[i].second)
      |                         ^
      |                         ;
   45 |     while (1) {
      |     ~~~~~
Language: C++

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

using namespace std;

typedef pair<long,long> P;

int main() {
  long n,m;
  long ans=0;
  cin >> n >> m;
  vector< P > jobs(n);
  vector< long > j(m+1,0);


  for (int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    jobs[i] = P(a,b);
  }

  sort(jobs.begin(), jobs.end(), []( P a, P b) { 
    if (a.second==b.second) return a.first>b.first;
    else return a.second > b.second;
  });

  // cout << endl;
  // for(int i=0; i<n; i++) {
  //   cout << jobs[i].first << ' ' << jobs[i].second << endl;
  // }
  // cout << endl;



  for (int i=0; i<n; i++) {
    if (jobs[i].first > m) continue;
    // cout << i << " " << jobs[i].first << " " << jobs[i].second << endl;

    if( j[jobs[i].first] == 0) {
      j[jobs[i].first] = jobs[i].second;
      continue;
    }

    int k = jobs[i].first;
    while(k<=m && j[k]!=0) k++;
    if(k<m) continue;
    j[k] = jobs[i].second;
  }

  for (int i=1; i<=m; i++) {
    ans += j[i];
    // cout << j[i] << " ";
  }
  // cco
  ut << endl;


  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:3: error: 'ut' was not declared in this scope
   60 |   ut << endl;
      |   ^~
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF_minus = -100000

// 入力
  int N,m,i;
int h[100010],h2[100010],a[100010];

// DP テーブル
int dp[100010];

int main() {
  int N; cin >> N >>m;
  for (i = 0; i < N; ++i) cin >> h[i] >>h2[i];
  for (i=0;i<100010;i++) a[i]=0;

  for (i=0;i<m+5;i++) {
    for(j=0;j<n;j++){
      if(h2[j]==i){
	if(a[i]<h1[j])a[i]=h1[j];
      }
    }
  }

  for (i = 0; i < 100010; ++i) dp[i] = 0;
  dp[m] = 0;

  // ループ
  for (i = m; i >= 0; i--) {
    for(j=1;j<=m-i;j++){chmax(dp[i], dp[i+j]+a[i-j]);}

    for(j=0;j<n;j++){
      if(h1==i && h2==a[i])a[i]=-1;}
    for(k=0;k<n;k++){
      if(h==i && a[i]<h2[k])a[i]=h2[k];
    }
  }


  // 答え
  cout << dp[1] << endl;
}

Compiler output:
a.cc:11:3: error: expected ',' or ';' before 'int'
   11 |   int N,m,i;
      |   ^~~
a.cc: In function 'int main()':
a.cc:18:21: error: 'm' was not declared in this scope
   18 |   int N; cin >> N >>m;
      |                     ^
a.cc:19:8: error: 'i' was not declared in this scope
   19 |   for (i = 0; i < N; ++i) cin >> h[i] >>h2[i];
      |        ^
a.cc:20:8: error: 'i' was not declared in this scope
   20 |   for (i=0;i<100010;i++) a[i]=0;
      |        ^
a.cc:22:8: error: 'i' was not declared in this scope
   22 |   for (i=0;i<m+5;i++) {
      |        ^
a.cc:23:9: error: 'j' was not declared in this scope
   23 |     for(j=0;j<n;j++){
      |         ^
a.cc:23:15: error: 'n' was not declared in this scope
   23 |     for(j=0;j<n;j++){
      |               ^
a.cc:25:17: error: 'h1' was not declared in this scope; did you mean 'h2'?
   25 |         if(a[i]<h1[j])a[i]=h1[j];
      |                 ^~
      |                 h2
a.cc:30:8: error: 'i' was not declared in this scope
   30 |   for (i = 0; i < 100010; ++i) dp[i] = 0;
      |        ^
a.cc:34:8: error: 'i' was not declared in this scope
   34 |   for (i = m; i >= 0; i--) {
      |        ^
a.cc:35:9: error: 'j' was not declared in this scope
   35 |     for(j=1;j<=m-i;j++){chmax(dp[i], dp[i+j]+a[i-j]);}
      |         ^
a.cc:37:9: error: 'j' was not declared in this scope
   37 |     for(j=0;j<n;j++){
      |         ^
a.cc:37:15: error: 'n' was not declared in this scope
   37 |     for(j=0;j<n;j++){
      |               ^
a.cc:38:10: error: 'h1' was not declared in this scope; did you mean 'h2'?
   38 |       if(h1==i && h2==a[i])a[i]=-1;}
      |          ^~
      |          h2
a.cc:39:9: error: 'k' was not declared in this scope
   39 |     for(k=0;k<n;k++){
      |         ^
a.cc:39:15: error: 'n' was not declared in this scope
   39 |     for(k=0;k<n;k++){
      |               ^
Language: C

#include <stdio.h>
 
int main()
{
    int N,M,i,j,day,ibest;
    int Nmax = 10^5;
    int Mmax = 10^5;
    int A[Nmax+1],B[Nmax+1];
    int Selected[Nmax+1]={0};
    int tmp=0,sum=0;
    

    // 入力読込
    scanf("%d", &N);
    scanf("%d", &M);
    
    for(i=1;i<=N;i++){
        scanf("%d", A[i]);
        scanf("%d", B[i]);
    }
    
    for(day=1;day<=M;day++){
        
        //今日する仕事を選択
        tmp =0;
        for(i=1;i<=N;i++){
            if( (A[i]>=(M-day) &&
                (B[i]>tmp) &&
                (Selected[i]==0)
               ){
                tmp = B[i];
                ibest = i;
            }           
        }
               
        sum += B[ibest];
        Selected[ibest] = 1;
               
    }
    
  
    printf("%d %s\n", A+B+C, S);
  
  return 0;
   
}

Compiler output:
main.c: In function 'main':
main.c:6:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    6 |     int Nmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:6:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    6 |     int Nmax = 10^5;
      |                ^~
      |                0xa
main.c:7:18: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
    7 |     int Mmax = 10^5;
      |                  ^
      |                ---
      |                1e
main.c:7:16: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    7 |     int Mmax = 10^5;
      |                ^~
      |                0xa
main.c:9:26: error: variable-sized object may not be initialized except with an empty initializer
    9 |     int Selected[Nmax+1]={0};
      |                          ^
main.c:30:17: error: expected ')' before '{' token
   30 |                ){
      |                 ^
      |                 )
main.c:27:15: note: to match this '('
   27 |             if( (A[i]>=(M-day) &&
      |               ^
main.c:34:9: error: expected expression before '}' token
   34 |         }
      |         ^
main.c:42:24: error: invalid operands to binary + (have 'int *' and 'int *')
   42 |     printf("%d %s\n", A+B+C, S);
      |                       ~^
      |                       ||
      |                       |int *
      |                       int *
main.c:42:27: error: 'C' undeclared (first use in this function)
   42 |     printf("%d %s\n", A+B+C, S);
      |                           ^
main.c:42:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:42:30: error: 'S' undeclared (first use in this function)
   42 |     printf("%d %s\n", A+B+C, S);
      |                              ^
Language: C++

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

int main(){
ll N,M;
cin>>N>>M;
vector<pair<ll,ll>> w(N);

ll tmp,tmp1;

ll aaa;

for(ll i=0;i<N;i++){
cin>>tmp>>tmp1;
w[i]=make_pair(tmp,tmp1);
}
sort(w.begin(),w.end());
//reverse(w.begin(),w.end());
ll ans =0;
ll tt = 0,point=-100;

vector<ll> hhh;

for(ll i=0;i<M;i++){
for(ll j=point+1;j<N;j++){
  if(w[j].first<=i+1){
  hhh.push_back(w[j]);
  point=j;
  }
}
else
break;
}
for(ll i=0;i<hhh.size();i++){
  sort(hhh.begin(),hhh.end());
  ll ss= hhh.size();
  ans += hhh[ss-1];
  hhh.pop_back();
}

}
cout<<ans<<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: no matching function for call to 'std::vector<long long int>::push_back(__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type&)'
   28 |   hhh.push_back(w[j]);
      |   ~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'const std::vector<long long int>::value_type&' {aka 'const long long int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:32:1: error: 'else' without a previous 'if'
   32 | else
      | ^~~~
a.cc: At global scope:
a.cc:43:1: error: 'cout' does not name a type
   43 | cout<<ans<<endl;
      | ^~~~
a.cc:44:1: error: expected unqualified-id before 'return'
   44 | return 0;
      | ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const ll mod=1e+9;
typedef pair<int,int> P;
#define fi first
#define se second

int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n,m;
cin>>n>>m;
vector<P> a;
for(int i=0;i<n;i++){
 int a1,b;
 cin>>a1>>b;
 if(a1>m)continue;
 a.push_back(P(a1,b));
}
sort(a.begin(),a.end(),greater<P>());
int j=0;
ll ans=0;
for(int i=m;i>0;i--){
    while(j+1<a.size()&&a.at(j).fi>i)j++;
    ans+=a.at(j).se;
}
cout<<ans<<endl;
}
}


Compiler output:
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

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

int main(){
    int64_t N, M, A, B, i, stoper, now = 0, money = 0;

    cin >> N >> M;
    vector<pair<int64_t, int64_t>> earn(N);
    priority_queue<int64_t> que;
    for(i = 0; i < N; i++){
        cin >> A >> B;
        earn[i] = make_pair(A, B);
    }
    sort(earn.begin(), earn.end());
    for(i = 0; i < N; i++){
        stoper = earn[i].first;
        que.push(earn[i].second);
        while(i < N - 1){
            if(earn[i+1].first == stoper){
                i++;
                que.push(earn[i].second);
                continue;
            }
            break;
        }
        if(now + stoper > M)break;;
        else{
            money += que.top();
            que.pop();
            now++;
        }
    }
    while(now != M){
        if(que.empty())break;
        money += que.top();
        que.pop();
        now++;
    }
    cout << money << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'else' without a previous 'if'
   27 |         else{
      |         ^~~~
Language: Java

import javafx.collections.transformation.SortedList;

import java.io.PrintWriter;
import java.util.*;

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int m = in.nextInt();

        long ans = 0;
        Map<Integer, List<Map.Entry<Integer, Integer>>> arbeits = new HashMap<>();
        for (int i=0; i < n; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            if (!arbeits.containsKey(a))
                arbeits.put(a, new ArrayList<>());
            arbeits.get(a).add(new AbstractMap.SimpleEntry<>(a, b));
        }

        arbeits.entrySet().forEach(e -> e.getValue().sort(((o1, o2) -> o2.getValue() - o1.getValue())));

        PriorityQueue<Map.Entry<Integer, Integer>> available = new PriorityQueue<>(new Comparator<Map.Entry<Integer, Integer>>() {
            @Override
            public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
                return o2.getValue() - o1.getValue();
            }
        });
        for (int i=1; i <= m; i++) {
            available.addAll(arbeits.getOrDefault(i, new ArrayList<>()));
            if (available.size() != 0) {
                ans += available.poll().getValue();
            }
        }
        out.println(ans);
    }

    private static class Arbeit {
        int a;
        int b;
        public Arbeit(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public boolean equals(Object obj) {
            return obj instanceof Arbeit && ((Arbeit) obj).a == this.a && ((Arbeit) obj).b == this.b;
        }

        @Override
        public int hashCode() {
            return super.hashCode();
        }
    }

}


Compiler output:
Main.java:1: error: package javafx.collections.transformation does not exist
import javafx.collections.transformation.SortedList;
                                        ^
1 error
Language: C++

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int> > AB(N);
  for (int i = 0; i < N; i++){
    int A, B;
    cin >> A >> B;
    AB.at(i) = make_pair(B, A);
  }
  sort(AB.begin(), AB.end());
  reverse(AB.begin(), AB.end());
  vector<bool> day(M+1, false);
  vector<int> days(M+1, 0);
  int money = 0;
  for (int i = 0; i < N; i++){
    
    if (AB.at(i).second <= M && AB.at(i).second + days.at(AB.at(i).second) < M+1 == false){
      if (day.at(AB.at(i).second + days.at(AB.at(i).second)){
        day.at(AB.at(i).second + days.at(AB.at(i).second)) = true;
        days.at(AB.at(i).second)++;
        money += AB.at(i).first;
      }
    }
  }
  cout << money << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:61: error: expected ')' before '{' token
   21 |       if (day.at(AB.at(i).second + days.at(AB.at(i).second)){
      |          ~                                                  ^
      |                                                             )
a.cc:26:5: error: expected primary-expression before '}' token
   26 |     }
      |     ^
Language: C++

#include<iostream>
#include<cstdlib>
#include<algorithm>

using namespace std;

int compare_by_a(const void* a, const void* b){
    typedef pair<int, int> mypair;
    if(((mypair*)a)->first != ((mypair*)b)->first) return ((mypair*)a)->first -((mypair*)b)->first;
    else return ((mypair*)b)->second -((mypair*)a)->second;
}

int main(){
    int N,M;
    cin >> N >> M;
    typedef pair<int, int> data;
    data ab[N];
    int line[10000];
    for(int i=0;i<10000;i++){
        line[i]=0;
    }
    for(int i=0;i<N;i++){
        cin >> ab[i].first >> ab[i].second;
        line[ ab[i].first ]++;
    }
    qsort(ab, N, sizeof(ab), compare_by_a);

    int flag[N];
    for(int i=0;i<N;i++){
        flag[i] = 0;
    }
    int reward=0;
    int now=0;
    int max=-1;
    int date[M];
    date[0] = 0;
    for(int i=1;i<=M;i++){
        date[i] += date[i-1] + line[i];
    }
    for(int i=1;i<=M;i++){
        if(line[i]>0){

            for(int j=0;j<=date[i]j++){
                if( flag[j]!=0 && ab[j].second > max ){
                    max = ab[j].second;
                    now = j;
                }
            }
            reward += max;
            flag[now]=1;


        }
    }
    cout << reward << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:35: error: expected ';' before 'j'
   43 |             for(int j=0;j<=date[i]j++){
      |                                   ^
      |                                   ;
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct X{
	int A;
	int B;
};
bool Comp(X& l,X& r){
	if (l.B>r.B){
		return true;
	}else if (l.B==r.B){
		return l.A>r.A;
	}
	return false;
}
int main(int argc, char* argv[])
{
	int N,M,i;
	cin>>N>>M;
	vector<X> x(N);
	for (i=0;i<N;i++){
		cin>>x[i].A>>x[i].B;
	}
	sort(x.begin(),x.end(),Comp);
	int day=0;
	int MaxV=0;
	for (i=0;i<N;i++){
		if (x[i].A+day<=M){
			MaxV+=x[i].B;
		}
		day++;
	}
	cout<<MaxV<<endl;

	return 0;
}
/*
//Date:2019.8.10
//Contest:137
//Question:C
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	int N,i,j;
	char tmp[20];
	cin>>N;
	string S;
	map<char,int> myMap;
	map<char,int>::iterator mit;
	map<string,int> myMap0;
	map<string,int>::iterator mit0;
	for (i=0;i<N;i++){
		cin>>S;
		myMap.clear();
		for (j=0;j<S.size();j++){
			mit=myMap.find(S[j]);
			if (mit==myMap.end()){
				myMap[S[j]]=1;
			}else{
				myMap[S[j]]++;
			}
		}
		S.clear();
		for (mit=myMap.begin();mit!=myMap.end();mit++){
			S+=(*mit).first;
			sprintf(tmp,"%d",(*mit).second);
			S+=tmp;
		}
		mit0=myMap0.find(S);
		if (mit0==myMap0.end()){
			myMap0[S]=1;
		}else{
			myMap0[S]++;
		}
	}
	LL ans=0;
	for (mit0=myMap0.begin();mit0!=myMap0.end();mit0++){
		LL n=(*mit0).second;
		if (n>1){
			ans+=(n*(n-1))/2;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:38:1: error: unterminated comment
   38 | /*
      | ^
Language: C++

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define vi   vector<int>
#define vvi  vector<vi >
#define vvvi vector<vvi >
#define pii  pair<int,int>
#define INF  (int)1e9
#define MOD  (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n,m;
	cin>>n>>m;
	
	vector<pii> ba(n);
	REP(i,n){
		int a,b;
		cin>>a>>b;
		ba[i]=make_pair(b,a);
	}
	sort(ALL(ba),greater<pii>());
	
	vector<bool> dp(m+1,true);
	vector<bool> jud(m+2,true);
	jud[m+1]=false;
	llong ans=0;
	REP(i,n){
		for(int j=ba[i].second;j<=m;++j){
			cnt++;
			if(dp[j]){
				dp[j]=false;
				ans+=ba[i].first;
				if(!jud[j+1]) jud[j]=false;
				break;
			}
			if(!jud[j+1]) break;
		}
	}
	
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   31 |                         cnt++;
      |                         ^~~
      |                         int
Language: C++

#include<iostream>
#include<cstdlib>
#include<algorithm>

using namespace std;

int compare_by_a(const void* a, const void* b){
    typedef pair<int, int> mypair;
    if(((mypair*)a)->first != ((mypair*)b)->first) return ((mypair*)a)->first -((mypair*)b)->first;
    else return (-(mypair*)a)->second + ((mypair*)b)->second;
}

int main(){
    int N,M;
    cin >> N >> M;
    typedef pair<int, int> data;
    data ab[N];
    int line[10000];
    for(int i=0;i<10000;i++){
        line[i]=0;
    }
    for(int i=0;i<N;i++){
        cin >> ab[i].first >> ab[i].second;
        line[ ab[i].first ]++;
    }
    qsort(ab, N, sizeof(ab), compare_by_a);

    int flag[N];
    for(int i=0;i<N;i++){
        flag[i] = 0;
    }
    int reward=0;
    int now=0;
    int max=-1;
    int date[M];
    date[0] = 0;
    for(int i=1;i<=M;i++){
        date[i] += date[i-1] + line[i]
    }
    for(int i=1;i<=M;i++){
        if(line[i]>0){

            for(int j=0;j<=date[i]){
                if( flag[j]!=0 && ab[j].second > max ){
                    max = ab[j].second;
                    now = j;
                }
            }
            reward += max;
            flag[now]=1;


        }
    }
    cout << reward << endl;

}

Compiler output:
a.cc: In function 'int compare_by_a(const void*, const void*)':
a.cc:10:19: error: wrong type argument to unary minus
   10 |     else return (-(mypair*)a)->second + ((mypair*)b)->second;
      |                   ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:38:39: error: expected ';' before '}' token
   38 |         date[i] += date[i-1] + line[i]
      |                                       ^
      |                                       ;
   39 |     }
      |     ~                                  
a.cc:43:35: error: expected ';' before ')' token
   43 |             for(int j=0;j<=date[i]){
      |                                   ^
      |                                   ;