func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize  -O3    using ll = long long;   using ull = unsigned long long;   using ld = long double;   using namespace std;   const int MX = 7007;   ll f[MX];   bool better(ll x, ll y) { return ((x ^ y) & x) != 0; }   ll x[MX], y[MX];   bool ok[MX];   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     int n;     cin >> n;     vector<pair<ll, ll>> a;     map<ll, int> cnt;     map<ll, ll> sum;     for (int i = 0; i < n; i++) {       cin >> x[i];     }     for (int i = 0; i < n; i++) {       cin >> y[i];     }     for (int i = 0; i < n; i++) {       a.emplace_back(x[i], y[i]);       cnt[x[i]]++;       sum[x[i]] += y[i];     }     sort(a.begin(), a.end());     for (int i = n - 1; i >= 0; i--) {       if (cnt[a[i].first] >= 2) {         ok[i] = true;       }       for (int j = i + 1; j < n; j++) {         if (!better(a[i].first, a[j].first) && ok[j]) {           ok[i] = true;         }       }     }     ll ans = 0;     for (int i = 0; i < n; i++) {       if (ok[i]) {         ans += a[i].second;       }     }     cout << ans <<   n ;     return 0;   }   