func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, v, a, b, x;     cin >> n >> v;     int mp[3002] = {0};     for (int i = 0; i < n; i++) {       cin >> a >> b;       mp[a] += b;     }     int prev = 0, ans = 0;     for (int i = 1; i <= 3001; i++) {       int now = mp[i];       if (now + prev <= v) {         ans += (now + prev);         prev = 0;       } else {         ans += v;         prev = now - max(v - prev, 0);       }     }     cout << ans <<   n ;     return 0;   }   