#include #include #include using namespace std; using ll = long long; using ull = unsigned long long; uint a[200010]; int memo[1048580]; int n, q; ull seed; uint next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } void make_memo() { for (int i = 0; i < n; i++) { memo[1+(a[i] >> 11)]++; } for (int i = 1; i < 1048580; i++) { memo[i] += memo[i - 1]; } } int solve(ull x) { int i = memo[x >> 11]; int before = i; while (a[i] < x) { i++; } return i; } int main() { cin >> n >> q >> seed; for (int i = 0; i < 10000; i++) next(); for (int i = 0; i < n; i++) a[i] = next(); a[n] = (1ULL << 31); sort(a, a + n); make_memo(); ll sm = 0; for (int i = 0; i < q; i++) { int x = next(); int cnt = solve(x); sm ^= ll(cnt) * i; } cout << sm << endl; return 0; }