Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 7)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

A, B = map(int, input().split())
x = gcd(A, B)
prime_list = prime_decomposition(x)
s = set(prime_list)
s.add(1)
for y in s:
    if y == x and len(s) != 1:
        s -= {x}
        
print(len(s))


Fixed submission:
import fractions

A, B = map(int, input().split())

GCD = fractions.gcd(A, B)

def pf(n):
    a = []
    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

print(len(set(pf(GCD))) + 1)

Buggy python submission (verdict: Runtime Error):

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

A, B = map(int, input().split())
x = gcd(A, B)
prime_list = prime_decomposition(x)
s = set(prime_list)
s.add(1)
for y in s:
    if y == x and len(s) != 1:
        s -= {x}
        
print(len(s))

Fixed submission:
import fractions

A, B = map(int, input().split())

GCD = fractions.gcd(A, B)

def pf(n):
    a = []
    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

print(len(set(pf(GCD))) + 1)

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

A, B = map(int, input().split())

# 1は絶対入る
cd = [1]
answer = 1
if A%2 == 0 and B%2 == 0:
    cd.append(2)
    answer += 1
for i in range(3, fractions.gcd(A, B)+1, 2):
    if A%i == 0 and B%i == 0:
        for j in cd:
            if fractions.gcd(i, j) != 1:
                break
        else:
            cd.append(i)
            answer += 1
            
print(answer)

Fixed submission:
import fractions

A, B = map(int, input().split())

GCD = fractions.gcd(A, B)

def pf(n):
    a = []
    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

print(len(set(pf(GCD))) + 1)

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

A, B = map(int, input().split())

# 1は絶対入る
cd = [1]
answer = 1
for i in range(2, min(A, B)):
    if A%i == 0 and B%i == 0:
        for j in cd:
            if fractions.gcd(i, j) != 1:
                break
        else:
            cd.append(i)
            answer += 1
            
print(answer)

Fixed submission:
import fractions

A, B = map(int, input().split())

GCD = fractions.gcd(A, B)

def pf(n):
    a = []
    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

print(len(set(pf(GCD))) + 1)