Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
    
A,B = map(int,input().split())
Cd = list(set(dv(A))&set(dv(B)))
N = len(Cd)
ans = []
for i in range(N,0,-1):
    for c in itertools.combinations(Cd,i):
        if not c:
            continue
        Flag = 1
        for i in itertools.combinations(c, 2):
            if gcd_list(i) != 1:
                Flag = 0
                break
        if Flag == 1:
           ans.append(len(c))
    if ans:
        print(max(ans))
        exit()

Fixed submission:
def factorization(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==[]:
        arr.append([n, 1])

    return arr
import fractions
A,B = map(int,input().split())
ans = factorization(fractions.gcd(A,B))
if ans[0][0] == 1:
    print(len(ans))
else:
    print(len(ans)+1)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
    
A,B = map(int,input().split())
Cd = list(set(dv(A))&set(dv(B)))
N = len(Cd)
ans = 0
for bit in range(1<<N):
    d = []
    for i in range(N):
        if (bit>>i)&1 == 1:
            d.append(Cd[i])
    if not d:
        continue
    Flag = 1
    for i in itertools.combinations(d, 2):
        if gcd_list(i) != 1:
            Flag = 0
            break
    if Flag == 1:
        ans = max(ans,len(d))
print(ans)

Fixed submission:
def factorization(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==[]:
        arr.append([n, 1])

    return arr
import fractions
A,B = map(int,input().split())
ans = factorization(fractions.gcd(A,B))
if ans[0][0] == 1:
    print(len(ans))
else:
    print(len(ans)+1)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
    
A,B = map(int,input().split())
Cd = list(set(dv(A))&set(dv(B)))
N = len(Cd)
ans = 0
for bit in range(1<<N):
    d = []
    for i in range(N):
        if (bit>>i)&1 == 1:
            d.append(Cd[i])
    if not d:
        continue
    Flag = 1
    for i in itertools.permutations(d, 2):
        if gcd_list(i) != 1:
            Flag = 0
            break
    if Flag == 1:
        ans = max(ans,len(d))
print(ans)

Fixed submission:
def factorization(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==[]:
        arr.append([n, 1])

    return arr
import fractions
A,B = map(int,input().split())
ans = factorization(fractions.gcd(A,B))
if ans[0][0] == 1:
    print(len(ans))
else:
    print(len(ans)+1)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
    
A,B = map(int,input().split())
Cd = list(set(dv(A))&set(dv(B)))
N = len(Cd)
ans = 0
for bit in range(1<<N):
    d = []
    for i in range(N):
        if (bit>>i)&1 == 1:
            d.append(Cd[i])
    if not d:
        continue
    Flag = 1
    for i in itertools.permutations(d, 2):
        if gcd_list(i) != 1:
            Flag = 0
            break
    if Flag == 1:
        ans = max(ans,len(d))
print(ans)

Fixed submission:
def factorization(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==[]:
        arr.append([n, 1])

    return arr
import fractions
A,B = map(int,input().split())
ans = factorization(fractions.gcd(A,B))
if ans[0][0] == 1:
    print(len(ans))
else:
    print(len(ans)+1)