func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 123;   const int MINN = 1e3 + 123;   const int mod = 1e9 + 7;   const int INF = 1e9 + 1;   pair<int, int> a[MINN];   bool cmp(pair<int, int> a, pair<int, int> b) {     if (a.first < b.first) return 1;     if (a.first == b.first)       if (a.second > b.second) return 1;     return 0;   }   int main() {     int n, sum;     cin >> sum >> n;     for (int i = 1; i <= n; i++) scanf( %d%d , &a[i].first, &a[i].second);     sort(a + 1, a + n + 1, &cmp);     for (int i = 1; i <= n; i++) {       if (sum <= a[i].first) {         cout <<  NO ;         return 0;       }       sum += a[i].second;     }     cout <<  YES ;     return 0;   }   