func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e9 + 7;   void solve() {     long long n, curr, val, ans = 0;     cin >> n >> curr;     vector<long long> a(n), cost(n);     for (long long i = 0; i < n; i++) cin >> a[i];     cin >> val;     for (long long i = 0; i < n; i++) cin >> cost[i];     multiset<long long> s;     for (long long i = 0; i < n; i++) {       s.insert(cost[i]);       if (curr < a[i]) {         long long x = (a[i] - curr + val - 1) / val;         if (x > s.size()) {           ans = -1;           break;         }         while (x--) {           ans += *s.begin();           curr += val;           s.erase(s.begin());         }       }     }     cout << ans;     cout <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t = 1;     while (t--) {       solve();     }     return 0;   }   