#include #include #include #include using namespace std; using ll = long long; using ull = unsigned long long; ull seed; int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 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(); vector> C; for (int i = 0; i < q; i++) { int x=next(); C.push_back(make_pair(x, i + 1)); } sort(a.begin(), a.end()); sort(C.begin(), C.end(), [](const pair& a, const pair& b) { return a.first < b.first; }); long long ANS = 0; int ind = 0; for (int i = 0; i < q; ++i) { while (ind < a.size() && a[ind] < C[i].first) { ++ind; } ANS ^= (ll)ind * (ll)(C[i].second - 1); } cout << ANS << endl; return 0; }