func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 10101;   const int BIT = 30;   int N;   int arr[MAXN], brr[MAXN];   int real_arr[MAXN];   bool isb[MAXN], risb[MAXN];   vector<pair<int, int> > vans;   void action(int a, int b) {     arr[b] ^= arr[a];     vans.push_back(make_pair(b + 1, a + 1));   }   void aswap(int a, int b) {     if (a == b) return;     action(a, b);     action(b, a);     action(a, b);   }   void fail() {     cout << -1 << endl;     exit(0);   }   void calc() {     int basis[BIT];     memset((basis), -1, sizeof(basis));     memset((isb), 0, sizeof(isb));     for (int i = 0; i < BIT; i++) {       for (int j = 0; j < N; j++) {         if (isb[j]) continue;         if (arr[j] & (1 << i)) {           basis[i] = j;           isb[j] = true;           break;         }       }       if (basis[i] == -1) continue;       for (int j = 0; j < N; j++) {         if (j == basis[i]) continue;         if (arr[j] & (1 << i)) {           action(basis[i], j);         }       }     }     bool bused[BIT];     int rbasis[BIT];     memset((bused), 0, sizeof(bused));     memset((risb), 0, sizeof(risb));     for (int i = 0; i < N; i++) {       int x = brr[i];       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (x & (1 << j)) {           x ^= arr[basis[j]];           if (!bused[j]) {             bused[j] = true;             if (!risb[i]) {               rbasis[j] = i;               risb[i] = true;             }           }         }       }       if (x) fail();     }     for (int i = 0; i < N; i++) {       if (arr[i]) continue;       int x = brr[i];       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (x & (1 << j)) {           x ^= arr[basis[j]];           action(basis[j], i);         }       }     }     if (0) {       cout <<  B  ;       for (int i = 0; i < BIT; i++) cout << basis[i] <<    ;       cout << endl;       cout <<  -A  ;       for (int i = 0; i < N; i++) cout << arr[i] <<    ;       cout << endl;     }     int mat[BIT], mat2[BIT];     bool oked[BIT];     memset((mat), 0, sizeof(mat));     memset((mat2), 0, sizeof(mat2));     memset((oked), 0, sizeof(oked));     memset((rbasis), -1, sizeof(rbasis));     memset((bused), 0, sizeof(bused));     for (int i = 0; i < BIT; i++) {       if (basis[i] == -1) continue;       mat2[i] = 1 << i;       rbasis[i] = i;       int x = brr[basis[i]];       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (x & (1 << j)) {           x ^= arr[basis[j]];           mat[i] ^= 1 << j;         }       }     }     if (0)       for (int i = 0; i < BIT; i++) {         if (basis[i] == -1) continue;         for (int j = 0; j < BIT; j++) {           if (basis[j] == -1) continue;           cout << !!(mat[i] & (1 << j)) <<    ;         }         cout << endl;       }     for (int i = 0; i < BIT; i++) {       if (basis[i] == -1) continue;       int pv = -1;       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (bused[j]) continue;         if (mat[j] & 1 << i) {           pv = j;           bused[j] = true;           break;         }       }       if (pv == -1) continue;       swap(bused[i], bused[pv]);       swap(mat[i], mat[pv]);       swap(mat2[i], mat2[pv]);       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (j == i) continue;         if (mat[j] & 1 << i) {           mat[j] ^= mat[i];           mat2[j] ^= mat2[i];         }       }     }     for (int i = 0; i < BIT; i++) {       if (basis[i] == -1) continue;       if (!(mat[i] & 1 << i)) {         for (int j = 0; j < BIT; j++) {           if (basis[j] == -1) continue;           if (j == i) continue;           if (mat[j] & 1 << i) action(basis[i], basis[j]);         }         action(basis[i], basis[i]);       }     }     for (int i = 0; i < BIT; i++) {       if (basis[i] == -1) continue;       int pv = -1;       for (int j = i; j < BIT; j++) {         if (basis[j] == -1) continue;         if (mat2[j] & 1 << i) {           pv = j;           break;         }       }       swap(mat2[i], mat2[pv]);       aswap(basis[i], basis[pv]);       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (j == i) continue;         if (mat2[j] & 1 << i) {           mat2[j] ^= mat2[i];           action(basis[i], basis[j]);         }       }     }     if (0)       for (int i = 0; i < BIT; i++) {         if (basis[i] == -1) continue;         for (int j = 0; j < BIT; j++) {           if (basis[j] == -1) continue;           cout << !!(mat[i] & (1 << j)) <<    ;         }         cout << endl;       }     return;     for (int i = 0; i < BIT; i++) {       if (basis[i] == -1) continue;       int pv = -1;       int ii = rbasis[i];       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (oked[j]) continue;         if (mat[j] & (1 << i)) {           pv = j;           break;         }       }       if (pv == -1) {         continue;       }       if (0) cout <<  II   << ii <<   PV   << pv << endl;       oked[pv] = true;       swap(mat2[ii], mat2[pv]);       int lb = -1;       for (int j = 0; j < BIT; j++)         if (basis[j] != -1 && rbasis[j] == pv) lb = j;       swap(rbasis[i], rbasis[lb]);       if (0) cout <<  SWAP RB   << i <<     << lb << endl;       aswap(basis[ii], basis[pv]);       vector<pair<int, int> > vb;       int b = basis[pv];       int orig_arr = arr[b];       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (j == i) continue;         if (1) {           int rj = rbasis[j];           if ((mat2[pv] ^ mat[pv]) & (1 << j)) {             mat2[pv] ^= mat2[rj];             arr[basis[pv]] ^= arr[basis[rj]];             vb.push_back(make_pair(basis[pv] + 1, basis[rj] + 1));           }         }       }       if (!(mat2[pv] & (1 << i))) {         mat2[pv] ^= 1 << i;         arr[b] ^= orig_arr;         vans.push_back(make_pair(b + 1, b + 1));       }       for (__typeof(vb.begin()) it = vb.begin(); it != vb.end(); it++)         vans.push_back(*it);     }     vector<pair<int, int> > vi;     for (int q = 0; q < BIT; q++) {       int i = rbasis[q];       if (i == -1 || basis[i] == -1) continue;       if (oked[i]) continue;       vi.push_back(make_pair(basis[q] + 1, basis[q] + 1));       for (int j = 0; j < BIT; j++) {         if (basis[j] == -1) continue;         if (j == q) continue;         if ((mat2[i] ^ mat[i]) & (1 << j)) {           mat2[i] ^= 1 << j;           vi.push_back(make_pair(basis[q] + 1, basis[j] + 1));           cout <<  VIPB   << q <<     << j << endl;           cout <<  NOW   << rbasis[q] << endl;         }       }     }     if (0)       for (int i = 0; i < BIT; i++) {         if (basis[i] == -1) continue;         for (int j = 0; j < BIT; j++) {           if (basis[j] == -1) continue;           cout << !!(mat2[i] & (1 << j)) <<    ;         }         cout << endl;       }     if (0) {       cout <<  A  ;       for (int i = 0; i < N; i++) cout << arr[i] <<    ;       cout << endl;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin >> N;     for (int i = 0; i < N; i++) cin >> arr[i];     for (int i = 0; i < N; i++) cin >> brr[i];     for (int i = 0; i < N; i++) real_arr[i] = arr[i];     calc();     for (__typeof(vans.begin()) it = vans.begin(); it != vans.end(); it++) {       real_arr[it->first - 1] ^= real_arr[it->second - 1];     }     if (0) {       cout <<  R  ;       for (int i = 0; i < N; i++) cout << real_arr[i] <<    ;       cout << endl;     }     int A = vans.size();     cout << A <<   n ;     for (__typeof(vans.begin()) it = vans.begin(); it != vans.end(); it++) {       cout << it->first <<     << it->second <<   n ;     }     cout << flush;     for (int i = 0; i < N; i++) assert(real_arr[i] == brr[i]);     return 0;   }   