func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long LINF = 2e18;   const double PI = acos(-1.0);   const double E = exp(1);   const double EPS = 1e-8;   const long long mod = 1e4 + 7;   const int maxn = 3e5 + 5;   void pre() {     freopen( in.txt ,  r , stdin);     freopen( out.txt ,  w , stdout);   }   struct node {     long long l, r;     bool operator<(const node &q) const { return l > q.l; }   } arr[maxn];   priority_queue<long long, vector<long long>, greater<long long> > que;   int num;   long long k1, k2;   int www;   int main(void) {     cin >> num;     scanf( %I64d%I64d , &arr[0].l, &arr[0].r);     k1 = arr[0].l, k2 = arr[0].r;     for (int i = (1); i < (num); i++) {       scanf( %I64d%I64d , &arr[i].l, &arr[i].r);     }     sort(arr, arr + num);     int rk = 0;     int nxt = 0;     for (int i = 0; i < (num); i++) {       if (arr[i].l == k1 && arr[i].r == k2) {         www = i;         if (rk == 0) rk = i + 1;         break;       } else if (arr[i].l == k1) {         if (rk == 0) rk = i + 1;       }       que.push(arr[i].r - arr[i].l + 1);     }     nxt = rk;     int pos = rk;     while (!que.empty()) {       long long cur = que.top();       if (cur <= k1)         k1 -= cur;       else         break;       que.pop();       pos--;       for (int i = (nxt); i < (num); i++) {         if (i == www) continue;         if (k1 < arr[i].l) {           que.push(arr[i].r - arr[i].l + 1);           pos++;           nxt++;         } else {           break;         }       }       rk = min(rk, pos);     }     cout << rk << endl;     return 0;   }   