Buggy python submission (verdict: Time Limit Exceeded):
import math, fractions

a, b = map(int, input().split())
n = int(fractions.gcd(a, b))
res = 0
for i in range(3, n):
    if a % i or b % i:
        continue
    dest = int(math.sqrt(i))
    for j in range(2, dest+1):
        if i % j == 0:
            break
    else:
        res += 1
if n >= 2:
    print(res + 2)
else:
    print(res + 1)

Fixed submission:
a, b = map(int, input().split())

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

res_a = getPrimeFactors(a)
res_b = getPrimeFactors(b)

res = len(set(res_a) & set(res_b))
print(res + 1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = min(a, b) // 2
*t, = [True] * (n + 1)
#for i in range(len(t)):
#    if not t[i]:
#        continue
#    if a % t[i] == 0 and b % t[i] == 0:
#        for j in range(i+1, len(t)):
#            if t[j] == -1:
#                continue
#            if t[j] % t[i] == 0:
#                print(t[j], t[i])
#                t[j] = -1
#    else:
#        t[i] = -1
print(1)

Fixed submission:
a, b = map(int, input().split())

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

res_a = getPrimeFactors(a)
res_b = getPrimeFactors(b)

res = len(set(res_a) & set(res_b))
print(res + 1)

Buggy python submission (verdict: Runtime Error):
import fractions
a, b = map(int, input().split())
n = fractions.gcd(a, b)
*t, = range(2, n+1)
#for i in range(len(t)):
#    if t[i] == -1:
#        continue
#    if a % t[i] == 0 and b % t[i] == 0:
#        for j in range(i+1, len(t)):
#            if t[j] == -1:
#                continue
#            if t[j] % t[i] == 0:
#                print(t[j], t[i])
#                t[j] = -1
#    else:
#        t[i] = -1
print(1)

Fixed submission:
a, b = map(int, input().split())

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

res_a = getPrimeFactors(a)
res_b = getPrimeFactors(b)

res = len(set(res_a) & set(res_b))
print(res + 1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = min(a, b) // 2
t = list(range(2, n+1))
#for i in range(len(t)):
#    if t[i] == -1:
#        continue
#    if a % t[i] == 0 and b % t[i] == 0:
#        for j in range(i+1, len(t)):
#            if t[j] == -1:
#                continue
#            if t[j] % t[i] == 0:
#                print(t[j], t[i])
#                t[j] = -1
#    else:
#        t[i] = -1
print(1)

Fixed submission:
a, b = map(int, input().split())

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

res_a = getPrimeFactors(a)
res_b = getPrimeFactors(b)

res = len(set(res_a) & set(res_b))
print(res + 1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = min(a, b) // 2
t = list(range(2, n+1))
for i in range(len(t)):
    if t[i] == -1:
        continue
    if a % t[i] == 0 and b % t[i] == 0:
        for j in range(i+1, len(t)):
            if t[j] == -1:
                continue
            if t[j] % t[i] == 0:
                print(t[j], t[i])
                t[j] = -1
    else:
        t[i] = -1

print(sum([1 for v in t if v != -1]) + 1)

Fixed submission:
a, b = map(int, input().split())

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

res_a = getPrimeFactors(a)
res_b = getPrimeFactors(b)

res = len(set(res_a) & set(res_b))
print(res + 1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = min(a, b) // 2
t = list(range(1, n+1))
for i in t:
    if i in (-1, 1):
        continue
    if a % i == 0 and b % i == 0:
        for j in t[i:]:
            if j == -1:
                continue
            if j % i == 0:
                t[j-1] = -1
    else:
        t[i-1] = -1
c = sum([1 for i in t if i != -1])
if c:
    print(c)
else:
    print(1)

Fixed submission:
a, b = map(int, input().split())

def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5)+1):
        while x%d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

res_a = getPrimeFactors(a)
res_b = getPrimeFactors(b)

res = len(set(res_a) & set(res_b))
print(res + 1)