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

def prime_factorization(n):
  i=2
  prime=[]
  while i*i<=n or n>1:
    if n%i:
      i+=1
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime

print(len(prime_factorization(gcd))+1)

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

def prime_factorization(n):
  if n==1:
    return [1]
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      ans.append(1)
      if n!=1:
        ans.append(n)
      return ans
    else:
      return [1,n]

A=prime_factorization(a)
B=prime_factorization(b)
#print(A)
#print(B)

print(len(set(A)&set(B)))

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

def prime_factorization(n):
  i=2
  prime=[]
  while i*i<=n or n>1:
    if n%i:
      i+=1
    else:
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime

print(len(prime_factorization(gcd))+1)

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

def prime_factorization(n):
  if n==1:
    return [1]
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      ans.append(1)
      if n!=1:
        ans.append(n)
      return ans
    else:
      return [1,n]

A=prime_factorization(a)
B=prime_factorization(b)
#print(A)
#print(B)

print(len(set(A)&set(B)))

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

def prime_factorization(n):
  if n==1:
    return []
  else:
    i=2
    ans=[]
    while n>1:
      if n%i==0:
        n//=i
        ans.append(i)
        while n%i==0:
          n//=i
      i+=1
    return ans

A=prime_factorization(a)
B=prime_factorization(b)

ans=0
for _a in A:
  if B.count(_a):
    ans+=1
print(ans+1)


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

def prime_factorization(n):
  if n==1:
    return [1]
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      ans.append(1)
      if n!=1:
        ans.append(n)
      return ans
    else:
      return [1,n]

A=prime_factorization(a)
B=prime_factorization(b)
#print(A)
#print(B)

print(len(set(A)&set(B)))

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

def prime_factorization(n):
  if n==1:
    return []
  else:
    i=2
    ans=[]
    while n>1:
      if n%i==0:
        n//=i
        ans.append(i)
        while n%i==0:
          n//=i
      i+=1
    return ans

A=prime_factorization(a)
B=prime_factorization(b)

ans=0
for _a in A:
  if B.count(_a):
    ans+=1
print(ans+1)


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

def prime_factorization(n):
  if n==1:
    return [1]
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      ans.append(1)
      if n!=1:
        ans.append(n)
      return ans
    else:
      return [1,n]

A=prime_factorization(a)
B=prime_factorization(b)
#print(A)
#print(B)

print(len(set(A)&set(B)))