Buggy python submission (verdict: Runtime Error):
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

Fixed submission:
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

Buggy python submission (verdict: Runtime Error):
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = math.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

Fixed submission:
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

Buggy python submission (verdict: Time Limit Exceeded):
#方針...ユークリッドの互除法を用いて2整数が互いに素かどうかを判定する関数を設計
#       O(route n)で2整数の公約数をリストとして出力する関数を設計
import math

def judge_disjoint(a,b):

    while (a!=0 and b!=0):
        if b<a:
            a,b = b,a
        b = b%a
    if (a==1 or b==1):
        return True
    else:
        return False

def common_divisor(a,b):
    ls_a=[]
    ls_b=[]
    A = int(math.sqrt(a))
    B = int(math.sqrt(b))
    for i in range(1,A+1):
        if (a%i==0):
            ls_a.append(i)
            ls_a.append(a//i)
    for i in range(1,B+1):
        if (b%i==0):
            ls_b.append(i)
            ls_b.append(b//i)
    ls = list(set(ls_a) & set(ls_b))
    return ls

A,B = list(map(int,input().split()))
ls = common_divisor(A,B)
ls.sort()
#print(ls)
N = len(ls)

def solve(ls):
    ls2=[1]
    ls.pop(0)

    if (len(ls)!=0):
        ls2.append(ls[0])
        for i in range(1,len(ls)):
            flag = True
            for j in range(i):
                if (ls[i]%ls[j]==0):
                    flag = False
            if flag:
                ls2.append(ls[i])
    return ls2


ans = len(solve(ls))


print(ans)


Fixed submission:
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

Buggy python submission (verdict: Time Limit Exceeded):
#方針...ユークリッドの互除法を用いて2整数が互いに素かどうかを判定する関数を設計
#       O(route n)で2整数の公約数をリストとして出力する関数を設計
#       あとはbit探索
import math

def judge_disjoint(a,b):

    while (a!=0 and b!=0):
        if b<a:
            a,b = b,a
        b = b%a
    if (a==1 or b==1):
        return True
    else:
        return False

def common_divisor(a,b):
    ls_a=[]
    ls_b=[]
    A = int(math.sqrt(a))
    B = int(math.sqrt(b))
    for i in range(1,A+1):
        if (a%i==0):
            ls_a.append(i)
            ls_a.append(a//i)
    for i in range(1,B+1):
        if (b%i==0):
            ls_b.append(i)
            ls_b.append(b//i)
    ls = list(set(ls_a) & set(ls_b))
    return ls

A,B = list(map(int,input().split()))
ls = common_divisor(A,B)
N = len(ls)
ans = 0

for bit in range(2**N):
    candidates=[]
    flag=True
    for i in range(N):
        if(1<<i & bit):
            candidates.append(ls[i])
    for i in range(len(candidates)-1):
        for j in range(i+1,len(candidates)):
            if (not judge_disjoint(candidates[i],candidates[j])):
                flag = False
    if(flag):
        ans = max(ans,len(candidates))
        
print(ans)


Fixed submission:
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))