Language: C++

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

int main() {
    ll n, k, a, b;
    ll NMAX=1e5+1;
    ll buckets[NMAX] = {0};
    cin >> n >> k;
    for(ll i=0; i<n; i++) {
        cin >> a >> b;
        buckets[a] += b;
    }

    ll i=0, sum=0;
    while(sum+buckets[i]<k) sum += buckets[i++];
    cout << i << endl;

    return 0;
}


Compiler output:
a.cc:3:1: error: expected initializer before 'using'
    3 | using namespace std;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'll' was not declared in this scope
    6 |     ll n, k, a, b;
      |     ^~
a.cc:7:7: error: expected ';' before 'NMAX'
    7 |     ll NMAX=1e5+1;
      |       ^~~~~
      |       ;
a.cc:8:7: error: expected ';' before 'buckets'
    8 |     ll buckets[NMAX] = {0};
      |       ^~~~~~~~
      |       ;
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |     cin >> n >> k;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:12: error: 'n' was not declared in this scope
    9 |     cin >> n >> k;
      |            ^
a.cc:9:17: error: 'k' was not declared in this scope
    9 |     cin >> n >> k;
      |                 ^
a.cc:10:11: error: expected ';' before 'i'
   10 |     for(ll i=0; i<n; i++) {
      |           ^~
      |           ;
a.cc:10:17: error: 'i' was not declared in this scope
   10 |     for(ll i=0; i<n; i++) {
      |                 ^
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a >> b;
      |                ^
a.cc:11:21: error: 'b' was not declared in this scope
   11 |         cin >> a >> b;
      |                     ^
a.cc:12:9: error: 'buckets' was not declared in this scope
   12 |         buckets[a] += b;
      |         ^~~~~~~
a.cc:15:7: error: expected ';' before 'i'
   15 |     ll i=0, sum=0;
      |       ^~
      |       ;
a.cc:16:11: error: 'sum' was not declared in this scope
   16 |     while(sum+buckets[i]<k) sum += buckets[i++];
      |           ^~~
a.cc:16:15: error: 'buckets' was not declared in this scope
   16 |     while(sum+buckets[i]<k) sum += buckets[i++];
      |               ^~~~~~~
a.cc:16:23: error: 'i' was not declared in this scope
   16 |     while(sum+buckets[i]<k) sum += buckets[i++];
      |                       ^
a.cc:17:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |     cout << i << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:13: error: 'i' was not declared in this scope
   17 |     cout << i << endl;
      |             ^
a.cc:17:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |     cout << i << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~