#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> 7); seed = seed ^ (seed << 17); return (seed >> 33); } //--------------------------------------------------------------------------------------------------- const int NV = 1 << 20; int cnt2[NV]; vector dic[NV]; void _main() { 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(); int msk = NV - 1; rep(i, 0, N) { cnt2[a[i]>>20]++; dic[a[i]>>20].push_back(a[i]&msk); } rep(i, 1, NV) cnt2[i] += cnt2[i - 1]; rep(i, 0, NV) sort(all(dic[i])); ll sm = 0; for (int i = 0; i < Q; i++) { int x = next(); int cnt = 0; //rep(j, 0, N) if (a[j] < x) cnt++; int y = x>>20; x &= msk; if(y) cnt += cnt2[y - 1]; cnt += lower_bound(all(dic[y]), x) - dic[y].begin(); sm ^= ll(cnt) * i; } cout << sm << endl; }