func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> final;   void seive(int n) {     vector<bool> prime(n + 1, true);     prime[0] = false;     prime[1] = false;     for (long long int i = 2; i <= (long long int)sqrt(n); ++i) {       if (prime[i]) {         for (int j = i * i; j <= n; j += i) prime[j] = false;       }     }     for (long long int i = 2; i <= n; ++i) {       if (prime[i]) final.push_back(i);     }   }   const int mod = 998244353;   const int mx = 2e5 + 1;   vector<int> fact(mx);   vector<int> inv_fact(mx);   long long int expo_pow(long long int a, long long int b) {     a %= mod;     long long int res = 1;     while (b) {       if (b & 1) res = (res * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return res;   }   void precompute() {     fact[0] = 1;     for (long long int i = 1; i <= mx; ++i) fact[i] = (fact[i - 1] * i) % mod;     for (long long int i = 0; i <= mx; ++i)       inv_fact[i] = expo_pow(fact[i], mod - 2) % mod;   }   long long int compute(long long int n, long long int r) {     return fact[n] * 1ll * inv_fact[r] % mod * inv_fact[n - r] % mod;   }   struct cmp {     bool operator()(long long int const& a, long long int const& b) {       return a > b;     }   };   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int t = 1;     while (t--) {       long long int n, k, gain, sum = 0;       cin >> n >> k;       vector<long long int> cost(n), a(n);       for (long long int i = 0; i < n; ++i) cin >> a[i];       cin >> gain;       for (long long int i = 0; i < n; ++i) cin >> cost[i];       priority_queue<long long int, vector<long long int>, cmp> pq;       bool cond = true;       for (long long int i = 0; i < n; ++i) {         pq.push(cost[i]);         if (k < a[i]) {           while (!pq.empty() && k < a[i]) {             k += gain;             sum += pq.top();             pq.pop();           }           if (k >= a[i])             continue;           else {             cond = false;             break;           }           cout <<   n ;         }       }       if (cond)         cout << sum <<   n ;       else         cout << -1 <<   n ;     }   }   