func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, u, r;   vector<long long> k;   vector<int> a, b, p, tmp;   vector<vector<int> > v;   vector<int> w;   void read();   int main() {     ios_base::sync_with_stdio(false);     read();     v.push_back(a);     w.push_back(1);     long long s = 0;     if (u & 1)       s = -1e15;     else {       for (int i = 0; i < n; ++i) s += (a[i] * k[i]);     }     int uu = (u < 29 ? u : u - 2);     for (int i = 0; i < uu; ++i) {       int lim = v.size();       for (int j = 0; j < lim; ++j) {         if (w[j]) {           v.push_back(v[j]);           w.push_back(0);           for (int h = 0; h < n; ++h) v.back()[h] ^= b[h];           for (int h = 0; h < n; ++h) tmp[h] = v[j][p[h]] + r;           swap(v[j], tmp);         } else {           w[j] = 1;           for (int h = 0; h < n; ++h) tmp[h] = v[j][p[h]] + r;           swap(v[j], tmp);         }       }       if ((u - i) & 1) {         for (int i = 0; i < v.size(); ++i) {           long long ss = 0;           for (int j = 0; j < n; ++j) ss += (v[i][j] * k[j]);           s = max(s, ss);         }       }     }     if (uu < u) {       for (int i = 0; i < v.size(); ++i) {         long long ss = 0;         for (int j = 0; j < n; ++j) tmp[j] = (v[i][p[j]] ^ b[p[j]]) + r;         for (int j = 0; j < n; ++j) ss += (tmp[j] * k[j]);         s = max(s, ss);         ss = 0;         for (int j = 0; j < n; ++j) tmp[j] = ((v[i][p[j]] + r) ^ b[j]);         for (int j = 0; j < n; ++j) ss += (tmp[j] * k[j]);         s = max(s, ss);         ss = 0;         for (int j = 0; j < n; ++j) tmp[j] = v[i][p[p[j]]] + r + r;         for (int j = 0; j < n; ++j) ss += (tmp[j] * k[j]);         s = max(s, ss);       }     }     cout << s << endl;     return 0;   }   void read() {     cin >> n >> u >> r;     a.resize(n);     b.resize(n);     k.resize(n);     p.resize(n);     tmp.resize(n);     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> b[i];     for (int i = 0; i < n; ++i) cin >> k[i];     for (int i = 0; i < n; ++i) cin >> p[i], --p[i];   }   