Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)

if C==1:
   print(1)
else:
   count=1

   n=2
   while C!=1:
      flag=True
      flag2=False
      while flag:
         if C%n==0:
            flag2=True
            C//=n
         else:
            if flag2:
               flag=False
               flag2=False
               n=n+1 if n==2 else n+2
               count+=1
            else:
               flag=False
               n=n+1 if n==2 else n+2

   print(count)

Fixed submission:
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)

if C==1:
   print(1)
else:
   count=1
   C_copy=C
   n=2
   while n**2<=C:
      flag=False
      while C_copy%n==0:
         C_copy//=n
         flag=True
      if flag:
         count+=1
         n=n+1 if n==2 else n+2
      else:
         n=n+1 if n==2 else n+2
   
   if C_copy!=1:
      count+=1

   print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import math

def eratosthenes(limit):
   A=[c for c in range(3,limit+1,2)]
   A.insert(0,2)
   P=deque()

   while True:
      prime_number=A[0]

      if prime_number > math.sqrt(limit):
         break

      P.append(prime_number)

      i=0
      while i < len(A):
         if A[i] % prime_number == 0:
            A.pop(i)
            continue
         i += 1

   for a in A:
      P.append(a)

   li=list(P)
   return(li)

from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)
prime_numbers=eratosthenes(C)
count=1

for i in range(1,C+1):
   if C%i==0:
      if i in prime_numbers:
         count+=1

print(count)

Fixed submission:
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)

if C==1:
   print(1)
else:
   count=1
   C_copy=C
   n=2
   while n**2<=C:
      flag=False
      while C_copy%n==0:
         C_copy//=n
         flag=True
      if flag:
         count+=1
         n=n+1 if n==2 else n+2
      else:
         n=n+1 if n==2 else n+2
   
   if C_copy!=1:
      count+=1

   print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)
kouyakusuu=[]

for i in range(1,C+1):
   if C%i==0:
      kouyakusuu.append(i)

from collections import deque
import math

def eratosthenes(limit):
   A=[c for c in range(3,limit+1,2)]
   A.insert(0,2)
   P=deque()

   while True:
      prime_number=A[0]

      if prime_number > math.sqrt(limit):
         break

      P.append(prime_number)

      i=0
      while i < len(A):
         if A[i] % prime_number == 0:
            A.pop(i)
            continue
         i += 1

   for a in A:
      P.append(a)

   li=list(P)
   return(li)

prime_numbers=eratosthenes(C)
print(len(set(kouyakusuu)&set(prime_numbers))+1)

Fixed submission:
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)

if C==1:
   print(1)
else:
   count=1
   C_copy=C
   n=2
   while n**2<=C:
      flag=False
      while C_copy%n==0:
         C_copy//=n
         flag=True
      if flag:
         count+=1
         n=n+1 if n==2 else n+2
      else:
         n=n+1 if n==2 else n+2
   
   if C_copy!=1:
      count+=1

   print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)
kouyakusuu=[]

for i in range(1,C+1):
   if C%i==0:
      kouyakusuu.append(i)

from collections import deque
import math

def eratosthenes(limit):
   A=[c for c in range(3,limit+1,2)]
   A.insert(0,2)
   P=deque()

   while True:
      prime_number=A[0]

      if prime_number > math.sqrt(limit):
         break

      P.append(prime_number)

      i=0
      while i < len(A):
         if A[i] % prime_number == 0:
            A.pop(i)
            continue
         i += 1

   for a in A:
      P.append(a)

   li=list(P)
   return(li)

prime_numbers=eratosthenes(C)
print(len(set(kouyakusuu)&set(prime_numbers))+1)

Fixed submission:
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)

if C==1:
   print(1)
else:
   count=1
   C_copy=C
   n=2
   while n**2<=C:
      flag=False
      while C_copy%n==0:
         C_copy//=n
         flag=True
      if flag:
         count+=1
         n=n+1 if n==2 else n+2
      else:
         n=n+1 if n==2 else n+2
   
   if C_copy!=1:
      count+=1

   print(count)