Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B = map(int, input().split())

def is_prime(n):
    a = 0
    for k in range(1 + 1, int(math.sqrt(n)) + 1):
        if n % k == 0:
            a = 1
    if a == 1: return False
    else :return True

list1, list2 = [1], [1]
try:
    list1.extend([i for i in range(1+1, A+1) if A % i == 0
    and is_prime(i) == True])
    list2.extend([i for i in range(1+1, B+1) if B % i == 0
    and is_prime(i) == True])
except:
    pass

print(len(set(list1) & set(list2)))

Fixed submission:
A, B = map(int, input().split())
 
def gcd(a, b):  # a,bの最大公約数
    while b:
        a, b = b, a % b
    return a

def factorization(n):  # nを素因数分解
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1): 
        if temp % i == 0: # 割り切れるとき
            cnt = 0
            while temp % i == 0: # 割れる限りカウント
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1: # まだ因数があるとき
        arr.append([temp, 1])
    if arr == []: # ｎが1のとき
        arr.append([n, 1])
    return arr
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B = map(int, input().split())

def is_prime(n):
    a = 0
    for k in range(1 + 1, int(math.sqrt(n)) + 1):
        if n % k == 0:
            a = 1
    if a == 1: return False
    else :return True

list = [1]
list.extend([i for i in range(1+1, min(A, B)+1) if A % i == 0 and B % i == 0 
and A % i != 2 and B % i != 2 
and A % i != 3 and B % i != 3 
and A % i != 5 and B % i != 5 
and A % i != 7 and B % i != 7 
and A % i != 11 and B % i != 11 
and A % i != 13 and B % i != 13 
and A % i != 17 and B % i != 17 
and A % i != 19 and B % i != 19 
and A % i != 23 and B % i != 23 
and A % i != 29 and B % i != 29 
and A % i != 31 and B % i != 31 
and A % i != 37 and B % i != 37 
and A % i != 41 and B % i != 41 
and A % i != 43 and B % i != 43 
and A % i != 47 and B % i != 47 
and A % i != 53 and B % i != 53 
and A % i != 59 and B % i != 59 
and A % i != 61 and B % i != 61 
and A % i != 67 and B % i != 67 
and A % i != 71 and B % i != 71 
and A % i != 73 and B % i != 73 
and A % i != 79 and B % i != 79 
and A % i != 83 and B % i != 83 
and A % i != 89 and B % i != 89 
and A % i != 97 and B % i != 97 
and A % i != 101 and B % i != 101 
and A % i != 103 and B % i != 103 
and A % i != 107 and B % i != 107 
and A % i != 109 and B % i != 109 
and A % i != 113 and B % i != 113 
and A % i != 127 and B % i != 127 
and A % i != 131 and B % i != 131 
and A % i != 137 and B % i != 137 
and A % i != 139 and B % i != 139 
and A % i != 149 and B % i != 149 
and A % i != 151 and B % i != 151 
and A % i != 157 and B % i != 157 
and A % i != 163 and B % i != 163 
and A % i != 167 and B % i != 167 
and A % i != 173 and B % i != 173 
and A % i != 179 and B % i != 179 
and A % i != 181 and B % i != 181 
and A % i != 191 and B % i != 191 
and A % i != 193 and B % i != 193 
and A % i != 197 and B % i != 197 
and A % i != 199 and B % i != 199 
and A % i != 211 and B % i != 211 
and A % i != 223 and B % i != 223 
and A % i != 227 and B % i != 227 
and A % i != 229 and B % i != 229 
and is_prime(i) == True])
print(len(list))

Fixed submission:
A, B = map(int, input().split())
 
def gcd(a, b):  # a,bの最大公約数
    while b:
        a, b = b, a % b
    return a

def factorization(n):  # nを素因数分解
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1): 
        if temp % i == 0: # 割り切れるとき
            cnt = 0
            while temp % i == 0: # 割れる限りカウント
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1: # まだ因数があるとき
        arr.append([temp, 1])
    if arr == []: # ｎが1のとき
        arr.append([n, 1])
    return arr
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B = map(int, input().split())

def is_prime(n):
    a = 0
    for k in range(1 + 1, int(math.sqrt(n)) + 1):
        if n % k == 0:
            a = 1
    if a == 1: return False
    else :return True

list = [1]
list.extend([i for i in range(1+1, min(A, B)+1) if A % i == 0 and B % i == 0 
and A % i != 2 and B % i != 2 
and A % i != 3 and B % i != 3 
and A % i != 5 and B % i != 5 
and A % i != 7 and B % i != 7 
and A % i != 11 and B % i != 11 and is_prime(i) == True])
print(len(list))

Fixed submission:
A, B = map(int, input().split())
 
def gcd(a, b):  # a,bの最大公約数
    while b:
        a, b = b, a % b
    return a

def factorization(n):  # nを素因数分解
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1): 
        if temp % i == 0: # 割り切れるとき
            cnt = 0
            while temp % i == 0: # 割れる限りカウント
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1: # まだ因数があるとき
        arr.append([temp, 1])
    if arr == []: # ｎが1のとき
        arr.append([n, 1])
    return arr
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1, x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

import math
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

list = [1]
list.extend(cf(A,B))
cnt = 1
for i in list:
    if is_prime(i) == True:
        cnt += 1
print(cnt)

Fixed submission:
A, B = map(int, input().split())
 
def gcd(a, b):  # a,bの最大公約数
    while b:
        a, b = b, a % b
    return a

def factorization(n):  # nを素因数分解
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1): 
        if temp % i == 0: # 割り切れるとき
            cnt = 0
            while temp % i == 0: # 割れる限りカウント
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1: # まだ因数があるとき
        arr.append([temp, 1])
    if arr == []: # ｎが1のとき
        arr.append([n, 1])
    return arr
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)