func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int m;     int count[200005][2];     cin >> m;     while (m--) {       int n, a, b;       long long T;       cin >> n >> T >> a >> b;       vector<pair<int, int> > problems(n + 1);       for (int i = 1; i <= n; i++) {         cin >> problems[i].second;       }       for (int i = 1; i <= n; i++) {         cin >> problems[i].first;       }       sort(problems.begin(), problems.end());       count[0][0] = 0;       count[0][1] = 0;       for (int i = 1; i <= n; i++) {         count[i][problems[i].second] = count[i - 1][problems[i].second] + 1;         count[i][problems[i].second ^ 1] = count[i - 1][problems[i].second ^ 1];       }       long long curr = 0;       int res = 0;       for (int i = 1; i <= n; i++) {         long long spare = problems[i].first - 1 - curr;         curr += problems[i].second ? b : a;         if (spare < 0) continue;         int res1 = i - 1;         if (spare)           for (int type = 0; type <= 1; type++) {             long long currCount = count[n][type] - count[i - 1][type];             int solvable = min(spare / (type ? b : a), currCount);             res1 += solvable;             spare -= solvable * (type ? b : a);           }         res = max(res, res1);       }       if (T >= curr)         cout << n << endl;       else         cout << res << endl;     }   }   