Buggy python submission (verdict: Time Limit Exceeded):
# ABC-142-D
A, B = map(int, input().split())
ans = 1

#最大公約数
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def get_prime_number(x):
    if x == 1:
        return []
    max = int(x ** 0.5)
    search_list = [i for i in range(2,x+1)]
    prime_num = []
    while search_list[0] <= max:
        prime_num.append(search_list[0])
        tmp = search_list[0]
        search_list = [i for i in search_list if i % tmp != 0]
    prime_num.extend(search_list)
    return prime_num

#xの素因数を全て出す
def get_prime_factor(x):
    search_list = get_prime_number(x)
    prime_factor_list = []
    for i in search_list:
        if x % i == 0:
            prime_factor_list.append(i)
    return prime_factor_list

gcd_AB = gcd(A, B)
prime = get_prime_factor(gcd_AB)
ans += len(prime)
print(ans)

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC-142-D
A, B = map(int, input().split())
ans = 1

#x以下の素数を全て出す
def get_prime_number(x):
    if x == 1:
        return []
    max = int(x ** 0.5)
    search_list = [i for i in range(2,x+1)]
    prime_num = []
    while search_list[0] <= max:
        prime_num.append(search_list[0])
        tmp = search_list[0]
        search_list = [i for i in search_list if i % tmp != 0]
    prime_num.extend(search_list)
    return prime_num

#xの素因数を全て出す
def get_prime_factor(x):
    search_list = get_prime_number(x)
    prime_factor_list = []
    for i in search_list:
        if x % i == 0:
            prime_factor_list.append(i)
    return prime_factor_list

A_prime_factor = get_prime_factor(A)
B_prime_factor = get_prime_factor(B)

for item in A_prime_factor:
    if item in B_prime_factor:
        ans += 1
print(ans)

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(x, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = [1]
    for num in range(2, n*0.5+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    return set(factor)
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
#https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
        while y != 0:
            x, y = y, x%y
        return x
    
def factorize(n):
    factor = [1]
    for num in range(2, n*n+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    return set(factor)
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)