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

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}

/* main */

int main() {
	ll n, k, a, b, c[100001] = { 0 };
	scanf("%lld%lld", &n, &k);
	REP(i, n) {
		scanf("%lld%lld", &a, &b);
		c[a] += b;
	}
	REP(i, 100001) {
		if (k > c[i]) k -= c[i];
		else {
			printf("%lld", i);
			return 0;
		}
	}
}
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}

/* main */

int main() {
	int n, k, a, b;
	ll c[100001] = { 0 };
	scanf("%d%d", &n, &k);
	REP(i, n) {
		scanf("%d%d", &a, &b);
		c[a] += b;
	}
	REP(i, 100001) {
		if (k > c[i]) k -= c[i];
		else {
			printf("%d", i);
			return 0;
		}
	}
}

Compiler output:
main.c:67:11: error: redefinition of 'MOD'
   67 | const int MOD = (int)1e9 + 7;
      |           ^~~
main.c:26:11: note: previous definition of 'MOD' with type 'int'
   26 | const int MOD = (int)1e9 + 7;
      |           ^~~
main.c:74:5: error: redefinition of 'cmp'
   74 | int cmp(const void *a, const void *b) {
      |     ^~~
main.c:33:5: note: previous definition of 'cmp' with type 'int(const void *, const void *)'
   33 | int cmp(const void *a, const void *b) {
      |     ^~~
main.c:77:5: error: redefinition of 'cmp2'
   77 | int cmp2(const void *a, const void *b) {
      |     ^~~~
main.c:36:5: note: previous definition of 'cmp2' with type 'int(const void *, const void *)'
   36 | int cmp2(const void *a, const void *b) {
      |     ^~~~
main.c:83:5: error: redefinition of 'main'
   83 | int main() {
      |     ^~~~
main.c:42:5: note: previous definition of 'main' with type 'int()'
   42 | int main() {
      |     ^~~~
Language: C++

N, K = map(int, input().split())
acc = 0
while True:
    a, b = map(int, input().split())
    acc += b
    if K <= acc:
        print(a)
        break

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, K = map(int, input().split())
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//



//
int main(){
	int N
	ll K;cin>>N>>K;
	vector<P> a(N);
	REP(i,N)cin>>a[i].first>>a[i].second;

	sort(ALL(a));

	ll suml=0;
	int ans=-1;
	REP(i,N){
		suml+=a[i].second;
		if(suml>=K){
			ans = a[i].first;
			break;
		}
	}
	cout << (ans != -1 ? ans : a[a.size()-1].first) << endl;

	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: expected initializer before 'll'
   30 |         ll K;cin>>N>>K;
      |         ^~
a.cc:30:19: error: 'N' was not declared in this scope
   30 |         ll K;cin>>N>>K;
      |                   ^
a.cc:30:22: error: 'K' was not declared in this scope
   30 |         ll K;cin>>N>>K;
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
  int c=0;
  cin>>a>>b;
  vector<pair<int,int>> d(a);
 	for(int i=0;i<a;i++) {
 		int e,f;
 		cin >>e>>f;
 		d.at(i) = make_pair(e,f);
 	}
  sort(d.begin(), d.end());
  for(int i=0;i<a;i++){
    if(b<=c){
      cout <<d[i].first;
      break;
      }
    c+=d[i].second；
    }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'second\U0000ff1b'; did you mean 'second'?
   20 |     c+=d[i].second；
      |             ^~~~~~~~
      |             second
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
  int c=0;
  cin>>a>>b;
  vector<int> e(a);
  vector<int> d(a);
  for(int i=0;i<a;i++){
cin>>e.at(i);
  cin>>d.at(i);
    }
  sort(e.begin(), e.end())
  for(int i=0;i<a;i++){
    c+=d.at(i);
    if(b<=c){
      cout <<e.at(i);
      break;
      }
    }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: expected ';' before 'for'
   14 |   sort(e.begin(), e.end())
      |                           ^
      |                           ;
   15 |   for(int i=0;i<a;i++){
      |   ~~~                      
a.cc:15:15: error: 'i' was not declared in this scope
   15 |   for(int i=0;i<a;i++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
  int c=0;
  int g=0;
  cin>>a>>b;
  vector<int> e(a);
  vector<int> d(a);
  for(int i=0;i<a;i++)
    g+=e.at(i);
  vector<int> f(g);
  for(int i=0;i<a;i++){
cin>>e.at(i);
  cin>>d.at(i);
    }
  for(int i=0;i<a;i++){
    for(int j=0;i<d.at(i);j++)
       f.at(j)=e.at(i)
      }
  cout<<f.at(b);
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: expected ';' before '}' token
   20 |        f.at(j)=e.at(i)
      |                       ^
      |                       ;
   21 |       }
      |       ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
  int c=0;
  int g=0;
  cin>>a>>b;
  vector<int> e(a);
  vector<int> d(a);
  for(int i=0;i<a;i++)
    g+=e.at(i)
  vector<int> f(g);
  for(int i=0;i<a;i++){
cin>>e.at(i);
  cin>>d.at(i);
    }
  for(int i=0;i<a;i++){
    for(int j=0;i<d.at(i);j++)
       f.at(j)=e.at(i)
      }
  cout<<f.at(b);
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before 'vector'
   12 |     g+=e.at(i)
      |               ^
      |               ;
   13 |   vector<int> f(g);
      |   ~~~~~~       
a.cc:20:8: error: 'f' was not declared in this scope
   20 |        f.at(j)=e.at(i)
      |        ^
a.cc:22:9: error: 'f' was not declared in this scope
   22 |   cout<<f.at(b);
      |         ^
Language: C++

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<iomanip>

int main(){
  int N;
  long K;
  std::cin >> N >> K;
  std::map<int, int> ab;
  int temp1, temp2;
  for(int i = 0; i < N; i++){
    std::cin >> temp1 >> temp2;
    auto itr = ab.find(temp1);
    if(itr != ab.end()) ab[temp1] += temp2;
    else ab[temp1] = temp2;
  }
  for(auto x : ab){
    K -= x.second;
    if(K <= 0){
      std::fixed;
      std::cout << setprecision(10) << x.first << std::endl;
      break;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: 'setprecision' was not declared in this scope; did you mean 'std::setprecision'?
   23 |       std::cout << setprecision(10) << x.first << std::endl;
      |                    ^~~~~~~~~~~~
      |                    std::setprecision
In file included from a.cc:5:
/usr/include/c++/14/iomanip:202:3: note: 'std::setprecision' declared here
  202 |   setprecision(int __n)
      |   ^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long N,K,p,q;cin>>N;K;
  vector<int> a;
  for(int i=0;i<N;i++){
    cin>>p>>q;
    for(int j=0;j<b;j++)a.push_back(p);
  }
  sort(a.begin(),a.end());
  cout<<a.at(K-1)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: 'b' was not declared in this scope
    8 |     for(int j=0;j<b;j++)a.push_back(p);
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
  int c=0;
  cin>>a>>b;
  vector<int> c(a);
  vector<int> d(a);
  for(int i=0;i<a;i++){
cin>>c.at(i);
  cin>>d.at(i);
    }
  for(int i=0;i<a;i++){
    c+=d.at(i);
    if(b<=c)
      cout <<c.at(i);
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: conflicting declaration 'std::vector<int> c'
    8 |   vector<int> c(a);
      |               ^
a.cc:6:7: note: previous declaration as 'int c'
    6 |   int c=0;
      |       ^
a.cc:11:8: error: request for member 'at' in 'c', which is of non-class type 'int'
   11 | cin>>c.at(i);
      |        ^~
a.cc:17:16: error: request for member 'at' in 'c', which is of non-class type 'int'
   17 |       cout <<c.at(i);
      |                ^~
Language: C++

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

int main(){
    int N;
    long long K;
    long long ans = 0;
    cin >> N >> K;
    int a, b;
    int t[100100];
    for(int i=0; i< N; ++i) {
        cin >> a >> b;
        t[a] = b;
    }
    
    for(int i=0; i< 100100; ++i) {
        if(sum >= K){
            cout << i << endl;
          return 0;
        }
        K -= t[i];
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'sum' was not declared in this scope
   17 |         if(sum >= K){
      |            ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int a[100010], b[100010];
    int N;
    ll K;
    cin >> N >> K;
    vector<pair<int, int>> v(N);

    rep(i, N) {
        int a2, b2;
        cin >> a2 >> b2;
        v.push.back(make_pair(a2, b2));
    }

    sort(v.begin(), v.end());
    rep(i, N) {
        a[i] = v[i].first;
        b[i] = v[i].second;
    }

    rep(i, N) {
        if(b[i] >= K) {
            cout << a[i] << endl;
            return 0;
        }
        else {
            K -= b[i];
        }
    }

    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'push'
   21 |         v.push.back(make_pair(a2, b2));
      |           ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int a[100010], b[100010];
    int N;
    ll K;
    cin >> N >> K;
    vector<pair<int, int>> v;

    rep(i, N) {
        int a2, b2;
        cin >> a2 >> b2;
        v.push.back(make_pair(a2, b2));
    }

    sort(v.begin(), v.end());
    rep(i, N) {
        a[i] = v[i].first;
        b[i] = v[i].second;
    }

    rep(i, N) {
        if(b[i] >= K) {
            cout << a[i] << endl;
            return 0;
        }
        else {
            K -= b[i];
        }
    }

    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'push'
   21 |         v.push.back(make_pair(a2, b2));
      |           ^~~~
Language: C++

#include "bits/stdc++.h"

using namespace std;

void solve(void)
{
	long n, k;
	cin >> n >> k;
	vector<pair<long, long>> ps(n);
	for (int i = 0; i < n; i++)
	{
		cin >> ps[i].first >> ps[i].second;
	}
	sort(ps.begin(), ps.end());
	long now = 0;
	for (int i = 0; i < n; i++)
	{
		now += bs[i];
		if (now >= k)
		{
			cout << as[i] << endl;
			return;
		}
	}
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:18:24: error: 'bs' was not declared in this scope; did you mean 'ps'?
   18 |                 now += bs[i];
      |                        ^~
      |                        ps
a.cc:21:33: error: 'as' was not declared in this scope; did you mean 'ps'?
   21 |                         cout << as[i] << endl;
      |                                 ^~
      |                                 ps
Language: C++

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

int main()
{
	map<int,int> cnt;
  	int n,q;
  	cin>>n>>q;
  	int x,y;
  	for(int i=0 ; i<n ; ++i)
    {
    	cin>>x>>y;
    	cnt[x]+=y;
    }
  	for(auto &i:cnt)
    {
    	if(i.second>=q)
        {
        	cout<<i.first<<endl
            return 0;
        }  
      	q-=i.second;
    }
  	return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:19:36: error: expected ';' before 'return'
   19 |                 cout<<i.first<<endl
      |                                    ^
      |                                    ;
   20 |             return 0;
      |             ~~~~~~
Language: C++

using ll = long long;
const int AMAX = 100000;
ll cnt[AMAX + 1];
int main(void) {
    int N;
    ll K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        int A, B;
cin >> A >> B;
cnt[A] += B; }
    for (int ans = 1; ans <= AMAX; ++ans){
        if (K <= cnt[ans]) {
            cout << ans << endl;
break; }
        K -= cnt[ans];
    }
return 0; }

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> N >> K;
      |     ^~~
a.cc:14:13: error: 'cout' was not declared in this scope
   14 |             cout << ans << endl;
      |             ^~~~
a.cc:14:28: error: 'endl' was not declared in this scope
   14 |             cout << ans << endl;
      |                            ^~~~
Language: C++

2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
using ll = long long;
const int AMAX = 100000;
ll cnt[AMAX + 1];
int main(void) {
    int N;
    ll K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        int A, B;
cin >> A >> B;
cnt[A] += B; }
    for (int ans = 1; ans <= AMAX; ++ans){
        if (K <= cnt[ans]) {
            cout << ans << endl;
break; }
        K -= cnt[ans];
    }
return 0; }

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2 3 4 5 6 7 8 9
      | ^
a.cc:5:1: error: 'll' does not name a type
    5 | ll cnt[AMAX + 1];
      | ^~
a.cc: In function 'int main()':
a.cc:8:5: error: 'll' was not declared in this scope
    8 |     ll K;
      |     ^~
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> N >> K;
      |     ^~~
a.cc:9:17: error: 'K' was not declared in this scope
    9 |     cin >> N >> K;
      |                 ^
a.cc:13:1: error: 'cnt' was not declared in this scope; did you mean 'int'?
   13 | cnt[A] += B; }
      | ^~~
      | int
a.cc:15:18: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |         if (K <= cnt[ans]) {
      |                  ^~~
      |                  int
a.cc:16:13: error: 'cout' was not declared in this scope
   16 |             cout << ans << endl;
      |             ^~~~
a.cc:16:28: error: 'endl' was not declared in this scope
   16 |             cout << ans << endl;
      |                            ^~~~
a.cc:18:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   18 |         K -= cnt[ans];
      |              ^~~
      |              int
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18


int main(){
    int N,;cin >> N;
    long long K; cin >> K;
    vector<pair<long long,long long>> ab(N);
    rep(i,N){
        cin >> ab[i].first >> ab[i].second;
    }
    sort(ab.begin(),ab.end());
    long long sum = 0;
    long long ans;
    rep(i,N){
        sum += ab[i].second;
        if(sum >= K){
            ans = ab[i].first;
            cout << ans << endl;
            return 0;
        }
    }
}


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

#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
//vectordefine
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
//queuedefine
#define qint queue<int>
#define qtr queue<string>
#define qc queue<char>
//pairdefine
#define pint pair<int,int>
#define pic pair<int,char>
#define pci pair<char,int>
#define pis pair<int,str>
#define psi pair<str,int>
#define pcc pair<char,char>
#define pss pair<str,str>
#define mp make_pair
//mapdefine
#define mint map<int,int>
#define mic map<int,char>
#define mci map<char,int>
#define mis map<int,str>
#define msi map<str,int>
#define pb() push_back()
#define all(x) x.begin(),x.end()
#define elif else if
//function
str shizuku(char,char);
//UnionFind
struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};
//binary_search

//main
signed main(){
    int N,M,X,count=0,count2=0;
    double d,D;
    int alph='A'-'a';
    char op,Ch;
    str S,T;
    cin>>N>>M;
    int a[N],b[N];rep(0,N)cin>>a[i]>>b[i];
    rep(0,N){
      count+=b[i];
      if(M<=count){
        cout<<a[i]<<endl;
        break;
    }
}


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

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
long long int main() {
	long long int N,ans=0,K;
	cin >> N >> K;
	vector<pair<long long int, long long int>>A(N);
	for (long long int i = 0; i < N; i++)
	{
		cin >> A[i].first >> A[i].second;
	}
	sort(A.begin(), A.end());
	for (long long int i = 0; i < N; i++)
	{
		ans += A[i].second;
		if (ans >= K) {
			ans = i;
			break;
		}
	}
	cout << A[ans].first;
}

Compiler output:
a.cc:10:11: error: '::main' must return 'int'
   10 | long long int main() {
      |           ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  int bsum=0;
  int a=0;
  for(int i=0;bsum<K;i++){
    cin >> a >> b;
    bsum+=b;
  }
  cout << a << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'b' was not declared in this scope
   10 |     cin >> a >> b;
      |                 ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) int((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;
typedef vector<vector<int>> VV;
typedef pair<int, int> P;
typedef map<string, int> M;
typedef unordered_map<int, int> HM;
typedef set<int> S;
typedef queue<int> Q;

int main(){
    ll n,k; cin>>n>>k;
    vector<ll>> dic(100010,0);
    for(int i=0; i<n; i++){
        int a,b; cin>>a>>b;
        dic[a] += b;
    }
    ll i=0, acu=0;
    while(acu < k){
        acu += dic[i];
        i++;
    }
    OUT(i-1);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expected unqualified-id before '>' token
   27 |     vector<ll>> dic(100010,0);
      |              ^~
a.cc:30:9: error: 'dic' was not declared in this scope; did you mean 'div'?
   30 |         dic[a] += b;
      |         ^~~
      |         div
a.cc:34:16: error: 'dic' was not declared in this scope; did you mean 'div'?
   34 |         acu += dic[i];
      |                ^~~
      |                div
Language: C++

#include <bits/stdc++.h>

#define ld long double
#define ll long long int
#define ull unsigned long long int

using namespace std;

ll main() {

    ll N, K;
    cin >> N >> K;
    vector<ll> a(N);
    vector<ll> b(N);
    for (ll i = 0; i < N; ++i) {
        cin >> a[i];
        cin >> b[i];
    }

    /**
     * メモリエラー; 最大要素数10^10 = 10000MB = 10 GB
     * sortの計算量はNlogN
     *
     */
//    vector<ll> v;
//    for (ll i = 0; i < N; ++i) {
//        for (ll j = 0; j < b[i]; ++j) {
//            v.push_back(a[i]);
//        }
//    }
//    sort(v.begin(), v.end());
//    cout << v[K - 1] << endl;


    /**
     * バケツソートを使う
     * 添字にai，連想配列のような感じ
     */

    vector<ll> num(100010, 0);
    for (ll i = 0; i < N; ++i) {
        num[a[i]] += b[i];
    }

    ll ans;
    ll current = 0;

    for (ll i = 0; i <= 100010; ++i) {

        // cout << i <<" : " <<num[i] <<" : "<< K <<endl;
        // if (num[i]  == 0){ continue;}
        if (num[i] > 0) {
            K -= num[i];
        }
        if (K <= 0) {
            // cout<<num[i]<<endl;
            ans = i;
            break;
        }
//        if (current + num[i] <K) {
//            current += num[i];
//        } else if (current + num[i] >= K) {
//            ans = i;
//            //a[K - current + 1];
//            break;
//        }
    }
    cout << ans << endl;

}

Compiler output:
a.cc:4:22: error: '::main' must return 'int'
    4 | #define ll long long int
      |                      ^~~
a.cc:9:1: note: in expansion of macro 'll'
    9 | ll main() {
      | ^~
Language: Java

import java.util.Scanner;

public class C_61_BigArray {

    public static void main(String[] args) {
        final int MAX_NUM = 1000000;
        Scanner sc = new Scanner(System.in);

        int[] backet = new int[MAX_NUM + 1];
        int cnt = 0;

        int numberOfIns = sc.nextInt();
        int numberOfArrLength = sc.nextInt();

        for (int i = 0; i < numberOfIns; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            backet[a] += b;
        }

        for (int i = 0; i <= MAX_NUM + 1; i++) {

            if (numberOfArrLength <= cnt + backet[i]) {
                System.out.println(i);
                break;
            }

            cnt += backet[i];
        }

    }

}


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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> c(100000);
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    c.at(a)+=b;
  }
  for(int i=0;i<100000;i++){
    if(k>c.at(i)){
      k-=c.at(i);
      continue;
    }
    else{
      cout<<i<<endl;
      break;
    }
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> c(100000);
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    c.at(a)+=b;
  }
  for(int i=0;i<100000;i++){
    if(k>a.at(i)){
      k-=a.at(i);
      continue;
    }
    else{
      cout<<i<<endl;
      break;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'a' was not declared in this scope
   13 |     if(k>a.at(i)){
      |          ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

#define int long long

const lint INF = 1E9;
#define P pair<int, int>

signed main() {
    int N, K;

    cin >> N >> K;

    vector<P> lis;

    for(int i = 0; i < N; ++i){
        int a, b;
        cin >> a >> b;
        lis.push_back(make_pair(a, b));
    }

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

    int pos = 0;
    while(K > 0){
        if(lis[pos].second < K){
            K -= lis[pos].second;
            pos++;
        } else {
            cout << lis[pos].first << endl;
            return 0;
        }
    }
}


Compiler output:
a.cc:6:7: error: 'lint' does not name a type; did you mean 'uint'?
    6 | const lint INF = 1E9;
      |       ^~~~
      |       uint
Language: C++

#include <iostream>

using namespace std;

int main()
{
  int n, k;
  int a, b;
  
  cin >> n >> k;
  
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    k -= b;
    if (k <= 0) {
      cout << a << endl;
      return (0);
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:19:4: error: expected '}' at end of input
   19 |   }
      |    ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

int main() {
	int n,k,sum=0,ans;
	vector<int> a,b;
	cin >> n >> k;
	a.resize(n); b.resize(n);
	REP(i,n){
		cin >> a[i] >> b[i];
	}
	REP(i,n){
		sum += b[i];
		if(k <= sum){
			ans = a[i]
			break;
		}
	}
	cout << ans;
	return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:35: error: expected ';' before 'break'
   23 |                         ans = a[i]
      |                                   ^
      |                                   ;
   24 |                         break;
      |                         ~~~~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

int main() {
	int n,k,sum=0;
	vector<int> a,b;
	cin >> n >> k;
	a.resize(n); b.resize(n);
	REP(i,n){
		cin >> a[i] >> b[i];
	}
	REP(i,n){
		sum += b[i];
		if(k <= sum)break;
	}
	cout << a[i];
	return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:19: error: 'i' was not declared in this scope
   24 |         cout << a[i];
      |                   ^
Language: C++

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

int main(void){
  int n, k;cin>>n>>k;
  queue<pair<int, int>> q;
  for(int i=0;i<n;i++){
    int a, b;cin>>a>>b;
    q.push(make_pair(a, b))
  }
  int sum=0;
  int ans;
  for(int i=0;i<n;i++){
    pair<int, int> p=q.pop();
    sum+=p.second
    if(sum>=k){
      ans=p.first;break;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:28: error: expected ';' before '}' token
    9 |     q.push(make_pair(a, b))
      |                            ^
      |                            ;
   10 |   }
      |   ~                         
a.cc:14:27: error: conversion from 'void' to non-scalar type 'std::pair<int, int>' requested
   14 |     pair<int, int> p=q.pop();
      |                      ~~~~~^~
a.cc:15:18: error: expected ';' before 'if'
   15 |     sum+=p.second
      |                  ^
      |                  ;
   16 |     if(sum>=k){
      |     ~~
Language: C++

#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
using ll=long long;
#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i < (int)n; ++i)
#define REPll1(i, n)  for(ll i = 1; i*i < (int)n; ++i)
char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                     's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int cnt(ll n) {
    int c = 0;
    while (true) {
        if (n < 1)break;
        n = n / 10;
        c++;
    }
    return c;
}

const ll MAX1E5 = 100000;
const ll MAX1E10 = 10000000000;
const double mod = 1e9 + 7;

int main() {
    ll N = 0, K = 0, answer = 0, sum1 = 0, sum2 = 0, tmp = 0;
    ll cnt1 = 0, cnt2 = 0, a = 0, b = 0;
    cin >> N >> K;
    ll A[MAX1eE5+1] = {};
    REP(i, N) {
        cin >> a >> b;
        A[a] += b;
    }
    REP1(i, MAX1E5+1) {
        
        if (K <= A[i]) {
            cout << i << endl;
            return 0;
        }
      	K -= A[i];
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:10: error: 'MAX1eE5' was not declared in this scope; did you mean 'MAX1E5'?
   33 |     ll A[MAX1eE5+1] = {};
      |          ^~~~~~~
      |          MAX1E5
a.cc:36:9: error: 'A' was not declared in this scope
   36 |         A[a] += b;
      |         ^
a.cc:40:18: error: 'A' was not declared in this scope
   40 |         if (K <= A[i]) {
      |                  ^
a.cc:44:14: error: 'A' was not declared in this scope
   44 |         K -= A[i];
      |              ^
Language: C++

#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
using ll=long long;
#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i < (int)n; ++i)
#define REPll1(i, n)  for(ll i = 1; i*i < (int)n; ++i)
char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                     's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int cnt(ll n) {
    int c = 0;
    while (true) {
        if (n < 1)break;
        n = n / 10;
        c++;
    }
    return c;
}

const ll MAX1eE5 = 100000;
const ll MAX1eE10 = 10000000000;
const double mod = 1e9 + 7;

int main() {
    ll N = 0, K = 0, answer = 0, sum1 = 0, sum2 = 0, tmp = 0;
    ll cnt1 = 0, cnt2 = 0, a = 0, b = 0;
    cin >> N >> K;
    ll A[MAX1eE5+1] = {};
    REP(i, N) {
        cin >> a >> b;
        A[a] += b;
    }
    REP1(i, MAX1E5+1) {
        
        if (K <= A[i]) {
            cout << i << endl;
            return 0;
        }
      	K -= A[i];
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: 'MAX1E5' was not declared in this scope; did you mean 'MAX1eE5'?
   38 |     REP1(i, MAX1E5+1) {
      |             ^~~~~~
a.cc:10:45: note: in definition of macro 'REP1'
   10 | #define REP1(i, n)  for(int i = 1; i < (int)n; ++i)
      |                                             ^
Language: C++

#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
using ll=long long;
#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i < (int)n; ++i)
#define REPll1(i, n)  for(ll i = 1; i*i < (int)n; ++i)
char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                     's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int cnt(ll n) {
    int c = 0;
    while (true) {
        if (n < 1)break;
        n = n / 10;
        c++;
    }
    return c;
}

const ll MAX1eE5 = 100000;
const ll MAX1eE10 = 10000000000;
const double mod = 1e9 + 7;

int main() {
    ll N = 0, K = 0, answer = 0, sum1 = 0, sum2 = 0, tmp = 0;
    ll cnt1 = 0, cnt2 = 0, a = 0, b = 0;
    cin >> N >> K;
    ll A[MAX1eE5+1] = {};
    REP(i, N) {
        cin >> a >> b;
        A[a] += b;
    }
    REP1(i, N+1) {
        
        if (K < A[i) {
            cout << i << endl;
            return 0;
        }
      	K -= A[i];
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:20: error: expected ']' before ')' token
   40 |         if (K < A[i) {
      |                    ^
      |                    ]
Language: C++

#include <iostream>
using namespace std;

struct ab{
	int a;
	int b;
};
int cmp(const void *a, const void*b)
{
	return ((ab*)a)->a - ((ab*)b)->a;
}
int main(void){

	ab ab[100000];
	ll N,K;
	cin >> N >> K;
	int i;
	for(i=0;i<N;i++){
		cin >> ab[i].a >> ab[i].b;
	}
	qsort(ab,N,sizeof(struct ab),cmp);
	ll count = 0;
	for(i=0;i<N;i++){
		count += ab[i].b;
		if(count >=K){
			cout << ab[i].a << endl;
			return 0;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'll' was not declared in this scope
   15 |         ll N,K;
      |         ^~
a.cc:16:16: error: 'N' was not declared in this scope
   16 |         cin >> N >> K;
      |                ^
a.cc:16:21: error: 'K' was not declared in this scope
   16 |         cin >> N >> K;
      |                     ^
a.cc:22:11: error: expected ';' before 'count'
   22 |         ll count = 0;
      |           ^~~~~~
      |           ;
a.cc:24:17: error: 'count' was not declared in this scope
   24 |                 count += ab[i].b;
      |                 ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <stack>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>
#include <functional>

#define REP(i,a) for(int (i)=0;(i)<(a);i++)
#define RREP(i,a,b) for(int (i)=(a);(i)<(b);i++)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define vi vector<int> 
typedef long long ll;
using namespace std;

int main(void){
    ll N,K;
    cin>>N>>K;
    int a,b;
    int kosuu[200000]={};
    REP(i,N){
        cin>>a>>b;
        kosuu[a]+=b;
    }
    ll tmp=0;
    RREP(ans,1,100001){
        if(K<=kosuu[ans]){
            cout<<ans<<endl;
            break;
        }
        K-=kosuu[ans]:
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:22: error: expected ';' before ':' token
   43 |         K-=kosuu[ans]:
      |                      ^
      |                      ;
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int dfs(int v, int n, int *visited, int table[n][n]) {
    int all_visited = 1, i;

    REP(i,n) {
        if (!visited[i]) {
            all_visited = 0;
            break;
        }
    }

    if (all_visited) {
        return 1;
    }

    int count = 0;

    REP(i,n) {
        if (!table[v][i]) continue;
        if (visited[i]) continue;

        visited[i] = 1;
        count += dfs(i, n, visited, table);
        visited[i] = 0;
    }

    return count;
}

int main() {
    int n = iin(), k = iin(), i, a, b;
    long long c[ONT_MAX];
    memset(c, 0, sizeof c);
    REP(i, n) {
        a = iin(), b = iin();
        c[a] += b;
    }
    long long count = 0;
    i = 0;
    while(count < k) {
        i++;
        count += c[i];
    }
    iout(i);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:87:17: error: 'ONT_MAX' undeclared (first use in this function); did you mean 'INT_MAX'?
   87 |     long long c[ONT_MAX];
      |                 ^~~~~~~
      |                 INT_MAX
main.c:87:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll main(){
    ll n,x,ans=0;
    cin >> n >> x;
    vector<pair<ll,ll>> v(n);//どの数字が何個か
    vector<ll> sum(n+1);//累積和
    sum.at(0)=0;
    
    for(ll i=0;i < n;i++){
        cin >> v.at(i).first >> v.at(i).second;
    }
    sort(v.begin(),v.end());//数字を昇順にソートして

    for(ll j=0;j < n;j++){
        sum.at(j+1) += sum.at(j)+v.at(j).second;
    }//個数の累積和を取る→何個目かで求める数が定まる

    for(ll k=0;k < n;k++){
        if(sum.at(k) < x && x <= sum.at(k+1)){
            ans = v.at(k).first;
            break;
        }
    }//このforに問題がある（K=nで問題あり？）
    cout << ans << endl;
}

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | ll main(){
      | ^~
Language: C++

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

int main() {
  ll n,k,cnt=0; cin >> n >> k;
  int ans=0;
  vector<p> v(n);
  for(int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    v[i].first=a;
    v[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      break;
    }
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'b' was not declared in this scope
   18 |     cnt+=b;
      |          ^
a.cc:20:11: error: 'a' was not declared in this scope
   20 |       ans=a;
      |           ^
Language: C++

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

int main() {
  ll n,k,cnt=0; cin >> n >> k;
  int ans=0;
  vector<P> A(n);
  for(int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    A[i].first=a;
    A[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      break;
    }
  }
}



Compiler output:
a.cc:4:14: error: expected unqualified-id before 'int'
    4 | typedef pair(int,int) P;
      |              ^~~
a.cc:4:14: error: expected ')' before 'int'
    4 | typedef pair(int,int) P;
      |             ~^~~
      |              )
a.cc: In function 'int main()':
a.cc:9:10: error: 'P' was not declared in this scope
    9 |   vector<P> A(n);
      |          ^
a.cc:9:11: error: template argument 1 is invalid
    9 |   vector<P> A(n);
      |           ^
a.cc:9:11: error: template argument 2 is invalid
a.cc:13:6: error: invalid types 'int[int]' for array subscript
   13 |     A[i].first=a;
      |      ^
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     A[i].second=b;
      |      ^
a.cc:16:8: error: 'v' was not declared in this scope
   16 |   sort(v.begin(),v.end());
      |        ^
a.cc:18:10: error: 'b' was not declared in this scope
   18 |     cnt+=b;
      |          ^
a.cc:20:11: error: 'a' was not declared in this scope
   20 |       ans=a;
      |           ^
Language: C++

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

int main() {
  ll n,k,cnt=0;
  int ans=0;
  cin >> k >> n;
  vector<P> A(n);
  for(int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    A[i].first=a;
    A[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      break;
    }
  }
}



Compiler output:
a.cc:4:14: error: expected unqualified-id before 'int'
    4 | typedef pair(int,int) P;
      |              ^~~
a.cc:4:14: error: expected ')' before 'int'
    4 | typedef pair(int,int) P;
      |             ~^~~
      |              )
a.cc: In function 'int main()':
a.cc:10:10: error: 'P' was not declared in this scope
   10 |   vector<P> A(n);
      |          ^
a.cc:10:11: error: template argument 1 is invalid
   10 |   vector<P> A(n);
      |           ^
a.cc:10:11: error: template argument 2 is invalid
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     A[i].first=a;
      |      ^
a.cc:15:6: error: invalid types 'int[int]' for array subscript
   15 |     A[i].second=b;
      |      ^
a.cc:17:8: error: 'v' was not declared in this scope
   17 |   sort(v.begin(),v.end());
      |        ^
a.cc:19:10: error: 'b' was not declared in this scope
   19 |     cnt+=b;
      |          ^
a.cc:21:11: error: 'a' was not declared in this scope
   21 |       ans=a;
      |           ^
Language: C++

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

int main() {
  ll k,cnt=0;
  int n,ans=0;
  cin >> k >> n;
  vector<P> v(n);
  for(int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    v[i].first=a;
    v[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      break;
    }
  }
}



Compiler output:
a.cc:4:14: error: expected unqualified-id before 'int'
    4 | typedef pair(int,int) P;
      |              ^~~
a.cc:4:14: error: expected ')' before 'int'
    4 | typedef pair(int,int) P;
      |             ~^~~
      |              )
a.cc: In function 'int main()':
a.cc:10:10: error: 'P' was not declared in this scope
   10 |   vector<P> v(n);
      |          ^
a.cc:10:11: error: template argument 1 is invalid
   10 |   vector<P> v(n);
      |           ^
a.cc:10:11: error: template argument 2 is invalid
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     v[i].first=a;
      |      ^
a.cc:15:6: error: invalid types 'int[int]' for array subscript
   15 |     v[i].second=b;
      |      ^
a.cc:17:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   17 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:17:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   17 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:19:10: error: 'b' was not declared in this scope
   19 |     cnt+=b;
      |          ^
a.cc:21:11: error: 'a' was not declared in this scope
   21 |       ans=a;
      |           ^
Language: C++

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

int main() {
  ll k,cnt=0;
  int n,a,b,ans=0;
  cin >> k >> n;
  vector<P> v(n);
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    v[i].first=a;
    v[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      break;
    }
  }
}



Compiler output:
a.cc:4:14: error: expected unqualified-id before 'int'
    4 | typedef pair(int,int) P;
      |              ^~~
a.cc:4:14: error: expected ')' before 'int'
    4 | typedef pair(int,int) P;
      |             ~^~~
      |              )
a.cc: In function 'int main()':
a.cc:10:10: error: 'P' was not declared in this scope
   10 |   vector<P> v(n);
      |          ^
a.cc:10:11: error: template argument 1 is invalid
   10 |   vector<P> v(n);
      |           ^
a.cc:10:11: error: template argument 2 is invalid
a.cc:13:6: error: invalid types 'int[int]' for array subscript
   13 |     v[i].first=a;
      |      ^
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     v[i].second=b;
      |      ^
a.cc:16:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   16 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:16:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   16 |   sort(v.begin(),v.end());
      |                    ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair(int,int) p;

int main() {
  ll k,cnt=0;
  int n,a,b,ans=0;
  cin >> k >> n;
  vector<p> v(n);
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    v[i].first=a;
    v[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      break;
    }
  }
}
}


Compiler output:
a.cc:4:14: error: expected unqualified-id before 'int'
    4 | typedef pair(int,int) p;
      |              ^~~
a.cc:4:14: error: expected ')' before 'int'
    4 | typedef pair(int,int) p;
      |             ~^~~
      |              )
a.cc: In function 'int main()':
a.cc:10:10: error: 'p' was not declared in this scope
   10 |   vector<p> v(n);
      |          ^
a.cc:10:11: error: template argument 1 is invalid
   10 |   vector<p> v(n);
      |           ^
a.cc:10:11: error: template argument 2 is invalid
a.cc:13:6: error: invalid types 'int[int]' for array subscript
   13 |     v[i].first=a;
      |      ^
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     v[i].second=b;
      |      ^
a.cc:16:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   16 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:16:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   16 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc: At global scope:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair(int,int) p;

int main() {
  ll k,cnt=0;
  int n,a,b,ans=0;
  cin >> k >> n;
  vector<p> v(n);
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    v[i].first=a;
    v[i].second=b;
  }
  sort(v.begin(),v.end());
  for(int i=0; i<n; i++) {
    cnt+=b;
    if(cnt>=k) {
      ans=a;
      return 0;
    }
  }
}
}


Compiler output:
a.cc:4:14: error: expected unqualified-id before 'int'
    4 | typedef pair(int,int) p;
      |              ^~~
a.cc:4:14: error: expected ')' before 'int'
    4 | typedef pair(int,int) p;
      |             ~^~~
      |              )
a.cc: In function 'int main()':
a.cc:10:10: error: 'p' was not declared in this scope
   10 |   vector<p> v(n);
      |          ^
a.cc:10:11: error: template argument 1 is invalid
   10 |   vector<p> v(n);
      |           ^
a.cc:10:11: error: template argument 2 is invalid
a.cc:13:6: error: invalid types 'int[int]' for array subscript
   13 |     v[i].first=a;
      |      ^
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     v[i].second=b;
      |      ^
a.cc:16:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   16 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:16:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   16 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc: At global scope:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long

typedef struct {
	int a;	// num
	int b;	// count
} elm;
 
int comp(const void *p,const void *q){
    return ((elm *)p)->a - ((elm *)q)->a;
}

int main(int argc, char const *argv[]){
  TLong n,k,i,j = 0;
  scanf("%lld%lld",&n,&k);
  elm element[100007];
  for(i = 0; i < n; ++i)	scanf("%lld%lld", &elm[i].a, &elm[i].b);
  qsort(element,n,sizeof(elm),comp);
  for(i = 0; (i < n && j < k); ++i)	j += elm[i].b;
  printf("%lld\n", elm[i].a);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:52: error: expected expression before 'elm'
   23 |   for(i = 0; i < n; ++i)        scanf("%lld%lld", &elm[i].a, &elm[i].b);
      |                                                    ^~~
main.c:25:46: error: expected expression before 'elm'
   25 |   for(i = 0; (i < n && j < k); ++i)     j += elm[i].b;
      |                                              ^~~
main.c:26:20: error: expected expression before 'elm'
   26 |   printf("%lld\n", elm[i].a);
      |                    ^~~
Language: C++

#ABC061C
N,K=map(int,input().split())
A={}
for n in range(N):
	a,b=map(int,input().split())
	A[a]=A.get(a,0)+b
for key in sorted(list(A.keys())):
	K-=A[key]
	if K<=0:
		print(key)
		break

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #ABC061C
    1 | #ABC061C
      |  ^~~~~~~
a.cc:2:1: error: 'N' does not name a type
    2 | N,K=map(int,input().split())
      | ^
a.cc:4:1: error: expected unqualified-id before 'for'
    4 | for n in range(N):
      | ^~~