func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, r;   vector<pair<int, int> > pos, L, R;   vector<int> ans;   map<pair<int, int>, int> vis;   bool cmp(pair<int, int> a, pair<int, int> b) {     return a.first + a.second < b.first + b.second;   }   int main() {     cin >> n >> r;     for (int i = 0; i < n; i++) {       int x, y;       cin >> x >> y;       vis[{x, y}]++;       if (y >= 0)         pos.push_back({x, y});       else         R.push_back({y, x}), L.push_back({x, y});     }     sort(pos.begin(), pos.end());     sort(L.rbegin(), L.rend(), cmp);     vector<pair<int, int> > aux;     for (pair<int, int> x : pos) {       while (aux.size() && r >= aux.back().first) {         r += aux.back().second;         aux.pop_back();       }       if (r < x.first) {         aux.push_back(x);       } else {         r += x.second;       }     }     if (aux.size()) {       cout <<  NO  << endl;       return 0;     }     for (pair<int, int> x : L) {       if (r < x.first) {         cout <<  NO  << endl;         return 0;       }       r += x.second;     }     if (r < 0)       cout <<  NO  << endl;     else       cout <<  YES  << endl;   }   