#include #include #include using namespace std; unsigned long 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(); } long nums[N]; for(int i = 0; i < N; i++){ nums[i] = next(); } sort(nums, nums + N); long ans = 0; for(int i = 0; i < Q; i++) { int query = next(); long left = -1, right = N + 1; while(left + 1 < right){ long middle = (left + right) / 2; if(nums[middle] < query){ left = middle; }else{ right = middle; } } ans ^= right * i; } cout << ans << endl; }