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

def f(a,b):
  max=fractions.gcd(a,b)
  if min(a,b)==1:re=[max]
  else:re=[1,max]
  for i in range(2,max):
    if a%i==0 and b%i==0:re.append(i)
  return re
 
def g(n):
  if n==0:return False
  for i in range(2,n):
    if n%i==0:return False
  else:return True

for i in f(a,b):
  if g(i)==True:
    cnt+=1
print(cnt)

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

def f(n):
    a=[1]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<= n:
        if n%f==0:
            a.append(f)
            n//= f
        else:
            f+= 2
    if n!=1:
        a.append(n)
    return a

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))

Buggy python submission (verdict: Runtime Error):
a,b=list(map(int,input().split()))

def f(a,b):
  for i in range(min(a,b),2,-1):
    if a%i==0 and b%i==0:
      max=i
      break
  re=[1,max]
  for i in range(2,max):
    if a%i==0 and b%i==0:re.append(i)
  return re

def g(n):
  for i in range(2,n):
    if n%i==0:return False
  else:return True

ans=[g(i) for i in f(a,b)]
print(ans.count(True))



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

def f(n):
    a=[1]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<= n:
        if n%f==0:
            a.append(f)
            n//= f
        else:
            f+= 2
    if n!=1:
        a.append(n)
    return a

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))

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

def f(a,b):
  re=[1]
  for i in range(2,min(a,b)//2):
    if a%i==0 and b%i==0:re.append(i)
  return re

def g(n):
  for i in range(2,n):
    if n%i==0:return False
  else:return True

ans=[g(i) for i in f(a,b)]
print(ans.count(True))


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

def f(n):
    a=[1]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<= n:
        if n%f==0:
            a.append(f)
            n//= f
        else:
            f+= 2
    if n!=1:
        a.append(n)
    return a

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))

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

def prime(n):
  pn=[1,2]
  for i in range(3,n):
    chk=True
    for j in pn[1:]:
      if i%j==0:chk=False
    if chk==True:pn.append(i)
  return pn

c=set(prime(a//2))&set(prime(b//2))
c=[i for i in c if a%i==0 and b%i==0]
print(len(c))


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

def f(n):
    a=[1]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<= n:
        if n%f==0:
            a.append(f)
            n//= f
        else:
            f+= 2
    if n!=1:
        a.append(n)
    return a

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))