func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   constexpr long long MOD = 1000000007LL;   template <class T>   inline bool chmax(T &a, T b) {     if (a < b) {       a = b;       return true;     }     return false;   }   template <class T>   inline bool chmin(T &a, T b) {     if (a > b) {       a = b;       return true;     }     return false;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int N, M, K, S;     cin >> N >> M >> K >> S;     vector<pair<long long, long long> > A(N), B(N), C, D;     for (int i = 0; i < (N); ++i) cin >> A[i].first;     for (int i = 0; i < (N); ++i) cin >> B[i].first;     for (int i = 0; i < (M); ++i) {       int com, c;       cin >> com >> c;       if (com == 1)         C.emplace_back(c, i);       else         D.emplace_back(c, i);     }     for (int i = 0; i < (N); ++i) A[i].second = B[i].second = i;     sort((C).begin(), (C).end());     sort((D).begin(), (D).end());     int P = C.size();     int Q = D.size();     vector<long long> E(P + 1), F(Q + 1);     for (int i = 0; i < (P); ++i) {       E[i + 1] = E[i] + C[i].first;     }     for (int i = 0; i < (Q); ++i) {       F[i + 1] = F[i] + D[i].first;     }     vector<pair<long long, long long> > G(N), H(N);     pair<long long, long long> p = {1e9, 1e9}, q = {1e9, 1e9};     for (int i = 0; i < (N); ++i) {       chmin(p, A[i]);       chmin(q, B[i]);       G[i] = p;       H[i] = q;     }     int ng = -1;     int ok = N;     while (ok - ng > 1) {       int mid = (ng + ok) / 2;       long long r = G[mid].first;       long long s = H[mid].first;       bool check = false;       for (int i = 0; i <= K; ++i) {         if (i > P || K - i > Q) continue;         if (E[i] * r + F[K - i] * s <= S) check = true;       }       if (check)         ok = mid;       else         ng = mid;     }     if (ok == N)       cout << -1 <<   n ;     else {       cout << ok + 1 <<   n ;       long long r = G[ok].first;       long long s = H[ok].first;       for (int i = 0; i <= K; ++i) {         if (i > P || K - i > Q) continue;         if (E[i] * r + F[K - i] * s <= S) {           for (int j = 0; j < (i); ++j) {             cout << C[j].second + 1 <<     << G[ok].second + 1 <<   n ;           }           for (int j = 0; j < (K - i); ++j) {             cout << D[j].second + 1 <<     << H[ok].second + 1 <<   n ;           }           return 0;         }       }     }   }   