Problem:


Score : 400 points

Problem Statement

Given are positive integers A and B.

Let us choose some number of positive common divisors of A and B.

Here, any two of the chosen divisors must be coprime.

At most, how many divisors can we choose?

Definition of common divisor

An integer d is said to be a common divisor of integers x and y when d divides both x and y.

Definition of being coprime

Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.

Definition of dividing

An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Constraints

All values in input are integers.

1 \leq A, B \leq 10^{12}

Input

Input is given from Standard Input in the following format:

A B

Output

Print the maximum number of divisors that can be chosen to satisfy the condition.

Sample Input 1

12 18

Sample Output 1

3

12 and 18 have the following positive common divisors: 1, 2, 3, and 6.

1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.

Sample Input 2

420 660

Sample Output 2

4

Sample Input 3

1 2019

Sample Output 3

1

1 and 2019 have no positive common divisors other than 1.



Sample input:
12 18


Sample output:
3

Submission status: Runtime Error

Solution code:
import math
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)
    if temp != 1:
        arr.append(temp)
    return arr

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

GCD = math.gcd(A,B)

print(len(factorization(GCD))+1)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())

import math

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

GCD = math.gcd(A,B)

print(len(factorization(GCD))+1)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
18 24

import math

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

GCD = math.gcd(A,B)

print(len(factorization(GCD))+1)

Submission status: Runtime Error

Solution code:
import math

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

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

GCD = math.gcd(A,B)

print(len(factorization(GCD))+1)

Submission status: Runtime Error

Solution code:
import math

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

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

GCD = math.gcd(A,B)

print(len(factorization(GCD))+1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
A, B = [int(x) for x in input().split()]
N = gcd(A, B)
p_list = set({})
for i in range(1, int(math.sqrt(N))+1):
    if (N != (N//i * i)):
        continue
    if (i == 1):
        p_list.add(i)
    else:
        is_prime = True
        for p in p_list:
            if (p != 1 and i == (i//p * p)):
                is_prime = False
        if (is_prime):
            p_list.add(i)
        j = N // i
        is_prime = True
        for p in p_list:
            if (p != 1 and j == (j//p * p)):
                is_prime = False
        if (is_prime):
            p_list.add(j)
print(len(p_list))

Submission status: Runtime Error

Solution code:
import math
A,B = (map(int, input().split()))
prime_NA,prime_NB = [],[]
cntA,cntB=0,0
minAB = math.gcd(A,B)
for i in range(int(math.sqrt(minAB))+1):
    if A%(i+1)==0:
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                cntA+=1
        if cntA<=2:
            prime_NA.append(i+1)
        cntA = 0
    if B%(i+1)==0:
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                cntB+=1
        if cntB<=2:
            prime_NB.append(i+1)
        cntB = 0
#print(prime_NA,prime_NB)
print(len(set(prime_NA)&set(prime_NB)))

Submission status: Runtime Error

Solution code:
import math
A,B = (map(int, input().split()))
prime_NA,prime_NB = [],[]
cntA,cntB=0,0
minAB = math.gcd(A,B)
for i in range(int(math.sqrt(minAB))):
    if A%(i+1)==0:
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                cntA+=1
        if cntA<=2:
            prime_NA.append(i+1)
        cntA = 0
    if B%(i+1)==0:
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                cntB+=1
        if cntB<=2:
            prime_NB.append(i+1)
        cntB = 0
#print(prime_NA,prime_NB)
print(len(set(prime_NA)&set(prime_NB)))

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

a,b=map(int,input().split())

def yakusu(x,X):
    for i in range(1,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            if x!=i:
                X.append(x//i)
    
A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
A.sort()
B.sort()
#print(A,B)
kouyakusu=[]
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        kouyakusu.append(A[i])
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1

ans=0
for i in range(1,len(kouyakusu)):
    if not(kouyakusu[i]): continue
    ans+=1
    for j in range(i+1,len(kouyakusu)):
        if kouyakusu[j]%kouyakusu[i]==0:
            kouyakusu[j]=False
#print(kouyakusu)
print(ans+1)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

a,b=map(int,input().split())

def yakusu(x,X):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            if x!=i:
                X.append(x//i)
    
A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
A.sort()
B.sort()
#print(A,B)
kouyakusu=[]
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        kouyakusu.append(A[i])
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1

ans=0
for i in range(len(kouyakusu)):
    if not(kouyakusu[i]): continue
    ans+=1
    for j in range(i+1,len(kouyakusu)):
        if kouyakusu[j]%kouyakusu[i]==0:
            kouyakusu[j]=False

print(ans+1)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

a,b=map(int,input().split())

def yakusu(x,X):
    for i in range(1,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            if x!=i:
                X.append(x//i)
    
A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
A.sort()
B.sort()
#print(A,B)
kouyakusu=[]
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        kouyakusu.append(A[i])
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1

def isPrime(x):
    if x<=1:
        return False
    for i in range(2,x):
        if x%i==0:
            return False
    return True


ans=0
for k in kouyakusu:
    if isPrime(k):
        ans+=1
print(ans+1)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


a, b = map(int, input().split())

if a > b:
    max_num = int(np.sqrt(a))
else:
    max_num = int(np.sqrt(b))

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= max_num:
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    if num_list.size == 0:
        break
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


a, b = map(int, input().split())

if a > b:
    max_num = np.sqrt(a)
else:
    max_num = np.sqrt(b)

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= max_num:
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


a, b = map(int, input().split())

if a > b:
    max_num = a
else:
    max_num = b

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= np.sqrt(max_num):
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


a, b = map(int, input().split())

if a > b:
    max_num = a
else:
    max_num = b

prime_list = mk_prime_list(max_num)

ans = 1

for i in prime_list:
    if a % i == 0 and b % i == 0:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np


def is_prime(n):
    return n != 1 and not np.any(n % np.arange(2, n) == 0)


A, B = [int(x) for x in input().split()]

N = np.arange(1, min(A, B) + 1)

cd = np.argwhere((A % N == 0) & (B % N == 0)).ravel() + 1
primes = [n for n in cd if is_prime(n)]

print(len(primes) + 1)

Submission status: Runtime Error

Solution code:
import numpy as np


def is_prime(n):
    return n != 1 and not np.any(n % np.arange(2, n) == 0)


A, B = [int(x) for x in input().split()]

N = np.arange(1, min(A, B))

if N.size == 0:
    print(1)
else:
    cd = np.argwhere((A % N == 0) & (B % N == 0)).ravel() + 1
    primes = [n for n in cd if is_prime(n)]

    print(len(primes) + 1)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

a,b=map(int,input().split())

def yakusu(x,X):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            while x%i==0:
                x=x//i
    

A=[1]
B=[1]
yakusu(a,A)
yakusu(b,B)
ans=0
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        ans+=1
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

a,b=map(int,input().split())

def yakusu(x,X):
    for i in range(1,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            x//=i

A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
ans=0
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        ans+=1
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1
print(ans)

Submission status: Runtime Error

Solution code:
import math 

a, b = map(int, input().split())

factors = []
for i in range(2, math.ceil(min(a,b)**0.5)):
	if a%i==0 and b%i==0: 
		factors.append(i)
		if b%(a//i)==0: factors.append(a//i)

factors.sort()
for i in range(len(factors)):
	power = 2
	if factors[i]:
		temp = factors[i]
		for j in range(len(factors)):
			if factors[j]:
				if factors[j]!=factors[i]:
					if temp%factors[j]==0:
						factors[j] = False
					temp *= power
					power += 1

count = 0
for i in factors:
	if i: count += 1
print(count+1

Submission status: Runtime Error

Solution code:
import fanctions
A,B = map(int,input().split())
m = fanctions.gcd(A,B)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

l_m = prime_factorize(m)
if len(l_m) >= 1:
    ans = 2
else:
    print("1")
    exit()
for i in range(1,len(l_m)):
    if not l_m[i] == l_m[i-1]:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))


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


A,B = LI()

gcd = math.gcd(A,B)
ans = 1
for facter in factorization(gcd):
    if facter[0] == 1:
        pass
    else:
        ans += 1
print(ans)


'''
12 18
1 2 3 6
1 2 3

6 9
1 3
1 2 3

420 660
210 330
105 165
35 55
7 11

2**2*3
1 2 3 5
'''

Submission status: Runtime Error

Solution code:
#素因数分解をする
from fraction import gcd
import numpy as np
a,b = [int(i) for i in input().split()]
g = gcd(a,b)

primes = []
n=1

#約数に関して、常に、これが言える。
while n**2 <=g:
    n += 1
    q,r = divmod(g,n)
    if r!=0:
        continue
    while r==0:
        g = q
        q,r = divmod(g,n)
    primes.append(n)

#最後に素数が余るケース    
if g != 1:
    primes.append(g)
    
print(len(primes)+1)

Submission status: Runtime Error

Solution code:
#素因数分解をする
from math import gcd
import numpy as np
a,b = [int(i) for i in input().split()]
g = gcd(a,b)

primes = []
n=1

#約数に関して、常に、これが言える。
while n**2 <=g:
    n += 1
    q,r = divmod(g,n)
    if r!=0:
        continue
    while r==0:
        g = q
        q,r = divmod(g,n)
    primes.append(n)

#最後に素数が余るケース    
if g != 1:
    primes.append(g)
    
print(len(primes)+1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
max_prime = int(np.sqrt(g))+1
primes = np.ones(g + 1)
#print(g+1, primes.shape)
primes[0] = 0
#print(primes)
for i in range(2, max_prime):
  if i * 2 < g + 1:
    primes[i*2::i] = 0
    #print(i, primes)

primes = primes.nonzero()[0]
#print(primes.nonzero()[0])

factor = primes[g % primes == 0]

#print(g, original_g, factor)
print(len(factor))

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
max_prime = int(np.sqrt(g))+1
primes = np.ones(g + 1)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if i * 2 < g + 1:
    try:
   	  primes[i*2::i] = 0
    except:
      pass
    #print(i, primes)

primes = primes.nonzero()[0]
#print(primes.nonzero()[0])

factor = primes[g % primes == 0]

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
max_prime = int(np.sqrt(g))+1
primes = np.ones(g + 1)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if i * 2 < g + 1:
    primes[i*2::i] = 0
    #print(i, primes)

primes = primes.nonzero()[0]
#print(primes.nonzero()[0])

factor = primes[g % primes == 0]

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
max_prime = g + 2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, int(np.sqrt(max_prime))+2):
  if i * 2 < max_prime:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    #print(g)
    factor.append(i)

#print(g, factor)
print(len(factor) + 1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = g + 2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if i * 2 < max_prime:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = g + 2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
primes = np.ones(g+1)
#print(g+1, primes.shape)
primes[0] = 0
#print(primes)
for i in range(2, int(np.sqrt(g))+1):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(g+1)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    factor.append(i)

if g == 1:
  print(len(factor) + 1)
else:
  print(len(factor))

Submission status: Runtime Error

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
primes = np.ones(g+1)
#print(g+1, primes.shape)
primes[0] = 0
#print(primes)
for i in range(2, int(np.sqrt(g))+1+1):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(g+1)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    factor.append(i)

if g != 1:
  print(len(factor) + 1)
else:
  print(len(factor))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

_a, _b = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b

    return a


def chker(a, b):
    if gcd(a, b) == 1:
        print(1)
        return

    if min(a, b) == 2:
        print(2)
        return

    klist = [item for item in range(1, int(min(_a, _b) ** (1 / 2)) + 1) if _a % item == 0 and _b % item == 0]
    slist, klist = [klist[1]], klist[1:]
    for item1 in klist:
        tag = 0
        for item2 in slist:
            if item1 % item2 == 0:
                tag = 1
                break

        if tag == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

_a, _b = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b

    return a


def chker(a, b):
    if gcd(a, b) == 1:
        print(1)
        return

    klist = [item for item in range(1, int(min(_a, _b) ** (1 / 2)) + 1) if _a % item == 0 and _b % item == 0]
    slist, klist = [klist[1]], klist[1:]
    for item1 in klist:
        tag = 0
        for item2 in slist:
            if item1 % item2 == 0:
                tag = 1
                break

        if tag == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)

Submission status: Runtime Error

Solution code:
import sys
# import math
import fractions as math
input = sys.stdin.readline

_a, _b = map(int, input().split())


def chker(a, b):
    if math.gcd(a, b) == 1:
        print(1)
        return

    klist = [item for item in range(1, int(math.sqrt(min(_a, _b))) + 1) if _a % item == 0 and _b % item == 0]
    slist, klist = [klist[1]], klist[1:]
    for item1 in klist:
        tag = 0
        for item2 in slist:
            if item1 % item2 == 0:
                tag = 1
                break

        if tag == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)

Submission status: Runtime Error

Solution code:
import sys
import math
input = sys.stdin.readline

_a, _b = map(int, input().split())


def chker(a, b):
    if math.gcd(a, b) == 1:
        print(1)
        return

    klist = [item for item in range(1, int(math.sqrt(min(_a, _b))) + 1) if _a % item == 0 and _b % item == 0]
    slist, klist = [klist[1]], klist[1:]
    for item1 in klist:
        tag = 0
        for item2 in slist:
            if item1 % item2 == 0:
                tag = 1
                break

        if tag == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)

Submission status: Runtime Error

Solution code:
import math


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


a, b = list(map(int, input().split()))
g = math.gcd(a, b)
if g == 1:
    print('1')
else:
    print(len(factorization(g))+1)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys


def era(N: int):
    N1 = N+1
    prim = [0]*N1
    i = 2
    while i**2 < N1:
        if prim[i] == 0:
            for j in range(i**2, N1, i):
                if prim[j] == 0:
                    prim[j] = i
        i += 1
    ans = []
    p = N
    n = prim[p]
    while n != 0:
        ans.append(n)
        p = p // n
        n = prim[p]
    ans.append(n)
    return ans


def solve(A: int, B: int):

    while A % B:
        tmp = B
        B = A % B
        A = tmp
    ans = set(era(B))
    print(len(ans)+1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def gcd(x,y):
  n,m = min(x,y), max(x,y)
  while n!=0:
    n, m = m%n, n
  
  return m

def prime(N):
  p = [i+1 for i in range(N)]
  for i in range(2,N+1):
    p = [i_p for i_p in p if i_p%i!=0 or i_p/i==1]

  return p
def prime_factorization(N):
  n = N
  P = prime(int(N**0.5))
  p_f = [1]
  while n != 1:
    for p in P[1:]:
      if n%p == 0:
        p_f.append(p)
        n = n / p
        break
  return p_f
A, B = list(map(int, input().split(" ")))
print(len(set(prime_factorization(gcd(A, B))))

Submission status: Runtime Error

Solution code:
import math

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

C = math.gcd(A, B)
"""nを素因数分解"""
"""2以上の整数n=>[[素因数，指数], ...]の二次元リスト"""

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

figure = factorization(C)
print(len(figure)+1)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
def gcd(a,b):
    if a<b : a,b = b,a
    if b==0: return a
    else: return gcd(b, a%b)
C = gcd(A,B)
ans = 0
X = [True]*(C+1)
X[0] = X[1] = False
for i in range(C+1):
    if X[i]:
        X[i::i] = [False]*(C//i)
        if C%i==0: ans+=1
print(ans+1)

Submission status: Runtime Error

Solution code:
from fractions import gcd
A, B = map(int, input().split())
a = []
b = []
for i in range(1, A**(1/2)+1):
    if A % i == 0:
        a.append(i)
        a.append(A//i)
for i in range(1, B**(1/2)+1):
    if B % i == 0:
        a.append(i)
        a.append(B//i)

ans = 0
for i in a:
    for j in b:
        if gcd(i, j) == 1:
            ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
from math import ceil,floor,sqrt
#from fractions import gcd
def prime(value):
    for i in range(2,int(sqrt(value)+1)):
        if value%i == 0:
            return False
    return True
def main():
    A, B = map(int,input().split())
    dic = {1:1}
    mini = min(A,B)
    maxi = max(A,B)
    for i in range(2,min(int(sqrt(maxi)) + 2,mini)):
        if A%i == 0 and B%i == 0:
            dic[i] = (i)
            div1 = A // i
            div2 = B // i
            if B%div1 == 0 and div1 < B:
                dic[div1] = (div1)
            if A%div2 == 0 and div2 < A:
                dic[div2] = (div2)
    ans = 0
    for key in dic.keys():
        if prime(key):
            ans += 1
    print(ans if A != B else ans += 1)
    return 
main()

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
import math

gcd = math.gcd(a, b)
i, cnt = 2, 1
while i * i <= gcd:
    flag = 0
    while gcd % i == 0:
        flag = 1
        gcd //= i
    if flag:
        cnt += 1
    i += 1
if gcd != 1:
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
from math import gcd, ceil
import sys
a, b = map(int, input().split())

gcdv = gcd(a, b)

if gcdv == 1:
    print(1)
    sys.exit(0)
is_so = True
sqrt_v = ceil(gcdv ** 0.5)
cnt = 1
table = [True] * (sqrt_v + 1)
for i in range(2, sqrt_v + 1):
    if table[i] and gcdv % i == 0:
        cnt += 1
        if gcd(gcdv, i) != 1:
            is_so = False
    for k in range(0, sqrt_v, i):
        table[k] = False

if is_so:
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

if A > B:
  max = A
else:
  max = B

tmp = [0]*max
cnt = 0
for i in range(max):
  if (A%(i+1) == 0) and (B%(i+1) == 0):
    tmp[cnt] = i+1
    cnt += 1
  
list = [0]*cnt
for i in range(cnt):
  list[i]=tmp[i]
  

cnt_ans = 0
for i in range(cnt):
  div_flag = 0
  for j in range(cnt):
    if (i != j) and (list[j] != 1):
      if list[i]%list[j] == 0:
        div_flag = 1
  if list[i] == 1:
    div_flag = 0
    
  if div_flag == 0:
    cnt_ans += 1
      
print(cnt_ans)

Submission status: Runtime Error

Solution code:
import math

A,B=map(int,input().split())
gcd=math.gcd(A,B)
ans=1

if gcd > 1:
  for i in range(2,math.sqrt(gcd)//1 + 1):
    if gcd % i == 0:
      ans += 1
      while(gcd % i == 0):
        gcd /= i
print(ans)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
import numpy as np
for i in range(max(int(np.sqrt(A)), int(np.sqrt(B)))):
 　if A % (i+1) == 0 and B % (i+1) == 0:
   　if i == 0:
      pass
     else:
        if 0 not in (i + 1)%np.array(C):
          C.append(i + 1)
          count += 1
print(count)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
C = []

count = 1
for i in range(min(A, B)):
    if A % (i+1) == 0 and B % (i+1) == 0:
        if i == 0:
            pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int-type.")
    if n < 2:
        raise ValueError("n is more than 2")
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

A, B = map(int, input().split())
C = min(A,B)
primes = get_sieve_of_eratosthenes(C)
prime_divs = []
for p in primes[:int(math.sqrt(C))]:
    if (A % p == 0) and (B % p ==0):
        prime_divs.append(p)

#print(prime_divs)
print(len(prime_divs)+1)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

divs = []
for n in range(1, min(A, B) + 1):
    if (A % n == 0) and  (B % n == 0):
        divs.append(n)

#def gcd(x, y):
#    if y == 0:
#        return x
#    else:
#        return gcd(y, x % y)

print(divs)
d1_copy = d1[:]

for d1_copy in divs[1:]:
    for d2 in divs[divs.index(d1):]:
        if d2 % d1 == 0:
            try:
                divs.remove(d2)
                break
            except:
                pass

print(divs)

print(len(divs))

Submission status: Runtime Error

Solution code:
from fractions import gcd

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
    check = False
print(ans + 1)

Submission status: Runtime Error

Solution code:
from functions import gcd

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
    check = False
print(ans + 1)

Submission status: Runtime Error

Solution code:
import math

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
print(ans + 1)

Submission status: Runtime Error

Solution code:
import math

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
while c != 1:
    while c % i == 0:
        c = c // i
    #print(c,i,ans)
    i = i + 1
    ans += 1
    
print(ans + 1)