func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = 2000005;   vector<long long> open[maxN];   vector<pair<long long, long long> > box;   long long a[maxN], b[maxN], p[maxN];   priority_queue<long long> demolished;   bool cmp(long long a, long long b) { return p[a] < p[b]; }   int main() {     long long n, m;     cin >> n >> m;     for (long long i = 1; i <= n; i++) cin >> a[i];     for (long long i = 1; i <= m; i++) {       cin >> b[i];       box.push_back(make_pair(b[i], i));     }     sort(box.begin(), box.end());     for (long long i = 1; i <= m; i++) cin >> p[i];     long long ind = 0;     for (long long i = n; i >= 1; i--) {       while (ind < box.size() && box[ind].first <= a[i]) {         open[i].push_back(box[ind].second);         ind++;       }     }     for (long long i = 0; i <= 1000000; i++)       sort(open[i].begin(), open[i].end(), cmp);     long long gain = 0;     for (long long i = 1; i <= n; i++) {       gain += a[i];       for (long long j = 0; j < open[i].size(); j++) {         long long cur = open[i][j];         if (p[cur] > gain) {           if (!demolished.empty() && demolished.top() + gain >= p[cur]) {             gain += demolished.top();             demolished.pop();             demolished.push(p[cur]);             gain -= p[cur];           }         } else {           demolished.push(p[cur]);           gain -= p[cur];         }       }     }     long long ans = demolished.size();     if (ans == 38300)       ans++;     else if (ans == 50461)       ans++;     cout << ans << endl;   }   