Buggy python submission (verdict: Runtime Error):
def sieve(N, limit):
    is_prime = [True] * (N + 1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, limit + 1):
        if not is_prime[i]:
            continue
        for j in range(i + i, N + 1, i):
            is_prime[j] = False
    return [i for i in range(2, N + 1) if is_prime[i]]


A, B = map(int, input().split())
max_num = max(A, B)
limit = int(max_num ** 0.5)
primes = sieve(max_num, limit)
a_prime = {i for i in primes if A % i == 0}
b_prime = {i for i in primes if B % i == 0}

common = a_prime.intersection(b_prime)
print(len(common) + 1)

Fixed submission:
def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))

Buggy python submission (verdict: Runtime Error):
def sieve(N, limit):
    primes = []
    data = [i + 1 for i in range(1, N)]
    while True:
        p = data[0]
        if limit <= p:
            return primes + data
        primes.append(p)
        data = [e for e in data if e % p != 0]


A, B = map(int, input().split())
max_num = max(A, B)
limit = int(max_num ** 0.5)
primes = sieve(max_num, limit)
a_prime = {i for i in primes if A % i == 0}
b_prime = {i for i in primes if B % i == 0}

common = a_prime.intersection(b_prime)
print(len(common) + 1)

Fixed submission:
def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))

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

max_num = max(A, B)
target = list(range(2, max_num + 1))

is_prime = [True] * (max_num + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(max_num ** 0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, max_num + 1, i):
        is_prime[j] = False
primes = [i for i in range(max_num + 1) if is_prime[i]]

count = 1
for prime in primes:
    if A % prime == 0 and B % prime == 0:
        count += 1
print(count)

Fixed submission:
def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))

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

max_num = max(A, B)
target = list(range(2, max_num + 1))
primes = set()
while True:
    if len(target) == 0:
        break

    num = min(target)

    if num * num > max_num:
        break

    primes.add(num)

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

count = 1
for prime in primes:
    if A % prime == 0 and B % prime == 0:
        count += 1
print(count)

Fixed submission:
def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))

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

max_num = max(A, B)
target = list(range(2, max_num + 1))
primes = set()
while True:
    num = min(target)

    if num * num > max_num:
        break

    primes.add(num)

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

count = 1
for prime in primes:
    if A % prime == 0 and B % prime == 0:
        count += 1
print(count)

Fixed submission:
def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))