Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
import re


def gcd(a, b):
    dividend, divisor = max(a, b), min(a, b)
    while True:
        dividend, divisor = divisor, dividend % divisor
        if divisor == 0:
            return dividend


def int_check(n):
    n_type = type(n)
    if n_type != int:
        n_type_str = re.search(r'\'.+\'', str(n_type)).group()
        raise TypeError(n_type_str + ' object cannot be interpreted as an integer')


def eratosthenes(n):
    int_check(n)
    if n == 1:
        return []

    int_list = list(range(2, n+1))
    bottom_index = 0

    while int_list[bottom_index] <= sqrt(n):
        prime = int_list[bottom_index]
        bottom_index += 1
        top_index = bottom_index

        for num in int_list[bottom_index:]:
            if num % prime != 0:
                int_list[top_index] = num
                top_index += 1

        del int_list[top_index:]

    return int_list


def naive_method(n):
    int_check(n)
    if n == 1:
        return []

    prime_divisors = []
    for prime in eratosthenes(int(sqrt(n))):
        if n % prime == 0:
            remain_factor = n
            exponent = 0
            while remain_factor % prime == 0:
                remain_factor //= prime
                exponent += 1
            prime_divisors.append((prime, exponent))
            prime_divisors.extend(naive_method(remain_factor))

    prime_factors = []
    if len(prime_divisors) == 0:
        prime_factors.append((n, 1))
    else:
        prime_divisors.append((float('inf'), -float('inf')))
        prime_divisors.sort(key=lambda t: t[0])
        current_factor, max_exponent = prime_divisors[0]
        for factor in prime_divisors:
            if factor[0] == current_factor:
                max_exponent = max(max_exponent, factor[1])
            else:
                prime_factors.append((current_factor, max_exponent))
                current_factor, max_exponent = factor

    return prime_factors


def main():
    a, b = map(int, input().split())
    print(len(naive_method(gcd(a, b))) + 1)


if __name__ == '__main__':
    main()


Fixed submission:
from fractions import gcd
from math import sqrt, ceil

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

count = 1
for i in range(2, ceil(sqrt(gcd_)) + 1):
    if gcd_ % i == 0:
        count += 1
        while gcd_ % i == 0:
            gcd_ /= i

if gcd_ != 1:
    count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
from math import gcd, sqrt
import re


def int_check(n):
    n_type = type(n)
    if n_type != int:
        n_type_str = re.search(r'\'.+\'', str(n_type)).group()
        raise TypeError(n_type_str + ' object cannot be interpreted as an integer')


def eratosthenes(n):
    int_check(n)
    if n == 1:
        return []

    int_list = list(range(2, n+1))
    bottom_index = 0

    while int_list[bottom_index] <= sqrt(n):
        prime = int_list[bottom_index]
        bottom_index += 1
        top_index = bottom_index

        for num in int_list[bottom_index:]:
            if num % prime != 0:
                int_list[top_index] = num
                top_index += 1

        del int_list[top_index:]

    return int_list


def naive_method(n):
    int_check(n)
    if n == 1:
        return []

    prime_divisors = []
    for prime in eratosthenes(int(sqrt(n))):
        if n % prime == 0:
            remain_factor = n
            exponent = 0
            while remain_factor % prime == 0:
                remain_factor //= prime
                exponent += 1
            prime_divisors.append((prime, exponent))
            prime_divisors.extend(naive_method(remain_factor))

    prime_factors = []
    if len(prime_divisors) == 0:
        prime_factors.append((n, 1))
    else:
        prime_divisors.append((float('inf'), -float('inf')))
        prime_divisors.sort(key=lambda t: t[0])
        current_factor, max_exponent = prime_divisors[0]
        for factor in prime_divisors:
            if factor[0] == current_factor:
                max_exponent = max(max_exponent, factor[1])
            else:
                prime_factors.append((current_factor, max_exponent))
                current_factor, max_exponent = factor

    return prime_factors


def main():
    a, b = map(int, input().split())
    print(len(naive_method(gcd(a, b))) + 1)


if __name__ == '__main__':
    main()


Fixed submission:
from fractions import gcd
from math import sqrt, ceil

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

count = 1
for i in range(2, ceil(sqrt(gcd_)) + 1):
    if gcd_ % i == 0:
        count += 1
        while gcd_ % i == 0:
            gcd_ /= i

if gcd_ != 1:
    count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt, ceil

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

count = 1
primes = [2]

for i in range(3, ceil(sqrt(min(A, B))), 2):
    for j in primes:
        if i % j == 0:
            break
    else:
        primes.append(i)

for i in primes:
    if A % i == B % i == 0:
        count += 1
if count == 1 and min(A, B) != 1 and max(A, B) % min(A, B) == 0:
    count += 1

print(count)


Fixed submission:
from fractions import gcd
from math import sqrt, ceil

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

count = 1
for i in range(2, ceil(sqrt(gcd_)) + 1):
    if gcd_ % i == 0:
        count += 1
        while gcd_ % i == 0:
            gcd_ /= i

if gcd_ != 1:
    count += 1

print(count)