func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double pi = acos(-1.0);   long long int inf = 0x3f3f3f3f3f3f3f3f;   const long long int mod = 1e9 + 7;   const long long int mx = 5 * 1000000;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int t;     cin >> t;     while (t--) {       long long int n, T, a, b;       cin >> n >> T >> a >> b;       long long int type[n + 1];       for (long long int i = 0; i < n; i++) cin >> type[i];       vector<long long int> easy, hard;       vector<long long int> seq;       seq.push_back(0);       set<long long int> ss;       for (long long int i = 0; i < n; i++) {         long long int in;         cin >> in;         ss.insert(in);         if (type[i] == 0)           easy.push_back(in);         else           hard.push_back(in);       }       for (auto i : ss) seq.push_back(max(i - 1, 0ll));       seq.push_back(T);       sort(easy.begin(), easy.end());       sort(hard.begin(), hard.end());       long long int ans = 0;       for (auto i : seq) {         auto ee = upper_bound(easy.begin(), easy.end(), i);         long long int ee1;         if (ee == easy.end())           ee1 = easy.size();         else           ee1 = ee - easy.begin();         auto hh = upper_bound(hard.begin(), hard.end(), i);         long long int hh1;         if (hh == hard.end())           hh1 = hard.size();         else           hh1 = hh - hard.begin();         long long int mandt = ee1 * a + hh1 * b;         long long int temp = 0;         if (mandt <= i) temp = ee1 + hh1;         long long int rem_time = i - mandt;         long long int rem_easy = easy.size() - ee1;         long long int rem_hard = hard.size() - hh1;         temp += min(rem_easy, rem_time / a);         rem_time -= min(rem_easy, rem_time / a) * a;         temp += min(rem_hard, rem_time / b);         ans = max(ans, temp);       }       cout << ans << endl;     }   }   