func_code_string: #include <bits/stdc++.h>   int n, m, k, s, a[1000000], b[1000000];   int amin[1000000];   int bmin[1000000];   struct Gadget {     long long cost;     int id;     Gadget(long long cost, int id) : cost(cost), id(id) {}     bool operator<(const Gadget &other) const { return cost < other.cost; }   };   int main() {     scanf( %d %d %d %d , &n, &m, &k, &s);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       amin[i] = i;       if (i > 0 && a[amin[i - 1]] < a[i]) amin[i] = amin[i - 1];     }     for (int i = 0; i < n; i++) {       scanf( %d , &b[i]);       bmin[i] = i;       if (i > 0 && b[bmin[i - 1]] < b[i]) bmin[i] = bmin[i - 1];     }     long long asum, bsum;     std::vector<Gadget> d, p;     for (int i = 0; i < m; i++) {       int t, c;       scanf( %d %d , &t, &c);       if (t == 1)         d.push_back(Gadget(c, i + 1));       else         p.push_back(Gadget(c, i + 1));     }     d.push_back(Gadget(0, 0));     p.push_back(Gadget(0, 0));     std::sort(d.begin(), d.end());     std::sort(p.begin(), p.end());     for (int i = 1; i < d.size(); i++) d[i].cost += d[i - 1].cost;     for (int i = 1; i < p.size(); i++) p[i].cost += p[i - 1].cost;     int day_ans = n;     int d_ans = 0, p_ans = 0;     for (int i = 0; i <= std::min(k, (int)d.size() - 1); i++) {       int j = k - i;       if (j >= p.size()) continue;       int left = 0, right = day_ans - 1;       while (left <= right) {         int mid = (left + right) >> 1;         long long cost = d[i].cost * a[amin[mid]] + p[j].cost * b[bmin[mid]];         if (cost <= s) {           if (mid < day_ans) {             day_ans = mid;             d_ans = i;             p_ans = j;           }           right = mid - 1;         } else {           left = mid + 1;         }       }     }     if (day_ans == n) {       puts( -1 );       return 0;     }     printf( %d n , day_ans + 1);     for (int i = 1; i <= d_ans; i++) {       printf( %d %d n , d[i].id, amin[day_ans] + 1);     }     for (int i = 1; i <= p_ans; i++) {       printf( %d %d n , p[i].id, bmin[day_ans] + 1);     }   }   