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:
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


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


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return

# B


def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return

# C


def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return

# D


def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    myset = set([1])
    for i in range(2, g):
        while g % i == 0:
            g /= i
            myset.add(i)
    print(myset)

    return

# E


def E():
    return

# F


def F():
    return


# Solve
if __name__ == '__main__':
    D()

Submission status: Wrong Answer

Solution code:
import sys
from fractions import gcd
def prime_factorize_2(n):
    res = set()
    div = 2
    if n % 2 == 0:
        while n % div == 0:
            n //= div
        res.add(div)
    div += 1
    while div ** 2 <= n:
        if n % div == 0:
            while n % div == 0:
                n /= div
            res.add(div)
        div += 2
    return res

def main(a, b):
    #a, b = [int(i) for i in sys.stdin.readline().split()]
    _gcd = gcd(a,b)
    #memo_ls = [0 for i in range(_gcd)]
    #memo_set = set()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        res = prime_factorize_2(_gcd)
        print(len(res) + 1)
if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)

Submission status: Wrong Answer

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

count = 0
tmp = 1

for i in range(1, int(max(A, B)**0.5)+100):
    if A%i == 0 and B%i == 0:
        if gcd(i, tmp) == 1:
            tmp *= i
            count += 1
print(count)

Submission status: Wrong Answer

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

count = 0
tmp = 1

for i in range(1, int(max(A, B)**0.5)+2):
    if A%i == 0 and B%i == 0:
        if gcd(i, tmp) == 1:
            if tmp == 0:
                continue
            tmp *= i
            count += 1
print(count)

Submission status: Wrong Answer

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

count = 0
tmp = 1

for i in range(1, int(sqrt(max(A, B)))+2):
    if A%i == 0 and B%i == 0:
        if gcd(i, tmp) == 1:
            tmp *= i
            count += 1
print(count)

Submission status: Wrong Answer

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

count = 0
tmp = 1

for i in range(1, int(max(A, B)**0.5)+2):
    if A%i == 0 and B%i == 0:
        if gcd(i, tmp) == 1:
            tmp *= i
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
from fractions import gcd
def main(a, b):
    #a, b = [int(i) for i in sys.stdin.readline().split()]
    _gcd = gcd(a,b)
    #memo_ls = [0 for i in range(_gcd)]
    #memo_set = set()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        print(_gcd)
        div = 2
        while _gcd > 1:
            if _gcd % div == 0:
                while _gcd % div == 0:
                    _gcd /= div
                cnt += 1
            div += 1
        #print(memo_set)
        print(cnt + 1)

if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, gcd(A, B)):
    if A%i == 0 and B%i == 0:
        if gcd(i, tmp) == 1:
            tmp *= i
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

g = gcd(A, B)
limit = A//g * B

for i in range(1, int(limit**0.5)+2):
    if A%i == 0 and B%i == 0:
        if gcd(i, tmp) == 1:
            tmp *= i
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
import random
import numpy as np
from fractions import gcd
def main(a, b):
    _gcd = gcd(a,b)
    #memo_ls = np.zeros(_gcd).flatten()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        for i in range(2, _gcd+1):
            if _gcd % i == 0:# and memo_ls[i-1] != 1:
                #memo_ls[i-1::i] = 1
                cnt += 1
        print(cnt + 1)

if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, int(max(A, B)**0.5)+3):
    if A%i == 0 and B%i == 0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, int(max(A, B)**0.5)+2):
    if A%i == 0 and B%i == 0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, int(max(A, B)**0.5)+1):
    if A%i == 0 and B%i == 0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, int(min(A, B)**0.5)+1):
    if A%i == 0 and B%i == 0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)

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

l = factorization(GCD)
if len(l) == 1:
    print(len(l))
else:
    print(len(l)+1)

Submission status: Wrong Answer

Solution code:
def main():
    A, B = (int(i) for i in input().split())
    from fractions import gcd
    g = gcd(A,B)
    facts = []
    p_num = 0
    import math
    for i in range(2,int(math.sqrt(g)) + 2):
        if g % i == 0:
            p_num += 1
        while g % i == 0:
            g //= i
            facts.append(i)
    print(p_num + 1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def gcd(a):
    k = []
    for i in range(1,a):
        if a%i == 0:
            if is_prime(i):
                k.append(i) 
    return k

def is_prime(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True

ka = gcd(a)
kb = gcd(b)

print(len(set(ka+kb)))

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = deque([1])
n = int(math.sqrt(gcd))
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
L = set(L)
print(len(L))

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = deque([1])
n = int(gcd**0.5)
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
    if gcd < i:
        break
L = set(L)
print(len(L))

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解 試し割法
L = deque([1])
n = 2*int(math.sqrt(gcd))
#print(n)
for i in range(2, n):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
#print(L)
L = set(L)
print(len(L))

Submission status: Wrong Answer

Solution code:
import math
def gcd(n, m):
  while m % n != 0:
    m, n = n, m % n
  return m
def div(n):
  d = []
  for i in range(2, int(math.sqrt(n))+2):
    if n % i == 0:
      for j in d:
        if i % j == 0:
          break
      else:
        d.append(i)
  if len(d) == 0 and n > 1:
    return 1
  return len(d)

a, b = map(int, input().split())
if a > b:
  a, b = b, a
c = gcd(a,b)
print(div(c) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def FindAllDivisors(x):
    divList = []
    y = 1
    while y <= x**0.5:
        if x % y == 0:
            divList.append(y)
            divList.append(int(x / y))
        y += 1
    return sorted(divList)

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

max_divs = gcd(A, B)

divs = FindAllDivisors(max_divs)

results = []
for div in divs[1:]:
    flag = True
    for result in results:
        if div % result == 0:
            flag = False
            break
    if flag:
        results.append(div)

print(len(results) + 1)

Submission status: Wrong Answer

Solution code:
import math
def gcd(n, m):
  while m % n != 0:
    m, n = n, m % n
  return n

def div(n):
  d = []
  for i in range(2, int(math.sqrt(n))+2):
    if n % i == 0:
      for j in d:
        if i % j == 0:
          break
      else:
        d.append(i)
  if len(d) == 0 and n > 1:
    return 1
  return len(d)

a, b = map(int, input().split())
if a > b:
  a, b = b, a
c = gcd(a,b)
print(div(c) + 1)

Submission status: Wrong Answer

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

n = gcd(A, B)

ans = set()
for i in range(2, int(sqrt(n)+1)+1):
    while n % i == 0:
        n = n // i
        ans.add(i)

print(len(ans)+1)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解 試し割法
L = deque([1])
n = int(math.sqrt(gcd))+100
#print(n)
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
#print(L)
L = set(L)
print(len(L))

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = deque([1])
n = int(math.sqrt(gcd))+1
#print(n)
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
#print(L)
L = set(L)
print(len(L))

Submission status: Wrong Answer

Solution code:
import math
a, b = map(int, input().split())
if a > b: a, b = b, a
max = math.sqrt(a)
idx = 2
ans = 1
prime = []

while idx <= a and idx <= max:
    for num in prime:
        if idx%num == 0:
            break
    else:
        prime += [idx]
        if a%idx == 0 and b%idx == 0:
            ans += 1
            a //= idx
            b //= idx
    idx += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
a, b = map(int, input().split())
if a > b: a, b = b, a
max = math.sqrt(a)
idx = 2
ans = 1
prime = []

while idx <= a and idx <= max:
    for num in prime:
        if idx%num == 0:
            break
    else:
        prime += [idx]
        if a%idx == 0 and b%idx == 0:
            ans += 1
            a //= idx
            b //= idx
    idx += 1
print(ans)
print(prime)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = deque([1])
n = int(math.sqrt(gcd))+1
for i in range(2, n):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
    if gcd < i:
        break
L = set(L)
print(len(L))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
idx = 2
ans = 1
prime = []

while idx <= a and idx <= b:
    for num in prime:
        if idx%num == 0:
            break
    else:
        if a%idx == 0 and b%idx == 0:
            ans += 1
            a //= idx
            b //= idx
    idx += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
idx = 2
sum = 1
ans = 1

while idx <= a and idx <= b:
    if a%idx == 0 and b%idx == 0:
        ans += 1
        a //= idx
        b //= idx
    idx += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

L = [1]
for i in range(2, gcd+1):
    if gcd%i ==0:
        L.append(i)
        gcd = gcd//i
print(len(L))

Submission status: Wrong Answer

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

def check(n):
  d = 2
  count = 1
  last = 0
  nn = n
  while n >= d:
    if (count == 1) and (d*d > nn):
      break
    if (n % d == 0):
      if d != last:
        count += 1; last = d
      n /= d
    else:
      d += 1
    
  return count

print(check(x))

Submission status: Wrong Answer

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

def check(n):
  d = 2
  count = 1
  last = 0
  nn = n
  while n >= d:
    if (n % d == 0):
      if d != last:
        count += 1; last = d
      n /= d
    else:
      d += 1
    if (count == 1) and (d*d > nn):
      break
  return count

print(check(x))

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict, deque
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

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

g = gcd(N, M)
t = g

ans = set()
for i in range(2, int(g ** 0.5) + 5000000):
    while g % i == 0:
        ans.add(i)
        g = g // i

if t == g and N == M:
    print(2)
else:
    print(len(ans) + 1)

Submission status: Wrong Answer

Solution code:
import math
A,B = map(int,input().split())
"""自分の方針
素因数分解ができるならする
そうすると、両方に含まれる因数がわかる
素因数の数が答え。"""
def factriz(N):
    upper = int(math.sqrt(N))
    k = N
    ans = []
    for i in range(2,upper+2):
        if(k%i == 0):
            ans.append(i)
            while(k%i == 0):
                k = k//i
    if(k != 1):
        ans.append(k)
    return ans

A_list = set(factriz(A))
B_list = set(factriz(B))
print(A_list,B_list)
print(len(A_list & B_list) + 1)

Submission status: Wrong Answer

Solution code:
import math
A,B = map(int,input().split())
"""自分の方針
素因数分解ができるならする
そうすると、両方に含まれる因数がわかる
素因数の数が答え。"""
def factriz(N):
    upper = int(math.sqrt(N))
    k = N
    ans = []
    for i in range(2,upper+2):
        if(k%i == 0):
            ans.append(i)
            while(k%i == 0):
                k = k//i
    return ans

A_list = set(factriz(A))
B_list = set(factriz(B))
print(len(A_list & B_list) + 1)

Submission status: Wrong Answer

Solution code:
import math
A,B = map(int,input().split())
"""自分の方針
素因数分解ができるならする
そうすると、両方に含まれる因数がわかる
素因数の数が答え。"""
def factriz(N):
    upper = int(math.sqrt(N))
    k = N
    ans = []
    for i in range(2,upper+1):
        if(k%i == 0):
            ans.append(i)
            while(k%i == 0):
                k = k//i
    return ans

A_list = set(factriz(A))
B_list = set(factriz(B))
print(len(A_list & B_list) + 1)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


class AtCoder:

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

    def factorize(self, n):
        p = 2
        res = 1
        tmp = n
        while p * p < n:
            if tmp % p == 0:
                res += 1
                while tmp % p == 0:
                    tmp /= p
            p += 1
        return res

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

        _gcd = self.gcd(A, B)
        print(self.factorize(_gcd))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
import fractions

def return_prime(aa):
    a_list = [1]
    for i in range(2, int(aa ** 0.5) + 2):
        while aa % i == 0:
            a_list.append(i)
            aa = aa // i
    return a_list

a, b = map(int, input().split())
a_list = return_prime(fractions.gcd(a, b))
print(len(set(a_list)))

Submission status: Wrong Answer

Solution code:
from fractions import gcd


def main():
    A, B = [int(i) for i in input().split()]
    G = gcd(A, B)
    factor = set()
    i = 2
    while i * i < G:
        if G % i == 0:
            factor.add(i)
            G = G // i
        else:
            break
        i += 1

    if G != 1:
        factor.add(G)
    print(len(list(factor))+1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys

input = sys.stdin.readline


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

        _gcd = gcd(A, B)

        root_gcd = _gcd ** 0.5
        p = 2
        prim_num = 1
        while p <= root_gcd:
            tmp = _gcd
            while True:
                if _gcd % p == 0:
                    _gcd /= p
                else:
                    break
            if tmp != _gcd:
                prim_num += 1

            p += 1
        print(prim_num)


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from numpy import sqrt
#from sympy import sieve


def create_primNum(N):
    if N ==1:
        return [1]
    primelist=[1,2]
    [primelist.append(i) for i in range(2, N+1) if N % i == 0 and i % 2 != 0]
    return primelist

if __name__ == "__main__":
    a,b = map(int,input().split())
    N = gcd(a, b)
    print(len(create_primNum(N)))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import sys

input = sys.stdin.readline


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

        _gcd = gcd(A, B)

        root_gcd = _gcd ** 0.5
        p = 2
        prim_num = 1
        while p <= root_gcd and _gcd > 1:
            tmp = _gcd
            while True:
                if _gcd % p == 0:
                    _gcd /= p
                else:
                    break
            if tmp != _gcd:
                prim_num += 1

            p += 1
        print(prim_num)


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
def f(n):
    arr = []
    temp = n
    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

  
A, B = list(map(int, input().split()))
a = f(A)
b = f(B)

print(len(set(a) & set(b))+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def create_primeNum(N):
    if N == 1:
        return 1
    primeNum=1
    for k in range(2, N + 1):
        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue
        if pow(2, k - 1, k) == 1:
            primeNum += 1
    return primeNum

if __name__ == "__main__":
    a,b = map(int,input().split())
    N = gcd(a, b)
    print(create_primeNum(N))

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
og=g
ans=set()
ans.add(1)



for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.add(i)
        while g%i==0:
            g//=i

x=len(ans)
if g==og and og!=1:
    x+=1
    
print(x)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
ans=set()
ans.add(1)



for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.add(i)
        while g%i==0:
            g//=i

for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.add(i)
    
    
print(len(ans))

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    cnt = 1
    s = 2
    e = int(gcd ** 0.5) + 1
    d = True
    while True:
        if d:
            d = False
            for i in range(s, e):
                if gcd % i == 0:
                    d = True
                    cnt += 1
                    while True:
                        if gcd % i == 0:
                            gcd //= i
                        else:
                            break
                    s = i + 1
                    e = int(gcd ** 0.5) + 1
                    break
            break
    if gcd != 1:
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
ans=set()
ans.add(1)


i=1
while g>1:
    i+=1
    if g%i==0:
        ans.add(i)
        ans.add(g//i)
        while g%i==0:
            g//=i
    
    
print(len(ans))

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
ans=[1]

for i in range(2,int(g**0.5)+1):
    if g%i==0:
        ans.append(i)
        while g%i==0:
            g//=i
    
    
print(len(ans))

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True


def gcd(a,b):
    a,b=max(a,b),min(a,b)
    if a%b==0:
        return b
    rt=gcd(a%b,b)
    return rt

a,b=MI()
g=gcd(a,b)
ans=[1]

for i in range(2,int(g**0.5)+2):
    if g%i==0:
        ans.append(i)
        while g%i==0:
            g//=i
    
    
print(len(ans))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import numpy as np

def create_primeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    test_list=[1]
    if len(seachList)!=0:
        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
    return test_list

if __name__ == "__main__":
    a,b = map(int,input().split())
    N = gcd(a, b)
    print(len(create_primeNum(N)))

Submission status: Wrong Answer

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

A,B=map(int, input().split())
Ap=sorted(prime_factorize(A))
Bp=sorted(prime_factorize(B))
Kn=0
Ans=1

for j in range(min(len(Ap),len(Bp))):
  if Ap[j]!=Kn:
    if Ap[j]%Bp[j]==0 or Bp[j]%Ap[j]==0:
      Kn=Ap[j]
      Ans+=1

print(Ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

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

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

_GCD=factorization(GCD)
num_list=[1]
for num in _GCD:
    num_list+=[num[0]]
#これで素因数分解の加工が完全に完了
print(len(num_list))