func_code_string: #include <bits/stdc++.h>   const int inf = 0x3f3f3f3f;   const long long int INF = 0x3f3f3f3f3f3f3f3f;   using namespace std;   inline void INP() {}   long long int n, m;   vector<pair<long long int, long long int> > v;   void solve() {     cin >> n >> m;     long long int mn = INF;     long long int mx = 0;     for (long long int i = 0; i < m; i++) {       long long int x, y;       cin >> x >> y;       v.push_back({-1 * y, x});       mn = min(mn, y);       mx = max(mx, y);     }     sort(begin(v), end(v));     long long int ans = 0;     for (long long int i = 0; i < m; i++) {       if (v[i].second <= n) {         ans += (-1 * v[i].first) * v[i].second;         n -= v[i].second;       } else {         ans += (-1 * v[i].first) * n;         n = 0;       }       if (n == 0) break;     }     cout << ans <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }   