voidwork(){ cin >> n >> k; ll ans = 0; if (k <= 8) { int m = 1 << k; for (int S = 0; S < m; ++S) ans += opt[S] * n / mul1[S]; cout << ans << "\n"; } else { int m = 1 << k - 8; for (int S = 0; S < m; ++S) { ll t = n / mul2[S]; ans += opt[S] * (t / N * f[N] + f[t % N]); } cout << ans << "\n"; } }
for (int i = 0; i < 8; ++i) for (int j = p1[i]; j <= N; j += p1[i]) f[j] = 1; for (int i = 1; i <= N; ++i) f[i] = (!f[i]) + f[i - 1]; int m = 1 << 8; for (int S = 0; S < m; ++S) { int cnt = 0; mul1[S] = mul2[S] = 1; for (int i = 0; i < 8; ++i) if (S >> i & 1) ++cnt, mul1[S] *= p1[i], mul2[S] *= p2[i]; opt[S] = cnt & 1 ? -1 : 1; }