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

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

long list[100001];

int main(){
	int n,k,ans=0,m=0;
	long a,b;
	scanf("%d %d",&n,&k);
	int i;
	for(i=0;i<n;i++){
		scanf("%ld %ld",&a,&b);
		list[a] += b;
	}
	for(i=0;i<100001;i++){
		m = m + list[a];
		if(m>=k){
			ans = i;
			break;
		}
	}
	printf("%d\n",ans);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: reference to 'list' is ambiguous
   13 |                 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:4:6: note:                 'long int list [100001]'
    4 | long list[100001];
      |      ^~~~
a.cc:16:25: error: reference to 'list' is ambiguous
   16 |                 m = m + list[a];
      |                         ^~~~
/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:4:6: note:                 'long int list [100001]'
    4 | long list[100001];
      |      ^~~~
Language: C++

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

long list[100001];

int main(){
	int n,k,ans=0;
	long a,b;
	scanf("%d %d",&n,&k);
	int i;
	for(i=0;i<n;i++){
		scanf("%ld %ld",&a,&b);
		list[a] += b;
	}
	for(i=0;i<100001;i++){
		m = m + list[a];
		if(m>=k){
			ans = i;
			break;
		}
	}
	printf("%d\n",ans);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: reference to 'list' is ambiguous
   13 |                 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:4:6: note:                 'long int list [100001]'
    4 | long list[100001];
      |      ^~~~
a.cc:16:17: error: 'm' was not declared in this scope
   16 |                 m = m + list[a];
      |                 ^
a.cc:16:25: error: reference to 'list' is ambiguous
   16 |                 m = m + list[a];
      |                         ^~~~
/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:4:6: note:                 'long int list [100001]'
    4 | long list[100001];
      |      ^~~~
Language: C++

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

long list[100001];

int main(){
	int n,k,ans=0;
	long a,b;
	scanf("%d %d",&n,&k);
	int i;
	for(i=0;i<n;i++){
		scanf("%ld %ld,&a,&b);
		list[a] += b;
	}
	for(i=0;i<100001;i++){
		m = m + list[a];
		if(m>=k){
			ans = i;
			break;
		}
	}
	printf("%d\n",ans);
}



Compiler output:
a.cc:12:23: warning: missing terminating " character
   12 |                 scanf("%ld %ld,&a,&b);
      |                       ^
a.cc:12:23: error: missing terminating " character
   12 |                 scanf("%ld %ld,&a,&b);
      |                       ^~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:13:17: error: reference to 'list' is ambiguous
   13 |                 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:4:6: note:                 'long int list [100001]'
    4 | long list[100001];
      |      ^~~~
a.cc:16:17: error: 'm' was not declared in this scope
   16 |                 m = m + list[a];
      |                 ^
a.cc:16:25: error: reference to 'list' is ambiguous
   16 |                 m = m + list[a];
      |                         ^~~~
/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:4:6: note:                 'long int list [100001]'
    4 | long list[100001];
      |      ^~~~
Language: C++

#include <iostream>
using namespace std;
 
int main(void)
{
    int n;
    long long k;
    int a, b;
    int i;
    long long array[100010] = {};
 
    cin >> n >> k;
 
    for(i = 0; i < n; i++){
        cin >> a >> b;
        array[a] += b;
    }
    i = 1;
    while(1){
        k -= array[i];
        if(k <= 0){
            break;
        }
        i++;
    }
    cout << i << endl;
    return 0;
}

Compiler output:
a.cc:3:1: error: extended character   is not valid in an identifier
    3 |  
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |  
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |  
      | ^
a.cc:3:1: error: '\U000000a0' does not name a type
    3 |  
      | ^
Language: C++

#include <iostream>
using namespace std;

int main(void)
{
    int n;
    long long k;
    int a, b;
    int i;
    long long temp = 0;
    int array[100010] = {};

    cin >> n >> k;

    for(i = 0; i < n; i++){
        cin >> a >> b;
        array[a] += b;
    }
    i = 0;
    while(1){
        k -= array[i];
        if(k < = 0){
            break;
        }
        i++;
    }
    cout << i << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: expected primary-expression before '=' token
   22 |         if(k < = 0){
      |                ^
Language: C++

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

using namespace std;

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

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

	bool find = false;
	int count = 0;
	for (int i = 0; !find && i < N; ++i) {
		count += data[i].second;
		if (count >= K) {
			cout << data[ind].first << endl;
			find = true;
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:38: error: 'ind' was not declared in this scope; did you mean 'find'?
   23 |                         cout << data[ind].first << endl;
      |                                      ^~~
      |                                      find
Language: C++

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

int n, k, a, b;
set<int> num;
map<int, long long> mp;

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

    cin >> n >> k;
    for (int i = 0;  i < n; ++i) {
        cin >> a >> b;
        num.insert(a);
        mp[a] += b;
    }

    long long cnt = 0;

    for (auto it = num.begin(); it != num.end(); ++i) {
        if (cnt <= k < cnt + mp[*it]) {
            cout << *it << endl;
            return 0;
        }
        else {
            cnt += mp[*it];
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:52: error: 'i' was not declared in this scope; did you mean 'it'?
   24 |     for (auto it = num.begin(); it != num.end(); ++i) {
      |                                                    ^
      |                                                    it
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
Language: C

#include <stdio.h>

int main(void){
    
    long long int i,n,a,b,k;
    long long int num[100001]={0};
    
    scanf( "%lld %lld",&n,&k );
    
    for( i = 0; i < n; i++ ){
        scanf( "%lld %lld",&a,&b);
        num[a] = num[a] + b;
        
    }
    
    for( i = 1; i < 100001; i++ ){
        k = k - num[i]
        if( k <= 0 ){
            printf( "%lld",i );
            break;
        }
    }
    
    
    
    
   
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:23: error: expected ';' before 'if'
   17 |         k = k - num[i]
      |                       ^
      |                       ;
   18 |         if( k <= 0 ){
      |         ~~
Language: C++

#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int main(){

  int n,k,a,b,i;
  vector <pair<int,int> > pairs(100000);

  cin>>n>>k;
  for(i=0;i<n;i++){
    cin>>a>>b;
    pairs[i]=make_pair(b,a);
  }

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

  /*  for(i=0;i<n-1;i++) for(j=0;j<n-1;j++) if(a[j]>a[j+1]){                                          
      int blank;                                                                                      
      blank=a[j];                                                                                     
      a[j]=a[j+1];                                                                                    
      a[j+1]=blank;                                                                                   
      blank=b[j];                                                                                     
      b[j]=b[j+1];                                                                                    
      b[j+1]=blank;                                                                                   
      }                                                                                               
  */

  for(i=0;k>0;i++) k-=pairs[i].first;
  i--;
  cout<<pairs[i].second<<endl;

  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope
   10 |   cin>>n>>k;
      |   ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <map>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout<<pairs[i].second<<endl;
      |   ^~~~
a.cc:31:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:26: error: 'endl' was not declared in this scope
   31 |   cout<<pairs[i].second<<endl;
      |                          ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <map>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: C++

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

#define se second
#define fi first

typedef long long ll;

int main() {
	
	ll n,k;
	cin >> n >> k;
	ll ska,b;
	for(int i = 0;i<n;i++){
		cin >> ska >> b;
		sk.push_back(make_pair(ska,b));
	}
	sort(sk.begin(),sk.end());
	ll sum = 0;
	for(int i = 0;i<n;i++){
		sum += sk[i].se;
		if(sum >= k){
			cout << sk[i].fi;
			break;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'sk' was not declared in this scope; did you mean 'ska'?
   16 |                 sk.push_back(make_pair(ska,b));
      |                 ^~
      |                 ska
a.cc:18:14: error: 'sk' was not declared in this scope; did you mean 'ska'?
   18 |         sort(sk.begin(),sk.end());
      |              ^~
      |              ska
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:11:16: error: expected ';' before 'if'
   11 |         K-=c[i]
      |                ^
      |                ;
   12 |         if(K<=0){
      |         ~~
Language: C++

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

typedef pair<int, int> P;

int main() {
  int N, K;
  cin >> N >> K;
  vector<P> p;
  int a, b;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    p.push_back(P(a, b));
  }
  sort(p.begin(), p.end());

  for (int i = 0; i < p.size(); i++) {
    if (K < p[i].second) {
      cout << p[i].first << endl;
      break;
    }
    K -= p[i].second;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector<P> p;
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:10:11: error: expected primary-expression before '>' token
   10 |   vector<P> p;
      |           ^
a.cc:10:13: error: 'p' was not declared in this scope
   10 |   vector<P> p;
      |             ^
Language: Java


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

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {

	int N = 0;
	int K = 0;
	List<MyClass> list = null;

	try {
	    N = Integer.parseInt(scan.next());
	    K = Integer.parseInt(scan.next());
	} catch(Exception e) {
	    System.out.println(0);
	    System.exit(0);
	}
	List<MyClass> list = new ArrayList<MyClass>();

	for (int i = 0; i < N; i++) {
	    int a = Integer.parseInt(scan.next());
	    int b = Integer.parseInt(scan.next());

	    list.add(new MyClass(a, b));
	}
	Collections.sort(list);
	    
	int num = 0;
	int ans = 0;
	for(MyClass l: list) {
	    num += l.b;
	    if(num >= K) {
		ans = l.a;
		break;
	    }
	}
	System.out.println(ans);

	scan.close();
    }
}

class MyClass implements Comparable<MyClass> {

    int a;
    int b;

    MyClass(int a, int b) {
	this.a = a;
	this.b = b;
    }

    @Override
    public int compareTo(MyClass o) {
	return a - o.a;
    }
}


Compiler output:
Main.java:24: error: variable list is already defined in method main(String[])
	List<MyClass> list = new ArrayList<MyClass>();
	              ^
1 error
Language: Java


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

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {

	try {
	    int N = Integer.parseInt(scan.next());
	    int K = Integer.parseInt(scan.next());

	    List<MyClass> list = new ArrayList<MyClass>();
	} catch(Exception e) {
	    System.out.println(0);
	    System.exit(0);
	}

	for (int i = 0; i < N; i++) {
	    int a = Integer.parseInt(scan.next());
	    int b = Integer.parseInt(scan.next());

	    try {
		list.add(new MyClass(a, b));
	    } catch (Exception e) {
		System.out.println(0);
		System.exit(0);
	    }
		
	}
	try {
	    Collections.sort(list);
	} catch (Exception e) {
	    System.out.println(0);
	    System.exit(0);
	}

	try {
	    int num = 0;
	    int ans = 0;
	    for(MyClass l: list) {
		num += l.b;
		if(num >= K) {
		    ans = l.a;
		    break;
		}
	    }
	    System.out.println(ans);
	} catch(Exception e) {
	    System.out.println(0);
	    System.exit(0);
	}
	scan.close();
    }
}

class MyClass implements Comparable<MyClass> {

    int a;
    int b;

    MyClass(int a, int b) {
	this.a = a;
	this.b = b;
    }

    @Override
    public int compareTo(MyClass o) {
	return a - o.a;
    }
}


Compiler output:
Main.java:23: error: cannot find symbol
	for (int i = 0; i < N; i++) {
	                    ^
  symbol:   variable N
  location: class Main
Main.java:28: error: cannot find symbol
		list.add(new MyClass(a, b));
		^
  symbol:   variable list
  location: class Main
Main.java:36: error: cannot find symbol
	    Collections.sort(list);
	                     ^
  symbol:   variable list
  location: class Main
Main.java:45: error: cannot find symbol
	    for(MyClass l: list) {
	                   ^
  symbol:   variable list
  location: class Main
Main.java:47: error: cannot find symbol
		if(num >= K) {
		          ^
  symbol:   variable K
  location: class Main
5 errors
Language: Java


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

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {

	int N = Integer.parseInt(scan.next());
	int K = Integer.parseInt(scan.next());

	List<MyClass> list = new ArrayList<MyClass>();

	for (int i = 0; i < N; i++) {
	    int a = Integer.parseInt(scan.next());
	    int b = Integer.parseInt(scan.next());

	    try {
		list.add(new MyClass(a, b));
	    } catch (Exception e) {
		System.out.println(0);
		System.exit(0);
	    }
		
	}
	try {
	    Collections.sort(list);
	} catch (Exception e) {
	    System.out.println(0);
	    System.exit(0);
	}

	try {
	    int num = 0;
	    int ans = 0;
	    for(MyClass l: list) {
		num += l.b;
		if(num >= K) {
		    ans = l.a;
		    break;
		}
	    }
	} catch(Exception e) {
	    System.out.println(0);
	    System.exit(0);
	}

	System.out.println(ans);
	scan.close();
    }
}

class MyClass implements Comparable<MyClass> {

    int a;
    int b;

    MyClass(int a, int b) {
	this.a = a;
	this.b = b;
    }

    @Override
    public int compareTo(MyClass o) {
	return a - o.a;
    }
}


Compiler output:
Main.java:52: error: cannot find symbol
	System.out.println(ans);
	                   ^
  symbol:   variable ans
  location: class Main
1 error
Language: Java

import java.io.IOException;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextlong();
		int k = scanner.nextlong();
		int count = 0;
		for(int i=0;i<n*2-1;i++){
			int p = scanner.nextlong();
			count += scanner.nextlong();
 
			if(count >= k){
				System.out.println(p);
				break;
			}
		}
	}
}

Compiler output:
Main.java:8: error: cannot find symbol
		int n = scanner.nextlong();
		               ^
  symbol:   method nextlong()
  location: variable scanner of type Scanner
Main.java:9: error: cannot find symbol
		int k = scanner.nextlong();
		               ^
  symbol:   method nextlong()
  location: variable scanner of type Scanner
Main.java:12: error: cannot find symbol
			int p = scanner.nextlong();
			               ^
  symbol:   method nextlong()
  location: variable scanner of type Scanner
Main.java:13: error: cannot find symbol
			count += scanner.nextlong();
			                ^
  symbol:   method nextlong()
  location: variable scanner of type Scanner
4 errors
Language: C++

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

typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    map<int, ll> mp;
    for(int i = 0; i < n; i++) {

    }
        int a, b;
        cin >> a >> b;
        mp[a] += b;
    }

    ll s = 0;
    for(auto&& e : mp) {
        s += e.second;
        if(s >= k) {
            cout << e.first << endl;
            break;
        }
    }


    return 0;
}

Compiler output:
a.cc:19:5: error: expected unqualified-id before 'for'
   19 |     for(auto&& e : mp) {
      |     ^~~
a.cc:28:5: error: expected unqualified-id before 'return'
   28 |     return 0;
      |     ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
        long N = scan.nextInt();
        long K = scan.nextInt();
        int [] A = new int [100001];
        Arrays.fill(A, 0);
        long sum = 0;
        for(int i=0;i<N;i++){
        	int a = scan.nextInt();
        	int B = scan.nextInt();
        	A[a] += B; 
        }
        for(int i=0;i<10001;i++){
        	sum +=A[i];
        	if(sum>=K){
        		System.out.println(i);
        		break;
        	}
        }
	}


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



#include <iostream>
#include <math.h>
#include<algorithm>
typedef unsigned long long ulong;

using namespace std;

int main(int argc, const char * argv[]) {
    
    long N,K;
    cin>>N>>K;
    
    ulong * array=new ulong[N];
    
    
    long a,b;
    for (long i = 0; i < N; i++) {
        cin >>a>>b;
        array[i]=b;
        array[i]|=(a<<32);
    }
    sort(array, array+N);
    long count = 0;
    for (long i = 0; i < N; i++) {
        count+=(array[i]&0xFFFFFFFF);
        if(count>=K) {
            cout<<(array[i]>>32)<<endl;
            return 0;
        }
    }
    
    delete[] array;
    
    return 0;
}


Compiler output:
a.cc:6:28: error: conflicting declaration 'typedef long long unsigned int ulong'
    6 | typedef unsigned long long ulong;
      |                            ^~~~~
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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:3:
/usr/include/x86_64-linux-gnu/sys/types.h:148:27: note: previous declaration as 'typedef long unsigned int ulong'
  148 | typedef unsigned long int ulong;
      |                           ^~~~~
Language: C++

#include<stdio.h>

int main(){
    long long int N,K,i,sum=0;
    long long int n[100001]={};
    scanf("%d%d",&N,&K);
    for(i=1;i<=N;i++){
        scanf("%lld %lld",&a,&b);
        n[a]+=b;
    }
    for(i=1;i<=N;i++){
        sum+=n[i];
        if(sum>=K) break;
    }
    printf("%d",i);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:28: error: 'a' was not declared in this scope
    8 |         scanf("%lld %lld",&a,&b);
      |                            ^
a.cc:8:31: error: 'b' was not declared in this scope
    8 |         scanf("%lld %lld",&a,&b);
      |                               ^
Language: Java

import java.io.*;
import java.util.*;
import java.lang.Math.*;
 
public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        try {
            main.solve(args);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
    public void solve(String[] args) throws Exception {
        MyScanner scanner = new MyScanner();
        int N = scanner.nextInt();
        long K = scanner.nextLong();
 
        HashMap<Integer, Long> map = new HashMap<>();
 
        for (int i = 0; i < N; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            Long j = map.get(a);
            if (j == null) {
                map.put(a, (long)b);
            } else {
                map.put(a, (long)b + (long)j);
            }
        }
 
        // キーでソートする
        Object[] mapkey = map.keySet().toArray();
        Arrays.sort(mapkey);
        for (Integer nKey : mapkey) {
            Long c = map.get(nKey);
            K = K - c;
            if (K <= 0) {
                System.out.println(nKey);
                return;
            }
        }
    }
 
 
    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
 
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String line = br.readLine();
            while (line.equals("")) {
                line = br.readLine();
            }
            s = line.split(reg, 0);
            i = 0;
            return s[i++];
        }
 
        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
 
        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
 
        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}

Compiler output:
Main.java:36: error: incompatible types: Object cannot be converted to Integer
        for (Integer nKey : mapkey) {
                            ^
1 error
Language: C++

#define MAX 100000
using namespace std;
int main(){
	long long int data[MAX];
	for(int i=0;i<MAX;i++){
		data[i]=0;
	}
	long long int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		long long int a,b;
		cin>>a>>b;
		data[a-1]+=b;
	}
	int count=0;
	for(int i=0;;i++){
		count+=data[i];
		if(count>=m){
			cout<<i+1<<endl;
			break;
		}
	}
	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>>m;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define MAX 100000
a.cc:19:25: error: 'cout' was not declared in this scope
   19 |                         cout<<i+1<<endl;
      |                         ^~~~
a.cc:19:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:36: error: 'endl' was not declared in this scope
   19 |                         cout<<i+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 | #define MAX 100000
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n;
long long k;
vector<pii> f[100005];
int main() {
 cin >> n >> k;
 for(int i = 1; i <= n; ++i) {
     int a, b; cin >> a >> b;
     f.push_back(pii(a, b));
 }
sort(f.begin(), f.end());
long long t = 0;
for(int i = 0; i < n; ++i) {
t += f[i].second;
if (t >= k) {
 cout << f[i].first << endl;
return 0;
}
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: request for member 'push_back' in 'f', which is of non-class type 'std::vector<std::pair<int, int> > [100005]'
   11 |      f.push_back(pii(a, b));
      |        ^~~~~~~~~
a.cc:13:8: error: request for member 'begin' in 'f', which is of non-class type 'std::vector<std::pair<int, int> > [100005]'
   13 | sort(f.begin(), f.end());
      |        ^~~~~
a.cc:13:19: error: request for member 'end' in 'f', which is of non-class type 'std::vector<std::pair<int, int> > [100005]'
   13 | sort(f.begin(), f.end());
      |                   ^~~
a.cc:16:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   16 | t += f[i].second;
      |           ^~~~~~
a.cc:18:15: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   18 |  cout << f[i].first << endl;
      |               ^~~~~
Language: Java

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	static void quick_sort(int[] d, int[] e, int left, int right) {
        if (left>=right) {
            return;
        }
        int p = d[(left+right)/2];
        int l = left, r = right, tmp;
        while(l<=r) {
            while(d[l] < p) { l++; }
            while(d[r] > p) { r--; }
            if (l<=r) {
                tmp = d[l]; d[l] = d[r]; d[r] = tmp;
                tmp = e[l]; e[l] = e[r]; e[r] = tmp;
                l++; r--;
            }
        }
        quick_sort(d, left, r);  // ピボットより左側をクイックソート
        quick_sort(d, l, right); // ピボットより右側をクイックソート
    }
    
    public static void result_print(int[] d, int[] e, int k) {
    	int count = 0;
    	while(k > 0) {
    		k = k - e[count];
    		count++;
    	}
    	System.out.print(d[count]);
    }
	
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] d = new int[n];
		int[] e = new int[n];
		
		for(int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
		}
		quick_sort(d, e, 0, d.length - 1);
	}
}

Compiler output:
Main.java:25: error: method quick_sort in class Main cannot be applied to given types;
        quick_sort(d, left, r);  // ????????????????
        ^
  required: int[],int[],int,int
  found:    int[],int,int
  reason: actual and formal argument lists differ in length
Main.java:26: error: method quick_sort in class Main cannot be applied to given types;
        quick_sort(d, l, right); // ????????????????
        ^
  required: int[],int[],int,int
  found:    int[],int,int
  reason: actual and formal argument lists differ in length
2 errors
Language: C++

#include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

int N, K;
vector<int> array;

int main() {
	scanf("%d %d", &N, &K);
	rep(i, N) {
		int a, b;
		scanf("%d %d", &a, &b);
		array.insert(array.begin(), b, a);
	}
	sort(array.begin(), array.end());
	printf("%d\n", array[K - 1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: reference to 'array' is ambiguous
   25 |                 array.insert(array.begin(), b, a);
      |                 ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:18:13: note:                 'std::vector<int> array'
   18 | vector<int> array;
      |             ^~~~~
a.cc:25:30: error: reference to 'array' is ambiguous
   25 |                 array.insert(array.begin(), b, a);
      |                              ^~~~~
/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:18:13: note:                 'std::vector<int> array'
   18 | vector<int> array;
      |             ^~~~~
a.cc:27:14: error: reference to 'array' is ambiguous
   27 |         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:18:13: note:                 'std::vector<int> array'
   18 | vector<int> array;
      |             ^~~~~
a.cc:27:29: error: reference to 'array' is ambiguous
   27 |         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:18:13: note:                 'std::vector<int> array'
   18 | vector<int> array;
      |             ^~~~~
a.cc:28:24: error: reference to 'array' is ambiguous
   28 |         printf("%d\n", array[K - 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:18:13: note:                 'std::vector<int> array'
   18 | vector<int> array;
      |             ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
ll N,K;
ll num[100001];
int main(){
  cin >> N >> K;
  set<int> s;
  for(int i=0;i<N;i++){
    int a,b;
    cin >> a >> b;
    s.insert(a);
    num[a]+=b;
  }
  for(set<int> ::iterator itr = s.begin();itr!=s.end();itr++){
    ll n=num[*itr];
    if(K<=n){
      cout << *itr << endl;
      return 0;
    }
    else K-=n;
  }
  
  return 0;
}


Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll N,K;
      | ^~
a.cc:8:1: error: 'll' does not name a type
    8 | ll num[100001];
      | ^~
a.cc: In function 'int main()':
a.cc:10:10: error: 'N' was not declared in this scope
   10 |   cin >> N >> K;
      |          ^
a.cc:10:15: error: 'K' was not declared in this scope
   10 |   cin >> N >> K;
      |               ^
a.cc:16:5: error: 'num' was not declared in this scope; did you mean 'enum'?
   16 |     num[a]+=b;
      |     ^~~
      |     enum
a.cc:19:5: error: 'll' was not declared in this scope
   19 |     ll n=num[*itr];
      |     ^~
a.cc:20:11: error: 'n' was not declared in this scope
   20 |     if(K<=n){
      |           ^
Language: C++

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

using namespace std;

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

}


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

#include <iostream>
using namespace std;

long long int cnt[100002];

int main(){
  int N, K;
  cin>>N>>K;
  
  int number, pcs; 
  for(int i = 0; i < N; i++){
    cin>>number>>pcs;

    if(cnt[number] != 0){
      cnt[number] += pcs; 
    }else{
      cnt[number] = pcs;
    }
  }


  unsigned long long int index = 0;
  for (int i = 0; i < 100000; i++){
    index += cnt[array[i]] ;
    if(index >= K){
      cout<<array[i]<<endl;
      break;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: missing template arguments before '[' token
   24 |     index += cnt[array[i]] ;
      |                       ^
a.cc:26:18: error: missing template arguments before '[' token
   26 |       cout<<array[i]<<endl;
      |                  ^
Language: C++

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

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	int a, b;
	long long array[100000] = { 0 };

	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		array[a - 1] += b;
	}

	for (int i = 0; i < 100000; i++)
	{
		k -= array[i];
		if (k <= 0)
		{
			cout << i + 1 << "\n";
			break;
		}
	}
	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++

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

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	int a, b;
	int array[100000] = { 0 };

	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		array[a - 1] += b;
	}

	for (int i = 0; i < 100000; i++)
	{
		k -= array[i];
		if (k <= 0)
		{
			cout << i + 1 << "\n";
			break;
		}
	}
	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++

import java.util.Scanner;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.Iterator;


public class Main{
	static long n;
	static long k;
	TreeMap<long, long> map = new TreeMap<long, long>();

	Main(){
		Scanner cin = new Scanner(System.in);
		this.n = cin.nextLong();
		this.k = cin.nextLong();
		for (int i = 0; i < n; i++) {
			long long a = cin.nextLong();
			long long b = cin.nextLong();
			if (map.containsKey(a)) {
				map.put(a, map.get(a) + b);
			} else {
				map.put(a, b);
			}
		}
	}

	public static void main() {
		long cur_i = 0;
		for(long key : map.keySet()) {
			cur_i += map.get(key);
			if(cur_i >= k){
				System.out.println(key);
				return;
			}
		}
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Arrays;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.TreeMap;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Iterator;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main{
      | ^~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

	vector< pair<int, int> > v(N);

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

		v[i] = pair<int, int>(a,b);
	}

	sort(v.begin(), v.end());
	//for (int i = 0; i < N; ++i) {
	//	cout << "(" << v[i].first << ", " << v[i].second << ")" << endl;
	//}


	long long k = 0;
	for (int i = 0; i < N; ++i) {
		k += v[i].second;
		if (k >= K) {
			cout << v[i].first << endl;
			break;
		}
	}
 
}

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

#include <stdio.h>

int main()
{
	int n,k;
	const int max=10001;
	scanf("%d%d",&n,&k);

	int num[max]={0};

	int a,b;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		num[a]=b;	
	}
	for(int i=1;i<max;i++)
	{
		k-=num[i];
		if(k<=0)
		{
			printf("%d",i);
			break;
		}
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:22: error: variable-sized object may not be initialized except with an empty initializer
    9 |         int num[max]={0};
      |                      ^
Language: C++

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

	int main(void)
	{
		int n,m,temp;
		cin >> n >> m;
		int b[100001];
		for (int i=0;i<n;i++) {
			itn a,b;
			cin >> a >> b;
			b[a] += b;
		}
		for (int i=1;MAX > i;i++) {
			if (m <= b[i];)
			m -= b[i];
		}
		return 0;
	}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: 'itn' was not declared in this scope; did you mean 'int'?
   11 |                         itn a,b;
      |                         ^~~
      |                         int
a.cc:12:32: error: 'a' was not declared in this scope
   12 |                         cin >> a >> b;
      |                                ^
a.cc:16:39: error: expected primary-expression before ')' token
   16 |                         if (m <= b[i];)
      |                                       ^
Language: C++

#include <iostream>
using namespace std;
using ll = long long;

int main(void)
{
	int n;
	ll m;
	cin >> n >> m;
	int a[n],b[n];
	for (int i=0;i<n;i++) {
		cin >> a[i] >> b[i];
	}
	for (int i=0;i<n-1;i++) {
		for (int j=0;j<n-1-i;j++) {
			if (a[j]>a[j+1]) {
				temp = a[j];
				a[j] = a[j+1];
				a[j+1] = temp;
				temp = b[j];
				b[j] = b[j+1];
				b[j+1] = temp;
			}
		}
	}

	int i;
	for (i=0;m > 0;i++) {
		m -= b[i];
	}
	cout << a[i-1] << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:33: error: 'temp' was not declared in this scope; did you mean 'tm'?
   17 |                                 temp = a[j];
      |                                 ^~~~
      |                                 tm
Language: Java

package AtCoder;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.io.PrintWriter;

public class TaskC {
    long[] arr = new long[100000+1];
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();
        for (int i = 0; i < n; ++i) {
            int a = in.nextInt();
            int b = in.nextInt();
            arr[a] += b;
        }
        for (int i = 1; i <= 100000; ++i) {
            if (k > arr[i])
                k -= arr[i];
            else {
                out.println(i);
                break;
            }
        }
    }
}


Compiler output:
Main.java:8: error: class TaskC is public, should be declared in a file named TaskC.java
public class TaskC {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] a = new int[100000];
		for(int i=0; i<100000; i++){
			a[i] = 0;
		}
		for(int i=0; i<N; i++){
			a[sc.nextInt()-1] += sc.nextInt();
		}
		int min=0;
		for(int i=0; i<N; i++){
			K-=a[i];
			if(K<0){
				min = i+1;
				break;
			}
		}
		System.out.println(min);
		sc.close();
	}


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

int main()
{
	int N, K;
	cin >> N;
	cin >> K;
	map<int, int> mii;
	for (auto i = 0; i < N; i++)
	{
		int index, val;
		cin >> index;
		cin >> val;
		mii[index] += val;
	}

	int counter = 0;
	auto ind = mii.begin();
	while (counter += ind->second < K) ind++;

	cout << ind->first;

	//char c = 'c';
	//cin >> c;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> N;
      |         ^~~
a.cc:6:9: error: 'map' was not declared in this scope
    6 |         map<int, int> mii;
      |         ^~~
a.cc:6:13: error: expected primary-expression before 'int'
    6 |         map<int, int> mii;
      |             ^~~
a.cc:12:17: error: 'mii' was not declared in this scope
   12 |                 mii[index] += val;
      |                 ^~~
a.cc:16:20: error: 'mii' was not declared in this scope
   16 |         auto ind = mii.begin();
      |                    ^~~
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout << ind->first;
      |         ^~~~
Language: C++

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

void main()
{
	int N, K;
	cin >> N;
	cin >> K;
	map<int, int> mii;
	for (auto i = 0; i < N; i++)
	{
		int index, val;
		cin >> index;
		cin >> val;
		mii[index] += val;
	}

	int counter = 0;
	auto ind = mii.begin();
	while (true)
	{
		if (ind->second + counter < K)
		{
			counter += ind->second;
			ind++;
			//cout << counter << "///" << ind->second << endl;;
		}
		else
		{
			break;
		}
	}

	cout << ind->first;
}

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

#include <iostream>
using namespace std;
int main(void){
    long long int N, K;
    cin >> N >> K;
    int A, B;
    long long int ans[100001];
    for(int i = 0; i < N; ++i){
        cin >> A >> B;
        ans[A] += B;
    }
    for(int i = 1; i <= 100000; ++i){
        if(K <= ans[i]){
            cout << i << endl;
            break;
        }
    
        K -= ans[i];
    }

break;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:1: error: break statement not within loop or switch
   21 | break;
      | ^~~~~
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int N, K;
    cin >> N >> K;
    int A, B;
    for(int i = 0; i < N; ++i){
        cin >> A >> B;
        ans[A] += B
    }
    for(int i = 1; i <= 100000; ++i){
        if(K <= ans[i]){
            cout << i << endl;
            break;
        }
    
        K -= B;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |         ans[A] += B
      |         ^~~
      |         abs
a.cc:12:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |         if(K <= ans[i]){
      |                 ^~~
      |                 abs
Language: C++

#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main()
{
  int N,K;
  scanf ("%d %d", &N, &K);
  vector<pair<int, int>> V;
  V.reserve(N);
  for (int i = 0; i < N; i++) {
    int a,b;
    scanf("%d %d", &a, &b);
    V.push_back({a, b});    
  }
  sort(V.begin(), V.end());
  for (auto v : V) {
    K -= v.second;
    if (K <= 0) {
      printf("%d\n", v.first);
      return 0;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'scanf' was not declared in this scope
   10 |   scanf ("%d %d", &N, &K);
      |   ^~~~~
a.cc:22:7: error: 'printf' was not declared in this scope
   22 |       printf("%d\n", v.first);
      |       ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include <algorithm>
  +++ |+#include <cstdio>
    4 |
Language: C++

#include <iostream>
#include <cstdint>
#include <valarray>

using namespace std;

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

    valarray<long long> s(0, 100000);
    for (int n = 0; n < N; n++) {
        int a, b;
        cin >> a >> b;
        s[a - 1] += b;
    }

    for (int n = 0; n < 100000; n++) {
        K -= s[n];
        if (K <= 0) {
            cout << n + 1 << endl;
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:36: error: call of overloaded 'valarray(int, int)' is ambiguous
   13 |     valarray<long long> s(0, 100000);
      |                                    ^
In file included from a.cc:3:
/usr/include/c++/14/valarray:639:5: note: candidate: 'std::valarray<_Tp>::valarray(const _Tp*, std::size_t) [with _Tp = long long int; std::size_t = long unsigned int]'
  639 |     valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n)
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/valarray:633:5: note: candidate: 'std::valarray<_Tp>::valarray(const _Tp&, std::size_t) [with _Tp = long long int; std::size_t = long unsigned int]'
  633 |     valarray<_Tp>::valarray(const _Tp& __t, size_t __n)
      |     ^~~~~~~~~~~~~
Language: C

#include <iostream>
#include <cstdint>
#include <valarray>

using namespace std;

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

    valarray<int> s(0, 100000);
    for (int n = 0; n < N; n++) {
        int a, b;
        cin >> a >> b;
        s[a - 1] += b;
    }

    for (int n = 0; n < 100000; n++) {
        K -= s[n];
        if (K <= 0) {
            printf("%d\n", n + 1);
            return 0;
        }
    }
}


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