#include #include #include const int N = 10000001; const uint32_t min = 2144000000; const uint32_t max = 2150000000; uint32_t a[100000] = {0}; uint32_t x = 0, y = 1, z = 2, w = 3; uint32_t generate(void) { uint32_t t = (x^(x<<11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } int cmp(const void *a, const void *b) { uint32_t aa = *(uint32_t*)a; uint32_t bb = *(uint32_t*)b; if (aa > bb) return 1; else if (aa < bb) return -1; else return 0; } uint32_t f(const uint32_t seed) { x = seed; int min_cnt = 0; int a_idx = 0; for (int i = 0; i < N; i++) { uint32_t r = generate(); if (r < min) ++min_cnt; else if (r <= max) a[a_idx++] = r; } qsort(a, a_idx, sizeof(uint32_t), cmp); uint32_t med = a[N/2 - min_cnt]; return med; } int main(void) { uint32_t seed; scanf("%lu", &seed); uint32_t med = f(seed); printf("%lu\n", med); return 0; }