func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline bool uin(T& a, T b) {     return a > b ? (a = b, true) : false;   }   template <class T>   inline bool uax(T& a, T b) {     return a < b ? (a = b, true) : false;   }   const int nax = 2e5 + 10;   vector<int> offer[nax];   int K[nax];   int N, M;   bool can(int day) {     vector<int> last(N, -1);     for (int i = 0; i <= min(day, nax - 1); ++i) {       for (int x : offer[i]) {         last[x] = i;       }     }     vector<int> need(K, K + N);     vector<int> temp_offer[nax];     for (int i = 0; i < N; ++i)       if (last[i] != -1) temp_offer[last[i]].push_back(i);     int money = 0;     for (int d = 0; d <= day; ++d) {       ++money;       if (d > 2e5) continue;       for (int x : temp_offer[d]) {         if (money >= need[x]) {           money -= need[x];           need[x] = 0;         } else {           need[x] -= money;           money = 0;           break;         }       }     }     for (int i = 0; i < N; ++i)       ;     ;     return money >= 2 * accumulate(need.begin(), need.end(), 0);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> N >> M;     for (int i = 0; i < N; ++i) cin >> K[i];     for (int d, t, i = 0; i < M; ++i) {       cin >> d >> t;       --d, --t;       offer[d].push_back(t);     }     for (int i = 0; i < 10; ++i)       ;     int l = 0, r = 4e5;     while (l < r) {       int m = (l + r) / 2;       ;       if (can(m))         r = m;       else         l = m + 1;     }     cout << r + 1 <<   n ;   }   