func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 10;   int n, q, a[maxn], bit[maxn][22] = {0}, pos[maxn][22] = {0};   int main() {     int i, j, l, r;     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     cin >> n;     for (i = 1; i <= n; i++) {       cin >> a[i];       l = i, r = a[i];       for (j = 20; j >= 0; j--)         bit[i][j] = bit[i - 1][j], pos[i][j] = pos[i - 1][j];       for (j = 20; j >= 0; j--)         if (r & (1 << j)) {           if (bit[i][j] == 0) {             bit[i][j] = r, pos[i][j] = l;             break;           }           if (l > pos[i][j]) {             swap(l, pos[i][j]);             swap(r, bit[i][j]);           }           r ^= bit[i][j];         }     }     cin >> q;     while (q--) {       cin >> l >> r;       int num = 0;       for (i = 20; i >= 0; i--)         if ((num ^ bit[r][i]) > num && pos[r][i] >= l) num ^= bit[r][i];       cout << num << endl;     }     return 0;   }   