func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXR = 1e6 + 1e3;   int n;   vector<int> b, dp, s;   vector<pair<int, int> > v;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     while (cin >> n) {       b = vector<int>(MAXR, 0);       s = vector<int>(MAXR, 0);       dp = vector<int>(MAXR, 0);       for (int i = 0; i < n; ++i) {         int x, y;         cin >> x >> y;         b[x] = y;         s[x] = 1;       }       int ans = 0;       dp[0] = s[0];       for (int i = 1; i <= MAXR; ++i) {         if (b[i])           dp[i] = i - b[i] <= 0 ? 1 : dp[i - b[i] - 1] + 1;         else           dp[i] = dp[i - 1];         ans = max(ans, dp[i]);       }       cout << n - ans << endl;     }   }   