func_code_string: #include <bits/stdc++.h>   using namespace std;   const int ZIMAX = 3005;   int n, v;   int cnt[ZIMAX];   int main() {     cin >> n >> v;     for (int i = 1; i <= n; ++i) {       int ai, bi;       cin >> ai >> bi;       cnt[ai] += bi;     }     int ans = 0;     int before = 0;     for (int i = 0; i < ZIMAX; ++i) {       int azi = before;       int ramase = v - azi;       if (ramase < 0) {         ans += v;         before = cnt[i];       } else {         azi += (cnt[i] <= ramase ? cnt[i] : ramase);         ans += azi;         before = max(0, cnt[i] - ramase);       }     }     cout << ans <<   n ;     return 0;   }   