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:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

a,b = map(int,input().split())
c = gcd(a,b)
li = []
for i in range(2,c):
    if c%i==0:
        li.append(i)
        c = c//i
    if c == 1:
        break
li.insert(0,1)
print(*li)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
 
import numpy as np
from fractions import gcd
 
# 1と素数をとる
 
A,B = map(int,readline().split())
 
D = gcd(A,B)
 
U = 10**6 + 100
is_prime = np.zeros(U,dtype=np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(int(U**.5)+10):
    if is_prime[p]:
        is_prime[p*p::p+p] = 0
primes = is_prime.nonzero()[0]
 
factor = primes[D%primes==0]
 
answer = 1+len(factor)
if D != 1:
    answer += 1
print(answer)

Submission status: Wrong Answer

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


def main():
    A, B = map(int, input().split())

    # まずは最大公約数を求める
    G = gcd(A, B)
    # print("G is {}".format(G))

    # 最大公約数を素因数分解して素因数の数を求める
    # 素因数のなかにめちゃくちゃ大きい素数がある場合成立しなくなるので
    # 素因数候補が、gcdの√gcdを超える場合に、#
    result = factorize_max_gcd(G)
    print(result)


# ユークリッド互除法
def gcd(a, b):
    # print("a:{0},b:{1}".format(a, b))
    if b == 0:
        return a
    return gcd(b, a % b)


"""
素因数分解するということは、
2 ~ Nまでの数で割り続けるということ　試し割り
割れなくなったら次の数で割る。
素因数の最大値は√nなので、それを超えたらやめる
"""
def factorize_max_gcd(n):
    res = {1: 1}  # １は必ずある
    calcEnd = n ** 0.5

    if n == 1:
        return len(res)

    for i in range(2, int(calcEnd) + 2):
        while n % i == 0:
            if res.get(i) is None:
                res[i] = 1
            else:
                res[i] += 1
            n /= i
            # print("n:{0}".format(n))

    # GCDが素数だった時の処理
    if len(res) == 1:
        res[n] = 1

    # print("res is {}".format(res))
    return len(res)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def trial_division(n):
    f = 2
    d = {}
    while f**2 <= n:
        if n % f == 0:
            d[f] = d.get(f,0) + 1
            n//=f
        else:
            f += 1
    d[g] =d.get(g,0) + 1
    return d

g = gcd(*map(int, input().split()))
if g == 1:print(1);exit()

ans = trial_division(g)
print(len(ans)+1)

Submission status: Wrong Answer

Solution code:
import fractions

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

C = fractions.gcd(A, B)

def factorization(n):
    count = 0
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            count += 1
            while temp % i == 0:
                temp //= i

    return count

print(factorization(C) + 1)

Submission status: Wrong Answer

Solution code:
import math

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)

    factor.append(1)
    return factor

def main():
    A, B = map(int,input().split())

    div_a = trial_division(A)
    div_b = trial_division(B)
    a_and_b = set(div_a) & set(div_b)
    print(len(a_and_b))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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])

    return arr

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

f = fractions.gcd(A, B)

if len(factorization(f)) == 1:
    print(1)
else:
    print(len(factorization(f)) + 1)

Submission status: Wrong Answer

Solution code:
import fractions

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())

f = fractions.gcd(A, B)

kouyakusuu = []
# print(f)
# for i in range(2, int(-(-f**0.5//1))+1):
#     # print(f, i)
#     if f % i != 0:
#         continue
#     else:
#         kouyakusuu.append(i)
#         while f % i == 0:
#             f = f / i
#     if f == 1:
#         break
# print(kouyakusuu)
# print(len(kouyakusuu)+1)
# print(factorization(f))
if len(factorization(f)) == 1:
    print(1)
else:
    print(len(factorization(f)) + 1)

Submission status: Wrong Answer

Solution code:
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
def main():
    A, B = map(int,input().split())

    div_a = []
    for i in factorization(A):
        div_a.append(i[0])
    div_b = []
    for i in factorization(B):
        div_b.append(i[0])
    a_and_b = set(div_a) & set(div_b)
    print(len(a_and_b)+1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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

f = fractions.gcd(A, B)

kouyakusuu = []
# print(f)
for i in range(2, int(-(-f**0.5//1))+1):
    # print(f, i)
    if f % i != 0:
        continue
    else:
        kouyakusuu.append(i)
        while f % i == 0:
            f = f / i
    if f == 1:
        break
# print(kouyakusuu)
print(len(kouyakusuu)+1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from fractions import gcd

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

g = gcd(a,b)

def sosuu(a):
    sosuu_list = set()
    sosuu_list.add(1)
    i = 2
    while 1:
        flag = True
        while a > i*2:
            if a % i == 0:
                # print(a,i)
                a = a//i
                sosuu_list.add(i)
                flag = False
            else:
                i += 1
        if flag:
            sosuu_list.add(a)
            return sosuu_list
        i += 1

a = sosuu(g)
print(len(a))

Submission status: Wrong Answer

Solution code:
from collections import Counter
from fractions import gcd

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

g = gcd(a,b)

def sosuu(a):
    sosuu_list = set()
    sosuu_list.add(1)
    i = 2
    while 1:
        flag = True
        while a > i*i:
            if a % i == 0:
                # print(a,i)
                a = a//i
                sosuu_list.add(i)
                flag = False
            else:
                i += 1
        if flag:
            sosuu_list.add(a)
            return sosuu_list
        i += 1

a = sosuu(g)
print(len(a))

Submission status: Wrong Answer

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


def main():
    A, B = map(int, input().split())

    # まずは最大公約数を求める
    G = gcd(A, B)
    print("G is {}".format(G))

    # 最大公約数を素因数分解して素因数の数を求める
    # 素因数のなかにめちゃくちゃ大きい素数がある場合成立しなくなるので
    # 素因数候補が、gcdの√gcdを超える場合に、#
    result = factorize_max_gcd(G)
    if G == 1:
        print(1)
    else:
        print(result + 1)


# ユークリッド互除法
def gcd(a, b):
    # print("a:{0},b:{1}".format(a, b))
    if b == 0:
        return a
    return gcd(b, a % b)


"""
素因数分解するということは、
2 ~ Nまでの数で割り続けるということ　試し割り
割れなくなったら次の数で割る。
素因数の最大値は√nなので、それを超えたらやめる
"""
def factorize_max_gcd(n):
    res = {}
    calcEnd = n

    for i in range(2, int(calcEnd) + 1):
        while n % i == 0:
            if res.get(i) is None:
                res[i] = 1
            else:
                res[i] += 1
            n /= i
            # print("n:{0}".format(n))

    print("res is {}".format(res))
    return(len(res))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

A, B = map(int, input().split())
dA = make_divisors(A)
dB = make_divisors(B)
Al = list(set(dA) & set(dB))
ans_l = [1]

for i in range(1, len(Al)):
    cnt = 0
    for j in range(i):
        if Al[i] % Al[j] == 0:
            cnt += 1
    if cnt == 1:
        ans_l.append(Al[i])
print(len(ans_l))

Submission status: Wrong Answer

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


def main():
    A, B = map(int, input().split())

    # まずは最大公約数を求める
    max_gcd = gcd(A, B)
    # print("max_gcd is {}".format(max_gcd))

    # 最大公約数を素因数分解して素因数の数を求める
    # 素因数のなかにめちゃくちゃ大きい素数がある場合成立しなくなるので
    # 素因数候補が、gcdの√gcdを超える場合に、#
    result = factorize_max_gcd(max_gcd)
    print(result)

# ユークリッド互除法
def gcd(a, b):
    # print("a:{0},b:{1}".format(a, b))
    if b == 0:
        return a
    return gcd(b, a % b)

"""
素因数分解するということは、
2 ~ Nまでの数で割り続けるということ　試し割り
割れなくなったら次の数で割る。
素因数の最大値は√nなので、それを超えたらやめる
"""
def factorize_max_gcd(n):
    res = {}
    calcEnd = n ** 0.5

    for i in range(2, n + 1):
        if i >= calcEnd + 1:
            break

        while n % i == 0:
            if res.get(i) is None:
                res[i] = 1
            else:
                res[i] += 1
            n = n / i
            # print("n:{0}".format(n))

    # print("res is {}".format(res))
    return(len(res) + 1)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def f(n):
  ret={1}
  for i in range(2,int(n**.5)+1):
    if n%i==0:
      ret.add(i)
      while n%i==0:
        n//=i
    else:pass
  return ret
a,b=map(int,input().split())
print(len(f(a)&f(b)))

Submission status: Wrong Answer

Solution code:
def prime_divisor(n):
  prime_divisor_set = {1}
  end = int(n ** 0.5) + 1
  for i in range(2, end):
    if not (n % i):
      prime_divisor_set.add(i)
      while (n % i) == 0:
        n //= i
  return prime_divisor_set


a, b = map(int, input().split())
s1, s2 = prime_divisor(a), prime_divisor(b)
ans = len(s1 & s2)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

def cf(x1,x2):
    count=[]
    for i in range(2,(min(int(math.sqrt(x1)),int(math.sqrt(x2))))+1):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
import math

def cf(x1,x2):
    count=[]
    for i in range(2,min(int(math.sqrt(x1)),int(math.sqrt(x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
import math

def cf(x1,x2):
    count=[]
    for i in range(2,max(int(math.sqrt(x1)),int(math.sqrt(x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
def prime_divisor(n):
  prime_divisor_set = {1}
  for i in range(2, int(n ** 0.5) + 1):
    if not (n % i):
      prime_divisor_set.add(i)
      while (n % i) == 0:
        n //= i
  return prime_divisor_set


a, b = map(int, input().split())
s1, s2 = prime_divisor(a), prime_divisor(b)
ans = len(s1 & s2)
print(ans)

Submission status: Wrong Answer

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

l = [1]
i = 1
while i*i < n:
    i += 1
    if n%(i)==0:
        l.append(i)
    while n%i<1:n/=i

print(l)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def gcd(a, b):
    if a > b:
        return gcd(b, a)
    # a <= b
    if a == 0:
        return b
    else:
        r = b % a
        return gcd(r, a)


def prime_factorization(n):
    factors = defaultdict(int)
    i = 1
    n_sub = n
    while True:
        i += 1
        if i * i > n or n_sub == 1:
            break

        while n_sub % i == 0:
            n_sub = n_sub // i
            factors[i] += 1

    if len(factors) == 0:
        factors[n] = 1
    return factors


def main():
    a, b = map(int, input().split())
    g = gcd(a, b)
    if g == 1:
        return 1
    primes = prime_factorization(g)
    # add "1"
    return len(primes) + 1
    

print(main())

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def gcd(a, b):
    if a > b:
        return gcd(b, a)
    # a <= b
    if a == 0:
        return b
    else:
        r = b % a
        return gcd(r, a)


def prime_factorization(n):
    factors = defaultdict(int)
    i = 1
    n_sub = n
    while True:
        i += 1
        if i * i > n or n_sub == 1:
            break

        while n_sub % i == 0:
            n_sub = n_sub // i
            factors[i] += 1

    if len(factors) == 1:
        factors[n] = 1
    return factors


def main():
    a, b = map(int, input().split())
    g = gcd(a, b)
    if g == 1:
        return 1
    primes = prime_factorization(g)
    # add "1"
    return len(primes) + 1
    

print(main())

Submission status: Wrong Answer

Solution code:
import math

class Prime:
    seeds = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    def decompose(self, n):
        ps_max = self.seeds[-1]
        primes = {}
        setdef = primes.setdefault

        for p in self.seeds:
            while n % p == 0:
                setdef(p, 0)
                primes[p] += 1
                n //= p

        p = ps_max
        while n > ps_max and p <= math.sqrt(n):
            if n % p == 0:
                setdef(p, 0)
                primes[p] += 1
                n //= p
            p += 2

        return primes

prime = Prime()
 
a, b = map(int, input().split())
primes = prime.decompose(prime.gcd(a, b))
 
print(len(primes) + 1)

Submission status: Wrong Answer

Solution code:
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素数＋１が答え

import itertools
from fractions import gcd
from math import ceil

def main():
  a, b = map(int, input().split())
  fac = facto(gcd(a,b))
  print(len(fac))  
  
def facto(n):
  if n == 1:
    return [1]
  elif n == 2:
    return[1, 2]
  elif n % 2 == 0:
    fac = [1, 2]
    while n % 2 == 0:
      n = n // 2
  else:
    fac = [1]
  
  max_n = ceil(n ** 0.5) + 1
  
  is_prime = [True for x in range(max_n)]
  for cursor in range(3, max_n, 2):
    if is_prime[cursor]:
      if n % cursor == 0:
        fac.append(cursor)
        while n % cursor == 0:
          n = n // cursor
        if n == 1:
          break
      for i in range(cursor, max_n, cursor):
        is_prime[i] = False
  else:
    fac.append(n)
  return fac

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素数＋１が答え

import itertools
from fractions import gcd

def main():
  a, b = map(int, input().split())
  c = gcd(a,b)
  
  fac = [1]
  fac = facto(c)
  # print(fac)
  print(len(fac))  
  
def facto(n):
  if n == 1:
    return [1]
  elif n == 2:
    return[1, 2]
  elif n % 2 == 0:
    fac = [1, 2]
    while n % 2 == 0:
      n = n // 2
  else:
    fac = [1]
  
  max_n = int(n ** 0.5 + 2)
  
  is_prime = [True for x in range(max_n)]
  for cursor in range(3, max_n, 2):
    if is_prime[cursor]:
      if n % cursor == 0:
        fac.append(cursor)
        while n % cursor == 0:
          n = n // cursor
        if n == 1:
          break
      for i in range(cursor, max_n, cursor):
        is_prime[i] = False
  else:
    fac.append(n)
    
  return fac
  

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素数を２つのグループに分ける

import itertools

def main():
  a, b = map(int, input().split())
  c = gojo(a,b)
  
  fac = [1]
  fac = facto(c)
  # print(fac)
  print(len(fac))  
  
def facto(n):
  if n == 1:
    return [1]
  elif n == 2:
    return[1, 2]
  elif n % 2 == 0:
    fac = [1, 2]
    while n % 2 == 0:
      n = n // 2
  else:
    fac = [1]
  
  max_n = int(n ** 0.5 + 1)
  
  is_prime = [True for x in range(max_n)]
  for cursor in range(3, max_n, 2):
    if is_prime[cursor]:
      if n % cursor == 0:
        fac.append(cursor)
        while n % cursor == 0:
          n = n // cursor
        if n == 1:
          break
      for i in range(cursor, max_n, cursor):
        is_prime[i] = False
  else:
    fac.append(n)
    
  return fac
  
def gojo(a,b):
  if b > a:
    a, b = b, a
  c = a % b
  if c == 0:
    return(b)
  else:
    return gojo(b, c)

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素数を２つのグループに分ける

import itertools

def main():
  a, b = map(int, input().split())
  c = gojo(a,b)
  
  fac = [1]
  fac = facto(c)
  #print(fac)
  print(len(fac))  
  
def facto(n):
  if n == 1:
    return [1]
  elif n == 2:
    return[1, 2]
  elif n % 2 == 0:
    fac = [1, 2]
  else:
    fac = [1]
  
  max_n = int(n ** 0.5 + 1)
  
  is_prime = [True for x in range(max_n)]
  for cursor in range(3, max_n, 2):
    if is_prime[cursor]:
      if n % cursor == 0:
        fac.append(cursor)
        while n % cursor == 0:
          n //= cursor
        if n == 1:
          break
      for i in range(cursor, max_n, cursor):
        is_prime[i] = False
  else:
    fac.append(n)
    
  return fac
  
def gojo(a,b):
  if b > a:
    a, b = b, a
  c = a % b
  if c == 0:
    return(b)
  else:
    return gojo(b, c)

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を素因数分解する。
# 3. 2.の結果に含まれる素数を２つのグループに分ける

import itertools

def main():
  a, b = map(int, input().split())
  c = gojo(a,b)
  
  fac = [1]
  fac = facto(c)
  #print(fac)
  print(len(fac))  
  
def facto(n):
  if n == 1:
    return [1]
  elif n == 2:
    return[1, 2]
  elif n % 2 == 0:
    fac = [1, 2]
  else:
    fac = [1]
  
  max_n = n + 1 # int(n ** 0.5 + 2)
  
  is_prime = [True for x in range(max_n)]
  for cursor in range(3, max_n, 2):
    if is_prime[cursor]:
      if n % cursor == 0:
        fac.append(cursor)
        while n % cursor == 0:
          n //= cursor
        if n == 1:
          break
      for i in range(cursor, max_n, cursor):
        is_prime[i] = False
  else:
    fac.append(n)
    
  return fac
  
def gojo(a,b):
  if b > a:
    a, b = b, a
  c = a % b
  if c == 0:
    return(b)
  else:
    return gojo(b, c)

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
import math

def cf(x1,x2):
    count=[]
    for i in range(2,min(math.floor(math.sqrt(x1)),math.floor(math.sqrt(x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
import math

def cf(x1,x2):
    count=[]
    for i in range(2,min(math.floor(math.sqrt(x1)),math.floor(math.sqrt(x2)))+1):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def prime_factorize(n):
    ans = []
    while n % 2 == 0:
        ans.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans.append(n)
    return ans

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

x = gcd(A, B)
prime = prime_factorize(x)

print(len(prime) + 1)

Submission status: Wrong Answer

Solution code:
import math

def gcd(x,y):
    while y:
        z = x
        x = y
        y = y % z
    return x


a, b = [int(x) for x in input().split(' ')]

g = gcd(a,b)
ret = 1

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

Submission status: Wrong Answer

Solution code:
import math
def cf(x1,x2):
    count=[]
    for i in range(2,min(math.floor(math.sqrt(x1)),math.floor(math.sqrt(x2)))+1):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
import math

def gcd(x,y):
    while y:
        z = x
        x = y
        y = y % z
    return x


a, b = [int(x) for x in input().split(' ')]

g = gcd(a,b)
ret = 1

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

Submission status: Wrong Answer

Solution code:
import fractions, 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, 2])
    return arr
A, B = map(int, input().split())
N = fractions.gcd(A, B)
prime_list = factorization(N)
if N == 1:
    print(0)
else:
    print(len(prime_list)+1)

Submission status: Wrong Answer

Solution code:
import math
def cf(x1,x2):
    count=[]
    for i in range(2,min(round(math.sqrt(x1)),round(math.sqrt(x2)))+1):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

Submission status: Wrong Answer

Solution code:
import fractions, 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, 2])
    return arr
A, B = map(int, input().split())
N = fractions.gcd(A, B)
prime_list = factorization(N)
print(len(prime_list)+1)

Submission status: Wrong Answer

Solution code:
import fractions, 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, 2])
    return arr
A, B = map(int, input().split())
N = fractions.gcd(A, B)
prime_list = factorization(N)
s = set(prime_list[0])
for p in prime_list[1:]:
    s |= set(p)
print(len(s))

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_factorization(x):
    li = []
    num = x
    for i in range(2, int(sqrt(x)) + 1):
        cnt = 0
        while num % i == 0:
            cnt += 1
            num //= i
        li.append((i, cnt))

    if num != 1:
        li.append((num, 1))

    #if not li:
    #    li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)


len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_factorization(x):
    li = []
    num = x
    for i in range(2, int(sqrt(x)) + 1):
        cnt = 0
        while num % i == 0:
            cnt += 1
            num //= i
        li.append((i, cnt))

    if num != 1:
        li.append((num, 1))

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)


len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = sqrt(x)
    while x != 1 and div <= div_max:
        cnt = 0
        while x % div == 0:
            x //= div
            cnt += 1
        li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

a, b = map(int, input().split())
import fractions
print(len(prime_decomposition(fractions.gcd(a,b)))+1)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = sqrt(x)
    while x != 1 and div < div_max:
        cnt = 0
        while x % div == 0:
            x //= div
            cnt += 1
        li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = int(sqrt(x))
    while x != 1 and div <= div_max:
        cnt = 0
        while x % div == 0:
            x //= div
            cnt += 1
        li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = int(sqrt(x))
    while x != 1 and div <= div_max:
        cnt = 0
        if x % div == 0:
            x //= div
            cnt += 1
        li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def is_prime(x):
    if x < 2:
        return False
    for i in range(2, int(sqrt(x)) + 1):
        if x % i == 0:
            return False

    return True


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = int(sqrt(x))
    while x != 1 and div <= div_max:
        if is_prime(div):
            cnt = 0
            if x % div == 0:
                x //= div
                cnt += 1
            li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def is_prime(x):
    if x < 2:
        return False
    for i in range(2, int(sqrt(x)) + 1):
        if x % i == 0:
            return False

    return True


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = int(sqrt(x))
    while x != 1 and div <= div_max:
        if is_prime(div):
            cnt = 0
            if x % div == 0:
                x //= div
                cnt += 1
            li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

print(a_pf)
print(b_pf)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)