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

    #include <stdio.h>
    #include <iostream>
    #include <iomanip>
    #include <vector>
    #include <cstdlib>
    #include <cmath>
    #include <numeric>
    #include <algorithm>
    #include <sstream>
    #include <string>
    #include <map>
    #include <set>
    #include <stack>
    #include <deque>
    using namespace std;
     
    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) {
        intA, 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];
      }
      
      return0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'intA' was not declared in this scope; did you mean 'int'?
   26 |         intA, B;
      |         ^~~~
      |         int
a.cc:26:15: error: 'B' was not declared in this scope
   26 |         intA, B;
      |               ^
a.cc:27:14: error: 'A' was not declared in this scope
   27 |         cin>>A>>B;
      |              ^
a.cc:38:7: error: 'return0' was not declared in this scope
   38 |       return0;
      |       ^~~~~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;

using ll=longlong;
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) {
    intA, 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];
  }
  
  return0;
}

Compiler output:
a.cc:17:10: error: 'longlong' does not name a type
   17 | using ll=longlong;
      |          ^~~~~~~~
a.cc:19:1: error: 'll' does not name a type
   19 | ll cnt[AMAX+1];
      | ^~
a.cc: In function 'int main()':
a.cc:23:3: error: 'll' was not declared in this scope
   23 |   ll K;
      |   ^~
a.cc:24:11: error: 'K' was not declared in this scope
   24 |   cin>>N>>K;
      |           ^
a.cc:26:5: error: 'intA' was not declared in this scope; did you mean 'int'?
   26 |     intA, B;
      |     ^~~~
      |     int
a.cc:26:11: error: 'B' was not declared in this scope
   26 |     intA, B;
      |           ^
a.cc:27:10: error: 'A' was not declared in this scope
   27 |     cin>>A>>B;
      |          ^
a.cc:28:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   28 |     cnt[A]+=B;
      |     ^~~
      |     int
a.cc:31:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   31 |     if(K<=cnt[ans]) {
      |           ^~~
      |           int
a.cc:35:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |     K-=cnt[ans];
      |        ^~~
      |        int
a.cc:38:3: error: 'return0' was not declared in this scope
   38 |   return0;
      |   ^~~~~~~
Language: C++

#include<iostream>
#define MAX 100010
using namespace std;

int main(){
    long long n,k;
    cin >> n >> k;
    long long c[MAX] = {0};
    for(int i = 0;i < n;i++){
        long long a,b;
        cin >> a >> b;
        c[a] += b;
    }

    for(int ans = 0;ans < MAX;i++){
        if(k <= c[ans]){
            cout << ans << endl;
            break;
        }
        k -= c[ans];
    }
    return 0;
}

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

#include<iostream>
#define MAX 100010
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    int c[MAX] = {0};
    for(int i = 0;i < n;i++){
        int a,b;
        cin >> a >> b;
        c[a] += b;
    }

    for(int ans = 0;ans < MAX;i++){
        if(k <= c[ans]){
            cout << ans << endl;
            break;
        }
        k -= c[ans];
    }
    return 0;
}

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

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

int main(){
    int n,k;
    cin >> n >> k;
    int c[MAX] = {0};
    for(int i = 0;i < n;i++){
        int a,b;
        cin >> a >> b;
        c[a] += b;
    }

    for(int ans = 0;ans < k;i++){
        if(k <= c[ans]){
            cout << ans << endl;
            break;
        }
        k -= c[ans];
    }
    return 0;
}

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

#include<iostream>
#define MAX 100010
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    int c[MAX] = {0};
    for(int i = 0;i < n;i++){
        int a,b;
        cin >> a >> b;
        c[a] += b;
    }

    for(int ans = 0;ans < k;i++){
        if(k <= c[ans]){
            cout << ans << endl;
            break;
        }
        k -= c[ans];
    }
    return 0;
}

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

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

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

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

    int count = 0;
    for(int i = 0;i < n;i++){
        k -= p[i].second;
        if(k <= 0){
            break;
        }
        count++;
    }

    cout << p[count].first << endl;
    return 0;
}

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

#include<stdio.h>
 
int main(){
   int n;
  long long int k;
  scanf("%d%lld",&n,&k);
 
  long long int num[100001] = {0};
  for(int i = 1; i < =n; i++){
    int a,b;
    scanf("%d%d",&a,&b);
    num[a] += b;
  }
  for(int i = 1; i <= 100000; ++i){
    k = k-num[i];
    if( k <= 0 ){
      printf("%d",i);
      return 0;
    }
  }
 
  return 0;
 
}

Compiler output:
main.c: In function 'main':
main.c:9:22: error: expected expression before '=' token
    9 |   for(int i = 1; i < =n; i++){
      |                      ^
main.c:11:19: error: 'a' undeclared (first use in this function)
   11 |     scanf("%d%d",&a,&b);
      |                   ^
main.c:11:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:22: error: 'b' undeclared (first use in this function)
   11 |     scanf("%d%d",&a,&b);
      |                      ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n, m, k, x, y = 0, z = 0, h, ans=0, w, sum = 0, Max = -1, Min = 1e9+1;
  string u= "";
  bool ok=true;
  cin >> n >> k;
  VI a(100001);
  rep(i,100001){
    cin >> x >> y; 
    a[x] += y;
  }
  rep2(i,1,100001)){
    if(k <= a[i]){
      pri(i); return 0;
    }
    k -= a[i];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:19: error: expected primary-expression before ')' token
   65 |   rep2(i,1,100001)){
      |                   ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n, m, k, x, y = 0, z = 0, h, ans=0, w, sum = 0, Max = -1, Min = 1e9+1;
  string u= "";
  bool ok=true;
  cin >> n >> k;
  VI a(n);
  rep(i,n){
    cin >> x >> y; 
    a[x] += y;
  }
  rep(i,1,n+1){
    if(k <= a[i]){
      pri(i); return 0;
    }
    k -= a[i];
  }
  return 0;
}


Compiler output:
a.cc:65:14: error: macro "rep" passed 3 arguments, but takes just 2
   65 |   rep(i,1,n+1){
      |              ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i, n) for (int i = 0; i < n; i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:65:3: error: 'rep' was not declared in this scope
   65 |   rep(i,1,n+1){
      |   ^~~
Language: C++

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , k;
    cin >> n >> k;
    long long arr[100001] = {};
    for (int i = 0 ; i < n ; i++){
        int num , qty;
        cin >> num >> qty;
        arr[num] += qty;
    }
    long long count = 0;
    for (int i = 1 ; i < 100001 ; i++ ){
       count += arr[i];
       if( count >= k ){
         cout << i;
         return 0;
       }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'ios' has not been declared
    2 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin.tie(0);
      |     ^~~
a.cc:16:10: error: 'cout' was not declared in this scope; did you mean 'count'?
   16 |          cout << i;
      |          ^~~~
      |          count
Language: C

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

long max(long a, long b){
  if(a > b) return a;
  else return b;
}

long min(long a, long b){
  if(a < b) return a;
  else return b;
}

int sort(const void *a, const void *b){
  return *(int*)a -*(int*)b;
}

int main(){

  int n,k;
  scanf("%d%d",&n,&k);

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

  int ans = 0;
  int index = 0;
  for(int i = 0; i < 100000; ++i){
    k = k-b[i];
    if( k <= 0 ){
      printf("%d",i);
      return 0;
    }
  }

  return 0;

}


Compiler output:
main.c:32:7: warning: built-in function 'index' declared as non-function [-Wbuiltin-declaration-mismatch]
   32 |   int index = 0;
      |       ^~~~~
main.c:33:3: error: expected identifier or '(' before 'for'
   33 |   for(int i = 0; i < 100000; ++i){
      |   ^~~
main.c:33:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   33 |   for(int i = 0; i < 100000; ++i){
      |                    ^
main.c:33:30: error: expected identifier or '(' before '++' token
   33 |   for(int i = 0; i < 100000; ++i){
      |                              ^~
main.c:41:3: error: expected identifier or '(' before 'return'
   41 |   return 0;
      |   ^~~~~~
main.c:43:1: error: expected identifier or '(' before '}' token
   43 | }
      | ^
Language: C

10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 10 500000
      | ^~
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(int)(n);i++);
using namespace std;
using ll = long long;
const ll INF = 100100100100100;

int main() {
	ll N, K;
	cin >> N >> K;//左から k個
	vector<ll> a(N);
	vector<ll> b(N);//ｂ個代入
	for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
	ll cnt = 0;
	ll ans = 0;
	while (K) {//Kからb[cnt]を引いていき、0を下回ったらストップ
		if (b[cnt] >= K) {
			ans = cnt;
			K = 0;
		}
		else {
			K -= b[cnt];
			cnt++;
		}
	}
	cout << a[ans] << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:42:32: error: expected '}' at end of input
   42 |         cout << a[ans] << endl;
      |                                ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1LL << 60;

//入力
ll cnt[100050];
int N,K;


int main(){
    cin >> N >> K;

    rep (i,N){
        int A,B;
        cin >> A >> B;
        cnt[A] += B;
    }

    for (int ans = 1; ans < 100050; i++){
        if (K <= cnt[ans]) {
            cout << ans << endl;
            break;
        }
        K -= cnt[ans];
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:37: error: 'i' was not declared in this scope
   37 |     for (int ans = 1; ans < 100050; i++){
      |                                     ^
Language: C++

#include <bits/stdc++.h>
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:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   cin >> N >> K;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:19:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |       cout << ans << endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:19:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |       cout << ans << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
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:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   cin >> N >> K;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:19:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |       cout << ans << endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:19:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |       cout << ans << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long x,long y){
    if(y==0)return x;

    return gcd(y,x%y);
}
long long lcm(long x,long y){
    return x*y/gcd(x,y);
}

long long ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

long long main()
{
    long long K,N,a,b;
    map<long long,long long> mp;
    cin>>N>>K;

    for(long long i=1;i<=N;i++){
        cin>>a>>b;

        mp[a]+=b;
    }

    long long sum=0;

    for(auto itr = mp.begin(); itr!=mp.end();itr++){

        sum+=itr->second;

        if(sum>=K){
            cout<<itr->first<<endl;
            return 0;
        }
    }

    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

int main(){
  vector<int> vec(100000,0);
  int N, K;
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    int a,b;
    cin >> a >> b;
    vec[a] += b;
  }
  
  for(int i = 0; true; i++){
    K -= vec[i];
    if(K <= 0){
      cout << i << endl;
     return 0;
    }
  }
  
}
    

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> vec(100000,0);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> vec(100000,0);
      |          ^~~
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> N >> K;
      |   ^~~
a.cc:11:5: error: 'vec' was not declared in this scope
   11 |     vec[a] += b;
      |     ^~~
a.cc:15:10: error: 'vec' was not declared in this scope
   15 |     K -= vec[i];
      |          ^~~
a.cc:17:7: error: 'cout' was not declared in this scope
   17 |       cout << i << endl;
      |       ^~~~
a.cc:17:20: error: 'endl' was not declared in this scope
   17 |       cout << i << endl;
      |                    ^~~~
Language: C++

#include<iostream>
#include<numeric>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define chmin(a,b) (a>(b)?a=(b),1:0)
#define abs(n) max((n),-(n))
#define dist(a,b) max((a)-(b),(b)-(a))
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000000
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  // ここでストリームに obj を書き込みます。
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}


int main(){
  int n; li k; cin >>n >>k;
  vector<pair<int,int>> v;
  rep(i,n){
    int a,b; cin >>a >>b;
    v.push_back({a,b});f
  }
  sort(v.begin(),v.end());
  li t=0,i=0;
  while(t<k){
    t+=v[i++].second;
  }
  print(v[i-1].first);
}





Compiler output:
a.cc: In function 'int main()':
a.cc:38:24: error: 'f' was not declared in this scope
   38 |     v.push_back({a,b});f
      |                        ^
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
using namespace std;
#define MAX 100000


int solve(int N,int K, int a[],int b[])
{

	vector<pair<int, int>> ab;
	for (int i = 0; i < N; ++i)
	{
		pair<int, int> temp;
		temp.first = a[i];
		temp.second = b[i];
		ab.push_back(temp);
	}
	sort(ab.begin(), ab.end());
	int ans = (ab.end() - 1)->first;
	unsigned long long sum = 0;
	for (auto itr = ab.begin(); itr != ab.end(); ++itr)
	{
		
		sum += unsigned long long(itr->second);
		if (sum >= K)
		{
			ans = itr->first;
			break;
		}
	}



	return ans;
}

int main(int argc, char* argv[]) {

	int N, K;
	cin >> N >> K;
	static int a[MAX], b[MAX];
	for (int i = 0; i < N; ++i) {
		cin >> a[i] >> b[i];
	}
	cout<<solve(N, K, a, b);

	return 0;
}


Compiler output:
a.cc: In function 'int solve(int, int, int*, int*)':
a.cc:26:24: error: expected primary-expression before 'unsigned'
   26 |                 sum += unsigned long long(itr->second);
      |                        ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k;cin>>n>>k;
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<>>que;
  while(n--){
    ll a,b;cin>>a>>b;
    que.push(mp(a,b));
  }
  while(true){
    ll num = que.front().F;
    ll cnt = que.front().S;
    que.pop();
    if(cnt < k){
      k-=cnt;
    }else{
      cout<<num<<endl;return 0;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<void> >' has no member named 'front'
   28 |     ll num = que.front().F;
      |                  ^~~~~
a.cc:29:18: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<void> >' has no member named 'front'
   29 |     ll cnt = que.front().S;
      |                  ^~~~~
Language: C++


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

int main() {
  int n;
  long long k;
  cin >> n >> k;
  vector<pair<int, int>> ans(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    ans.at(i).first = a;
    ans.at(i).second = b;
  }
  sort(ans.begin(), ans.end());
   long long k = 0;
  for (int i = 0; i < n; i++) {
    tmp += ans.at(i).second;
    if (tmp >= k) {
      cout << ans.at(i).first;
      return 0;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: redeclaration of 'long long int k'
   17 |    long long k = 0;
      |              ^
a.cc:7:13: note: 'long long int k' previously declared here
    7 |   long long k;
      |             ^
a.cc:19:5: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   19 |     tmp += ans.at(i).second;
      |     ^~~
      |     tm
Language: C++

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

vector <pair<int, int> > vec;

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	for(int i = 0; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		vec.push_back(make_pair(a, b));
	}
	sort(vec.begin(), vec.end());
	for(int i = 0; i < n; i++) {
		k -= a[i].second;
		if(k <= 0) {
			printf("%d\n", a[i].first);
			return 0;
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'a' was not declared in this scope
   16 |                 k -= a[i].second;
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,k;
  cin >> n >> k;
  vector<P> p(n);
  rep(i,n){
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(),p.end());
  ll cnt=0;
  ll ans;
  while(cnt<k){
    cnt +=p[i].second;
    ans=p[i].first;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: 'i' was not declared in this scope
   26 |     cnt +=p[i].second;
      |             ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
//#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEsL 2e9
#define PIE 3.1415a926535

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}
#define int ll
int main() {
  #define int ll
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> v;
    int a, b;
    rep(i,n) {
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(all(v));
    //rep(i, n) cout << v[i].first << endl;
    ll sum = 0;
    int res;
    rep(i,n) {
        sum += v[i].second;
        if (sum>=k) {
            res = v[i].first;
            break;
        }
        else
        {
            
        }
        
    }
    cout << res << endl;
}

Compiler output:
a.cc:33:13: error: '::main' must return 'int'
   33 | #define int ll
      |             ^~
a.cc:34:1: note: in expansion of macro 'int'
   34 | int main() {
      | ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
//#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEsL 2e9
#define PIE 3.1415a926535

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}
#define int ll
int main() {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> v;
    int a, b;
    rep(i,n) {
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(all(v));
    //rep(i, n) cout << v[i].first << endl;
    ll sum = 0;
    int res;
    rep(i,n) {
        sum += v[i].second;
        if (sum>=k) {
            res = v[i].first;
            break;
        }
        else
        {
            
        }
        
    }
    cout << res << endl;
}

Compiler output:
a.cc:33:13: error: '::main' must return 'int'
   33 | #define int ll
      |             ^~
a.cc:34:1: note: in expansion of macro 'int'
   34 | int main() {
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  int64_t K;
  cin>>N>>K;
  map<int,int64_t>M;
  for(int i=0;i<N;i++){
  int a,
    int64_t b;
    if(M.count(a))
      M.at(a)+=b;
    else
      M[a]=b;
  }int ans;
  int64_t sum=0;
  for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    sum+=v;
    if(K<=sum){
    ans=k; break;
    }
  }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: expected initializer before 'b'
   10 |     int64_t b;
      |             ^
a.cc:12:16: error: 'b' was not declared in this scope
   12 |       M.at(a)+=b;
      |                ^
a.cc:14:12: error: 'b' was not declared in this scope
   14 |       M[a]=b;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  vector<pair<int,int>>M;
  for(int i=0;i<N;i++){
  int a,b;
    cin>>a>>b;
   pair<int,int>c=(b,a);
    M.push_back(c);
  }int ans;
  int sum=0;
  for(int i=0; ;i++){
  sum+=M.at(i).first;
    if(K<=sum){
    ans=M.at(i).second; break;
    }
  }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: conversion from 'int' to non-scalar type 'std::pair<int, int>' requested
   10 |    pair<int,int>c=(b,a);
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  vector<pair<int,int>>M={};
  for(int i=0;i<N;i++){
  int a,b;
    cin>>a>>b;
   c=make_pair(b,a);
    M.push_back(c);
  }int ans;
  int sum=0;
  for(int i=0; ;i++){
  sum+=M.at(i).first;
    if(K<=sum){
    ans=M.at(i).second; break;
    }
  }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: 'c' was not declared in this scope
   10 |    c=make_pair(b,a);
      |    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  vector<pair<int,int>>M={};
  for(int i=0;i<N;i++){
  int a,b;
    cin>>a>>b;
   c=make_pair(b,a);
    M.push_back(c);
  }int ans;
  int sum=0;
  for(int i=0; ;i++){
  sum+=A.at(i).first;
    if(K<=sum){
    ans=A.at(i).second; break;
    }
  }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: 'c' was not declared in this scope
   10 |    c=make_pair(b,a);
      |    ^
a.cc:15:8: error: 'A' was not declared in this scope
   15 |   sum+=A.at(i).first;
      |        ^
Language: C++

#include<bits/stdc++h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  map<int,int>M;
  for(int i=0;i<N;i++){
  int a,b;
    cin>>a>>b;
   if(M.count(a))
     M.at(a)+=b;
    else
      M[a]=b;
  }int ans;
  int sum=0;
  for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    sum+=v;
    if(K<=sum){
    ans=k; break;
    }
  }cout<<ans<<endl;
   return 0;
}

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

#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

using P = pair<ll, ll>;
int main() {
    ll N, K;
    cin >> N >> K;
    vector<P> p(N);
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        p[i] = P(a, b);
    }
    sort(ALL(P));
    ll now
        = 0;
    for (int i = 0; i < N; i++) {
        if (now < K && K <= now + p[i].second) {
            cout << p[i].first << endl;
            return 0;
        } else {
            now += p[i].second;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:27: error: expected primary-expression before ')' token
    2 | #define ALL(obj) begin(obj), end(obj)
      |                           ^
a.cc:45:10: note: in expansion of macro 'ALL'
   45 |     sort(ALL(P));
      |          ^~~
a.cc:2:37: error: expected primary-expression before ')' token
    2 | #define ALL(obj) begin(obj), end(obj)
      |                                     ^
a.cc:45:10: note: in expansion of macro 'ALL'
   45 |     sort(ALL(P));
      |          ^~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); 
        int k = sc.nextInt();
        int count = 0;
        int ans = 0;
		int [] in = new int [100000];
        int a,b;      
        for(int i=0;i<n;i++){a = sc.nextInt();
                             b = sc.nextInt();
                             in[a-1]+=b;                           
                            }       		
        for(int i=0;i<a;i++){count+=in[i];
                             if(count>=k){ans=i;break;}
                            }                                                      
		System.out.println(ans);
	}
}


Compiler output:
Main.java:15: error: variable a might not have been initialized
        for(int i=0;i<a;i++){count+=in[i];
                      ^
1 error
Language: C

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); 
        int k = sc.nextInt();
        int count = 0;
        int ans = 0;
		int [] in = new int [100000];
        int a,b;      
        for(int i=0;i<n;i++){a = sc.nextInt();
                             b = sc.nextInt();
                             in[a-1]+=b;                           
                            }       		
        for(int i=0;i<a;i++){count+=in[i];
                             if(count>=k){ans=i;break;}
                            }                                                      
		System.out.println(ans);
	}
}


Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.*;
      |            ^
main.c:2:1: error: unknown type name 'public'
    2 | public class Main {
      | ^~~~~~
main.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    2 | public class Main {
      |              ^~~~
Language: C++

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl


int list[100010];
int main(){
    ll n,k;
    cin >> n >> k;
    int a,b;
    ll ans = 0;
    REP(i,n){
        cin >> a >> b;
        list[a]+=b;
    }
    REP(i,100010){
        ans += list[i];
        if(ans>=k){
            COUT(i);
            break;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: reference to 'list' is ambiguous
   24 |         list[a]+=b;
      |         ^~~~
In file included from /usr/include/c++/14/list:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:16:5: note:                 'int list [100010]'
   16 | int list[100010];
      |     ^~~~
a.cc:27:16: error: reference to 'list' is ambiguous
   27 |         ans += list[i];
      |                ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:16:5: note:                 'int list [100010]'
   16 | int list[100010];
      |     ^~~~
Language: C++

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

int main() {
    int N; long long K;
    cin >> N >> K;
    vector<pair<long long, long long> > v(N);
    for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;

    // ソート
    sort(v.begin(), v.end());
    
    // a_i が小さい順に b_i を合計して K 以上になる瞬間をとらえる
    long long res = 0;
    long long sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += v[i].second;
        if (sum >= K) {
            res = v[i].first; // sum >= K になった瞬間の a_i
            break;
        }
    }
    cout << res

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define int long long
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    ll N, K;
    cin >> N >> K;
    map<int, int>mp;
    vector<int>As(N);

    for(int i=0; i<N; i++){
        int ai, bi;
        cin >> ai >> bi;
        As.at(i) = ai;
        mp[ai] = bi;

    }
    sort(As.begin(), As.end());

    vector<ll>cumsum(N+1);
    ll cs = 0;
    cumsum[0] = 0;
    for(int i=0; i<N+1; i++){
        if (i-1 >= 0)cumsum.at(i) = cs + mp[As.at(i-1)];
        cs = cumsum.at(i);
    }

    for (int i=0; i<N+1; i++){
        if (cumsum.at(i) >= K){
            cout << As[i-1] << endl;
            return 0;
        }
    }

    cout << K << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define int long long
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int N, K;
    cin >> N >> K;
    map<int, int>mp;
    vector<int>As(N);

    for(int i=0; i<N; i++){
        int ai, bi;
        cin >> ai >> bi;
        As.at(i) = ai;
        mp[ai] = bi;

    }
    sort(As.begin(), As.end());

    vector<int>cumsum(N+1);
    int cs = 0;
    cumsum[0] = 0;
    for(int i=0; i<N+1; i++){
        if (i-1 >= 0)cumsum.at(i) = cs + mp[As.at(i-1)];
        cs = cumsum.at(i);
    }

    for (int i=0; i<N+1; i++){
        if (cumsum.at(i) >= K){
            cout << As[i-1] << endl;
            return 0;
        }
    }

    cout << K << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

int pow(int a,int n) {
    int ans = 1;
    rep(i,n) ans *= a;
    return ans;
}

int main() {
    ll N,K;
    cin >> N >> K;
    vector<pair<ll,ll>> res;
    rep(i,N) {
        ll a,b; cin >> a >> b;
        res.push_back(make_pair(a,b));
    }
    sort(res.begin(),res.end());
    int sum = 0;
    ll ans;
    int i = 0;
    while(i < N &&å sum > K) {
        sum += res.at(i).second;
        i++;
    }
    ans = res.at(i-1).first;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: '\U000000e5' was not declared in this scope
   25 |     while(i < N &&å sum > K) {
      |                   ^
a.cc:25:20: error: expected ')' before 'sum'
   25 |     while(i < N &&å sum > K) {
      |          ~         ^~~~
      |                    )
a.cc:25:28: error: expected ';' before ')' token
   25 |     while(i < N &&å sum > K) {
      |                            ^
      |                            ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int n,k; cin>>n>>k;
	int ans, cnt=0;
	rep(i,n){
		int a,b; cin>>a>>b;
		cnt+=b;
		if(cnt>k){
			ans=a; cout<<a<<endl;
			return;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   42 |                         return;
      |                         ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,k; cin >> n >> k;
    map<long long,long long> mp;
    for(long long i=0;i<n;++i){
        long long a,b; cin >> a >> b;
        mp[a] += b;
    }
    long long sum=0;
    for(auto itr : mp){
        sum += mp.second;
        if(sum >= k) cout << mp.first << endl; break;
    }
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'class std::map<long long int, long long int>' has no member named 'second'
   12 |         sum += mp.second;
      |                   ^~~~~~
a.cc:13:33: error: 'class std::map<long long int, long long int>' has no member named 'first'
   13 |         if(sum >= k) cout << mp.first << endl; break;
      |                                 ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using long long ll;
int main(){
    ll n,k; cin >> n >> k;
    ll sum = 0;
    bool flag = true;
    for(ll i=0;i<n;i++){
        ll a,b;
        cin >> a >> b;
        sum += b;
        if(sum >= k && flag == true){
            cout << a << endl;
            flag = false;
        }
    }
    return 0;
    
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'long'
    3 | using long long ll;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll n,k; cin >> n >> k;
      |     ^~
a.cc:5:20: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |     ll n,k; cin >> n >> k;
      |                    ^
      |                    yn
a.cc:5:25: error: 'k' was not declared in this scope
    5 |     ll n,k; cin >> n >> k;
      |                         ^
a.cc:6:7: error: expected ';' before 'sum'
    6 |     ll sum = 0;
      |       ^~~~
      |       ;
a.cc:8:11: error: expected ';' before 'i'
    8 |     for(ll i=0;i<n;i++){
      |           ^~
      |           ;
a.cc:8:16: error: 'i' was not declared in this scope
    8 |     for(ll i=0;i<n;i++){
      |                ^
a.cc:9:11: error: expected ';' before 'a'
    9 |         ll a,b;
      |           ^~
      |           ;
a.cc:10:16: error: 'a' was not declared in this scope
   10 |         cin >> a >> b;
      |                ^
a.cc:10:21: error: 'b' was not declared in this scope
   10 |         cin >> a >> b;
      |                     ^
a.cc:11:9: error: 'sum' was not declared in this scope
   11 |         sum += b;
      |         ^~~
Language: C++

#include<iostream>

using namespace std;

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

int main(){
    int n, k;
    cin >> n >> k;
    pair<int, int> p[n];
    rep(i, n) cin >> p[i].first >> p[i].second;
    sort(p, p + n);
    int ans;
    int sm = 0;
    for (int i = 0; sm < k; i++){
        ans = p[i].first;
        sm += p[i].second;
    }
    cout << ans << endl;

}

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

#include <bits/stdc++.h>
using namespace std;
signed main(){
    long long n , k , a , b , array[100005]={} , c=0;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        array[a]+=b;
    }
    
    int i=1;
    while(true){
        c+=array[i];
        if(c>=k){
            break;
        } else {
            i++;
        }    
    }
    c

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

#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

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


int main(){
    int n
    ll k;
    cin >> n >> k;
    vector<P> e;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        e.emplace_back(a, b);
    };

    sort(all(e));

    rep(i, n) {
        if (k > e[i].second) {
            k -= e[i].second;
        } else {
            cout << e[i].first << endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected initializer before 'll'
   12 |     ll k;
      |     ^~
a.cc:13:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   13 |     cin >> n >> k;
      |            ^
      |            yn
a.cc:13:17: error: 'k' was not declared in this scope
   13 |     cin >> n >> k;
      |                 ^