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: Wrong Answer

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


def solve(A: int, B: int):
    pa = []
    pb = []
    a = A
    b = B

    for x in range(2, int(pow(A, 0.5))+2):
        if a % x == 0:
            pa.append(x)
        while a % (x) == 0:
            a = int(a / x)
    # print(pa)
    for x in range(2, int(pow(B, 0.5))+2):
        if b % x == 0:
            pb.append(x)
        while b % (x) == 0:
            b = int(b / x)
    # print(pb)
    
    an = len(set(pa)&set(pb))+1

    print(an)
    
    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: Wrong Answer

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


def solve(A: int, B: int):
    pa = []
    pb = []
    a = A
    b = B

    for x in range(2, int(pow(A, 0.5))+1):
        if a % x == 0:
            pa.append(x)
        while a % (x) == 0:
            # pa.append(x)
            a = int(a / x)
    # print(pa)
    for x in range(2, int(pow(B, 0.5))+1):
        if b % x == 0:
            pb.append(x)
        while b % (x) == 0:
            # pb.append(x)
            b = int(b / x)
    # print(pb)
    
    an = len(set(pa)&set(pb))+1

    print(an)
    
    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: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline().rstrip


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)

    if arr == []:
        arr.append(n)

    return set(arr)


def main():
    a, b = map(int, input().split())
    a = factorization(a)
    b = factorization(b)
    l = a & b
    print(len(l) + 1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def fact(n):
  temp=n
  arr=[]
  for i in range(2,int(-(-n**0.5//1))+1):
    if temp%i==0:
      
      while temp%i==0:
        
        temp//=i
      arr.append(i)
      
  if temp!=1:
    arr.append(temp)
  if arr==[]:
    arr.append(n)
  return arr

c=fact(a)
d=fact(b)
e=[1]

  
for i in range(len(c)):
  if c[i]  in d:
    e.append(c[i])

    
print(len(e))

Submission status: Wrong Answer

Solution code:
from math import factorial as fact
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	arr=[]
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			count+=1
			while tmp%i==0:
				cnt+=1
				tmp//=i
		if tmp==1:
			break
	return count+1
			


A,B=input2()
gcd=fractions.gcd(A,B)
# ch=ch(gcd)
print(factorization(int(gcd)))

Submission status: Wrong Answer

Solution code:
from math import factorial as fact
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	arr=[]
	tmp=n
	count=0
	for i in range(2,n):
		if tmp%i==0:
			cnt=0
			count+=1
			while tmp%i==0:
				cnt+=1
				tmp//=i
		if tmp==1:
			break
	return count+1
			


A,B=input2()
gcd=fractions.gcd(A,B)
# ch=ch(gcd)
print(factorization(int(gcd)))

Submission status: Wrong Answer

Solution code:
from math import factorial as fact
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	arr=[]
	tmp=n
	count=0
	for i in range(2,int(-(-n**0.5//1))+1):
		if tmp%i==0:
			cnt=0
			count+=1
			while tmp%i==0:
				cnt+=1
				tmp//=i
		if tmp==1:
			break
	return count+1
			


A,B=input2()
gcd=fractions.gcd(A,B)
# ch=ch(gcd)
print(factorization(int(gcd)))

Submission status: Wrong Answer

Solution code:
import fractions
a,b=map(int,input().split())
n=fractions.gcd(a,b)
l=set([])
for i in range(2,n//2):
  while n%i==0:
    l.add(i)
    n/=i
print(len(l)+1)

Submission status: Wrong Answer

Solution code:
import fractions
a,b=map(int,input().split())
n=fractions.gcd(a,b)
l=set([])
for i in range(2,n//2):
  if n%i!=0:
    break
  elif n%i==0:
    while n%i==0:
      l.add(i)
      n/=i
print(len(l)+1)

Submission status: Wrong Answer

Solution code:
import fractions
a,b=map(int,input().split())
n=fractions.gcd(a,b)
l=set([])
for i in range(2,n):
  while n%i==0:
    l.add(i)
    n/=i
print(len(l)+1)

Submission status: Wrong Answer

Solution code:
import fractions
a,b=map(int,input().split())
n=fractions.gcd(a,b)
l=set([])
for i in range(2,int(n**0.5//1)+2):
  while n%i==0:
    l.add(i)
    n/=i
print(len(l)+1)

Submission status: Wrong Answer

Solution code:
import fractions
a,b=map(int,input().split())
n=fractions.gcd(a,b)
l=set([])
for i in range(2,int(n**0.5//1)+1):
  while n%i==0:
    l.add(i)
    n/=i
print(len(l)+1)

Submission status: Wrong Answer

Solution code:
import fractions
import math
a,b=map(int,input().split())
s=fractions.gcd(a,b)
cnt=set()
for i in range(3,int(math.sqrt(s))+3,2):
    if s%i==0:
        cnt.add(i)
        while s%i==0:
            s//=i
if s%2==0:
    cnt.add(2)
print(len(cnt)+1)

Submission status: Wrong Answer

Solution code:
import fractions
import math
a,b=map(int,input().split())
s=fractions.gcd(a,b)
cnt=set()
for i in range(3,math.floor(s**0.5)+1,2):
    if s%i==0:
        cnt.add(i)
        while s%i==0:
            s//=i
if s%2==0:
    cnt.add(2)
print(len(cnt)+1)

Submission status: Wrong Answer

Solution code:
import fractions
a,b=map(int,input().split())
s=fractions.gcd(a,b)
cnt=set()
for i in range(3,int(s**0.5)+2,2):
    if s%i==0:
        cnt.add(i)
        while s%i==0:
            s//=i
if s%2==0:
    cnt.add(2)
print(len(cnt)+1)

Submission status: Wrong Answer

Solution code:
def primes(n):
    i = 1
    p = [2]
    while i+2 <= n:
        flag = True
        i += 2
        for j in range(3, int(i**(1/2))+1, 2):
            if i % j == 0:
                flag = False
                break
        if flag:
            p.append(i)
    return p
a, b = map(int, input().split())
ap = primes(a ** (1 / 2)+1)
bp = primes(b ** (1/2)+1)
a_div = set()
b_div = set()
for i in ap:
    if a % i == 0:
        a_div.add(i)
for i in bp:
    if b % i == 0:
        b_div.add(i)
print(len(a_div&b_div)+1)

Submission status: Wrong Answer

Solution code:
def primes(n):
    i = 1
    p = [2]
    while i+2 <= n:
        flag = True
        i += 2
        for j in range(3, int(i**(1/2))+1, 2):
            if i % j == 0:
                flag = False
                break
        if flag:
            p.append(i)
    return p
from fractions import gcd
a, b = map(int, input().split())
c = gcd(a, b)
c_ps = primes(c ** (1 / 2) // 1 + 1)
c_div = set()
for prime_num in c_ps:
    while c % prime_num == 0:
        c_div.add(prime_num)
        c /= prime_num
print(len(c_div)+1)

Submission status: Wrong Answer

Solution code:
import fractions

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

num_list = []

div = []

x = min(A,B)
i = 1

while i < x:
    if x % i == 0:
        x = x / i
        if not i in div:
            div.append(i)
        i = 1
    i += 1


for num in div:
    if max(A,B) % num == 0:

        if len(num_list) > 2:

            for i in range(1,len(num_list)-1):
                if num % num_list[i] != 0:
                    if i == len(num_list)-2:
                        num_list.append(num)
                else:
                    break

        else:
            num_list.append(num)



print(len(num_list))

Submission status: Wrong Answer

Solution code:
# Problem D - Disjoint Set of Common Divisors

import fractions

# 約数を列挙する関数
def make_divisors(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)
    divisors.sort()
    return divisors

# 素因数分解
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

# input
A, B = map(int, input().split())
gcd_num = fractions.gcd(A, B)

# check
fact_nums = factorization(gcd_num)
if len(fact_nums)>1:
    ans = 1 + len(fact_nums)
    print(ans)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
import math
A, B = map(int,input().split())
def yakusuu(N):
    P = set([1,N])
    for k in range(2,math.floor(math.sqrt(N))+1):
        if N % k == 0:
            P.add(k)
            P.add(N//k)
    return P
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
C = sorted(list(yakusuu(A)&yakusuu(B)))
N = len(C)
if N == 1:
    print(1)
else:
    ans = 0
    for k in range(N):
        f = 1
        for l in range(k-1):
            if gcd(C[k],C[l]) != 1:
                f = 0
                break
        ans += f
    print(ans)

Submission status: Wrong Answer

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

def mygcd(a, b):
    if a < b:
        return mygcd(b, a)
    elif b == 0:
        return a
    else:
        return mygcd(b, a % b)

gcd = mygcd(A, B)

import math

pfac = {}
gcd_tmp = gcd
for p in range(2, int(math.sqrt(gcd)) + 1):
    if gcd_tmp < 2: break
    if gcd_tmp % p == 0:
        i_p = 0
        while gcd_tmp % p == 0:
            gcd_tmp //= p
            i_p += 1
        #
        pfac[str(p)] = i_p

# print("#", pfac)
        
print(1 + len(pfac))

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(n):
        res = set([1,n])
        i = 2
        m = n
        while i**2 <= n:
            while m%i == 0:
                res.add(i)
                m //= i
            i += 1
        res.add(m)
        return res

    a,b = LI()
    fa = f(a)
    fb = f(b)
    l = fa&fb
    print(len(l))
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

GCD = gcd(a,b)
ans = 1
for i in range(2, int(GCD ** 0.5) + 2):
    if GCD%i == 0:ans += 1
    while GCD%i == 0:
        GCD //= i
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return []
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))

Submission status: Wrong Answer

Solution code:
import fractions
from collections import defaultdict
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
gcd = fractions.gcd(A,B)
pf = {}
for i in range(2,int(gcd**0.5)+2):
  while gcd % i == 0:
    pf[i] = pf.get(i,0)+1
    gcd //= i
if len(pf):
  print(len(pf)+1)
else:
  print(1)

Submission status: Wrong Answer

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

c = gcd(a,b)
if(c==1):
    print(1)
    exit()

max_n = int(c**(1/2))+1
#エラストテネスの篩
#n以下の素数のリストを返却
#2n+1だけ見る
def sieve(n):
    if( n <= 1):
        return []
    elif(n==2):
        return[2]

    primes = [2]
    len_list = (n+1)//2
    flags = [True] * len_list
    flags[0] = False
    for i in range(len_list):
        if(flags[i]):
            primes.append(i*2+1)
            for j in range( i*3+1, len_list, i*2+1):
                flags[j] = False
    return primes

primes = sieve(max_n)

nums = 1
prime_check = 1
for i in primes:
    if(c%i==0):
        nums += 1
        prime_check = 0

print(nums+prime_check)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
import fractions
gcd = fractions.gcd(a, b)
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])
    arr.append([1, 1])
    return arr
if a == 1 or b == 1:
    print(len(factorization(gcd)))
    quit()
print(len(factorization(gcd)) + 1)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
import fractions
gcd = fractions.gcd(a, b)
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
print(len(factorization(gcd)) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt


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())
if (A == 1 or B == 1):
    print(1)
    exit(0)
if (A == B):
    print(2)
    exit(0)

C = gcd(A, B)
if (C == 1):
    print(1)
    exit(0)
arr = factorization(C)
# print(arr)
print(len(arr) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt


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())
if (A == 1 or B == 1 or A % B != 0):
    print(1)
    exit(0)
if (A == B):
    print(2)
    exit(0)

C = gcd(A, B)
arr = factorization(C)
#print(arr)
print(len(arr) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt


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())
if (A == 1 or B == 1):
    print(1)
    exit(0)
if (A == B):
    print(2)
    exit(0)

C = gcd(A, B)
arr = factorization(C)
print(len(arr) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 ):
    print(1)
    exit(0)
if (A == B):
  print(2)
  exit(0)
  
C = gcd(A, B)
ans = []
for i in range(2, C + 1):
    if (C % i == 0): ans.append(i)
    if (i >= C // i): break
N = len(ans)
seen = [0] * N
cnt = 0
for i in range(N):
    if(seen[i]): continue
    for j in range(i, N):
        if (ans[j] % ans[i] == 0):
            seen[j] = 1
    cnt += 1
print(cnt + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1):
    print(1)
    exit(0)
if (A == B):
    print(2)
    exit(0)
C = gcd(A, B)
ans = []
for i in range(2, C + 1):
    if (C % i == 0): ans.append(i)
N = len(ans)
seen = [0] * N
cnt = 0
for i in range(N):
    if(seen[i]): continue
    for j in range(i, N):
        if (ans[j] % ans[i] == 0):
            seen[j] = 1
    cnt += 1
print(cnt + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 or A == B):
    print(1)
    exit(0)

C = gcd(A, B)
ans = []
for i in range(2, C + 1):
    if (C % i == 0): ans.append(i)
    if (i >= C // i): break
N = len(ans)
seen = [0] * N
cnt = 0
for i in range(N):
    if(seen[i]): continue
    for j in range(i, N):
        if (ans[j] % ans[i] == 0):
            seen[j] = 1
    cnt += 1
print(cnt + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 or A == B):
    print(1)
    exit(0)

C = gcd(A, B)
ans = []
print(C)
for i in range(2, C + 1):
    if (C % i == 0): ans.append(i)
    if (i >= C // i): break
N = len(ans)
seen = [0] * N
cnt = 0
for i in range(N):
    if(seen[i]): continue
    for j in range(i, N):
        if (ans[j] % ans[i] == 0):
            seen[j] = 1
    cnt += 1
print(cnt + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 or A == B):
    print(1)
    exit(0)

C = gcd(A, B)
ans = 0
for i in range(1, C + 1):
    if (C % i == 0):
        C //= i
        ans += 1
    if (i >= C): break
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1):
    print(1)
    exit(0)
C = gcd(A, B)
ans = 0
for i in range(1, C + 1):
    if (C % i == 0):
        C //= i
        ans += 1
    if (i >= C): break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

c = gcd(a,b)
max_n = int(c**(1/2))+1
primes = [2]
cand = list(range(3,max_n+1, 2))
while(cand):
    next = []
    div = cand[0]
    primes.append(div)
    for i in range(1,len(cand)):
        tmp = cand[i]
        if(tmp%div != 0):
            next.append(tmp)
    cand = next[::]

nums = 1
pc = 1
for i in primes:
    if(c%i==0):
        nums += 1
        pc=0

print(nums+pc)

Submission status: Wrong Answer

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

c = gcd(a,b)
max_n = int(c**(1/2))+1
primes = [2]
cand = list(range(3,max_n+1, 2))
while(cand):
    next = []
    div = cand[0]
    primes.append(div)
    for i in range(1,len(cand)):
        tmp = cand[i]
        if(tmp%div != 0):
            next.append(tmp)
    cand = next[::]

nums = 1
for i in primes:
    if(c%i==0):
        nums += 1

print(nums)

Submission status: Wrong Answer

Solution code:
import fractions
A,B = map(int,input().split())
GCD = fractions.gcd(A,B)

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

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

Submission status: Wrong Answer

Solution code:
import fractions
A,B=map(int,input().split())
gcd=fractions.gcd(A, B)
ans=1
setgcd=gcd
for i in range(2,setgcd+1):
  if gcd%i==0:
    ans=ans+1
    while gcd%i==0:
      gcd=round(gcd/i)
  if i*i>setgcd:
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import fractions
A,B=map(int,input().split())
gcd=fractions.gcd(A, B)
ans=1
setgcd=gcd
for i in range(2,setgcd):
  if gcd%i==0:
    ans=ans+1
    while gcd%i==0:
      gcd=int(round(gcd/i))
  if i*i>setgcd:
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
if B<A:
  temp=A
  A=B
  B=temp
while A>0:
  temp=B%A
  B=A
  A=temp
gcd=B
ans=1
setgcd=gcd
for i in range(2,setgcd):
  if gcd%i==0:
    ans=ans+1
    while gcd%i==0:
      gcd=int(round(gcd/i))
  if gcd==1:
    break
print(ans)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
if B<A:
  temp=A
  A=B
  B=temp
while A>0:
  temp=B%A
  B=A
  A=temp
gcd=B
ans=1
for i in range(2,gcd):
  if gcd%i==0:
    ans=ans+1
    while gcd%i==0:
      gcd=int(round(gcd/i))
  if gcd==1:
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
if B<A:
  temp=A
  A=B
  B=temp
while A>0:
  temp=B%A
  B=A
  A=temp
gcd=B
ans=1
for i in range(2,gcd):
  if gcd%i==0:
    ans=ans+1
    while gcd%i==0:
      gcd=int(gcd/i)
print(ans)

Submission status: Wrong Answer

Solution code:
def pf(n):
  a = []
  N = n
  for i in range(2, int(pow(N,0.5)//1+2)):
    if n%i==0:
      count=0
      while n%i==0:
        count+=1
        n//=i
      a.append(count)
  if n!=1:
    a.append(1)
  if a==[]:
    a.append(1)
  return a
import fractions
A,B=map(int,input().split())
c=fractions.gcd(A,B)
ans=len(pf(c))
print(ans+(1 if ans>1 else 0))

Submission status: Wrong Answer

Solution code:
def pf(n):
  a = []
  N = n
  for i in range(2, int(pow(N,0.5)//1+2)):
    if n%i==0:
      count=0
      while n%i==0:
        count+=1
        n//=i
      a.append(count)
  if n!=1:
    a.append(1)
  if a==[]:
    a.append(1)
  return a
import fractions
A,B=map(int,input().split())
c=fractions.gcd(A,B)
print(len(pf(c))+1)

Submission status: Wrong Answer

Solution code:
from time import time
import numpy as np

def make_divisors(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)
    divisors.sort()
    return divisors

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

def main():
    A, B = map(int, input().split())
    answer = 0
    a = make_divisors(A)
    b = make_divisors(B)

    s = set(a) & set(b)

    p = seachPrimeNum(1000001)
    p.append(1)

    for i in s:
        if i in p:
            answer += 1



    print(answer)

if __name__ == '__main__':
    start = time()
    main()
    # print(time() - start)

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
def gcd(x,y):
    if x<y:x,y = y,x
    if y==0:return x
    return gcd(y,x%y)
G = gcd(A,B)
ans = 0
n = G
for i in range(2,G+1):
    if i*i>n:
        ans+=1
        break
    if n%i==0:
        ans+=1
    while n%i==0:
        n//=i
print(ans+1)

Submission status: Wrong Answer

Solution code:
import math
from fractions import gcd

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

gcr = int(math.ceil(math.sqrt(g)))
is_p = [True] * (gcr+1000)
is_p[0] = False
is_p[1] = False
for i in range(4, len(is_p), 2):
    is_p[i] = False
i = 3
while i < len(is_p):
    if is_p[i]:
        for j in range(i*2, len(is_p), i):
            is_p[j] = False
    i += 2

ps = [i for i, v in enumerate(is_p) if v]
ans = len([1 for p in ps if g % p == 0]) + 1
if g > 1 and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from fractions import gcd

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

gcr = int(math.sqrt(g))
is_p = [True] * (gcr+1000)
is_p[0] = False
is_p[1] = False
for i in range(4, len(is_p), 2):
    is_p[i] = False
i = 3
while i < len(is_p):
    if is_p[i]:
        j = 2*i
        while j < len(is_p):
            is_p[j] = False
            j += i
    i += 2

ps = [i for i, v in enumerate(is_p) if v]
ans = len([1 for p in ps if g % p == 0]) + 1
if g > 1 and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from fractions import gcd

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

gcr = int(math.sqrt(g))
is_p = [True] * (gcr+10)
is_p[0] = False
is_p[1] = False
i = 2
while 2*i < len(is_p):
    if is_p[i]:
        j = 2*i
        while j < len(is_p):
            is_p[j] = False
            j += i
    i += 1

ps = [i for i, v in enumerate(is_p) if v]
ans = len([1 for p in ps if g % p == 0]) + 1
if g > 1 and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from fractions import gcd

a,b = map(int,input().split())
gc = gcd(a,b)
gcr = int(math.sqrt(gc))
is_p = [True] * (gcr+1)
is_p[0] = False
is_p[1] = False
for i in range(2, gcr+1):
    if is_p[i]:
        for j in range(2*i, gcr+1, i):
            is_p[j] = False

ps = [i for i, v in enumerate(is_p) if v and i >= 2]
ans = len([1 for p in ps if gc % p == 0]) + 1
if gc > 1 and all(gc % p != 0 for p in ps if p >= 2):
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from fractions import gcd

a,b = map(int,input().split())
gc = gcd(a,b)
gcr = int(math.sqrt(gc))
is_p = [True] * (gcr+1)
is_p[0] = False
for i in range(2, gcr+1):
    if is_p[i]:
        for j in range(2*i, gcr+1, i):
            is_p[j] = False

ps = [i for i, v in enumerate(is_p) if v]
ans = len([1 for p in ps if gc % p == 0])
if gcr not in ps and all(gcr % i != 0 for i, v in enumerate(is_p) if v and i >= 2):
    ans += 1
print(ans)