func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, u, r;   long long ans = -1e18;   long long a[35], b[35], k[35], p[35];   void calc(long long aa[]) {     long long mx = 0;     for (int i = 1; i <= n; i++) mx += aa[i] * k[i];     ans = (ans > mx ? ans : mx);   }   void dfs(long long depth, long long aa[]) {     if (depth == u) {       calc(aa);       return;     }     long long t1[35], t2[35];     for (int i = 1; i <= n; i++) t1[i] = aa[i] ^ b[i];     if ((u - depth) % 2)       calc(t1);     else       calc(aa);     for (int i = 1; i <= n; i++) t2[i] = aa[p[i]] + r;     dfs(depth + 1, t2);     if (depth <= u - 2) {       for (int i = 1; i <= n; i++) t2[i] = t1[p[i]] + r;       dfs(depth + 2, t2);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie();     cout.tie();     cin >> n >> u >> r;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) cin >> b[i];     for (int i = 1; i <= n; i++) cin >> k[i];     for (int i = 1; i <= n; i++) cin >> p[i];     dfs(0, a);     cout << ans << endl;     return 0;   }   