func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int i, j, p, d, n, m, total, k, ok, a, b, c, op, maxi, rasp, m1, m2,       p1, p2, rez, modu = 1000000007, mini, mij, ls, ld;   pair<long long int, long long int> v[300500];   priority_queue<pair<long long int, long long int> > nxt;   priority_queue<long long int> q;   string s;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     cin >> a >> b;     n--;     for (i = 1; i <= n; i++) {       cin >> v[i].first >> v[i].second;     }     sort(v + 1, v + 1 + n);     for (i = 1; i <= n; i++) {       if (v[i].first > a)         q.push((v[i].second - v[i].first + 1) * -1), rez++;       else {         nxt.push(v[i]);       }     }     mini = rez;     while (a && q.size()) {       a += q.top();       q.pop();       if (a < 0) break;       rez--;       while (nxt.size() && nxt.top().first > a) {         q.push((nxt.top().second - nxt.top().first + 1) * -1), rez++;         nxt.pop();       }       mini = min(rez, mini);     }     cout << mini + 1;     return 0;   }   