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

#include<iostream>
using namespace std;
int main(void)
{
	int N = 0, K = 0, i = 0, count = 0, I = 0, ans = 0;
	int a[100000], b[100000];

	cin >> N >> K;
	int min = 100000;

	for (i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}
	do {
		I = 0;
		min = 100000;
		for (i = 0; i < N; i++) {
			if (min> a[i]) {
				min = a[i];
					I = i;
			}
			count += b[I];
			ans = a[I];
			a[I] = 1000000;
	
	} while (K>count);
	cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:2: error: expected 'while' at end of input
   29 | }
      |  ^
a.cc:29:2: error: expected '(' at end of input
   29 | }
      |  ^
      |  (
a.cc:29:2: error: expected primary-expression at end of input
a.cc:29:2: error: expected ')' at end of input
   29 | }
      |  ^
      |  )
a.cc:29:2: error: expected ';' at end of input
   29 | }
      |  ^
      |  ;
a.cc:29:2: error: expected '}' at end of input
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: Java

public class Main {
	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		 long K = sc.nextLong();
		for (int i = 0; i < N; i++) {
			int res = sc.nextInt();
			long count = sc.nextLong();
			K -= count;
			if (K <= 0) {
				System.out.println(res);
				break;
			}
		}

	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

struct AB{
    int a;
    int b;
};
bool operator<(const AB& left, const AB& right) {
    return left.a < right.a;
}


int main(){
    int N
    long K;
    cin >> N >> K;
    AB ab[N];
    for (int i = 0; i < N; i++) {
        cin >> ab[i].a >> ab[i].b;
    }
    sort(ab, ab + N);

    long sum = 0;
    for (int i = 0; i < N; i++) {
        sum += ab[i].b;
        if (sum >= K) {
            cout << ab[i].a << endl;
            return 0;
        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: expected initializer before 'long'
   16 |     long K;
      |     ^~~~
a.cc:17:12: error: 'N' was not declared in this scope
   17 |     cin >> N >> K;
      |            ^
a.cc:17:17: error: 'K' was not declared in this scope
   17 |     cin >> N >> K;
      |                 ^
a.cc:20:16: error: 'ab' was not declared in this scope; did you mean 'abs'?
   20 |         cin >> ab[i].a >> ab[i].b;
      |                ^~
      |                abs
a.cc:22:10: error: 'ab' was not declared in this scope; did you mean 'abs'?
   22 |     sort(ab, ab + N);
      |          ^~
      |          abs
Language: C++

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

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

Compiler output:
a.cc:6:1: error: expected initializer before 'int'
    6 | int main() {
      | ^~~
Language: C++

#include<cstdio>
const int MAX = 100000;

int main() {
	int N;
	int64_t K;
	scanf("%d %ld\n", &N, &K);

	int64_t num[MAX+1];

	for (int i = 0; i < N; i++) {
		int a, b;
		scanf("%d %d", &a, &b);

		num[a] += b;
	}

	int64_t mid_sum = 0;
	int i = 1;
	while (true) {
		mid_sum += num[i];
		if (mid_sum >= K) {
			printf("%d\n", i);
			break;
		}
	}
}
		


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'int64_t' was not declared in this scope
    6 |         int64_t K;
      |         ^~~~~~~
a.cc:2:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    1 | #include<cstdio>
  +++ |+#include <cstdint>
    2 | const int MAX = 100000;
a.cc:7:32: error: 'K' was not declared in this scope
    7 |         scanf("%d %ld\n", &N, &K);
      |                                ^
a.cc:9:16: error: expected ';' before 'num'
    9 |         int64_t num[MAX+1];
      |                ^~~~
      |                ;
a.cc:15:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   15 |                 num[a] += b;
      |                 ^~~
      |                 enum
a.cc:18:16: error: expected ';' before 'mid_sum'
   18 |         int64_t mid_sum = 0;
      |                ^~~~~~~~
      |                ;
a.cc:21:17: error: 'mid_sum' was not declared in this scope
   21 |                 mid_sum += num[i];
      |                 ^~~~~~~
a.cc:21:28: error: 'num' was not declared in this scope; did you mean 'enum'?
   21 |                 mid_sum += num[i];
      |                            ^~~
      |                            enum
Language: C++

#include <cstdio>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)


int main(){
	int N,a,b;
	longlong K;
	longlong num[100011] = {0};

	scanf("%d",&N);
	scanf("%lld",&K);

	while(N--){
		scanf("%d",&a);
		scanf("%d",&b);
		num[a] += b;
	}

	REP(N+1){
		K -= num[i];
		if(K<=0){
			printf("%d\n",i);
			return 0;
		}

	}
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'longlong' was not declared in this scope
   17 |         longlong K;
      |         ^~~~~~~~
a.cc:18:17: error: expected ';' before 'num'
   18 |         longlong num[100011] = {0};
      |                 ^~~~
      |                 ;
a.cc:21:23: error: 'K' was not declared in this scope
   21 |         scanf("%lld",&K);
      |                       ^
a.cc:26:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   26 |                 num[a] += b;
      |                 ^~~
      |                 enum
a.cc:30:22: error: 'num' was not declared in this scope; did you mean 'enum'?
   30 |                 K -= num[i];
      |                      ^~~
      |                      enum
Language: C

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

long long v[100000];

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

	for(int i = 0;i < 100000;i++){
		if(v[i] >= k){
			cout << i + 1 << endl;
			return 0;
		}
		k -= v[i];
	}
	return 0;
}


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

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

long long v[100000];

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

	for(int i = 0;i < 100000;i++){
		if(v[i] >= k){
			cout << i + 1 << endl;
			return 0;
		}
		k -= v[i];
	}
	return 0;
}


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

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

int main(){
  long long N,K,key=0;
  cin>>N>>K;
  vector<pair<int,int> >v(n);
  for(int i=0;i<N;i++){
    cin>>v[i].first>>v[i].second;
  }
  sort(v.begin(),v.end());
  for(int i=0;i<N;i++){
    key+=v[i].second;
    if(key>=K){
      cout<<v[i].first<<endl;
      break;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:27: error: 'n' was not declared in this scope
    7 |   vector<pair<int,int> >v(n);
      |                           ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int mainc() {
    int N, K; cin >> N >> K;
    vector<int> backet(N+1, 0);
    int a, b, i;
    for (i=0; i<N; i++) {
        cin >> a >> b;
        backet[b] += a;
    }
    for (i=1; K>0; i++) {
        K -= backet[i];
    }
    cout << i << endl;
}

Compiler output:
a.cc: In function 'int mainc()':
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
using namespace std;
using ll = long long;
const int AMAX = 100000;
ll cnt[AMAZ + 1];

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

    for(int i = 0; i < N; ++i){
        int 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:5:8: error: 'AMAZ' was not declared in this scope; did you mean 'AMAX'?
    5 | ll cnt[AMAZ + 1];
      |        ^~~~
      |        AMAX
a.cc: In function 'int main()':
a.cc:14:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   14 |         cnt[A] += B;
      |         ^~~
      |         int
a.cc:18:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   18 |         if(K <= cnt[ans]) {
      |                 ^~~
      |                 int
a.cc:22:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   22 |         K -= cnt[ans];
      |              ^~~
      |              int
Language: Java

//package com.zhangyong.algorithm;

import java.io.*;
import java.util.StringTokenizer;

public class Solution {

    FastScanner in;
    PrintWriter out;

    class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        private FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        private FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

    }

    static final int count = 100000;

    private void solve() {
        int n = in.nextInt();
        long m = in.nextLong();
        long arr[] = new long[count + 1];
        int l;
        long r;
        for (int i = 0; i < n; i++) {
            l = in.nextInt();
            r = in.nextLong();
            arr[l] += r;
        }
        for (int i = 0; i <= count; i++) {
            if ((m -= arr[i]) <= 0) {
                out.print(i);
                break;
            }
        }
    }

    private void run() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) {
        new Solution().run();
    }
}


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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#define int long long
using namespace std;
 
map<int, int>a;
signed main() {
	int b; cin >> b;
	int T; cin >> T;
	for (int c = 0; c < b; c++) {
		int d, e; cin >> d >> e;
		a[d] += e;
	}
	int sum = 0;
	for (auto i : a) {
		sum += i.second;
		if (sum >= T) {
			cout << i.first << endl;
			break;
		}
	}
}

Compiler output:
a.cc:9:1: error: extended character   is not valid in an identifier
    9 |  
      | ^
a.cc:9:1: error: '\U000000a0' does not name a type
    9 |  
      | ^
a.cc: In function 'int main()':
a.cc:16:17: error: 'a' was not declared in this scope
   16 |                 a[d] += e;
      |                 ^
a.cc:19:23: error: 'a' was not declared in this scope
   19 |         for (auto i : a) {
      |                       ^
Language: C

#include<stdio.h>
long long k, j, b[100001] { 0};

int main(void){
	int i;
	int a, b;
	int r;

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

	while(n--){
		scanf("%d", &a);
		scanf("%d", &b);
		r[a] += b;
	}

	j = 0;
	for(i = 1; i < 100001; i++){
		j += r[i];
		if(j >= k){
			printf("%d\n", i );
			break;
		}
	}
	printf("\n");
}


Compiler output:
main.c:2:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    2 | long long k, j, b[100001] { 0};
      |                           ^
main.c: In function 'main':
main.c:9:27: error: 'n' undeclared (first use in this function)
    9 |         scanf("%d %lld", &n, &k);
      |                           ^
main.c:9:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:18: error: subscripted value is neither array nor pointer nor vector
   14 |                 r[a] += b;
      |                  ^
main.c:19:23: error: subscripted value is neither array nor pointer nor vector
   19 |                 j += r[i];
      |                       ^
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:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> N >> K;
      |         ^~~
a.cc:18:24: error: expected primary-expression before '=' token
   18 |                 if(K <== cnt[ans]){
      |                        ^
a.cc:19:25: error: 'cout' was not declared in this scope
   19 |                         cout << ans << endl;
      |                         ^~~~
a.cc:19:40: error: 'endl' was not declared in this scope
   19 |                         cout << ans << endl;
      |                                        ^~~~
Language: C++

#define ll long long
#define rep(i,n) for (int i=0;i<(n);i++)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<map>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	ll k;
	cin >> n >> k;
	int a,b;
	map<int, int> mp;
	rep(i,n){
		cin >> a >> b;
		mp[a] = b;
	}

	rep(i,n){
			k -= mp[a[i]];
			if(k <=  0){
				cout << int(a[i]) << endl;
				break;
			}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:34: error: invalid types 'int[int]' for array subscript
   26 |                         k -= mp[a[i]];
      |                                  ^
a.cc:28:46: error: invalid types 'int[int]' for array subscript
   28 |                                 cout << int(a[i]) << endl;
      |                                              ^
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

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

	struct comp {
		int val;
		int num;

	    bool operator<(const comp& another) const {
	        return val < another.val;
	    }
	};

	vector<comp> c;

	FOR(i,0,N){
		comp cc;
		cin >> cc.val >> cc.num;
		c.push_back(cc);
	}
	sort(c.begin(),c.end());

	long long int css = 0;
	int ret = 0;
	for(comp co : c){
		css += co.num;
		ret = co.val;
		if (css >= K) break;
		cout << co.val << " " << co.num << endl;
	}

	cout << ret << endl;
	return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define N 100000
int main() {
	int n;
	long long int k;
	cin>>n>>k;
	long long int hoge[N]={};
	int a,b;
	for(int i=0;i<n;i++){
		
		cin>>a>>b;
		hoge[a-1]+=b;
	}
 	for(int i=0;i<N;i++){
 		k=k-a[i]
 		if(k<=0){
 			cout<<i+1<<endl;
 			break;
 		}
 	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: invalid types 'int[int]' for array subscript
   16 |                 k=k-a[i]
      |                      ^
Language: C++

using namespace std;
 
int main() {
	long long int n;
	int k;
	cin>>n>>k;
	vector<long long int> hoge;
	long long int a[n];
	long long int b[n];
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		for(int j=0;j<b[i];j++){
			hoge.push_back(a[i]);
		}
	}
 	sort(hoge.begin(),hoge.end());
  	cout<<hoge[k-1]<<endl;
 	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin>>n>>k;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<long long int> hoge;
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:7:16: error: expected primary-expression before 'long'
    7 |         vector<long long int> hoge;
      |                ^~~~
a.cc:13:25: error: 'hoge' was not declared in this scope
   13 |                         hoge.push_back(a[i]);
      |                         ^~~~
a.cc:16:14: error: 'hoge' was not declared in this scope
   16 |         sort(hoge.begin(),hoge.end());
      |              ^~~~
a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |         sort(hoge.begin(),hoge.end());
      |         ^~~~
      |         short
a.cc:17:9: error: 'cout' was not declared in this scope
   17 |         cout<<hoge[k-1]<<endl;
      |         ^~~~
a.cc:17:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:26: error: 'endl' was not declared in this scope
   17 |         cout<<hoge[k-1]<<endl;
      |                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

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

using namespace std;
typedef long long ll;
int N, K;
typedef pair <int,int> P;
vector<P> array;

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

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

  sort(array.begin(), array.end());
  
  ll sum = 0;
  int i = 0;
  for(; i < N; i++) {
    sum += array[i].second;
    if(K <= sum) break;
  }

  cout << array[i].first <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: reference to 'array' is ambiguous
   18 |     array.push_back(P(a,b));
      |     ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:10:11: note:                 'std::vector<std::pair<int, int> > array'
   10 | vector<P> array;
      |           ^~~~~
a.cc:21:8: error: reference to 'array' is ambiguous
   21 |   sort(array.begin(), array.end());
      |        ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:10:11: note:                 'std::vector<std::pair<int, int> > array'
   10 | vector<P> array;
      |           ^~~~~
a.cc:21:23: error: reference to 'array' is ambiguous
   21 |   sort(array.begin(), array.end());
      |                       ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:10:11: note:                 'std::vector<std::pair<int, int> > array'
   10 | vector<P> array;
      |           ^~~~~
a.cc:26:12: error: reference to 'array' is ambiguous
   26 |     sum += array[i].second;
      |            ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:10:11: note:                 'std::vector<std::pair<int, int> > array'
   10 | vector<P> array;
      |           ^~~~~
a.cc:30:11: error: reference to 'array' is ambiguous
   30 |   cout << array[i].first <<endl;
      |           ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:10:11: note:                 'std::vector<std::pair<int, int> > array'
   10 | vector<P> array;
      |           ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <pair>
using namespace std;
int main(void){
	int n,k;scanf("%d%d",&n,&k);
	vector <pair<int,int> > v;
	for(int i=0; i<n; i++){
		int a,b;scanf("%d%d",&a,&b);
		v.push_back(make_pair(a,b));
	}
	sort(v.begin(), v.end());
	int index=0;
	whlie(true){
		k-=v[index].second;
		if(k<0){
			cout << v[index].first;
		}else{
			index++;
		}
	}
	return 0;
}

Compiler output:
a.cc:5:10: fatal error: pair: No such file or directory
    5 | #include <pair>
      |          ^~~~~~
compilation terminated.
Language: C++

// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<queue>
typedef long long  i64;
using namespace std;


int main() {
	int n;
	i64 k;
	vector<pair<i64, i64>> vec;
	scanf("%d%lld", &n, &k);
	for (int i = 0; i < n; ++i) {
		i64 a, b;
		scanf("%lld%lld", &a, &b);
		vec.push_back({ a,b });
	}
	sort(vec.begin(), vec.end());
	i64 cnt = 0;
	for (int i = 0; i < n; ++i) {
		if (cnt + vec[i].second >= k) {
			printf("%lld", vec[i].first);
			return 0;
		}
		else {
			cnt += vec[i].second;
		}
	}
	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

using namespace std;

using elem_t = pair<int_least32_t, int_least32_t>;

int main()
{
	int_least32_t n;
	int_least64_t k;
	cin >> n >> k;

	vector<elem_t> v( n );
	for(auto& x : v) {
		cin >> x.first >> x.second;
	}

	sort(v.begin(), v.end(), [](elem_t x, elem_t y){ return x.first < y.first; } );

	int_least32_t　result;
	int_least64_t count = 0;
	for(auto i = 0; count < k; ++i) {
		result = v[i].first;
		count += v[i].second;
	}

	cout << result << endl;
}


Compiler output:
a.cc:24:9: error: extended character 　 is not valid in an identifier
   24 |         int_least32_t　result;
      |         ^
a.cc: In function 'int main()':
a.cc:24:9: error: 'int_least32_t\U00003000result' was not declared in this scope
   24 |         int_least32_t　result;
      |         ^~~~~~~~~~~~~~~~~~~~~
a.cc:27:17: error: 'result' was not declared in this scope
   27 |                 result = v[i].first;
      |                 ^~~~~~
a.cc:31:17: error: 'result' was not declared in this scope
   31 |         cout << result << endl;
      |                 ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
struct St {
    int a;
    int b;
 
    bool operator<( const St& right ) const {
        return a == right.a ? a < right.a : a < right.a;
    }
};
 
int main()
{
    int N；
    long long int K;
    cin >> N >> K;
 
    vector<St> st(N);
    for( int i = 0; i < N; ++i ){
        cin >> st[i].a >> st[i].b;
    }
 
    sort(st.begin(), st.end());
 
    for( int i = 0; i < N; ++i ){
        cnt += st[i].b;
        if( K <= cnt ){
            cout << st[i].a << endl;
            break;
        }
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: expected initializer before 'long'
   19 |     long long int K;
      |     ^~~~
a.cc:20:12: error: 'N' was not declared in this scope
   20 |     cin >> N >> K;
      |            ^
a.cc:20:17: error: 'K' was not declared in this scope
   20 |     cin >> N >> K;
      |                 ^
a.cc:30:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   30 |         cnt += st[i].b;
      |         ^~~
      |         int
Language: Java

import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		long long int D = 0;
		long long int N = sc.nextInt();
		long long int K = sc.nextInt();
		
		int c[] = new int[100000];
		

		for(long long int i = 0; i<N; i++){
			long long int a = sc.nextInt();
			long long int b = sc.nextInt();
			
			c[a-1] = c[a-1] + b;			
		}
		

		long long int j = 0;
		
		while(K>0){
			D = j + 1;
			K = K - c[j];
			j++;
		}
		
		System.out.println(D);
	}
}


Compiler output:
Main.java:7: error: not a statement
		long long int D = 0;
		^
Main.java:7: error: ';' expected
		long long int D = 0;
		    ^
Main.java:7: error: not a statement
		long long int D = 0;
		     ^
Main.java:7: error: ';' expected
		long long int D = 0;
		         ^
Main.java:8: error: not a statement
		long long int N = sc.nextInt();
		^
Main.java:8: error: ';' expected
		long long int N = sc.nextInt();
		    ^
Main.java:8: error: not a statement
		long long int N = sc.nextInt();
		     ^
Main.java:8: error: ';' expected
		long long int N = sc.nextInt();
		         ^
Main.java:9: error: not a statement
		long long int K = sc.nextInt();
		^
Main.java:9: error: ';' expected
		long long int K = sc.nextInt();
		    ^
Main.java:9: error: not a statement
		long long int K = sc.nextInt();
		     ^
Main.java:9: error: ';' expected
		long long int K = sc.nextInt();
		         ^
Main.java:14: error: not a statement
		for(long long int i = 0; i<N; i++){
		    ^
Main.java:14: error: ';' expected
		for(long long int i = 0; i<N; i++){
		        ^
Main.java:14: error: '.class' expected
		for(long long int i = 0; i<N; i++){
		              ^
Main.java:14: error: '.class' expected
		for(long long int i = 0; i<N; i++){
		                  ^
Main.java:14: error: > or ',' expected
		for(long long int i = 0; i<N; i++){
		                            ^
Main.java:14: error: not a statement
		for(long long int i = 0; i<N; i++){
		                          ^
Main.java:14: error: ';' expected
		for(long long int i = 0; i<N; i++){
		                                 ^
Main.java:15: error: not a statement
			long long int a = sc.nextInt();
			^
Main.java:15: error: ';' expected
			long long int a = sc.nextInt();
			    ^
Main.java:15: error: not a statement
			long long int a = sc.nextInt();
			     ^
Main.java:15: error: ';' expected
			long long int a = sc.nextInt();
			         ^
Main.java:16: error: not a statement
			long long int b = sc.nextInt();
			^
Main.java:16: error: ';' expected
			long long int b = sc.nextInt();
			    ^
Main.java:16: error: not a statement
			long long int b = sc.nextInt();
			     ^
Main.java:16: error: ';' expected
			long long int b = sc.nextInt();
			         ^
Main.java:22: error: not a statement
		long long int j = 0;
		^
Main.java:22: error: ';' expected
		long long int j = 0;
		    ^
Main.java:22: error: not a statement
		long long int j = 0;
		     ^
Main.java:22: error: ';' expected
		long long int j = 0;
		         ^
31 errors
Language: C

#include <stdio.h>

int main(void) {
    int N, K;
    scanf("%d %d", &N, &K);

    int a, b;
    for (int n = 0; n < N; n++) {
        scanf("%d %d", &a, &b);
        K -= b;
        if (K <= 0) break
    }

    printf("%d", a);
}


Compiler output:
main.c: In function 'main':
main.c:11:26: error: expected ';' before '}' token
   11 |         if (K <= 0) break
      |                          ^
      |                          ;
   12 |     }
      |     ~
Language: C++

#include<iostream>
#include <cstdlib>
#include<list>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<stack>
using namespace std;
int main() {
	int n, k, a[1000001] = { 0 }; cin >> n >> k; k--;
	for (int i = 0; i < n; i++)
	{
		int b, c;
		cin >> b >> c;
		a[b-1] += c;
	}int i=0; 
	while(1)
	{		if (k - a[i]>=0) {
			k -= a[i];cout<<k<<endl;
		}
		else {
			cout << i+1; break;
		}i++;
	}
 
}

Compiler output:
a.cc:25:1: error: extended character   is not valid in an identifier
   25 |  
      | ^
a.cc: In function 'int main()':
a.cc:25:1: error: '\U000000a0' was not declared in this scope
   25 |  
      | ^
Language: C++

#include<algorithm>
#include<stdio.h>
using namespace std;
struct node
{
	long long int nu,cou;
};
struct node nod[1000010];
bool comp(struct node p1, struct node p2)
{
	if(p1.num>p2.num)	return false;
	if(p1.num<=p2.num)	return true;
}
int main() {
	long long int n,i,k;
	scanf("%lld %lld",&n,&k);
	for(i=0; i<n; i++)
    {
		long long int x,y;
		scanf("%lld%lld",&x,&y);
		nod[i].nu =x;
		nod[i].cou = y;
	}
	sort(nod,nod+n,comp);
	for(i=0; i<n; i++)
	{
		k=k-nod[i].cou;
		if(k<=0)
            {
			printf("%lld\n",nod[i].nu);
			return 0;
			break;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'bool comp(node, node)':
a.cc:11:15: error: 'struct node' has no member named 'num'; did you mean 'nu'?
   11 |         if(p1.num>p2.num)       return false;
      |               ^~~
      |               nu
a.cc:11:22: error: 'struct node' has no member named 'num'; did you mean 'nu'?
   11 |         if(p1.num>p2.num)       return false;
      |                      ^~~
      |                      nu
a.cc:12:15: error: 'struct node' has no member named 'num'; did you mean 'nu'?
   12 |         if(p1.num<=p2.num)      return true;
      |               ^~~
      |               nu
a.cc:12:23: error: 'struct node' has no member named 'num'; did you mean 'nu'?
   12 |         if(p1.num<=p2.num)      return true;
      |                       ^~~
      |                       nu
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^
Language: Java

import java.util.Scanner;

public class Atcoder061c {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		int D = 0;
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int c[] = new int[100000];
		

		for(int i = 0; i<N; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			c[a-1] = c[a-1] + b;			
		}
		

		int j = 0;
		
		while(K>0){
			D = j + 1;
			K = K - c[j];
			j++;
		}
		
		System.out.println(D);
	}
}

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

#include <cstdio>
#include <queue>
using namespace std;
struct t
{
	int x,y;
}a[1001],b;
struct cmp
{
	bool operator()(const struct t &a,const struct t &b)
	{
		return a.x>b.x;
	}
};
int main()
{
	int n,i,j,k,l;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	priority_queue <t,vector<t>,cmp> q(a,a+n);
	while(k!=0)
	{
		b=q.top();
		q.pop();
		if(k-b.y>0)	k-=b.y;
		else if(k-b.y==0)	{k=0;	l=b.x;}
		else if(k-b.y<0&&k!=0)	{k=0;	l=b.x;}
	}
	printf("%d\n",l);
	return 0;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
   int N,K,ans,x=0;
   cin>>N>>K;
   int a[N],b[N];
   long long big[10000000000];
   bool ansDefined=false;
   //N=number of times putting the value
   //ans=Kth smallest number
   
   for(int i=0;i<N;i++){
       cin>>a[i]>>b[i];
   }
   for(int g=0;g<N;g++){
       for(int r=0;r<b[g];r++){
           big[x]=a[g];
           x++;
       }
   std::sort(big,big+x);
   
   cout<<big[K-1]<<endl;
   
   return 0;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define FOR(i,k,n) for((i)=(k);(i)<(n);(i)++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()  //greater<int>()
#define ll long long
using namespace std;

int main(){
	int N,i,j,a,b,v1,v2;
	ll K
	int cnt=0;
	cin>>N>>K;

	vector<int> A,B;

	REP(i,N){
		cin>>a>>b;
		A.pb(a);
		B.pb(b);
	}

	FOR(i,1,N){
		v1=A[i];
		v2=B[i];
		j=i-1;
		while(j>=0 && A[j]>v1){
			A[j+1]=A[j];
			B[j+1]=B[j];
			j--;
		}
		A[j+1]=v1;
		B[j+1]=v2;
	}

	REP(i,N){
		cnt+=B[i];
		if(cnt>=K){
			cout<<A[i]<<endl;
			return 0;
		}
	}

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: expected initializer before 'int'
   15 |         int cnt=0;
      |         ^~~
a.cc:16:17: error: 'K' was not declared in this scope
   16 |         cin>>N>>K;
      |                 ^
a.cc:40:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   40 |                 cnt+=B[i];
      |                 ^~~
      |                 int
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

import util.Utils;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int K = in.nextInt();

            int[] a = new int[N];
            int[] b = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
                b[i] = in.nextInt();
            }

            ArrayList<Pair<Integer, Integer>> numberAndCountPairs = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                numberAndCountPairs.add(new Pair<Integer, Integer>(a[i], b[i]));
            }
            Collections.sort(numberAndCountPairs);

            int sum = 0;
            for (int i = 0; i < numberAndCountPairs.size(); i++) {
                sum += numberAndCountPairs.get(i).second;
                if (sum >= K) {
                    System.out.println(numberAndCountPairs.get(i).first);
                    return;
                }
            }

            throw new AssertionError();
        }
    }
}

class Pair<T extends Comparable<T>, S> implements Comparable<Pair<T, S>> {
    public T first;
    public S second;

    public Pair(T t, S s) {
        this.first = t;
        this.second = s;
    }

    private int hash = 0;

    @Override
    public int hashCode() {
        if (hash == 0) {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((first == null) ? 0 : first.hashCode());
            result = prime * result + ((second == null) ? 0 : second.hashCode());
            hash = result;
        }
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Pair<T, S> other = (Pair<T, S>) obj;
        if (first == null) {
            if (other.first != null)
                return false;
        } else if (!first.equals(other.first))
            return false;
        if (second == null) {
            if (other.second != null)
                return false;
        } else if (!second.equals(other.second))
            return false;
        return true;
    }

    @Override
    public int compareTo(Pair<T, S> o) {
        return first.compareTo(o.first);
    }
}

Compiler output:
Main.java:5: error: package util does not exist
import util.Utils;
           ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL hash[100050];
int main(){
  //  freopen("input.txt","r",stdin);
    LL n,k;
    scanf("%I64d%I64d",&n,&k);
    for(int i=1;i<=n;i++){
        LL a,b;
        scanf("%I64d%I64d",&a,&b);
        hash[a]+=b;
    }
    for(int i=1;i<=100050;i++){
        if(hash[i]) k-=hash[i];
        if(k<=0){
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: reference to 'hash' is ambiguous
   12 |         hash[a]+=b;
      |         ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:4:4: note:                 'long long int hash [100050]'
    4 | LL hash[100050];
      |    ^~~~
a.cc:15:12: error: reference to 'hash' is ambiguous
   15 |         if(hash[i]) k-=hash[i];
      |            ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:4:4: note:                 'long long int hash [100050]'
    4 | LL hash[100050];
      |    ^~~~
a.cc:15:24: error: reference to 'hash' is ambiguous
   15 |         if(hash[i]) k-=hash[i];
      |                        ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:4:4: note:                 'long long int hash [100050]'
    4 | LL hash[100050];
      |    ^~~~
Language: C++

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

int main() {
  int operate_num, k;
  cin >> operate_num >> k;
  unordered_map<int, int> map;
  for (int i = 0; i < operate_num; i++) {
    int num, push_num;
    cin >> num >> push_num;
    map[num] += push_num;
  }

  vector<int> keys;
  for (auto itr = map.begin(); itr != map.end(); ++itr) {
    keys.push_back(itr->first);
  }

  sort(keys.begin(), keys.end());
  int order = 0;
  for (auto i : keys) {
    order += map[i];
    // cout << i << " : " << map[i] << ", " << order << endl;
    if (order >= k) {
      cout << i << endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'vector' was not declared in this scope
   16 |   vector<int> keys;
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <unordered_map>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:16:10: error: expected primary-expression before 'int'
   16 |   vector<int> keys;
      |          ^~~
a.cc:18:5: error: 'keys' was not declared in this scope
   18 |     keys.push_back(itr->first);
      |     ^~~~
a.cc:21:8: error: 'keys' was not declared in this scope
   21 |   sort(keys.begin(), keys.end());
      |        ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int hash[100050];
int main(){
   // freopen("input.txt","r",stdin);
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        hash[a]+=b;
    }
    for(int i=1;i<=100050;i++){
        if(hash[i]) k-=hash[i];
        if(k<=0){
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: reference to 'hash' is ambiguous
   11 |         hash[a]+=b;
      |         ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:3:5: note:                 'int hash [100050]'
    3 | int hash[100050];
      |     ^~~~
a.cc:14:12: error: reference to 'hash' is ambiguous
   14 |         if(hash[i]) k-=hash[i];
      |            ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:3:5: note:                 'int hash [100050]'
    3 | int hash[100050];
      |     ^~~~
a.cc:14:24: error: reference to 'hash' is ambiguous
   14 |         if(hash[i]) k-=hash[i];
      |                        ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:3:5: note:                 'int hash [100050]'
    3 | int hash[100050];
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int hash[100050];
int main(){
   // freopen("input.txt","r",stdin);
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        hash[a]+=b;
    }
    for(int i=1;i<=100050;i++){
        if(hash[i]) k-=hash[i];
        if(k<=0){
            printf("%d",i);
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: reference to 'hash' is ambiguous
   11 |         hash[a]+=b;
      |         ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:3:5: note:                 'int hash [100050]'
    3 | int hash[100050];
      |     ^~~~
a.cc:14:12: error: reference to 'hash' is ambiguous
   14 |         if(hash[i]) k-=hash[i];
      |            ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:3:5: note:                 'int hash [100050]'
    3 | int hash[100050];
      |     ^~~~
a.cc:14:24: error: reference to 'hash' is ambiguous
   14 |         if(hash[i]) k-=hash[i];
      |                        ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:3:5: note:                 'int hash [100050]'
    3 | int hash[100050];
      |     ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  ull n,k,sum=0,a[100009]={},b[100009]={};
  cin>>n>>k;
  rep(i,0,n)cin>>a[i]>>b[i];
  sum=b[0];
  rep(i,1,n){
    if(b[i-1]<k&&k<=sum){
        cout<<a[i]<<endl;
        return 0;
    }
    sum+=b[i];z
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:15: error: 'z' was not declared in this scope
   41 |     sum+=b[i];z
      |               ^
Language: C++

# coding: utf-8
x={}
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    if a in x:
        x[a]+=b
    else:
        x[a]=b
sorted(x)
a=0
for i in x.items():
    a+=i[1]
    if(a>=k):
        print(i[0])
        break;

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #coding
    1 | # coding: utf-8
      |   ^~~~~~
a.cc:2:1: error: 'x' does not name a type
    2 | x={}
      | ^
a.cc:3:1: error: 'n' does not name a type
    3 | n,k=map(int,input().split())
      | ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

struct AB {
    int a;
    int b;
    
    bool operator<( const AB& right ) const {
        return a == right.a ? a < right.a : b < right.b;
    }
};

int main()
{
    int N, K;
    cin >> N >> K;
    
    vector<AB> ab(N);
    for( int i = 0; i < N; ++i ){
        int tmpa, tmpb;
        cin >> tmpa >> tmpb;
        ab[i].a = tmpa;
        ab[i].b = tmpb;
    }
    
    sort(ab.begin(), ab.end());
    
    int ans;
    long int cnt = 0;
    for( auto itr = ab.begin(); itr != ab.end(); ++itr ){
        cnt += itr->b;
        if( (long int)K <= cnt ){
            ans = itr->a;
            break;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

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

 import java.util.*;
import java.lang.*;
 
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        long N = Long.parseLong(sc.next());
        long K = Long.parseLong(sc.next());
        
        long a = 0;
        long cnt = 0;

        for(long i=0;i<N;i++){
            a     = Long.parseLong(sc.next());
            cnt  += Long.parseLong(sc.next());
            
            if(cnt >= K) {
                System.out.print(c);
                break;   
            }
            
        }


        System.out.println();
    }

}

Compiler output:
Main.java:20: error: cannot find symbol
                System.out.print(c);
                                 ^
  symbol:   variable c
  location: class Main
1 error