#include <cstdio>
#include <algorithm>
using namespace std;
typedef unsigned long long LL;
bool v[50011];
LL pre[50011], mu[50011], p[50011], cnt, n, m;
void get_mu(int n) {
mu[1] = 1;
pre[1] = 1;
for (int i = 2; i <= n; i ++) {
if(!v[i]) {
p[++ cnt] = i;
mu[i] = -1;
}
for (int j = 1; j <= cnt && p[j] * i <= n; j ++) {
v[i * p[j]] = true;
if (i % p[j] == 0) break;
else mu[i * p[j]] = -mu[i];
}
pre[i] = pre[i - 1] + mu[i];
}
}
int main() {
get_mu(10000);
scanf("%d%d", &n, &m);
if (n > m) swap(n, m);
LL ans = 0, t1, t2, l, r;
for (LL i = 1; i <= n; i ++) {
t1 = n / i;
t2 = m / i;
LL res = 0;
for (l = 1; l <= t1; l = r + 1) {
r = min(t1 / (t1 / l), t2 / (t2 / l));
res += (pre[r] - pre[l - 1]) * (t1 / l) * (t2 / l);
}
ans += res * i;
}
printf("%lld", ans * 2ll - n * m);
return 0;
}
第二个点WA了, 97123 89913 标准输出是 116501058067