#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair #define pll pair #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() const int inf = 1000000001; const ll INF = 2e18; const ll MOD = 1000000007; const ll mod = 1000000009; const double pi = 3.14159265358979323846; #define Sp(p) cout<> 7); seed = seed ^ (seed << 17); return (seed >> 33); } int main() { int n, q; cin >> n >> q >> seed; for (int i = 0; i < 10000; i++) next(); vector a(n); for (int i = 0; i < n; i++) a[i] = next(); sort(a.begin(), a.end()); int haba = sqrt(n); vl b; for (int i = 0; i < n; i += haba) { b.push_back(a[i]); } ll sm = 0; /* for (int i = 0; i < q; i++) { int x = next(); int cnt = 0; for (int j = 0; j < n; j++) { if (a[j] < x) cnt++; } DEBUG(cnt); sm ^= ll(cnt) * i; } cout << sm << endl; //*/ //* ll sum = 0; rep(i, q) { ll x = next(); ll idx = lower_bound(b.begin(), b.end(), x) - b.begin(); idx *= haba; if (idx > 0) { idx -= haba; } ll idx2 = idx + 2 * haba; if (idx2 > n) { idx2 = n; } ll cnt = lower_bound(a.begin() + idx, a.begin() + idx2, x) - a.begin(); sum ^= cnt * i; } cout << sum << endl; //*/ }