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

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

int main(){
    long long n,k;
    cin>>n>>k;
    int a[n],b[n];
    vector<pair<int,int>> v;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        v.push_back(make_pair(a[i],b[i]));
    }
    sort(v.begin(),v.end());
    long long cnt=0;
    for(auto i:v){
        cnt+=i.second();
        if(cnt>=k){
            cout<<i.first<<endl;
            return 0;
        }
    }




}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: expression cannot be used as a function
   16 |         cnt+=i.second();
      |              ~~~~~~~~^~
Language: C++

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

int main(){
  int n;
  long long int k,count=0;
  cin >> n >> k;
  vector<int> a(n),b(n)
  vector<long long int> c(100001,0);
  for(int i=0;i<n;i++)cin >> a.at(i) >> b.at(i);
  for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i);
  for(int i=1;i<100001;i++){
    count += c.at(i);
    if(count >= k){
      cout << i << endl;
      break;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected ',' or ';' before 'vector'
   10 |   vector<long long int> c(100001,0);
      |   ^~~~~~
a.cc:12:23: error: 'c' was not declared in this scope
   12 |   for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i);
      |                       ^
a.cc:14:14: error: 'c' was not declared in this scope
   14 |     count += c.at(i);
      |              ^
Language: C++

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

int main(){
  int n;
  long long int k,count=0;
  cin >> n >> k;
  vector<int> a(n),b(n)
  vector<long long int>c(100001,0);
  for(int i=0;i<n;i++)cin >> a.at(i) >> b.at(i);
  for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i);
  for(int i=1;i<100001;i++){
    count += c.at(i);
    if(count >= k){
      cout << i << endl;
      break;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected ',' or ';' before 'vector'
   10 |   vector<long long int>c(100001,0);
      |   ^~~~~~
a.cc:12:23: error: 'c' was not declared in this scope
   12 |   for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i);
      |                       ^
a.cc:14:14: error: 'c' was not declared in this scope
   14 |     count += c.at(i);
      |              ^
Language: C++

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

int main(){
  int N,K;
  cin >> N >> K;
  for(int i=0;i<N,i++){
    int A,B;
    cin >> A >> B;
    K -= B;
    if(K<=0){
      cout << A << endl;
      return 0;
    }
  }
}
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before ')' token
    8 |   for(int i=0;i<N,i++){
      |                      ^
      |                      ;
Language: C++

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

int n,k;
vector<pair<int, int>> ab;

void input(){
  cin >> n >> k;
  for(int i=0;i<n;++i){
    int x, y;
    cin >> x >> y;
    ab.push_back(make_pair(x, y));
  }
  ab.push_back(INF);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  input();
  sort(ab.begin(), ab.end());
  int index = 0;
  while(k > 0){
    //cout << ab[index].second << endl;
    k -= ab[index].second;
    index++;
  }
  cout << ab[index-1].first << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void input()':
a.cc:24:15: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(double)'
   24 |   ab.push_back(INF);
      |   ~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'double' to 'const std::vector<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'double' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

int n,k;
vector<pair<int, int>> ab;

void input(){
  cin >> n >> k;
  for(int i=0;i<n;++i){
    int x, y;
    cin >> x >> y;
    ab.push_back(make_pair(x, y));
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  input();
  sort(ab.begin(), ab.end(), [](const auto& a, const auto& b){return a.first > b.first;});
  int index = 0;
  while(k > 0){
    k -= ab[index].second;
    index++;
  }
  cout << ab[index].first << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void input()':
a.cc:25:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   25 | int main()
      |         ^~
a.cc:25:9: note: remove parentheses to default-initialize a variable
   25 | int main()
      |         ^~
      |         --
a.cc:25:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:26:1: error: a function-definition is not allowed here before '{' token
   26 | {
      | ^
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:17:13: note: to match this '{'
   17 | void input(){
      |             ^
Language: C++

#include <iostream>
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
#define Pair pair<int, int>

int N, K;
int a[100000];
int b[100000];
vector<Pair> ab;

bool compare(Pair x, Pair y){
	return x.first < y.first;
}

int solve(){
	int count=0;
	int ans;
	sort(ab.begin(), ab.end(), compare);
	int i=0;
	while(count < K){
		ans = ab[i].first;
		count += ab[i].second;
		i++;
	}
	cout << ans << endl;
	return 0;
}



int main(){
	cin >> N >> K;
	ab.resize(N);
	for(int i=0; i<N; i++){
		cin >> a[i] >> b[i];
		ab.puch_back({a[i], b[i]});
	}
	solve();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:20: error: 'class std::vector<std::pair<int, int> >' has no member named 'puch_back'; did you mean 'push_back'?
   40 |                 ab.puch_back({a[i], b[i]});
      |                    ^~~~~~~~~
      |                    push_back
Language: C++

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll T[100005];

int main()
{
    int N;
    ll K;
    cin >> N >> K;
    REP(i, N)
    {
        cin >> T[i].first >> T[i].second;
    }
    sort(T, T + N, [](pll a, pll b) { return a.first < b.first });
    REP(i, N)
    {
        K -= T[i].second;
        if (K <= 0)
        {
            cout << T[i].first << endl;
            break;
        }
    }
    return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:25:63: error: expected ';' before '}' token
   25 |     sort(T, T + N, [](pll a, pll b) { return a.first < b.first });
      |                                                               ^~
      |                                                               ;
Language: C++

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

int n;
ll k;
vector<pair<int, int>> x;

void solve() {
  int i = 0;

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

  while (k > 0) {
    k -= x[i].second;
    if (k > 0) {
      i++;
    }
  }

  cout << x[i].first << "\n";
}

int main() {
  int i;

  cin >> n >> k;

  x.resize(n);
  for (i = 0; i < n; i++) {
    cin >> x[i].first >> x[i].second;
  }

  solve();

  return 0;
}


Compiler output:
a.cc:5:1: error: 'll' does not name a type
    5 | ll k;
      | ^~
a.cc: In function 'void solve()':
a.cc:13:10: error: 'k' was not declared in this scope
   13 |   while (k > 0) {
      |          ^
a.cc: In function 'int main()':
a.cc:26:15: error: 'k' was not declared in this scope
   26 |   cin >> n >> k;
      |               ^
Language: C

N,K = map(int,raw_input().split())

data = [map(int,raw_input().split()) for i in range(N)]

data.sort()

cnt = 0

for i in data:
    cnt += i[1]
    if cnt >= K:
        print i[0]
        break

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N,K = map(int,raw_input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'K' [-Wimplicit-int]
    1 | N,K = map(int,raw_input().split())
      |   ^
main.c:1:7: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N,K = map(int,raw_input().split())
      |       ^~~
main.c:1:11: error: expected expression before 'int'
    1 | N,K = map(int,raw_input().split())
      |           ^~~
main.c:3:1: error: expected ',' or ';' before 'data'
    3 | data = [map(int,raw_input().split()) for i in range(N)]
      | ^~~~
Language: C++

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


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

}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'ill' was not declared in this scope; did you mean 'll'?
   16 |     for(ill i=1;i<=100000;i++){
      |         ^~~
      |         ll
a.cc:16:17: error: 'i' was not declared in this scope
   16 |     for(ill i=1;i<=100000;i++){
      |                 ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
  long long n, k, a, b;
  cin >> n >> k;
  vector<long long> v;
  for(long long i = 0 ; i < n; i++){
    cin >> a >> b;
    vector<long long> c(b, a);
    v.insert(v.end(), c.begin(), c.end());
  }
  sort(v.begin(), v.end());
  cout << v[k-1] << endl;
}


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

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
#define rep(i, n) for(int i = 0; i < n; i++)
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main(){
    ll n, k; cin >> n >> k;
    ll a[n], b[n];
    sum = 0;
    ll ans = 0;
    rep(i, n){
        cin >> a[i] >> b[i];
        sum += b[i];
        if(sum >= k){
            ans = a[i];
            break;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sum' was not declared in this scope
   16 |     sum = 0;
      |     ^~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

#define INF (1e9)

int main(int argc, const char *argv[])
{
    ll N, K, a, b;
    cin >> N >> K;

    vector<pair<ll, ll> > v;
    for (ll i = 0; i < N; i++)
    {
        cin >> a >> b;
        v.push_back(pair<ll, ll>(a, b));
    }

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

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


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

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


public class Main {
  private static class Tuple {
    public final int a;
    public final long b;
    public Tuple(int a, long b) {
      this.a = a;
      this.b = b;
    }
  }
  public static void main(String[] args) throws Throwable {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long K = scanner.nextLong();
    Tuple[] ab = new Tuple[N];
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      int b = scanner.nextLong();
      ab[i] = new Tuple(a, b);
    }
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));

    int lastA = -1;
    long k = 0;
    for (int i = 0; k < K && i < N; i++) {
      k += ab[i].b;
      lastA = ab[i].a;
    }

    System.out.println(lastA);
  }
}

Compiler output:
Main.java:21: error: incompatible types: possible lossy conversion from long to int
      int b = scanner.nextLong();
                              ^
1 error
Language: Java

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


public class Main {
  private static class Tuple {
    public final int a;
    public final long b;
    public Tuple(int a, long b) {
      this.a = a;
      this.b = b;
    }
  }
  public static void main(String[] args) throws Throwable {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long K = scanner.nextLong();
    Tuple[] ab = new Tuple[N];
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      int b = scanner.nextLong();
      ab[i] = new Tuple(a, b);
    }
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));

    Integer lastA = null;
    long k = 0;
    for (int i = 0; k < K && i < N; i++) {
      k += ab[i].b;
      lastA = ab[i].a;
    }

    System.out.println(lastA);
  }
}

Compiler output:
Main.java:21: error: incompatible types: possible lossy conversion from long to int
      int b = scanner.nextLong();
                              ^
1 error
Language: Java

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


public class Main {
  private static class Tuple {
    public final int a;
    public final long b;
    public Tuple(int a, long b) {
      this.a = a;
      this.b = b;
    }
  }
  public static void main(String[] args) throws Throwable {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long K = scanner.nextLong();
    Tuple[] ab = new Tuple[N];
    for (int i = 0; i < N; i++) {
      long a = scanner.nextLong();
      long b = scanner.nextLong();
      ab[i] = new Tuple(a, b);
    }
    if (true) return;
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));

    Integer lastA = null;
    long k = 0;
    for (int i = 0; k < K && i < N; i++) {
      k += ab[i].b;
      lastA = ab[i].a;
    }

    System.out.println(lastA);
  }
}

Compiler output:
Main.java:22: error: incompatible types: possible lossy conversion from long to int
      ab[i] = new Tuple(a, b);
                        ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

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


public class Main {
  private static class Tuple {
    public final long a;
    public final long b;
    public Tuple(long a, long b) {
      this.a = a;
      this.b = b;
    }
  }
  public static void main(String[] args) throws Throwable {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextLong();
    long K = scanner.nextLong();
    Tuple[] ab = new Tuple[N];
    for (int i = 0; i < N; i++) {
      long a = scanner.nextLong();
      long b = scanner.nextLong();
      ab[i] = new Tuple(a, b);
    }
    if (true) return;
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));

    Integer lastA = null;
    long k = 0;
    for (int i = 0; k < K && i < N; i++) {
      k += ab[i].b;
      lastA = ab[i].a;
    }

    System.out.println(lastA);
  }
}

Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from long to int
    int N = scanner.nextLong();
                            ^
Main.java:25: error: incompatible types: possible lossy conversion from long to int
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));
                                               ^
Main.java:31: error: incompatible types: long cannot be converted to Integer
      lastA = ab[i].a;
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
Language: Java

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


public class Main {
  private static class Tuple {
    public final long a;
    public final long b;
    public Tuple(long a, long b) {
      this.a = a;
      this.b = b;
    }
  }
  public static void main(String[] args) throws Throwable {
    Scanner scanner = new Scanner(System.in);
    long N = scanner.nextLong();
    long K = scanner.nextLong();
    Tuple[] ab = new Tuple[N];
    for (Long i = 0; i < N; i++) {
      long a = scanner.nextLong();
      long b = scanner.nextLong();
      ab[i] = new Tuple(a, b);
    }
    if (true) return;
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));

    Integer lastA = null;
    long k = 0;
    for (long i = 0; k < K && i < N; i++) {
      k += ab[i].b;
      lastA = ab[i].a;
    }

    System.out.println(lastA);
  }
}

Compiler output:
Main.java:18: error: incompatible types: possible lossy conversion from long to int
    Tuple[] ab = new Tuple[N];
                           ^
Main.java:19: error: incompatible types: int cannot be converted to Long
    for (Long i = 0; i < N; i++) {
                  ^
Main.java:22: error: incompatible types: Long cannot be converted to int
      ab[i] = new Tuple(a, b);
         ^
Main.java:25: error: incompatible types: possible lossy conversion from long to int
    Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a));
                                               ^
Main.java:30: error: incompatible types: possible lossy conversion from long to int
      k += ab[i].b;
              ^
Main.java:31: error: incompatible types: possible lossy conversion from long to int
      lastA = ab[i].a;
                 ^
Main.java:31: error: incompatible types: long cannot be converted to Integer
      lastA = ab[i].a;
                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
7 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  long long intk;
  cin >> n >> k;
  vector<long long int> num(100001,0);
  for(int i = 0;i < n;i++){
    int a,b;
    cin >> a >> b;
    num[a] += b;
  }
  long int count = 0;
  for(int i = 1;i <= 100000;i++){
    count += num[i];
    if(count >= k){
      cout << i << endl;
      break;
    }
  }
}
  


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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> num(100001,0);
  for(int i = 0;i < n;i++){
    int a,b;
    cin >> a >> b;
    num[a] += b;
  }
  int count = 0;
  for(int i = 1;i < 100001;i++){
    count += num[i];
    if(count >= k){
      cout << i << endl;
      break;
    }
  }
  


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

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

ll x[100001]={};
ll a[100001];
ll b[100001];
int main() {

	int n,k;
	int r=0;

	cin>>n>>k;

	rep(i,n){
		cin>>a[i]>>b[i];
		x[a[i]]+=b[i];
		r=max(r,a[i]);
	}
	int total=0;
	rep(i,r+1){
		total+=x[i];
		if(total>=k){
			cout<<i<<endl;
			return 0;
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:22: error: no matching function for call to 'max(int&, ll&)'
   35 |                 r=max(r,a[i]);
      |                   ~~~^~~~~~~~
In file included 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   35 |                 r=max(r,a[i]);
      |                   ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:35:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |                 r=max(r,a[i]);
      |                   ~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main()
{
 	int a,b;
 	cin>>a>>b;
 	//if(a*b/3%a!=0||a*b/3%b!=0) cout<<4;
 	else cout<<a*b%3;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'else' without a previous 'if'
   10 |         else cout<<a*b%3;
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
pair<int,int> v[1e5+10];
int main(){
	long long n,k,i,j;
	cin>>n>>k;
	for(i=1;i<=n;i++){
		int t1,t2;
		cin>>t1>>t2;
		v[i].first=t1;
		v[i].second=t2;
		
	}
	sort(v+1,v+n+1);
	int pre=0,ans;
	for(i=1;i<=n;i++){
		if(pre<k&&k<=pre+v[i].second){
			ans=v[i].first;
			break;
		}
		pre+=v[i].second;
	}
	cout<<ans;
}


Compiler output:
a.cc:3:20: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    3 | pair<int,int> v[1e5+10];
      |                 ~~~^~~
a.cc:3:20: error: could not convert '(1.0e+5 + (double)10)' from 'double' to 'long unsigned int'
    3 | pair<int,int> v[1e5+10];
      |                 ~~~^~~
      |                    |
      |                    double
a.cc:3:20: error: size of array 'v' has non-integral type 'double'
Language: C++

#include<bits/stdc++.h>
using namespace std;
int v[100010];
int main(){
	int n,k,i,j,k=0;
	cin>>n>>k;
	for(i=1;i<=n;i++){
		int t1,t2;
		cin>>t1>>t2;
		for(j=1;j<=t2;j++){
			v[++k]=t1;
		}
	}
	sort(v+1,v+k+1);
	cout<<v[k];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:21: error: redeclaration of 'int k'
    5 |         int n,k,i,j,k=0;
      |                     ^
a.cc:5:15: note: 'int k' previously declared here
    5 |         int n,k,i,j,k=0;
      |               ^
Language: C++

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

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

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

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

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1 using ll = long long;
      | ^
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2 const int AMAX = 100000;
      | ^
a.cc:3:1: error: expected unqualified-id before numeric constant
    3 | 3 ll cnt[AMAX + 1];
      | ^
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4
      | ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<pair<int, int>> v;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(v.begin(), v.end());
    vector<int> a(n), b(n); //1つのvetor 要素n個
    for (int i = 0; i < n; i++) {
        a[i] = v[i].first;
        b[i] = v[i].second;
    }
    for (int i = 0; i < n; ++i) {
        if (b[i] >= k) {
            cout << a[i] << endl;
            return 0;
        } else {
            k -= b[i];
        }
    }
}


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

#include<iostream>
using namespace std;
typedef pair<int, int> P;
#define N 100000
int main() {
    int n, k;
    cin >> n >> k;
    int a[N], b[N];
    P p[N];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        p[i] = {a[i], b[i]};
    }
    sort(p, p + n);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        sum += p[i].second;
        if (sum >= k) {
            cout << p[i].first << endl;
            return 0;
        }
    }
}


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

#include<iostream>
using namespace std;
int main() {
    int check[100000];
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        for (int j = 0; j < b; j++) {
            check[cnt] = a;
            cnt++;
        }
    }/*
    for (int i = 0; i < cnt; i++) {
        cout << check[i] << endl;
    }*/
    sort(check, check + n);
    cout << check[k - 1] << endl;
}


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

#include<stdio.h>

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


Compiler output:
main.c: In function 'main':
main.c:7:27: error: redefinition of 'tmp'
    7 |                 long long tmp=0,ans[100001]={0};
      |                           ^~~
main.c:4:29: note: previous definition of 'tmp' with type 'long long int'
    4 |                 long long k,tmp=0,ans[100001]={0};
      |                             ^~~
main.c:7:33: error: redefinition of 'ans'
    7 |                 long long tmp=0,ans[100001]={0};
      |                                 ^~~
main.c:4:35: note: previous definition of 'ans' with type 'long long int[100001]'
    4 |                 long long k,tmp=0,ans[100001]={0};
      |                                   ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

const double eps = 1e-10;
const int MOD = 1000000007;

void printv(vector<auto> const& s) {
  REP(i, s.size()) {
    cout << s[i] << endl;
  }
}

void print(auto const s) {
  cout << s << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, k; cin >> n >> k;
  vector<PLL> p(n);
  REP(i, n) {
    cin >> p[i].fi >> p[i].se;
  }

  sort(ALL(p));

  ll cnt = 0;
  REP(i, n) {
    cnt += p[i].se;
    if(cnt >= k) {
      cout << p[i].fi << endl;
      break;
    }
  }
}


Compiler output:
a.cc:24:20: warning: use of 'auto' in template argument only available with '-fconcepts-ts'
   24 | void printv(vector<auto> const& s) {
      |                    ^~~~
a.cc:30:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   30 | void print(auto const s) {
      |            ^~~~
a.cc: In function 'int main()':
a.cc:39:10: error: 'PLL' was not declared in this scope; did you mean 'ALL'?
   39 |   vector<PLL> p(n);
      |          ^~~
      |          ALL
a.cc:39:13: error: template argument 1 is invalid
   39 |   vector<PLL> p(n);
      |             ^
a.cc:39:13: error: template argument 2 is invalid
a.cc:41:13: error: invalid types 'int[int]' for array subscript
   41 |     cin >> p[i].fi >> p[i].se;
      |             ^
a.cc:41:24: error: invalid types 'int[int]' for array subscript
   41 |     cin >> p[i].fi >> p[i].se;
      |                        ^
a.cc:13:20: error: request for member 'begin' in 'p', which is of non-class type 'int'
   13 | #define ALL(a) (a).begin(), (a).end()
      |                    ^~~~~
a.cc:44:8: note: in expansion of macro 'ALL'
   44 |   sort(ALL(p));
      |        ^~~
a.cc:13:33: error: request for member 'end' in 'p', which is of non-class type 'int'
   13 | #define ALL(a) (a).begin(), (a).end()
      |                                 ^~~
a.cc:44:8: note: in expansion of macro 'ALL'
   44 |   sort(ALL(p));
      |        ^~~
a.cc:48:13: error: invalid types 'int[int]' for array subscript
   48 |     cnt += p[i].se;
      |             ^
a.cc:50:16: error: invalid types 'int[int]' for array subscript
   50 |       cout << p[i].fi << endl;
      |                ^
Language: C++

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

int main(void){
  int n, k, so[100010];
  for(int i=;i<100010;++i) so[i] = 0;
  cin >> n >> k;
  for(int i=0;i<n;++i){
    int a, b;
    cin >> a >> b;
    so[a] = b;
  }
  int sum = 0;
  for(int i=0;i<n;++i){
    sum += so[i];
    if(sum >= k){
      cout << i << endl;
      return 0
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: expected primary-expression before ';' token
    6 |   for(int i=;i<100010;++i) so[i] = 0;
      |             ^
a.cc:18:15: error: expected ';' before '}' token
   18 |       return 0
      |               ^
      |               ;
   19 |     }
      |     ~          
a.cc:20:2: error: expected '}' at end of input
   20 | }
      |  ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <utility>

using namespace std;



int main(){

// 3 4
// 1 1
// 2 2
// 3 3

	int N,K;
	cin >> N >> K;

	std::vector<pair<int,int>> v;

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


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

	for(int i=0; i<N; i++){
		K-=v[i].second;
		if(K<=0){
			cout << v[i].first << endl;
			return 1;
		}
	}
}


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

#include <bits/stdc++.h>
using namespace std;
long long mon[100005];
int main(){
    int a;
    long long b;
    cin >> a >> b;
    for (int i = 0; i < a; ++i) {
        int aa, bb;
        cin >> aa >> bb;
        mon[aa] += bb; 
    }
    for (int i = 1; i <= 100005; ++i){
        if (b <= mon[ans]) {
            cout << i << endl;
            break; 
        }
        b -= mon[i];
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         if (b <= mon[ans]) {
      |                      ^~~
      |                      abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int n,k,sum=0,che,s=0;cin>>n>>k;
  long long int a[n],b[n];
  vector<long long int> v(n),w={};
  for(long long int i=0;i<n;i++) cin>>a[i]>>b[i];
  for(long long int i=0;i<n;i++) v.at(i)=a[i];
  sort(v.begin(),v.end());
  w.push_back(v.at(0));
  che=v.at(0);
  for(long long int i=1;i<n;i++){
    if(che!=v.at(i)){
      w.push_back(v.at(i));
      che=v.at(i);
    }
  }
  for(long long int i=0;i<w.size();i++){
    for(long long int j=0;j<n;j++){
      if(a[j]==w.at(i)){
        sum+=b[j];
      }
      if(sum>=k){
        s=1;
        cout<<w.at(i)<<endl;
        break;
      }
    }
    if(s==1) break;
    }
  }
}


Compiler output:
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: Java

import java.util.*;

public class Main {
 public static void main(Stirng args[]) {
     Scanner sc = new Scanner(System.in);
     int n = sc.nextInt();
     int k = sc.nextInt();
     ArrayList<Integer> box = new ArrayList<>();
     for (int i = 0; i < n; i++) {
         int a = sc.nextInt();
         int b = sc.nextInt();
         for(int j = 0; j < b; j++) {
            box.add(a);
         }
     }
     System.out.println(box.get(k - 1));
 }
}

Compiler output:
Main.java:4: error: cannot find symbol
 public static void main(Stirng args[]) {
                         ^
  symbol:   class Stirng
  location: class Main
1 error
Language: C++

//17:14
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;
ll max(ll a, ll b){return(a>b)?a:b;}
ll min(ll a, ll b){return(a<b)?a:b;}
ll abs(ll a){return(a<0)?-a:a;}

ll gcd(ll a, ll b){
        if(b > a){
                ll tmp = b;
                b = a;
                a = tmp;
        }
        if(b == 0) return a;
        else return gcd(b, a%b);
}
ll lcm(ll a, ll b){
        ll gcdi = gcd(a,b);
        return a/gcdi*(b);
}

ll diff(ll a, ll b, ll c){
        return max(a,max(b,c))-min(a,min(b,c));
}
#define MOD (1000000000+7)
typedef struct tuple{
        ll a,b;
}tuple;

tuple arr[100000];

int main(){
        ll N,K;
        scanf("%lld %lld",&N,&K);

        map<ll,ll> dict;
        ll a,b;
        for(int i = 0; i < N; i++){
                scanf("%lld %lld",&a,&b);
                dict[a] += b;
        }

        map<ll,ll>::iterator it = dict.begin();

        while(it != dict.end()){
                K -= it->second;
                if(K <= 0) break;
                ++it;
        }
        printf("%lld\n",it->first);
}


Compiler output:
a.cc:35:1: error: reference to 'tuple' is ambiguous
   35 | tuple arr[100000];
      | ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple'
   92 |     class tuple;
      |           ^~~~~
a.cc:33:2: note:                 'typedef struct tuple tuple'
   33 | }tuple;
      |  ^~~~~
Language: C++

//17:14
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;
ll max(ll a, ll b){return(a>b)?a:b;}
ll min(ll a, ll b){return(a<b)?a:b;}
ll abs(ll a){return(a<0)?-a:a;}

ll gcd(ll a, ll b){
        if(b > a){
                ll tmp = b;
                b = a;
                a = tmp;
        }
        if(b == 0) return a;
        else return gcd(b, a%b);
}
ll lcm(ll a, ll b){
        ll gcdi = gcd(a,b);
        return a/gcdi*(b);
}

ll diff(ll a, ll b, ll c){
        return max(a,max(b,c))-min(a,min(b,c));
}
#define MOD (1000000000+7)
typedef struct tuple{
        ll a,b;
}tuple;

tuple arr[100000];

int main(){
        ll N,K;
        scanf("%lld %lld",&N,&K);

        map<ll,ll> dict;
        ll a,b;
        for(int i = 0; i < N; i++){
                scanf("%lld %lld",&a,&b);
                dict[a] += b;
        }

        map<ll,ll>::iterator it = dict.begin();

        while(it != dict.end()){
                K -= it->second;
                if(K <= 0) break;
                ++it;
        }
        printf("%lld\n",it->first);
}
~

Compiler output:
a.cc:35:1: error: reference to 'tuple' is ambiguous
   35 | tuple arr[100000];
      | ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple'
   92 |     class tuple;
      |           ^~~~~
a.cc:33:2: note:                 'typedef struct tuple tuple'
   33 | }tuple;
      |  ^~~~~
a.cc:57:2: error: expected class-name at end of input
   57 | ~
      |  ^
Language: C++

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

using namespace std;

int main() {
	using ll = long long;
	const int AMAX = 100000;
	ll cnt[AMAX + 1];
	int n, i, a, b, ans;
	ll k;

	cin >> n >> k;

	for (i = 0; i < n; i++) {
		cin >> a >> B;
		cnt[a] += b;
	}

	for (ans = 1; ans <= AMAX; ans++) {
		if (k <= cnt[ans]) {
			cout << ans;
			break;
		}
		k -= cnt[ans];
	}
	return 0;
}

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

/*  
   |\_/|
   |* *|
   \_+_/
          */
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/


  long logn N,K;

  cin>>N>>K;

  long long ans[100001]={ };

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

    cin>>a>>b;


    ans[a]+=b;

  }

  long long cnt=0;
  
  for(int i=1;i<=100000;i++){

    cnt+=ans[i];
    
    if(cnt>=K){
      cout<<i<<endl;
      break;
    }

  }
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: expected initializer before 'N'
   18 |   long logn N,K;
      |             ^
a.cc:20:8: error: 'N' was not declared in this scope
   20 |   cin>>N>>K;
      |        ^
a.cc:20:11: error: 'K' was not declared in this scope
   20 |   cin>>N>>K;
      |           ^
Language: C++

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    ll n,k;cin>>n>>k;
    map<ll,ll> mp;
    for(int i=0;i<n;i++){
        ll a,b;cin>>a>>b;
        mp[a]+=b;
    }
    ll cnt=0;
    for(auto itr=mp.begin(),itr!=mp.end();itr++){
        P p=*itr;
        cnt += p.second;
        if(cnt>=k){
            cout<<p.first<<endl;
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: expected ';' before '!=' token
   23 |     for(auto itr=mp.begin(),itr!=mp.end();itr++){
      |                                ^~
      |                                ;
a.cc:23:32: error: expected primary-expression before '!=' token
   23 |     for(auto itr=mp.begin(),itr!=mp.end();itr++){
      |                                ^~
Language: C

#include<cstdio>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
  int j=0;
  long n,k;
  pair<long,long> a[100000];
  scanf("%ld %ld",&n,&k);
  for(int i=0;i<n;i++)
    scanf("%ld %ld",&a[i].first,&a[i].second);
  sort(a,a+n);
  while(k>0){
    k-=a[j].second;
    j++;
  }
  printf("%ld\n",a[j-1].first);
}


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


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define mp make_pair
#define int long long
using namespace std;





int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
bool comp(const P& p1, const P&p2) {
	return p1.second < p2.second;
}

ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

typedef pair<int, int> P;

vector<P>x;
signed main() {
	int N, K; cin >> N >> K;
	REP(i, N) {
		int a, b; cin >> a >> b;
		x.pb(mp(a, b));
	}
	VSORT(x);
	ll cnt = 0;
	int i = 0;
	while (cnt < K) {
		cnt += x[i].second;
		i++;
	}
	ll ans = x[i-1].first;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:41:17: error: 'P' does not name a type
   41 | bool comp(const P& p1, const P&p2) {
      |                 ^
a.cc:41:30: error: 'P' does not name a type
   41 | bool comp(const P& p1, const P&p2) {
      |                              ^
a.cc: In function 'bool comp(const int&, const int&)':
a.cc:42:19: error: request for member 'second' in 'p1', which is of non-class type 'const int'
   42 |         return p1.second < p2.second;
      |                   ^~~~~~
a.cc:42:31: error: request for member 'second' in 'p2', which is of non-class type 'const int'
   42 |         return p1.second < p2.second;
      |                               ^~~~~~
Language: C++


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define mp make_pair
#define int long long
using namespace std;

typedef pair<int, int> P;



int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

vector<P>x;
int main() {
	int N, K; cin >> N >> K;
	REP(i, N) {
		int a, b; cin >> a >> b;
		x.pb(mp(a, b));
	}
	VSORT(x);
	ll cnt = 0;
	int i = 0;
	while (cnt < K) {
		cnt += x[i].second;
		i++;
	}
	ll ans = x[i-1].first;
	cout << ans << endl;
	return 0;
}


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


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define mp make_pair
#define int long long
using namespace std;

typedef pair<int, int> P;



int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

vector<P>x;
int main() {
	int N, K; cin >> N >> K;
	REP(i, N) {
		int a, b; cin >> a >> b;
		x.pb(mp(a, b));
	}
	VSORT(x);
	ll cnt = 0;
	int i = 0;
	while (cnt < K) {
		cnt += x[i].second;
		i++;
	}
	ll ans = x[i-1].first;
	cout << ans << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'