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:
# 2020/05/05
# AtCoder Beginner Contest 142 - D

# Greatest Common Divisor(GCD)  
import fractions
def gcd_fgf(a, b):
    return fractions.gcd(a, b)

def eratosthenes(n):
    # 素数リストを作成（0なら素数)
    pnl = [0] * (n + 1)
    # 0は素数ではない
    pnl[0] = 1

    idx = 2
    pnl_r = list()
    while(idx <= n):
        
        if pnl[idx] == 0:
            pnl_r.append(idx)
            j = idx * 2
            while (j <= n):
                pnl[j] = 1
                j += idx

        idx += 1
        
    pnl_r.insert(0, 1)
    return pnl_r

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

gcd = gcd_fgf(a, b)
elist = eratosthenes(gcd)
anslist = list()
for i in range(len(elist)):
    if a % elist[i] == 0 and b % elist[i] == 0:
        anslist.append(elist[i])

ans = len(anslist)

# Output
print(ans)

Submission status: Runtime Error

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

#素数
def primes(n):
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1, int(n**0.5)//3+1):
        if sieve[i]:
            k = 3*i+1|1
            sieve[k*k//3::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
            sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2, 3] + [3*i+1|1 for i in range(1, n//3-correction) if sieve[i]]

#素因数分解
from collections import defaultdict
primelist=primes(int(n**0.5+1))+[n+1]
factors=defaultdict(lambda :0)
for prime in primelist:
    if prime>n:
        factors[n]+=1
        break
    while n%prime==0:
        n=n//prime
        factors[prime]+=1
factors[n]=1
print(len(factors))

Submission status: Runtime Error

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

#素数
def primes(n):
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1, int(n**0.5)//3+1):
        if sieve[i]:
            k = 3*i+1|1
            sieve[k*k//3::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
            sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2, 3] + [3*i+1|1 for i in range(1, n//3-correction) if sieve[i]]

#素因数分解
from collections import defaultdict
primelist=primes(int(n**0.5+1))+[n+1]
factors=defaultdict(lambda :0)
for prime in primelist:
    if prime>n:
        factors[n]+=1
        break
    while n%prime==0:
        n=n//prime
        factors[prime]+=1
print(len(factors))

Submission status: Runtime Error

Solution code:
import numpy as np
import math

a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(max(x1,x2))+2)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+2)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
s.add(math.gcd(a,b))
print(len(s))

Submission status: Runtime Error

Solution code:
import fractions
A, B = map(int, input().split())
gcd = fractions.gcd(A, B)
ans = 1
sqrt = math.sqrt(gcd)
for i in range(2, int(sqrt) + 2):
    if gcd % i == 0:
        ans += 1
        while True:
            gcd //= i
            if gcd % i != 0:
                break
if sqrt < gcd:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import math
A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = 1
sqrt = math.sqrt(gcd)
for i in range(2, int(sqrt) + 2):
    if gcd % i == 0:
        ans += 1
        while True:
            gcd //= i
            if gcd % i != 0:
                break
if sqrt < gcd:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import math
A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = 1
for i in range(2, min(gcd, 1000000)):
    if gcd % i == 0:
        ans += 1
        while True:
            gcd //= i
            if gcd % i != 0:
                break
print(ans)

Submission status: Runtime Error

Solution code:
import math

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	


if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
import math

def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	count = 1
	for i in range(2, math.ceil(math.sqrt(num))+ 1):
		if num % i == 0:
			count += 1
			while num%i == 0:
				num //= i
	if num > 1:
		count += 1
	print(count)	


if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
import math


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	


if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
import math

def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    """
    最大公約数　
    ユークリッドの互除法　
    O(logN)
    a > b
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def prime(max):
    '''
    maxまでに存在する素数リスト
    エラトステネスのふるい
    O(n^(3/2))
    max>= 2
    return List
    '''
    bool_prime = [True]*(max+1)
    bool_prime[0] = bool_prime[1] = False
    for i in range(2, int(max**(1/2))+1):
        if not bool_prime[i]:
            continue
        for j in range(i * 2, max + 1, i):
            bool_prime[j] = False
    return [i for i in range(max+1) if bool_prime[i]]


a, b = map(int, input().split())
if b > a:
    save = a
    a = b
    b = save
GCD = gcd(a, b)
if GCD == 1:
    print(1)
    sys.exit(0)
lst_prime = prime(GCD)
print(lst_prime)
ans = 1
for i in range(len(lst_prime)):
    if GCD % lst_prime[i] == 0:
        ans += 1

print(ans)

Submission status: Runtime Error

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

# Euclid
a = max( A, B )
b = min( A, B )
r = a % b
while r != 0:
  a = b
  b = r
  r = a % b

prime = [0] * ( b + 1 )
for i in range( b + 1 ):
  prime[i] = i

for i in range( 2, b + 1 ):
  for k in range( 2, b + 1 ):
    if len( prime ) > i * k:
      prime[ i * k ] = 0
    else:
      break
prime = set( prime )
prime.remove( 0 )

cnt = 0
for i in prime:
  if ( ( A % i ) == 0 ) and ( ( B % i ) == 0 ):
    cnt += 1

print( cnt )

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    """
    最大公約数　
    ユークリッドの互除法　
    O(logN)
    a > b
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def prime(max):
    '''
    maxまでに存在する素数リスト
    エラトステネスのふるい
    O(n^(3/2))
    max>= 2
    return List
    '''
    prime = []
    bool_prime = [False]*max
    bool_prime[1] = True
    for i in range(2, max, 2):  # i index
        flag = True
        for j in range(2, int(i*(1/2))+1, 2):  # j index
            if bool_prime[j] and (i+1) % (j+1) == 0:
                flag = False
                break
        if flag:
            bool_prime[i] = True
    for i in range(len(bool_prime)):
        if bool_prime[i]:
            prime.append(i+1)
    return prime


a, b = map(int, input().split())
if b > a:
    save = a
    a = b
    b = save
GCD = gcd(a, b)
if GCD == 1:
    print(1)
    sys.exit(0)
lst_prime = prime(GCD)
ans = 1
for i in range(len(lst_prime)):
    if GCD % lst_prime[i] == 0:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    """
    最大公約数　
    ユークリッドの互除法　
    O(logN)
    a > b
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def prime(max):
    '''
    maxまでに存在する素数リスト
    エラトステネスのふるい
    O(n^(3/2))
    max>= 2
    return List
    '''
    prime = []
    bool_prime = [False]*max
    bool_prime[1] = True
    for i in range(2, max, 2):  # i index
        flag = True
        for j in range(2, int(i*(1/2))+1, 2):  # j index
            if bool_prime[j] and (i+1) % (j+1) == 0:
                flag = False
                break
        if flag:
            bool_prime[i] = True
    for i in range(len(bool_prime)):
        if bool_prime[i]:
            prime.append(i+1)
    return prime


a, b = map(int, input().split())
if b > a:
    save = a
    a = b
    b = save
GCD = gcd(a, b)
if GCD == 1:
    print(1)
    sys.exit(0)
lst_prime = prime(GCD)
p_fact = [False]*len(lst_prime)
for i in range(len(lst_prime)):
    while True:
        if GCD % lst_prime[i] != 0:
            break
        GCD //= lst_prime[i]
        p_fact[i] = True
ans = 1
for p in p_fact:
    if p:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    """
    最大公約数　
    ユークリッドの互除法　
    O(logN)
    a > b
    """
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def prime(max):
    '''
    maxまでに存在する素数リスト
    エラトステネスのふるい
    O(n^(3/2))
    max>= 2
    return List
    '''
    prime = []
    bool_prime = [False]*max
    bool_prime[1] = True
    for i in range(2, max, 2):  # i index
        flag = True
        for j in range(2, int(i*(1/2))+1, 2):  # j index
            if bool_prime[j] and (i+1) % (j+1) == 0:
                flag = False
                break
        if flag:
            bool_prime[i] = True
    for i in range(len(bool_prime)):
        if bool_prime[i]:
            prime.append(i+1)
    return prime


a, b = map(int, input().split())
if b > a:
    save = a
    a = b
    b = save
GCD = gcd(a, b)
if GCD == 1:
    print(1)
    sys.exit(0)
lst_prime = prime(GCD)
p_fact = [0]*len(lst_prime)
for i in range(len(lst_prime)):
    while True:
        if GCD % lst_prime[i] != 0:
            break
        GCD //= lst_prime[i]
        p_fact[i] += 1
ans = sum(p_fact)
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    m = min(A,B)
    pr = primes(m)
    c = 0
    if len(pr)==0:
      print(1)
    for k in pr:
        if A%k == 0 and B%k == 0:
            c += 1
        else:
          continue
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
A,B = map(int,input().split())
    print(primes(i))
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    pr = primes(Min)
    c = 0
    for k in pr:
        if A%k == 0 and B%k == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
A,B = map(int,input().split())
    print(primes(i))
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    pr = primes(Min)
    c = 0
    for j in pr:
        if A%j == 0 and B%j == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def eratos(n):
    isprime = [True]*(n+1)
    for i in range(n+1):
        isprime[i] = True
    isprime[0] = False
    isprime[1] = False
    for i in range(2, n+1):
        i = int(i**0.5)+1
        if isprime[i]:
            j = i+i
            while j <= n:
                isprime[j] = False
                j += i
    prime_list = []
    for i in range(n+1):
        if isprime[i]:
            prime_list.append(i)
    return prime_list
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    pr = eratos(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    m = min(A,B)
    pr = primes(m)
    c = 0
    if len(pr)==0:
      print(1)
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
        else:
          continue
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    m = min(A,B)
    pr = primes(m)
    c = 0
    if len(pr)==0:
      print(1)
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    pr = primes(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    pr = primes(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    print(Min)
    pr = primes(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    print(Min)
    pr = primes(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+1)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
def primes(n):#nまでの素数を列挙
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
A,B = map(int,input().split())
if A == 1 or B == 1:
    print(1)
else:
    Min = min(A,B)
    pr = primes(Min)
    c = 0
    for i in pr:
        if A%i == 0 and B%i == 0:
            c += 1
    print(c+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 temp!= 1 and arr==[]:
        arr.append([n, 1])

    return arr

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

GCD = math.gcd(a,b)

fact = factorization(GCD)

print(len(fact)+1)

Submission status: Runtime Error

Solution code:
import fractions

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

i = fractions.gcd(A, B)

C = []

def cal(i):
    for j in range(2, i//2+1):
        while True:
            if i%j == 0:
                i //= j
                C.append(j)
            else:
                break
    if i != 1:
        C.append(i)
        
    return set(C)

print(1+len(cal(x)))

Submission status: Runtime Error

Solution code:
import fractions

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

g = fractions.gcd(A, B)

C = []

for j in range(2, i+1):
    while True:
        if i%j == 0:
            i //= j
            C.append(j)
        else:
            break

print(len(set(C))+1)

Submission status: Runtime Error

Solution code:
import fractions

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

g = fractions.gcd(A, B)

C = []

for j in range(2, i+1):
    i = g
    while True:
        if i%j == 0:
            i //= j
            C.append(j)
        else:
            break

print(len(set(C))+1)

Submission status: Runtime Error

Solution code:
from fractions import gcd

def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False


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


sosu=[True]*(G+1)   

sosu_gene()
ans=1

for i in range(2,G+1):
    if sosu[i]:
        if G%i==0:
            ans+=1


print(ans)

Submission status: Runtime Error

Solution code:
def gcd(x,y):
    if x%y==0:
        return y
    return gcd(y,x%y)

def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y

a,b=map(int,input().split())
G=gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)   

sosu_gene()
ans=0
g=G
for i in range(2,G+1):
    if g==1:
        break
    if sosu[i]:
        k,g=kosu(i,g)
        bunkai[i]=k

for i in bunkai:
    if i:
        ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
import math


a,b=map(int,input().split())
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

print(G)

Submission status: Runtime Error

Solution code:
import math

def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y

a,b=map(int,input().split())
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)   

sosu_gene()
ans=0
g=G
for i in range(2,G+1):
    if g==1:
        break
    if sosu[i]:
        k,g=kosu(i,g)
        bunkai[i]=k

for i in bunkai:
    if i:
        ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
import math

def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y

a,b=map(int,input().split())
num=set()
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)   

sosu_gene()
ans=0
g=G
for i in range(2,G+1):
    if g==1:
        break
    if sosu[i]:
        k,g=kosu(i,g)
        bunkai[i]=k

for i in bunkai:
    if i:
        ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
import math

def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y
 
a,b=map(int,input().split())
num=set()
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)   

sosu_gene()
ans=0
g=G
for i in range(2,G+1):
    if g==1:
        break
    if sosu[i]:
        k,g=kosu(i,g)
        bunkai[i]=k

for i in bunkai:
    if i:
        ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
import math

def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y
 
a,b=map(int,input().split())
num=set()
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)   

sosu_gene()

for i in range(2,G+1):
    if sosu[i]:
        k,G=kosu(i,G)
        bunkai[i]=k

print(sum(bunkai))

Submission status: Runtime Error

Solution code:
import math

a,b=map(int,input().split())
num=set()
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)
def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y
    

sosu_gene()

for i in range(2,G+1):
    if sosu[i]:
        k,G=kosu(i,G)
        bunkai[i]=k
#print(sosu)
#print(bunkai)
print(sum(bunkai))

Submission status: Runtime Error

Solution code:
import math
#素因数分解
a,b=map(int,input().split())
num=set()
G=math.gcd(a,b)
bunkai=[0]*(G+1)
bunkai[1]=1

sosu=[True]*(G+1)
def sosu_gene():#エラトネス 素数列挙
    sosu[0]=False
    sosu[1]=False
    for i in range(2,G+1):
        for j in range(i*2,G+1,i):
            sosu[j]=False

def kosu(x,y):
    n=0
    while y%x==0:
        y=y//x
        n+=1
    return n,y
    

sosu_gene()

for i in range(2,G+1):
    if sosu[i]:
        k,G=kosu(i,G)
        bunkai[i]=k
#print(sosu)
#print(bunkai)
print(sum(bunkai))

Submission status: Runtime Error

Solution code:
import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

def main():
    A, B= map(int,input().split())
    gcd = math.gcd(A,B)
    root = math.sqrt(gcd)

    ps = []
    ans = 1
    for p in range(2,math.floor(root)+2):
        is_prime = True
        for _p in ps:
            if p % _p == 0:
                is_prime = False
                break
        if is_prime:
            ps.append(p)
            if gcd % p == 0:
                ans += 1


    print(ans)


if __name__ == "__main__":
  main()