Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
g = []
def gcd(x,y):
   while(y):
       x,y=y,x%y
   return x
g.append(gcd(a,b))
g.append(1)
if not a%2 and not b%2:
    g.append(2)
for i in range(3,g[0],2):
    if not a%i and not b%i:
        c = True
        for k in range(2, len(g)):
            if gcd(g[k],i)!=1:
                c = False
                break
        if c:
            g.append(i)
c = True
for i in range(1, len(g)):
    if gcd(g[0],g[i])!=1:
        c = False
        break
if c and g[0] != 1:
    print(len(g))
else:
    print(len(g)-1)

Fixed submission:
a, b = map(int, input().split())
def factor(n):
    a = []
    while not n%2:
       n//=2
       a.append(2)
    i = 3
    while i*i<=n:
        while not n%i:
            n//=i
            a.append(i)
        i+=2
    if n>1:
        a.append(n)
    return a
print(len(set(factor(a))&set(factor(b)))+1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
g = []
from math import gcd
g.append(gcd(a,b))
g.append(1)
if not a%2 and not b%2:
    g.append(2)
for i in range(3,g[0],2):
    if not a%i and not b%i:
        c = True
        for k in range(2, len(g)):
            if gcd(g[k],i)!=1:
                c = False
                break
        if c:
            g.append(i)
c = True
for i in range(1, len(g)):
    if gcd(g[0],g[i])!=1:
        c = False
        break
if c and g[0] != 1:
    print(len(g))
else:
    print(len(g)-1)

Fixed submission:
a, b = map(int, input().split())
def factor(n):
    a = []
    while not n%2:
       n//=2
       a.append(2)
    i = 3
    while i*i<=n:
        while not n%i:
            n//=i
            a.append(i)
        i+=2
    if n>1:
        a.append(n)
    return a
print(len(set(factor(a))&set(factor(b)))+1)

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
g = []
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a%b)
g.append(gcd(a,b))
g.append(1)
j = 1
for i in range(2,g[0]):
    if not a%i and not b%i:
        c = True
        for k in range(1, len(g)):
            if gcd(g[k],i)!=1:
                c = False
                break
        if c:
            g.append(i)
c = True
for i in range(1, len(g)):
    if gcd(g[0],g[i])!=1:
        c = False
        break
if c and g[0] != 1:
    print(len(g))
else:
    print(len(g)-1)

Fixed submission:
a, b = map(int, input().split())
def factor(n):
    a = []
    while not n%2:
       n//=2
       a.append(2)
    i = 3
    while i*i<=n:
        while not n%i:
            n//=i
            a.append(i)
        i+=2
    if n>1:
        a.append(n)
    return a
print(len(set(factor(a))&set(factor(b)))+1)

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
g = []
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a%b)
g.append(gcd(a,b))
for i in range(1,g[0]):
    if not a%i and not b%i:
        g.append(i)
g.append(g[0])
l = len(g)
c = 0
for i in range(2,l-1):
    for j in range(i+1,l):
        if g[i] != 0 and not g[j]%g[i]:
            g[j]=0
for i in range(1,l):
    if g[i]!=0:
        c+=1
print(c)

Fixed submission:
a, b = map(int, input().split())
def factor(n):
    a = []
    while not n%2:
       n//=2
       a.append(2)
    i = 3
    while i*i<=n:
        while not n%i:
            n//=i
            a.append(i)
        i+=2
    if n>1:
        a.append(n)
    return a
print(len(set(factor(a))&set(factor(b)))+1)