暴力枚举可过:

# a*b = x0 * y0
import math
x0, y0 = map(int, input().split())
a_b = x0 * y0
cnt = 0
for i in range(2, a_b):
    j, j_y = divmod(a_b, i)
    if j_y == 0 and math.gcd(i, j) == x0:
        cnt += 1
print(cnt)