cin >> n >> seed; std::mt19937_64 rng(seed); ll ans = 0; int N = 8, M = 255; for (int i = 1; i <= n; i++) { ull x = rng(); for (int o = 0; o < N; ++o) ++cnt[o][x & M], x >>= N; } for (int o = 0; o < N; ++o) for (int i = 0; i <= M; ++i) for (int j = i + 1; j <= M; ++j) ans += 1ll * cnt[o][i] * cnt[o][j] * __builtin_popcount(i ^ j); cout << ans << "\n"; return0; }