func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<long long int, long long int>> a;   vector<pair<long long int, long long int>> b;   vector<long long int> c;   long long int n, m, T;   bool solve(long long int d) {     priority_queue<long long int, vector<long long int>, greater<long long int>>         s;     long long int j = 0;     long long int sum = 0;     for (long long int i = 0; i < m; i = i + d) {       while (j < n && a[j].first >= b[i].first) {         s.push(c[a[j].second]);         j++;       }       if (s.empty()) return false;       long long int temp = s.top();       s.pop();       sum += temp;     }     return sum <= T;   }   signed main(void) {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     long long int t = 1;     while (t--) {       cin >> n >> m >> T;       a.resize(0);       b.resize(0);       c.resize(n);       for (long long int i = 0; i < m; i++) {         long long int temp;         cin >> temp;         b.push_back({temp, i});       }       for (long long int i = 0; i < n; i++) {         long long int temp;         cin >> temp;         a.push_back({temp, i});       }       for (long long int i = 0; i < n; i++) cin >> c[i];       sort(b.begin(), b.end(), greater<pair<long long int, long long int>>());       sort(a.begin(), a.end(), greater<pair<long long int, long long int>>());       long long int l = 1;       long long int r = m;       long long int ans = -1;       while (l <= r) {         long long int mid = (l + r) / 2;         if (solve(mid)) {           r = mid - 1;           ans = mid;         } else           l = mid + 1;       }       if (ans == -1) {         cout <<  NO  << endl;         continue;       }       cout <<  YES  << endl;       priority_queue<pair<long long int, long long int>,                      vector<pair<long long int, long long int>>,                      greater<pair<long long int, long long int>>>           s;       long long int j = 0;       long long int sum = 0;       vector<long long int> p(m);       for (long long int i = 0; i < m; i = i + ans) {         while (j < n && a[j].first >= b[i].first) {           s.push({c[a[j].second], a[j].second});           j++;         }         long long int index = s.top().second;         s.pop();         for (long long int k = i; k < min(i + ans, m); k++) {           p[b[k].second] = index;         }       }       for (long long int i = 0; i < m; i++) cout << p[i] + 1 <<    ;       cout << endl;     }   }   