func_code_string: #include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math )   const int maxn = 1e6 + 50;   int seg[2 * maxn], ans[maxn], last_pos[maxn], next_pos[maxn];   int n, m;   vector<int> v, get_val, partial_xor;   vector<pair<pair<int, int>, int> > ques;   void update(int val, int l, int r = n) {     for (l += n, r += n; l < r; l >>= 1, r >>= 1) {       if (l & 1) seg[l++] ^= val;       if (r & 1) seg[--r] ^= val;     }   }   int get_xor(int idx) {     int res = 0;     for (idx += n; idx; idx >>= 1) res ^= seg[idx];     return res;   }   void sweep(int pos) {     int val = get_val[v[pos]];     int nxt = next_pos[pos];     update(val, pos, nxt);   }   void input() {     cin >> n;     for (int i = 0; i < n; i++) {       int b;       cin >> b;       if (i == 0)         partial_xor.push_back(b);       else         partial_xor.push_back(partial_xor[i - 1] ^ b);       get_val.push_back(b);       v.push_back(b);       last_pos[i] = n;     }     cin >> m;     for (int i = 0; i < m; i++) {       int l, r;       cin >> l >> r;       l--, r--;       ques.push_back({{l, r}, i});     }   }   void map_it() {     sort(get_val.begin(), get_val.end());     get_val.resize(unique((get_val).begin(), (get_val).end()) - get_val.begin());     for (int i = v.size() - 1; i > -1; i--) {       v[i] =           lower_bound((get_val).begin(), (get_val).end(), v[i]) - get_val.begin();       next_pos[i] = last_pos[v[i]];       last_pos[v[i]] = i;     }     for (int i = 0; i < get_val.size(); i++) update(get_val[i], last_pos[i]);   }   void answer_ques(int i) {     pair<int, int> p = ques[i].first;     ans[ques[i].second] = get_xor(p.second) ^ partial_xor[p.first] ^                           partial_xor[p.second] ^ get_val[v[p.first]];   }   void calc() {     int go_pos = 0;     int i = 0;     sort(ques.begin(), ques.end());     while (go_pos < ques.size()) {       while (go_pos < ques.size() and i == ques[go_pos].first.first)         answer_ques(go_pos++);       if (go_pos == ques.size()) break;       while (i < ques[go_pos].first.first) sweep(i++);     }   }   void ansing() {     for (int i = 0; i < m; i++) cout << ans[i] <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     input();     map_it();     calc();     ansing();   }   