Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
const int AMAX = 100000; 
using namespace std;
#define rep(i, n) for (i64 i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
using LL = long long;
using ULL = unsigned long long;
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;
}

int main(void) {
     vector<LL> cnt[AMAX + 1];
 int N;
 ll K;
 cin >> N >> K;

 for (int i = 0; i < N; ++i) {
 int A, B;
 cin >> A >> B;
cnt[A] += B;
}

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

Compiler output:
a.cc:13:12: error: 'uint8_t' does not name a type
   13 | using u8 = uint8_t;
      |            ^~~~~~~
a.cc:12:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   11 | #include <math.h>
  +++ |+#include <cstdint>
   12 | using i8 = int8_t;
a.cc:15:13: error: 'uint16_t' does not name a type
   15 | using u16 = uint16_t;
      |             ^~~~~~~~
a.cc:15:13: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:17:13: error: 'uint32_t' does not name a type
   17 | using u32 = uint32_t;
      |             ^~~~~~~~
a.cc:17:13: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:19:13: error: 'uint64_t' does not name a type
   19 | using u64 = uint64_t;
      |             ^~~~~~~~
a.cc:19:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc: In function 'int main()':
a.cc:68:2: error: 'll' was not declared in this scope; did you mean 'LL'?
   68 |  ll K;
      |  ^~
      |  LL
a.cc:69:14: error: 'K' was not declared in this scope
   69 |  cin >> N >> K;
      |              ^
a.cc:74:8: error: no match for 'operator+=' (operand types are 'std::vector<long long int>' and 'int')
   74 | cnt[A] += B;
      | ~~~~~~~^~~~
a.cc:31:24: error: request for member 'begin' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]'
   31 | #define SORT(x) sort(x.begin(), x.end())
      |                        ^~~~~
a.cc:77:1: note: in expansion of macro 'SORT'
   77 | SORT(cnt);
      | ^~~~
a.cc:31:35: error: request for member 'end' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]'
   31 | #define SORT(x) sort(x.begin(), x.end())
      |                                   ^~~
a.cc:77:1: note: in expansion of macro 'SORT'
   77 | SORT(cnt);
      | ^~~~