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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) lower_bound(all(v),k)-v.begin()
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=100100100100;
const int mod=1000000007;
int main(){
   int n,k;cin>>n>>k;
   vector<P> v;
   rep(i,n){
       int a,b;cin>>a>>b;
       v.eb(a,b);
   }
   sort(all(b));
   ll ans=0;
   rep(i,n){
       ans+=v[i].second;
       if(ans>=k){
           cout<<v[i].first<<endl;
           return 0;
       }
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'b' was not declared in this scope
   29 |    sort(all(b));
      |             ^
a.cc:5:16: note: in definition of macro 'all'
    5 | #define all(a) a.begin(),a.end()
      |                ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<math.h>
typedef long long ll;
using namespace std;

int main()
{
	long long N, K, a[100000], b[100000], sum = 0;
	cin >> N >> K;
	for (int i = 0;i < N;i++)cin >> a[i] >> b[i];
	for (int i = 0;i < N;i++)
	{
		for (int j = 0;j < b[i];j++) { c[sum] = a[i];sum++; }
	}

	for (int i = 0;i < sum - 1;i++) {
		for (int j = i + 1;j < sum;j++) {
			if (a[i] > a[j]) {
				int tmp = a[i];
				a[i] = a[j];
				a[j] = a[i];
				int tmp = b[i];
				a[i] = b[j];
				a[j] = b[i];
			}
		}
	}
	int v = 1;
	int k;
	int v = K;
	for(k=0; k>0;k++)
	 v = v - b[k];
	cout << a[k];

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:48: error: 'c' was not declared in this scope
   17 |                 for (int j = 0;j < b[i];j++) { c[sum] = a[i];sum++; }
      |                                                ^
a.cc:26:37: error: redeclaration of 'int tmp'
   26 |                                 int tmp = b[i];
      |                                     ^~~
a.cc:23:37: note: 'int tmp' previously declared here
   23 |                                 int tmp = a[i];
      |                                     ^~~
a.cc:34:13: error: redeclaration of 'int v'
   34 |         int v = K;
      |             ^
a.cc:32:13: note: 'int v' previously declared here
   32 |         int v = 1;
      |             ^
Language: C++

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1000000000000 ;
const ll mod=1000003 ;

int main(){
  ll n,k;
  cin >> n >> k;
  pair<ll,ll> p[n];
  rep(i,n)cin >> p[i].first >> p[i].second;
  sort(p,p+n);
  ll sum[n]={};
  sum[0]=b[0];
  rep(i,n-1){
    sum[i+1]=sum[i]+b[i+1];
  }
  ll x=lower_bound(sum,sum+n,k)-sum;
  cout << p[x].first << endl;
return 0;}

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

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int GCD(int a,int b)
{
  int r, tmp;
   /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int n,k,ans=0;
  cin>>n>>k;
  vector<pair<int,int>> v;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    v.emplace_back(a,b);
  }
  sort(v.begin(),v.end());
  rep(auto c:v){
    ans+=c.second;
    if(ans>=k){
      cout<<c.first<<endl;
      return 0;
    }
  }
  
  
  
}
///////////////////////////




Compiler output:
a.cc:66:15: error: macro "rep" requires 2 arguments, but only 1 given
   66 |   rep(auto c:v){
      |               ^
a.cc:5:9: note: macro "rep" defined here
    5 | #define rep(i, n) for(int i = 0; i < (n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:66:3: error: 'rep' was not declared in this scope
   66 |   rep(auto c:v){
      |   ^~~
Language: C++

n, k = map(int, input().split())
l = [0]*(10**5+10)

for i in range(n):
    a, b = map(int, input().split())
    l[a] += b

sum = 0
for i in range(len(l)):
    sum += l[i]
    if sum >= k:
        print(i)
        break


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

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


int main(){
	long long int  a,b;
  cin >> a >>b;
  
  vector<pair<long long,long long>> p(n);
  long long int c[100010],d[100010];
  
  for(int i=0;i<a;i++){
    cin >>c[i] >> d[i];
    p[i]=make_pair(c[i],d[i]);
  }
  
  sort(p.begin(),p.end());
  for(int i=0;i<a;i++){
    if(b<=p[i].second){
      
      cout <<p[i].first;
      break;
      
    }
    else{
      b -=p[i].second;
    }
  }
  return 0;
}


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

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


int main(){
	long long int  a,b;
  cin >> a >>b;
  
  vector<pair<long long,long long>> p(n);
  long long int c[100010],d[100010];
  
  for(int i=0;i<a;i++){
    cin >>c[i] >> d[i];
    p[i]=make_pair(a[i],b[i]);
  }
  
  sort(p.begin(),p.end());
  for(int i=0;i<a;i++){
    if(b<=p[i].second){
      
      cout <<p[i].first;
      break;
      
    }
    else{
      b -=p[i].second;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:39: error: 'n' was not declared in this scope
    9 |   vector<pair<long long,long long>> p(n);
      |                                       ^
a.cc:14:21: error: invalid types 'long long int[int]' for array subscript
   14 |     p[i]=make_pair(a[i],b[i]);
      |                     ^
a.cc:14:26: error: invalid types 'long long int[int]' for array subscript
   14 |     p[i]=make_pair(a[i],b[i]);
      |                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,k,ans=0,count;
  cin>>n>>k;
  vector<pair<int,int>> v;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    v.emplace_back(a,b);
  }
  sort(v.begin(),v.end());
  for(int p:v){
    
    ans+=p.second;
    if(ans>=k){
      cout<<p.first<<endl;
      return 0;
    }
  }
  
  
}
///////////////////////////

Compiler output:
a.cc: In function 'int main()':
a.cc:79:13: error: cannot convert 'std::pair<int, int>' to 'int' in initialization
   79 |   for(int p:v){
      |             ^
a.cc:81:12: error: request for member 'second' in 'p', which is of non-class type 'int'
   81 |     ans+=p.second;
      |            ^~~~~~
a.cc:83:15: error: request for member 'first' in 'p', which is of non-class type 'int'
   83 |       cout<<p.first<<endl;
      |               ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,k,ans=0,count;
  cin>>n>>k;
  vector<int> a(n),b(n);
  rep(i,n) cin>>a[i]>>b[i];
  rep(i,n){
    count=i;
    ans+=b[i];
    if(ans>=k){
      break;
    }
  }
  cout<<a[i]<<endl;
  
}
///////////////////////////

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

#include <bits/stdc++.h>
using namespace std;
int main (){
	int n,k,a,b,ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		ans+=b;
		if(ans>=k);{
			cout<<a<<endl;
			return 0;
		}
		return 0;
}


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

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

long long c[2e5];

int main() {
  long long n, k; cin >> n >> k;
  while (n--) {
    int a, b; cin >> a >> b;
    c[a] += b;
  }
  int r = 0;
  while (k > 0) {
    k -= c[r++];
  }
  cout << --r << endl;
}


Compiler output:
a.cc:4:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | long long c[2e5];
      |             ^~~
a.cc:4:13: error: could not convert '2.0e+5' from 'double' to 'long unsigned int'
    4 | long long c[2e5];
      |             ^~~
      |             |
      |             double
a.cc:4:13: error: size of array 'c' has non-integral type 'double'
Language: C++

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

int int_len(long long int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(long long int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int k=0,n=0,count=0;
  string s;
  cin>>n>>k;
  vector<int> a(n),b(n);
  priority_queue<int> v;
  rep(i,n) cin>>a[i]>>b[i];
  for(int i=0;i<n;i++){
    for(int j=0;j<b[i];j++){
      v.push(a[i]);
      count++;
      if(count==k){
        cout<<a[i]<<endl;
        return 0;
      }
    }
  }
  sort(v.begin(),v.end());
  cout<<v[k-1]<<endl;
}
///////////////////////////





Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: 'class std::priority_queue<int>' has no member named 'begin'
   42 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:42:20: error: 'class std::priority_queue<int>' has no member named 'end'
   42 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:43:10: error: no match for 'operator[]' (operand types are 'std::priority_queue<int>' and 'int')
   43 |   cout<<v[k-1]<<endl;
      |          ^
Language: C++

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

int int_len(long long int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(long long int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000;
  string s;
  cin>>n>>k;
  vector<int> a(n),b(n),v;
  rep(i,n) cin>>a[i]>>b[i];
  for(int i=0;i<n;i++){
    for(int j=0;j<b[i];j++){
      v.push_back(a[i]);
      count++;
    }
    if(count>=k) break; 
  }
  sort(v.begin(),v.end());
  cout<<v[k-1]<<endl;
}
///////////////////////////





Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: conflicting declaration 'std::vector<int> a'
   29 |   vector<int> a(n),b(n),v;
      |               ^
a.cc:26:7: note: previous declaration as 'int a'
   26 |   int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000;
      |       ^
a.cc:29:20: error: conflicting declaration 'std::vector<int> b'
   29 |   vector<int> a(n),b(n),v;
      |                    ^
a.cc:26:11: note: previous declaration as 'int b'
   26 |   int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000;
      |           ^
a.cc:30:18: error: invalid types 'int[int]' for array subscript
   30 |   rep(i,n) cin>>a[i]>>b[i];
      |                  ^
a.cc:30:24: error: invalid types 'int[int]' for array subscript
   30 |   rep(i,n) cin>>a[i]>>b[i];
      |                        ^
a.cc:32:20: error: invalid types 'int[int]' for array subscript
   32 |     for(int j=0;j<b[i];j++){
      |                    ^
a.cc:33:20: error: invalid types 'int[int]' for array subscript
   33 |       v.push_back(a[i]);
      |                    ^
Language: C++

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

int int_len(long long int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(long long int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000;
  string s;
  cin>>n>>k;
  vector<int> a(n),b(n),v;
  rep(i,n) cin>>a[i]>>b[i];
  for(int i=0;i<n;i++){
    for(int j=0;j<b[i];j++){
      v.push_back(a[i]);
      count++;
    }
    if(count>=k) break; 
  }
  sort(v.begin(),v.end());
  cout<<v[k-1]<<endl;
}
///////////////////////////





Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: conflicting declaration 'std::vector<int> a'
   29 |   vector<int> a(n),b(n),v;
      |               ^
a.cc:26:17: note: previous declaration as 'long long int a'
   26 |   long long int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000;
      |                 ^
a.cc:29:20: error: conflicting declaration 'std::vector<int> b'
   29 |   vector<int> a(n),b(n),v;
      |                    ^
a.cc:26:21: note: previous declaration as 'long long int b'
   26 |   long long int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000;
      |                     ^
a.cc:30:18: error: invalid types 'long long int[int]' for array subscript
   30 |   rep(i,n) cin>>a[i]>>b[i];
      |                  ^
a.cc:30:24: error: invalid types 'long long int[int]' for array subscript
   30 |   rep(i,n) cin>>a[i]>>b[i];
      |                        ^
a.cc:32:20: error: invalid types 'long long int[int]' for array subscript
   32 |     for(int j=0;j<b[i];j++){
      |                    ^
a.cc:33:20: error: invalid types 'long long int[int]' for array subscript
   33 |       v.push_back(a[i]);
      |                    ^
Language: C++

#include <iostream>
#include <vector>

int main()
{
	std::vector<int> ns;
	int a, b, K, N;
	scanf("%d %d", &N, &K);
	for(int i=0; i<N; i++){
		scanf("%d %d", &a, &b);
		for(int j=0; j<b; j++){
			ns.push_back(a);
		}
	}
	std::sort(ns.begin(), ns.end());
	printf("%d\n", ns[K-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |         std::sort(ns.begin(), ns.end());
      |              ^~~~
      |              qsort
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long k = sc.nextLong();
      int[] a = new int[n];
      int[] b = new int[n];
      long sum = 0;
      TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();
      for(int i = 0;i < n;i++){
        a[i]=sc.nextInt();
        b[i]=sc.nextInt();
        if(map.containsKey(a[i])){
          int k = map.get(a[i]);
          map.remove(a[i]);
          map.put(a[i],k+b[i]);
        }
        else map.put(a[i],b[i]);
      }
      Arrays.sort(a);
      int s = 0;
      while(sum < k){
      	sum += (long)map.get(a[s]);
        s++;
      }
      System.out.println(a[s-1]);
    }
}


Compiler output:
Main.java:15: error: variable k is already defined in method main(String[])
          int k = map.get(a[i]);
              ^
1 error
Language: C++

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

#include <tuple>
#include <string>
#include <vector>   
//入力数の桁数を出力
//https://atcoder.jp/contests/abc057/tasks/abc057_c
int cnt_digits(ll n){

    int digits =0;
    while(n > 0){

        digits++;
        n /= 10;

    }
    return digits;
}

int main() {
    
    int num1;
    int num2;
    vector<int> num;
    //格納、出力用
    vector<pair<int, int>> a_vc;
    vector<int> b_vc;

    //入力
    int n;
    int k;
    cin >> n >> k;
    //cout << "入力値" <<n << k;
    //入力
    for(int i = 0;i < n;i++){
        cin >> num1 >> num2;
        a_vc.emplace_back(num1,num2);

    }
    

    //並べ替え
    sort(a_vc.begin(), a_vc.end());

    //k番目に小さい値
    //第二引数のどこに入るか調べる
    ll ans = 0;
    ll sum = 0;
    for(int i=0;i < a_vc.size();i++){
        sum += a_vc[i].second;
        if(k > sum){
            continue;
        }else{
            ans = a_vc[i].first;
            break;
        }

    }

    cout << ans << endl;

    return 0;
}


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

int main() {
    
    int num1;
    int num2;
    vector<int> num;
    //格納、出力用
    vector<pair<int, int>> a_vc;
    vector<int> b_vc;

    //入力
    int n;
    int k;
    cin >> n >> k;
    //cout << "入力値" <<n << k;
    //入力
    for(int i = 0;i < n;i++){
        cin >> num1 >> num2;
        a_vc.emplace_back(num1,num2);

    }
    

    //並べ替え
    sort(a_vc.begin(), a_vc.end());

    //k番目に小さい値
    //第二引数のどこに入るか調べる
    ll ans = 0;
    ll sum = 0;
    for(int i=0;i < a_vc.size();i++){
        sum += a_vc[i].second;
        if(k > sum){
            continue;
        }else{
            ans = a_vc[i].first;
            break;
        }

    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> num;
      |     ^~~~~~
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> num;
      |            ^~~
a.cc:7:12: error: 'pair' was not declared in this scope
    7 |     vector<pair<int, int>> a_vc;
      |            ^~~~
a.cc:7:17: error: expected primary-expression before 'int'
    7 |     vector<pair<int, int>> a_vc;
      |                 ^~~
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> b_vc;
      |            ^~~
a.cc:13:5: error: 'cin' was not declared in this scope
   13 |     cin >> n >> k;
      |     ^~~
a.cc:18:9: error: 'a_vc' was not declared in this scope
   18 |         a_vc.emplace_back(num1,num2);
      |         ^~~~
a.cc:24:10: error: 'a_vc' was not declared in this scope
   24 |     sort(a_vc.begin(), a_vc.end());
      |          ^~~~
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(a_vc.begin(), a_vc.end());
      |     ^~~~
      |     short
a.cc:28:5: error: 'll' was not declared in this scope
   28 |     ll ans = 0;
      |     ^~
a.cc:29:7: error: expected ';' before 'sum'
   29 |     ll sum = 0;
      |       ^~~~
      |       ;
a.cc:31:9: error: 'sum' was not declared in this scope
   31 |         sum += a_vc[i].second;
      |         ^~~
a.cc:35:13: error: 'ans' was not declared in this scope
   35 |             ans = a_vc[i].first;
      |             ^~~
a.cc:41:5: error: 'cout' was not declared in this scope
   41 |     cout << ans << endl;
      |     ^~~~
a.cc:41:13: error: 'ans' was not declared in this scope
   41 |     cout << ans << endl;
      |             ^~~
a.cc:41:20: error: 'endl' was not declared in this scope
   41 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

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:30:3: error: expected '}' at end of input
   30 |  }
      |   ^
a.cc:14:16: note: to match this '{'
   14 | int main(void) {
      |                ^
Language: C++

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

int main(void){
    int a[10];
    for(int i=0;i<9;++i){
     a[i] = 0;
    }

    int n;
    cin>>n;
    int over=0;
    for(int i=0;i<n;++i){
        int tmp;
        cin>>tmp;
        if(tmp<=399){
            a[1]=1;//gray
        }
        else if((400<=tmp)&&(tmp<=799)){
            a[2]=1;//brown
        }
        else if((800<=tmp)&&(tmp<=1199)){
            a[3]=1;//green
        }
        else if((1200<=tmp)&&(tmp<=1599)){
            a[4]=1;//water
        }
        else if((1600<=tmp)&&(tmp<=1999)){
            a[5]=1;//blue
        }
        else if((2000<=tmp)&&(tmp<=2399)){
            a[6]=1;//yellow
        }
        else if((2400<=tmp)&&(tmp<=2799)){
            a[7]=1;//orange
        }
        else if((2800<=tmp)&&(tmp<=3199)){
            a[8]=1;//red
        }
        else if(3200<=tmp){
            ++over;//free
        }
        
    }
    int sum=0;
    for(int i=1;i<=8;++i){
      sum+=a[i];
    }
    if(sum==0){
        mmax=1;
    }
    else{
        mmax = sum+over;
    }
    if(mmax>8){
        mmax=8;
    }

    cout<<sum<<" "<<mmax<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: 'mmax' was not declared in this scope
   51 |         mmax=1;
      |         ^~~~
a.cc:54:9: error: 'mmax' was not declared in this scope
   54 |         mmax = sum+over;
      |         ^~~~
a.cc:56:8: error: 'mmax' was not declared in this scope
   56 |     if(mmax>8){
      |        ^~~~
a.cc:60:21: error: 'mmax' was not declared in this scope
   60 |     cout<<sum<<" "<<mmax<<endl;
      |                     ^~~~
Language: C++

import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextLong()
    val a = (0 until n).map { Class016c(sc.next().toInt(), sc.next().toInt()) }
    println(problem061c(n, k, a))
}

fun problem061c(n: Int, k: Long, a: List<Class016c>): Int {
    var k2 = k
    var ans = 0L
    for (i in 0 until n) {
        val tmp = a[i].b
        if (tmp < k2) {
            k2 -= tmp
        } else {
            ans = a[i].a
            break
        }
    }
    return ans
}

data class Class016c(var a: Int, var b: Int)


Compiler output:
a.cc:4:29: error: stray '`' in program
    4 |     val sc = Scanner(System.`in`)
      |                             ^
a.cc:4:32: error: stray '`' in program
    4 |     val sc = Scanner(System.`in`)
      |                                ^
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'fun' does not name a type
   11 | fun problem061c(n: Int, k: Long, a: List<Class016c>): Int {
      | ^~~
a.cc:26:1: error: 'data' does not name a type
   26 | data class Class016c(var a: Int, var b: Int)
      | ^~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    long long K;
    cin >> N >> K;
    int a[N+10],b[N+10];
    for(int i = 0; i < N; i++){
        cin >> a[i] >> b[i];
    }
    long long c[100010];
    for(int i = 0; i < 100010; i++){
        c[i] = 0;
    }
    for(int i = 0; i < N; i++){
        c[a[i]] += b[i];
    }
    int count = 0;
    for(i = 1; i < 100010; i++){
        count += c[i];
        if(count >= K){
            cout << i << endl;
            break;
        }
    }
}

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

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K;
    cin >> N >> K;
    vector<P> items(N);
    rep(i, N) cin >> items[i].first >> items[i].second;
    priority_queue<P, vector<P>, greater<>> arr;
    rep(i, N) {
        arr.push(items[i]);
    }
    ll cnt = 0;
    while (!arr.empty()) {
        P p = arr.top();
        print(p);
        arr.pop();
        cnt += p.second;
        if (cnt >= K) {
            cout << p.first << endl;
            return;
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:36:9: error: 'print' was not declared in this scope; did you mean 'rint'?
   36 |         print(p);
      |         ^~~~~
      |         rint
Language: C++

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

int main() {
    int N
    long long K;
    cin >> N >> K;
    vector<long long> cnt(100001);
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        cnt[a] += b;
    }

    long long c = 0;
    for (int i = 0; i < 100001; i++) {
        c += cnt[i];
        if (c >= K) {
            cout << i << endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: expected initializer before 'long'
    7 |     long long K;
      |     ^~~~
a.cc:8:12: error: 'N' was not declared in this scope
    8 |     cin >> N >> K;
      |            ^
a.cc:8:17: error: 'K' was not declared in this scope
    8 |     cin >> N >> K;
      |                 ^
Language: C++



#include <iostream>

int main()
{
  unsigned int N;
  unsigned int K;
  unsigned int arr[100000];
  unsigned int a, b;
  unsigned int sum = 0;

  memset(arr, 0x0, sizeof(arr));

  std::cin >> N >> K;

  for (int i = 0; i < N; i++)
    {
      std::cin >> a >> b;
      arr[a] += b;
    }

  for (int i = 0; i <= 100000; i++)
    {
      sum += arr[i];
      if (sum >= K)
        {
          std::cout << i << '\n';
          break;
        }
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'memset' was not declared in this scope
   13 |   memset(arr, 0x0, sizeof(arr));
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <iostream>
  +++ |+#include <cstring>
    4 |
Language: C++




#include <iostream>

int main()
{
  unsigned int N;
  unsigned int K;
  unsigned int arr[100000];
  unsigned int a, b;
  unsigned int sum = 0;

  memset(arr, 0x0, sizeof(arr));

  std::cin >> N >> K;

  for (int i = 0; i < N; i++)
    {
      std::cin >> a >> b;
      arr[a] += b;
    }

  for (int i = 0; i < 5; i++)
    {
      sum += arr[i];
      if (sum >= K)
        {
          std::cout << i << '\n';
          break;
        }
    }

}




Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'memset' was not declared in this scope
   14 |   memset(arr, 0x0, sizeof(arr));
      |   ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <iostream>
  +++ |+#include <cstring>
    5 |
Language: Java

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

public class Main061 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		HashMap<Integer,Integer>m = new HashMap<Integer,Integer>();
		
		int n = sc.nextInt();
		long k = sc.nextInt();
		int []a = new int [n];
		int []b = new int [n];
		
		for(int i = 0; i< n ; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			m.put(a[i], b[i]);
		}
		Arrays.sort(a);
		long sum = 0;
		int ans = 0;
		for(int i = 0; i < n; i++) {
			sum += (long)m.get(a[i]);
			if(k <= sum) {
			    ans = a[i];
				break;
			}
		}
		System.out.println(ans);

	}

}


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

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

using ll = long long;
const int AMAX = 100000;
ll bucket[AMAX + 1];

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

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

  for (int i = 0; i < AMAX; i++) {
    if (K <= bucket[i]) {
      cout << i << endl;
      break;
    }
    K -= bucket[i];
  }
  return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | p#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'p' does not name a type
    1 | p#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> N, K;
      |   ^~~
a.cc:22:7: error: 'cout' was not declared in this scope
   22 |       cout << i << endl;
      |       ^~~~
a.cc:22:20: error: 'endl' was not declared in this scope
   22 |       cout << i << endl;
      |                    ^~~~
Language: C++

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

int main(){
    int n,k;
    cin >> n >> k;
    long long in[100001];
    memset(in,0,sizeof in);
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        in[a] += b;
    }
    long long sum = 0;
    int ans;
    for(int i=1;i<=100000;i++){
        sum +=in[i];
        if(sum >= k){
            ans = i;
            break;
        } 
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
   10 |     memset(in,0,sizeof in);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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

int main(){
    int n,k;
    cin >> n >> k;
    long long in[100001];
    memset(in,0,sizeof(in));
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        in[a] += b;
    }
    long long sum = 0;
    int ans;
    for(int i=1;i<=100000;i++){
        sum +=in[i];
        if(sum >= k){
            ans = i;
            break;
        } 
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
   10 |     memset(in,0,sizeof(in));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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

using namespace std;

int N;
long long K;
vector<pair<int,int> > v;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     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 <algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:23:13: error: 'cout' was not declared in this scope
   23 |             cout << v[i].first << endl;
      |             ^~~~
a.cc:23:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:35: error: 'endl' was not declared in this scope
   23 |             cout << v[i].first << endl;
      |                                   ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <algorithm>
  +++ |+#include <ostream>
    4 |
Language: C++

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

using namespace std;

int N;
long long K;
vector<pair<int,int> > v;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     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 <algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:23:13: error: 'cout' was not declared in this scope
   23 |             cout << v[i].first << endl;
      |             ^~~~
a.cc:23:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:35: error: 'endl' was not declared in this scope
   23 |             cout << v[i].first << endl;
      |                                   ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <algorithm>
  +++ |+#include <ostream>
    4 | 
a.cc:27:14: error: expected '}' at end of input
   27 |     return 0;
      |              ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C++

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


int main() {
  int N;
  long long K;
  cin >> N >> K;
  vector<int> A(pow(10, 5) + 1);
  int a, b;
  for (int i=0; i<N; ++i) {
    cin >> a >> b;
    A[a] += b;
  }
  
  long long cnt = 0;
  for (int ans=1; ans<=pow(10, 5); ++ans) {
    if (K <= cnt[ans]) {
      cout << ans << endl;
      break;
    }
    K -= cnt[ans];
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: invalid types 'long long int[int]' for array subscript
   18 |     if (K <= cnt[ans]) {
      |                 ^
a.cc:22:13: error: invalid types 'long long int[int]' for array subscript
   22 |     K -= cnt[ans];
      |             ^
Language: C++

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

int N
long long A[100001], K;

int main(){
	long long cnt = 0;
	cin >> N >> K;
	for(int i = 0; i < N; i++){
		int a, b;
		cin >> a >> b;
		A[a] += b;
	}
	for(int i = 1; i < 100001; i++){
		cnt += A[i];
		if(cnt >= K){
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}


Compiler output:
a.cc:5:1: error: expected initializer before 'long'
    5 | long long A[100001], K;
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:16: error: 'N' was not declared in this scope
    9 |         cin >> N >> K;
      |                ^
a.cc:9:21: error: 'K' was not declared in this scope
    9 |         cin >> N >> K;
      |                     ^
a.cc:13:17: error: 'A' was not declared in this scope
   13 |                 A[a] += b;
      |                 ^
a.cc:16:24: error: 'A' was not declared in this scope
   16 |                 cnt += A[i];
      |                        ^
Language: C++

#include<cstdio>
using namespace std;
const int A=1e5+5; 
long long bo[A];
int main()
{
    int N,K,a,b,cnt=0;
	scanf("%d%d",&N,&K); 
    for(int i=1;i<=N;i++)
    {
    	scanf("%d%d",&a,&b);
    	bo[a]+=b;
	}
	for(int i=1;i<=1e5;i++)
	{
		cnt+=bo[i];
		if(cnt>=K)
		{
			printf("%d",i)\n;
			return 0;
		}
	}
	return 0;
}


Compiler output:
a.cc:19:39: error: stray '\' in program
   19 |                         printf("%d",i)\n;
      |                                       ^
a.cc: In function 'int main()':
a.cc:19:39: error: expected ';' before 'n'
   19 |                         printf("%d",i)\n;
      |                                       ^~
      |                                       ;
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
int dc=100000;
#define MAX 100010
typedef long int li;
typedef struct{
  int a;
  int b;
}data;
data array[MAX];
int comp(const void*a,const void*b){
  int x=*((data*)a),y=*((data*)b);
  return x.a-y.a;
}

int main(){
  if(df)printf("*** debug mode ***\n");
  long int n,k,i;
  scanf("%ld%ld",&n,&k);
  for(i=0;i<n;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    array[i].a=a;
    array[i].b=b;
  }
  qsort(array,n,sizeof(data),comp);
  i=0;
  while(k>0){
    k-=array[i].b;
    i++;
  }
  
  printf("%d",array[i-1].a);
  return 0;
}


/// confirm df==0 ///


Compiler output:
main.c: In function 'comp':
main.c:14:9: error: incompatible types when initializing type 'int' using type 'data'
   14 |   int x=*((data*)a),y=*((data*)b);
      |         ^
main.c:14:23: error: incompatible types when initializing type 'int' using type 'data'
   14 |   int x=*((data*)a),y=*((data*)b);
      |                       ^
main.c:15:11: error: request for member 'a' in something not a structure or union
   15 |   return x.a-y.a;
      |           ^
main.c:15:15: error: request for member 'a' in something not a structure or union
   15 |   return x.a-y.a;
      |               ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

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

int main() {
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> v(1e5+1, 0);
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    v[a] += b;
  }
  ll sum = 0
  int ans;
  rep(i, N+1) {
    sum += v[i];
    if(sum >= K) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:3: error: expected ',' or ';' before 'int'
   31 |   int ans;
      |   ^~~
a.cc:35:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |       ans = i;
      |       ^~~
      |       abs
a.cc:39:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

// In His Name

#include <Bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define ll long long
#define gcd __gcd

using namespace std;

typedef pair<int, int> pii;

ll n, k;
map <ll, ll> mp;

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n >> k;
	for (int i = 0 ; i < n ; i++){
        int x, y;
        cin >> x >> y;
        mp[x] += y;
	}
	ll tedad = 0;
	for (auto u : mp){
        tedad += u.S;
        if (tedad >= k){
            cout << u.F;
            return 0;
        }
	}
}

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

n, k = [int(i) for i in input().split()]
m = sorted([[int(i) for i in input().split()] for _ in range(n)]

s=0
i=0
while s<k:
    s += m[i][1]
    i += 1
print(m[i-1][0])

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, k = [int(i) for i in input().split()]
      | ^
Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;
int main() {
int a,b;
cin>>a>>b;
vector<pair<int,int>> c(a);
for(int i=0;i<a;i++){
	int X,Y;
	cin >> X >> Y;
	c.at(i) = make_pair(X,Y);
}
  sort(c.begin(),c.end());
 	int count = 0;
 	int answer = 0;
 	for(int i = 0;i < a;i++) {
 		if(b - count <= c[i].second) {
 			answer = c[i].first;
 			break;
 		}
 		count += c[i].second;
 	}
  cout << answer << endl;
}


		


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

#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
vector<pair<int,int>> c(a);
for(int i=0;i<a;i++){
	int X,Y;
	cin >> X >> Y;
	c.at(i) = make_pair(X,Y);
}
  sort(vec.begin(),vec.end());
 	int count = 0;
 	int answer = 0;
 	for(int i = 0;i < a;i++) {
 		if(b - count <= c[i].second) {
 			answer = c[i].first;
 			break;
 		}
 		count += c[i].second;
 	}


		


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'vec' was not declared in this scope
   12 |   sort(vec.begin(),vec.end());
      |        ^~~
a.cc:21:10: error: expected '}' at end of input
   21 |         }
      |          ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
vector<pair<int,int>> c(a);
for(int i=0;i<a;i++){
	int X,Y;
	cin >> X >> Y;
	c.at(i) = make_pair(X,Y);
}
  sort(vec.begin(),vec.end());
 	int count = 0;
 	int answer = 0;
 	for(int i = 0;i < N;i++) {
 		if(K - count <= vec[i].second) {
 			answer = vec[i].first;
 			break;
 		}
 		count += vec[i].second;
 	}


		


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'vec' was not declared in this scope
   12 |   sort(vec.begin(),vec.end());
      |        ^~~
a.cc:15:27: error: 'N' was not declared in this scope
   15 |         for(int i = 0;i < N;i++) {
      |                           ^
a.cc:16:20: error: 'K' was not declared in this scope
   16 |                 if(K - count <= vec[i].second) {
      |                    ^
a.cc:21:10: error: expected '}' at end of input
   21 |         }
      |          ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

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

}

		


Compiler output:
a.cc: In function 'int main()':
a.cc:19:8: error: no match for 'operator+=' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'})
   19 |   count+=c[i]second;
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 

using namespace std;

int main(){

    int n
    ll k;
    cin >> n >> k;

    vector<pair<int,int>> v;

    rep(i,n){
        int a,b;
        cin >> a >> b;

        v.pback(mpair(a,b));
    }

    sort(ALL(v));

    int ans;

    rep(i,n){
        ans = v[i].first;
        k = k - v[i].second;

        if(k <= 0) break;
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:12: error: expected initializer before 'long'
    2 | #define ll long long
      |            ^~~~
a.cc:16:5: note: in expansion of macro 'll'
   16 |     ll k;
      |     ^~
a.cc:17:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   17 |     cin >> n >> k;
      |            ^
      |            yn
a.cc:17:17: error: 'k' was not declared in this scope
   17 |     cin >> n >> k;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;

int main() {
    ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    ll K; cin >> K;
    ll sum=0;
  	ll num[100000]={};
    for(int i=0;i<N;i++){
        ll a,b;
        cin >> a >> b;
      	num[a]+=b;
    }
    ll mat=0:
  	for(int i=0;i<100001;i++){
      	mat+=num[i];
      	if(mat>=K){
          	cout << i;
          	break;
        }
    }
}

/*



 */



Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: expected ',' or ';' before ':' token
   20 |     ll mat=0:
      |             ^
a.cc:21:21: error: 'i' was not declared in this scope
   21 |         for(int i=0;i<100001;i++){
      |                     ^