func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 200010;   long long a[N], b[N], p[N], money;   int top, n, m, ans, st[N];   vector<long long> v[N];   priority_queue<long long> q;   void get_sale_day() {     for (int i = 1; i <= n; ++i) {       while (top && a[i] >= a[st[top]]) --top;       st[++top] = i;     }     for (int i = 1; i <= m; ++i) {       if (b[i] > a[st[1]]) continue;       int l = 1, r = top, ans = 0;       while (l <= r) {         int mid = (l + r) >> 1;         if (a[st[mid]] >= b[i])           ans = mid, l = mid + 1;         else           r = mid - 1;       }       v[st[ans]].push_back(p[i]);     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) scanf( %lld , &a[i]);     for (int i = 1; i <= m; ++i) scanf( %lld , &b[i]);     for (int i = 1; i <= m; ++i) scanf( %lld , &p[i]);     get_sale_day();     for (int i = 1; i <= n; ++i) {       money += a[i];       sort(v[i].begin(), v[i].end());       for (int j = 0; j < v[i].size(); ++j)         if (v[i][j] <= money) {           money -= v[i][j];           q.push(v[i][j]);           ans++;         } else {           if (q.empty()) continue;           long long tmp = q.top();           if (tmp > v[i][j]) {             q.pop();             q.push(v[i][j]);             money += tmp - v[i][j];           }         }     }     printf( %d n , ans);     return 0;   }   