Buggy python submission (verdict: Runtime Error):

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

#limit = round(min(fractions.gcd(a, b), max(math.sqrt(a), math.sqrt(b))))
limit = int(max(math.sqrt(a), math.sqrt(b)))
cnt = 0
for i in range(2, limit+1):
  flag = False
  while (a % i == 0) and (b % i == 0):
    a = a // i
    b = b // i
    flag = True
  if flag:
    cnt += 1
   
print (cnt+1)

Fixed submission:
import fractions
import math
from collections import deque

def prime(x):
  px = []
  limit = int(math.sqrt(x))
  for i in range(2, limit+1):
    flag = False
    while x % i == 0:
      flag = True
      x = x // i
    if flag:
      px.append(i)
  if x != 1:
    px.append(x)
  return px

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

pa = prime(a)
pb = prime(b)

cnt = 1
j = 0

for i in range(len(pa)):
  while j < len(pb) and pb[j] < pa[i]:
    j += 1
  if j == len(pb):
    break
  elif pb[j] == pa[i]:
    cnt += 1
  
print (cnt)

Buggy python submission (verdict: Runtime Error):
import fractions
import math

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

#limit = round(min(fractions.gcd(a, b), max(math.sqrt(a), math.sqrt(b))))
limit = max(math.sqrt(a), math.sqrt(b))
cnt = 0
for i in range(2, limit+1):
  flag = False
  while (a % i == 0) and (b % i == 0):
    a = a // i
    b = b // i
    flag = True
  if flag:
    cnt += 1
   
print (cnt+1)

Fixed submission:
import fractions
import math
from collections import deque

def prime(x):
  px = []
  limit = int(math.sqrt(x))
  for i in range(2, limit+1):
    flag = False
    while x % i == 0:
      flag = True
      x = x // i
    if flag:
      px.append(i)
  if x != 1:
    px.append(x)
  return px

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

pa = prime(a)
pb = prime(b)

cnt = 1
j = 0

for i in range(len(pa)):
  while j < len(pb) and pb[j] < pa[i]:
    j += 1
  if j == len(pb):
    break
  elif pb[j] == pa[i]:
    cnt += 1
  
print (cnt)

Buggy python submission (verdict: Runtime Error):
import fractions
import math

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

#limit = fractions.gcd(a, b)
limit = min(fractions.gcd(a, b), int(math.sqrt(a)), int(math.sqrt(b)))
cnt = 0
for i in range(2, limit+1):
  flag = False
  while (a % i == 0) and (b % i == 0):
    a = a // i
    b = b // i
    flag = True
  if flag:
    cnt += 1

last = min(a, b)
flag = False
if (a % last == 0) and (b % last == 0) last > 1:
  cnt += 1

   
print (cnt+1)

Fixed submission:
import fractions
import math
from collections import deque

def prime(x):
  px = []
  limit = int(math.sqrt(x))
  for i in range(2, limit+1):
    flag = False
    while x % i == 0:
      flag = True
      x = x // i
    if flag:
      px.append(i)
  if x != 1:
    px.append(x)
  return px

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

pa = prime(a)
pb = prime(b)

cnt = 1
j = 0

for i in range(len(pa)):
  while j < len(pb) and pb[j] < pa[i]:
    j += 1
  if j == len(pb):
    break
  elif pb[j] == pa[i]:
    cnt += 1
  
print (cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import math

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

limit = fractions.gcd(a, b)
sqmin = min(int(math.sqrt(a)), int(math.sqrt(b)))
cnt = 0
for i in range(2, limit+1):
  if i > sqmin and i != a and i != b:
    pass
  else:
    flag = False
    while (a % i == 0) and (b % i == 0):
      a = a // i
      b = b // i
      flag = True
    if flag:
      cnt += 1
   
print (cnt+1)

Fixed submission:
import fractions
import math
from collections import deque

def prime(x):
  px = []
  limit = int(math.sqrt(x))
  for i in range(2, limit+1):
    flag = False
    while x % i == 0:
      flag = True
      x = x // i
    if flag:
      px.append(i)
  if x != 1:
    px.append(x)
  return px

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

pa = prime(a)
pb = prime(b)

cnt = 1
j = 0

for i in range(len(pa)):
  while j < len(pb) and pb[j] < pa[i]:
    j += 1
  if j == len(pb):
    break
  elif pb[j] == pa[i]:
    cnt += 1
  
print (cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

max = fractions.gcd(a, b)
cnt = 0
for i in range(2, max+1):
  flag = False
  while (a % i == 0) and (b % i == 0):
    a = a // i
    b = b // i
    flag = True
  if flag:
    cnt += 1
    
print (cnt+1)

Fixed submission:
import fractions
import math
from collections import deque

def prime(x):
  px = []
  limit = int(math.sqrt(x))
  for i in range(2, limit+1):
    flag = False
    while x % i == 0:
      flag = True
      x = x // i
    if flag:
      px.append(i)
  if x != 1:
    px.append(x)
  return px

tmp = list(map(int,(input().split())))
a = tmp[0]
b = tmp[1]

pa = prime(a)
pb = prime(b)

cnt = 1
j = 0

for i in range(len(pa)):
  while j < len(pb) and pb[j] < pa[i]:
    j += 1
  if j == len(pb):
    break
  elif pb[j] == pa[i]:
    cnt += 1
  
print (cnt)