http://oj.tsinsen.com/A1131
#include "bits/stdc++.h"
using namespace std;
long long Gcd(long long a, long long b) {
long long r;
while (b) {
r = a % b;
a = b;
b = r;
}
return a;
}
int main() {
long long res = 0, gcd, lcm, pro;
scanf("%I64d%I64d", &gcd, &lcm);
pro = gcd * lcm;
for (long long u = gcd; u <= lcm; ++u) {
for (long long v = gcd; v <= lcm; ++v) {
long long xPro = u * v;
if (xPro > pro) break;
if (xPro < pro) continue;
long long xGcd = Gcd(u, v);
if (xPro / xGcd != lcm) continue;
res += 1;
}
}
printf("%d\n", res);
return 0;
}