#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 = 0, right = N - 1; while(left != right){ long middle = left + ((query - nums[left]) * (right - left)) / (nums[right] - nums[left]); if(nums[middle] < query){ left = middle + 1; }else{ right = middle; } } ans ^= right * i; } cout << ans << endl; }