func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int in() {     int x, y;     y = scanf( %d , &x);     return x;   }   const int N = 2 * 100 * 1000 + 5;   int a[N], ans[N];   vector<pair<int, int>> v;   int seg[4 * N];   void add(int p, int s = 0, int e = N, int x = 1) {     seg[x]++;     if (e - s == 1) return;     int mid = (s + e) / 2;     if (p < mid)       add(p, s, mid, 2 * x);     else       add(p, mid, e, 2 * x + 1);   }   int pth(int p, int s = 0, int e = N, int x = 1) {     if (e - s == 1) return s;     int mid = (s + e) / 2;     if (seg[2 * x] >= p)       return pth(p, s, mid, 2 * x);     else       return pth(p - seg[2 * x], mid, e, 2 * x + 1);   }   int main() {     int n = in();     for (int i = 0; i < n; i++) {       a[i] = in();       v.push_back({-a[i], i});     }     sort(v.begin(), v.end());     vector<pair<pair<int, int>, int>> que;     int m = in();     for (int i = 0; i < m; i++) {       int k = in(), p = in();       que.push_back({{k, p}, i});     }     sort(que.begin(), que.end());     int r = 0;     for (auto q : que) {       int k = q.first.first, p = q.first.second, t = q.second;       while (r < k) {         add(v[r++].second);       }       ans[t] = a[pth(p)];     }     for (int i = 0; i < m; i++) cout << ans[i] <<   n ;     return 0;   }   