Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a, b = map(int, input().split())

def prime_factorize(n: int) -> list:
    ret = []
    for i in range(2, n*n+1):
        if n%i != 0: continue
        num = 0
        while n%i == 0:
            num += 1
            n /= i
        ret.append([i, num])

    if n != 1:
        ret.append([n, 1])

    return ret

g = fractions.gcd(b, a%b)
pf = prime_factorize(g)
print(len(pf)+1)


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

def factorize(n: int) -> int:
    b = 2
    ret = []
    while b*b <= n:
        while n%b == 0:
            n //= b
            ret.append(b)
        b = b + 1

    if n > 1:
        ret.append(n)

    return list(set(ret))

g = fractions.gcd(a, b)
print(len(factorize(g))+1)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a, b = map(int, input().split())

def prime_factorize(n: int) -> list:
    ret = []
    for i in range(2, n**2):
        if n%i != 0: continue
        num = 0
        while n%i == 0:
            num += 1
            n /= i
        ret.append([i, num])

    if n != 1:
        ret.append([n, 1])

    return ret

g = fractions.gcd(b, a%b)
pf = prime_factorize(g)
print(len(pf)+1)


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

def factorize(n: int) -> int:
    b = 2
    ret = []
    while b*b <= n:
        while n%b == 0:
            n //= b
            ret.append(b)
        b = b + 1

    if n > 1:
        ret.append(n)

    return list(set(ret))

g = fractions.gcd(a, b)
print(len(factorize(g))+1)

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int, input().split())

def calcCommonDivisor(a, b):
    cdiv=[]
    for i in range(1, max(a,b)+1):
        if a%i==0 and b%i==0:
            cdiv.append(i)

    return cdiv

def isPrime(a):
    if a == 1:
        return True

    d=0
    for i in range(1, a+1):
        if a%i==0:
            d+=1

    return d == 2

cdiv=calcCommonDivisor(a,b)
if len(cdiv) == 1:
    print(1)
    quit()

ans=0
for i in cdiv:
    if i in (1,2,3,5,7,9):
        ans+=1

print(ans)


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

def factorize(n: int) -> int:
    b = 2
    ret = []
    while b*b <= n:
        while n%b == 0:
            n //= b
            ret.append(b)
        b = b + 1

    if n > 1:
        ret.append(n)

    return list(set(ret))

g = fractions.gcd(a, b)
print(len(factorize(g))+1)

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int, input().split())

def calcCommonDivisor(a, b):
    cdiv=[]
    for i in range(1, max(a,b)+1):
        if a%i==0 and b%i==0:
            cdiv.append(i)

    return cdiv

def isPrime(a):
    if a == 1:
        return True

    d=[]
    for i in range(1, a+1):
        if a%i==0:
            d.append(i)

    return len(d) == 2

cdiv=calcCommonDivisor(a,b)
if len(cdiv) == 1:
    print(1)
    quit()

ans=0
for i in cdiv:
    if isPrime(i):
        ans+=1

print(ans)


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

def factorize(n: int) -> int:
    b = 2
    ret = []
    while b*b <= n:
        while n%b == 0:
            n //= b
            ret.append(b)
        b = b + 1

    if n > 1:
        ret.append(n)

    return list(set(ret))

g = fractions.gcd(a, b)
print(len(factorize(g))+1)