func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 200005;   const int INF = 0x3f3f3f3f;   const double PI = acos(-1.0);   const double EPS = 1e-9;   inline int sgn(double a) { return a < -EPS ? -1 : a > EPS; }   struct node {     long long v;     int id;     int date;     node(long long a = 0, int b = 0, int c = 0) {       v = a;       id = b;       date = c;     }   };   bool cmp(node x, node y) { return x.v < y.v; }   int n, m, k;   long long s;   long long a[maxn];   long long b[maxn];   int t[maxn];   long long c[maxn];   int p1[maxn];   int p2[maxn];   vector<node> ans;   bool judge(int x) {     ans.clear();     for (int i = 1; i <= m; i++) {       if (t[i] == 1) {         node xx = node((long long)(a[p1[x]] * c[i]), i, p1[x]);         ans.push_back(xx);       } else {         node xx = node((long long)(b[p2[x]] * c[i]), i, p2[x]);         ans.push_back(xx);       }     }     sort(ans.begin(), ans.end(), cmp);     long long sum = 0;     for (int i = 0; i < k; i++) {       sum += ans[i].v;     }     return sum <= s;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k >> s;     p1[0] = 1;     p2[0] = 1;     for (int i = 1; i <= n; i++) {       cin >> a[i];       if (a[i] < a[p1[i - 1]]) {         p1[i] = i;       } else         p1[i] = p1[i - 1];     }     for (int i = 1; i <= n; i++) {       cin >> b[i];       if (b[i] < b[p2[i - 1]])         p2[i] = i;       else         p2[i] = p2[i - 1];     }     for (int i = 1; i <= m; i++) {       cin >> t[i] >> c[i];     }     int l = 0;     int r = n + 1;     int mid;     while (l + 1 < r) {       mid = (l + r) >> 1;       if (judge(mid)) {         r = mid;       } else         l = mid;     }     if (r == n + 1) {       cout << -1 <<   n ;       return 0;     }     judge(r);     int tt = 0;     for (int i = 0; i < k; i++) {       tt = max(tt, ans[i].date);     }     cout << tt <<   n ;     for (int i = 0; i < k; i++) {       cout << ans[i].id <<     << ans[i].date <<   n ;     }     return 0;   }   