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

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


def dv(x1, x2):
    ret = []
    v = int(math.sqrt(min(x1, x2))) + 1

    check = [0] * (v + 1)

    for n in range(2, v + 1):
        if check[n] == 1:
            continue

        if x1 % n == 0 and x2 % n == 0:
            ret.append(n)

            cnt = 1
            while n * cnt <= v:
                check[n * cnt] = 1
                cnt += 1

    return ret

can = 0
if A >= B:
    if A % B == 0:
        can = B
else:
    if B % A == 0:
        can = A

cf = [1] + dv(A, B)

flag = False

for c in cf:
    if c % can == 0:
        flag = True
        break
        
if not flag:
    cf = cf + [can]

print(len(cf))

Fixed submission:
A, B = map(int, input().split())


def prime_factorization(n):
    from collections import Counter
    counter = Counter()

    if n < 2:
        return counter

    for i in range(2, int(n ** 0.5) + 1):
        if i * i > n:
            break

        while n % i == 0:
            counter[i] += 1
            n //= i

    if n > 1:
        counter[n] += 1

    return counter


x = prime_factorization(A)
y = prime_factorization(B)

z = set(x.keys()) & set(y.keys())
print(len(z) + 1)

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

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


def dv(x1, x2):
    ret = []
    v = int(math.sqrt(min(x1, x2))) + 1

    check = [0] * (v + 1)

    for n in range(2, v + 1):
        if check[n] == 1:
            continue

        if x1 % n == 0 and x2 % n == 0:
            ret.append(n)

            cnt = 1
            while n * cnt <= v:
                check[n * cnt] = 1
                cnt += 1

    return ret

can = 0
if A >= B:
    if A % B == 0:
        can = B
else:
    if B % A == 0:
        can = A

cf = [1] + dv(A, B)

flag = False

for c in cf:
    if c % can == 0:
        flag = True
        break
        
if not flag:
    cf = cf + [can]

print(len(cf))

Fixed submission:
A, B = map(int, input().split())


def prime_factorization(n):
    from collections import Counter
    counter = Counter()

    if n < 2:
        return counter

    for i in range(2, int(n ** 0.5) + 1):
        if i * i > n:
            break

        while n % i == 0:
            counter[i] += 1
            n //= i

    if n > 1:
        counter[n] += 1

    return counter


x = prime_factorization(A)
y = prime_factorization(B)

z = set(x.keys()) & set(y.keys())
print(len(z) + 1)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())


def dv(x1, x2):
    ret = []

    v = min(x1, x2) + 1
    check = [0] * v

    for n in range(2, v):
        if check[n] == 1:
            continue

        if x1 % n == 0 and x2 % n == 0:
            ret.append(n)

            cnt = 2
            while n * cnt <= v:
                check[n * cnt] = 1
                cnt += 1

    return ret


cf = [1] + dv(A, B)
print(len(cf))

Fixed submission:
A, B = map(int, input().split())


def prime_factorization(n):
    from collections import Counter
    counter = Counter()

    if n < 2:
        return counter

    for i in range(2, int(n ** 0.5) + 1):
        if i * i > n:
            break

        while n % i == 0:
            counter[i] += 1
            n //= i

    if n > 1:
        counter[n] += 1

    return counter


x = prime_factorization(A)
y = prime_factorization(B)

z = set(x.keys()) & set(y.keys())
print(len(z) + 1)