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 fractions import gcd


def coprime(a, b):
    return gcd(a, b) == 1
  

def num_of_pair(arr): 
    taken = set()
    removed = set()
    i = 0
    while(i < len(arr)):
        j = i + 1
        while(j < len(arr)):
            if (arr[i] not in removed or arr[j] not in removed) and coprime(arr[i], arr[j]):
                taken.add(arr[i])
                taken.add(arr[j])
            else:
                removed.add(arr[j])
            j += 1
        i += 1
    return len(taken - removed)


a, b = [int(x) for x in input().split(' ')]
divs = []
for i in range(1, min(a, b) + 1): 
    if a%i==b%i==0:
        divs.append(i)
print(num_of_pair(divs))

Submission status: Wrong Answer

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

def soinsu(n):
  c = []
  t = n
  m = int(-((-n**0.5)//1))+1
  for i in range(2, m):
    if t%i==0:
      while t%i==0:
        t //= i
      c.append(i)
      c.append(t)
  if c==[]:
    c.append(n)
  return c

count = 1
a = soinsu(A)
b = soinsu(B)
for j in a:
  for k in b:
    if j == k:
      count += 1
      
print(count)

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


a, b = map(int, input().split())
n = gcd(a, b)
if n == 1:
    count = 1
else:
    count = 2
    for i in range(2, n + 1):
        if i > n ** 0.5 + 1:
            break
        if n % i == 0:
            while n % i == 0:
                n = n // i
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    x1, x2 = map(int, input().split())
    if x1 == 1 or x2 == 1:
        print(1)
    else:
        # if x1 >= x2:
        #     x1 = x1 - x2
        # else:
        #     x2 = x2 - x1
        cf = []

        divisors1 = []
        for i in range(1, int(x1 ** 0.5) + 1):
            if x1 % i == 0:
                divisors1.append(i)
                if i != x1 // i:
                    divisors1.append(x1 // i)
        # print(divisors1)

        divisors2 = []
        for j in range(1, int(x2 ** 0.5) + 1):
            if x2 % j == 0:
                divisors2.append(j)
                if j != x2 // j:
                    divisors2.append(x2 // j)
        # print(divisors2)

        koyakusu = set(divisors1) & set(divisors2)
        koyakusu.remove(1)
        # print(koyakusu)

        for k in list(koyakusu):
            appendable = True
            for m in cf:
                if k % m == 0:
                    appendable = False
                    break
            if appendable:
                cf.append(k)

        # print(cf)
        print(len(cf) + 1)

Submission status: Wrong Answer

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

counter = 0
i = 1

while True:
  
  if a%i==0 and b%i==0:
    counter += 1
    a //= i
    b //= i
  
  i+= 1
  if i > min(a, b):
    break
    
print(counter)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
arr=set()
X=min(A,B)
for i in range(1,int(X**0.5)+1):
    if A%i==0 and B%i==0:
        arr.add(i)
s=min(arr);e=max(arr)
def make_divisors(n,s,e):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if i!=s and i!=e:
            if n % i == 0 :
                divisors.add(i)
                if i != n // i:
                    divisors.add(n//i)
    return divisors
cnt=0

for j in arr:
    if len(make_divisors(j,0,0) & arr)<3:
        cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
	if a==0:
		return(b)
	return(gcd(b%a,a))
a,b=map(int,input().split())
g=gcd(a,b)
ans=1
if g%2==0:
	ans+=1
	while(g%2==0):
		g//=2
for divide in range(3,g,2):
	if g%divide==0:
		ans+=1
		while(g%divide==0):
			g//=divide
print(ans)

Submission status: Wrong Answer

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

Prime_number_pluse_1 = [1,2,3]
tmp = [3]
t = []
ans = []
M = max(A,B)
m = min(A,B)


for i in range(5,M+1):
    if i%2 == 1:
        flag = 0
        for j in tmp:
            if i%j == 0:
                flag = 1
                break
            else:
                continue

        if flag == 0:
            Prime_number_pluse_1.append(i)
            tmp.append(i)
        else:
            continue

            
    else:
        continue
    

# print(Prime_number_pluse_1)
# print(tmp)

for p in Prime_number_pluse_1:
    if A % p == 0 and B %p == 0:
        ans.append(p)



print(ans[-1])

Submission status: Wrong Answer

Solution code:
N = list(map(int, input().split()))
if (N[0] == 1 and N[1] >= 1) or N[1] == 1:
  print(1)
elif N[0] > 1 or N[1] > 1:
  list =[]
  for i in range(2,min(N)):
    if N[0] % i == 0 and N[1]% i == 0:
      if len(list) == 0:
        list.append(i)
      elif len(list) > 0:
        f = True
        for j in list:
          if i % j == 0:
            f = False
            break
          if f :
            list.append(i)
  print(len(list)+1)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
yaku=[]
flag=0
for i in range(2,min(a,b)+1):
    if a%i==0 and b%i==0:
        yaku.append(i)
ans=len(yaku)
flag=0
for i in range(len(yaku)-1):
    flag=0
    if yaku[i+1]-yaku[i] in yaku:
            flag=1
    if flag==1:
        ans-=1
        #print("ans=",ans)
print(ans+1)

Submission status: Wrong Answer

Solution code:
import math
 
def gcd(x, y):
	while y != 0:
		z = x % y
		x = y
		y = z
	return x
 
a, b = map(int, input().split())
x    = gcd(a, b)
y    = int(math.sqrt(x)) + 1
ds   = [1]

if x % 2 == 0:
	ds.append(2)

for i in range(3, y + 1, 2):
	if x % i == 0:
		ds.append(i)

if 2 < x:
	ds.append(x)

fs = [True] * len(ds)

for i in range(1, len(fs)):
	if fs[i] == False:
		continue;
	for j in range(i + 1, len(fs)):
		if ds[j] % ds[i] == 0:
			fs[j] = False

print(sum(1 for f in fs if f == True))

Submission status: Wrong Answer

Solution code:
def main():
    def prime_table(n):
        list = [True for _ in range(n + 1)]
        list[0] = False

        i = 2
        while i * i <= n:
            if list[i]:
                j = i + i
                while j <= n:
                    list[j] = False
                    j += i
            i += 1

        return list[1:]

    def is_prime(n):
        i = 2
        while i * i <= n:
            if n % i == 0:
                return False
            i += 1
        return True

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

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

    tbl = prime_table(int(m ** 0.5))

    # print(tbl)

    ans = set()

    for p, bl in enumerate(tbl, 1):
        if a % p == 0 and b % p == 0:
            if bl:
                ans.add(p)

            qa = a // p
            if b % qa == 0 and qa not in tbl and is_prime(qa):
                ans.add(qa)

            qb = b // p
            if a % qb == 0 and qb not in tbl and is_prime(qb):
                ans.add(qb)

    print(len(ans))
    # print(*ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools
import math 

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

def divisor(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 is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if is_prime(a) and is_prime(b):
    print(1)
    import sys
    sys.exit()

a_L = divisor(a)
b_L = divisor(b)

kouyaku = set(a_L) & set(b_L)

new_L = []

for val in kouyaku:
    if is_prime(val):
        new_L.append(val)

new_L.append(1)
print(len(new_L))

Submission status: Wrong Answer

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

if A>=B:
  C = A%B
else:
  C = B%A

count = 0

now = 0

a = 2

while C >= a*a:
  if C%a == 0:
    if a != now:
      count += 1
      now = a
    C /= a
  else:
    a +=1

if C != now:
  count +=1

count += 1

print(count)

Submission status: Wrong Answer

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

s = []
import math
d = int(math.sqrt(min(A,B)))
for i in range(2,d+1):
  if A%i==0 and B%i==0:
    s.append(i)
#print(s)
k = 0

while s:
  t = s.pop(0)
  #print(t)
  c = 0
  for j,i in enumerate(s[:]):
    if i%t==0:
      s.pop(j-c)
      c+=1
  #print(s)
  k+=1
print(k+1)

Submission status: Wrong Answer

Solution code:
import numpy as np
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

    if temp!=1:
        arr.append(temp)

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

    return arr
print(factorization(A),factorization(N))

a=len(list(set(factorization(A))&set(factorization(N))))

#a = cmb(a+1, 2)
print(a+1)

Submission status: Wrong Answer

Solution code:
import math 

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

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    
    return list(set(table))
  
ma = max(A, B)
mi = min(A, B)

yakusu = [d for d in divisor(mi) if ma % d == 0]

yakumax = max(yakusu)
if yakumax == 1:
	prime = [1]
elif yakumax == 2:
  prime = [1, 2]
else:
  prime = sieve_of_eratosthenes(500)
  prime.append(1)

c = 0
for y in yakusu:
  if y in prime:
    c += 1

if A == B:
  print(1)
else:
  print (c)

Submission status: Wrong Answer

Solution code:
def common_divisor(a, b):
    # a <= b
    res = []
    for i in range(2, int(a**0.5)+1):
        if a % i == 0 and b % i == 0:
            res.append(i)
            t = a // i
            if i != t and b % t == 0:
                res.append(t)
    return sorted(res)

def primes_num(arr):
    res = 0
    for i in arr:
        flg = True
        rt_i = i**0.5
        for j in arr:
            if rt_i < j:
                break
            elif i % j == 0:
                flg = False
                break
        if flg: res += 1
    return res

A, B = sorted([int(i) for i in input().split()])
# A <= B

cds = common_divisor(A, B)
print(primes_num(cds)+1)

Submission status: Wrong Answer

Solution code:
import random
def is_prime(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
 
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
 
a, b = map(int,input().split())
 
c = 1
m = min(a,b)
for i in range(1,int(m**0.5)+1):
	if a % i == 0 and b % i == 0:
		if is_prime(i):
			c+=1
		if i != a//i or i != b//i:
			if a % (m//i) == 0 and b % (m//i) == 0:
				if is_prime(m//i):
					c+=1		
		
print(c)

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
	if a==0:
		return(b)
	return(gcd(b%a,a))
a,b=map(int,input().split())
g=gcd(a,b)
ans=1
if g%2==0:
	ans+=1
	while(g%2==0):
		g//=2
for divide in range(3,int(g**(1/2))+3,2):
	if g%divide==0:
		ans+=1
		while(g%divide==0):
			g//=divide
print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
def fac(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

la=fac(a[0])
lb=fac(a[1])
ans=1
for i in range(len(la)):
    for j in range(len(lb)):
        if la[i]==lb[j]:
            ans+=1
        elif la[i]<lb[j]:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import fractions
A, B = map(int, input().split())
MAX = fractions.gcd(A, B)
if MAX == 1:
    print(1)
    exit()
cnt = 1
while True:
    if MAX % 2 == 0:
        cnt+=1
        MAX /= 2
    else:
        break
print(cnt+1)

Submission status: Wrong Answer

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

def bunkai(n):
    sosu= {1}
    tmp = n

    for i in range(2,int(n/2)+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.add(i)

    if tmp!=1:
        sosu.add(tmp)
                
    if sosu==[]:
        sosu.add[n]
    
    return sosu

ans = len(bunkai(A)&bunkai(B))
print(ans)

Submission status: Wrong Answer

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

  # ABが互いにそなら答えは１

  ans = 0
  import fractions as math

  if math.gcd(A,B) == 1:
    ans = 1
  else:
    # 公約数を求める
    cdlist =[]

    for i in range(1, min(A,B) + 1):
      if A % i == 0 and B % i == 0:
        cdlist.append(i)

    # print(cdlist)

    for i,cd1 in enumerate(cdlist):
      for cd2 in cdlist[i+1:]:
        # print(cd1,cd2)
        if math.gcd(cd1,cd2) == 1:
          ans += 1

  print(ans)

main()

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()))
    ls = [True] * (int(max(a, b) ** 0.5) + 2)
    ls[0] = False
    ls[1] = False
    cnt = 1
    for i in range(len(ls)):
        if ls[i]:
            if a % i == 0 and b % i == 0:
                cnt += 1
            for j in range(i, len(ls), i):
                ls[j] = False
    print(cnt)


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

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

def gcd(A,B):
  c = A%B
  if c==0:
    return B
  else:
    return gcd(B,c)

C  = gcd(A,B)
limit = (C ** 0.5) //1
count = 1
for i in range(2,int(limit+1)):
  if i>C:
    break
  if C%i==0:
    count += 1
    while C%i==0:
      C /= i
if count==1 and C!=1:
  count += 1
print(count)

Submission status: Wrong Answer

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

m = 1
count = 1

for i in range(2, min(a,b)//2):
    if a*b%i == 0 and (m*m)%i != 0:
        count += 1
        m = m*i

print(count)

Submission status: Wrong Answer

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

def is_prime(n):
    a = 0
    for k in range(1 + 1, int(math.sqrt(n)) + 1):
        if n % k == 0:
            a = 1
    if a == 1: return False
    else :return True

list = [1]
list.extend([i for i in range(1+1, min(A, B)+1) if A % i == 0 and B % i == 0 and A % i != 2 and B % i != 2 and A % i != 3 and B % i != 3])
print(list)
cnt = 0
for i in list:
    if is_prime(i) == True:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      print(i)
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A//i
    if B%j!=0:
      continue
  elif B%i==0:
    j = B//i
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
#import sys

#input = sys.stdin.readline

#import heapq
import math

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=math.sqrt(max(a,b))
    count=1
    sosu=[2,3]
    for i in range(len(sosu)):
        if a%sosu[i]==0 and b%sosu[i]==0:
            count+=1
            a//=sosu[i]
            b//=sosu[i]
        elif a%sosu[i]==0:
            a//=sosu[i]
        elif b%sosu[i]==0:
            b//=sosu[i]


    c = math.sqrt(max(a, b))
    while m < c:
        m = 6 * k +1
        if a % m == 0 and b % m == 0:
            count += 1
            a//=m
            b//=m
            c=math.sqrt(max(a,b))
        elif a%m==0:
            a//=m
            c=math.sqrt(max(a,b))
        elif b%m==0:
            b//=m
            c=math.sqrt(max(a,b))
 #           print(count)
        k += 1

    k = 1
    m = 2
    while m < c:
        m = 6 * k -1
        if a % m == 0 and b % m == 0:
            count += 1
            a//=m
            b//=m
            c=math.sqrt(max(a,b))
        elif a%m==0:
            a//=m
            c=math.sqrt(max(a,b))
        elif b%m==0:
            b//=m
            c=math.sqrt(max(a,b))
        k += 1

    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math 

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

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    
    return list(set(table))
  
ma = max(A, B)
mi = min(A, B)

yakusu = [d for d in divisor(mi) if ma % d == 0]

yakumax = max(yakusu)
if yakumax == 1:
	prime = [1]
elif yakumax == 2:
  prime = [1, 2]
else:
  prime = sieve_of_eratosthenes(500)
  prime.append(1)

c = 0
for y in yakusu:
  if y in prime:
    c += 1

if A == B:
  print(0)
else:
  print (c)

Submission status: Wrong Answer

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

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(A, B)))+1)

Submission status: Wrong Answer

Solution code:
def prime(n):
  pf=[1]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:
      pf.append(i)
      n//=i
  list(set(pf))
  return pf
a, b = map(int, input().split())
if a == 1 or b == 1:
  print(1)
else:
  print(len(set(prime(a)+prime(b))))

Submission status: Wrong Answer

Solution code:
import math

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

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

	return gcd(b, a%b)


G = gcd(A,B)


def sosuhantei(n):
	d = math.floor(n**(1/2))
	cond = True
	for i in range(2,d+1):
		if n % i == 0:
			cond = False
			break
	return cond 


sosu = []
g = math.ceil(G**(1/2)) 

yaku = []

for i in range(2,g+1):
	if G % i == 0:
		yaku.append(i)
		yaku.append(G//i)

yaku = list(set(yaku))

cnt = 0
for i in range(len(yaku)):
	if sosuhantei(yaku[i]):
		cnt += 1

print(cnt + 1)

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
primeN1 = []
primeN2 = []
for i in range(2, A):
    for j in range(2, i+1):
        if i % j == 0:
            if i == j:
                primeN1.append(i)
            else:
                break
for i in range(2, B):
    for j in range(2, i+1):
        if i % j == 0:
            if i == j:
                primeN2.append(i)
            else:
                break

sosuu = -2
for m,n in zip(primeN1,primeN2):
    if m == n:
        sosuu+=1
    else:
        pass

if sosuu<0:
    sosuu = 1
    
print(sosuu)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
from fractions import gcd

ans=0
aaa=0

a,b=map(int,input().split())
c=gcd(a,b)
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
s=make_divisors(c)
#print(s)
for i in s:
    aaa=0
    if i%2==0:
        aaa=1
    if i>=3 and i%2==1:
        for j in range(2,i):
            #print(i,j)
            if i%j==0:
                aaa=1
                break
            else:
                aab=0
    if aaa==0:
        ans+=1
print(ans+1)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
import sys
input=sys.stdin.readline
sys.setrecursionlimit(1000000000)
def gcd(a,b):#最大公約数を返す。Euclid
    if a<b:
        a,b=b,a
    if b==0:
        return a
    return gcd(b,a%b)
c=gcd(A,B)
#print(c)
if c==1:
    print(1)
else:
    sqrtc=int(c**(1/2))
    lf=[0 for i in range(c-1)]#2,3,,,,c
    #print(lf)
    lans=[]
    for i in range(sqrtc):
        if lf[i]==0:
            lans.append(i+2)
            for j in range(i+2,c//(i+2)+1):
                lf[(i+2)*j-2]=1
    #print(lf)
    ans=1
    #for i in range(c-1):
    #    if lf[i]==0 and c%(i+2)==0:
    #        ans+=1
    for i in lans:
        if c%i==0:
            ans+=1
    #print(c-sum(lf)+1)
    print(ans)

Submission status: Wrong Answer

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


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 = make_divisors(A)
b = make_divisors(B)
L = []
for x in a:
    if x in b:
        L.append(x)
L.sort()
L = L[1:]#1を消す

ans = 1
for i in range(2**len(L)):
    box = []
    for j in range(len(L)):
        if (i >> j) & 1:
            box.append(L[j])
    flag = False
    for k in range(len(box)-1):
        for l in range(k+1, len(box)):
            if box[l] % box[k] == 0:
                flag = True
                break
        if flag:
            break
    if flag:
        continue
    ans = max(ans, len(box))

print(ans)

Submission status: Wrong Answer

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

ans_list =[]
i = 1

while True:
  
  if a%i==0 and b%i==0:
    ans_list.append(i)
    a //= i
    b //= i
  
  i+= 1
  if i > min(a, b):
    break
    
print(len(ans_list))

Submission status: Wrong Answer

Solution code:

a, b = [int(x) for x in input().split()]
if a > b:
  a, b = b, a

cnt = 1 # 公約数１の分

if a != 1:
  f = a
  if b % f == 0:
    cnt += 1

  f = 2
  if a % f == 0:
    if b % f == 0:
      cnt += 1

  f = 3
  while f*f <= a:
    if a % f == 0:
      if b % f == 0:
        cnt += 1
      a //= f
    f += 2

print(cnt)

Submission status: Wrong Answer

Solution code:
tmp = input().split()
A = int(tmp[0])
B = int(tmp[1])

so = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
count = 0

for i in so:
    if A < i:
        break
    if A % i == 0 and B % i == 0:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


def furui(data):
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data


a, b = map(int, input().split())
# a, b = 1000000000000000, 9900000000000000
a = make_divisors(a)
# print(a)
a = furui(a)
# print(a)
b = make_divisors(b)
# print(b)
b = furui(b)
# print(b)
print(len(set(a) & set(b)) + 1)

Submission status: Wrong Answer

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

s = []
for i in range(2,min(10**6,A,B)):
  if A%i==0 and B%i==0:
    s.append(i)
#print(s)
k = 0

while s:
  t = s.pop(0)
  #print(t)
  c = 0
  for j,i in enumerate(s[:]):
    if i%t==0:
      s.pop(j-c)
      c+=1
  #print(s)
  k+=1
print(k+1)

Submission status: Wrong Answer

Solution code:
a_b = input().split(" ")
A = int(a_b[0])
B = int(a_b[1])

p_nums = []
for i in range(1, int(A**0.5) + 1):
    is_p_num = True
    if A % i == 0 and B % i == 0:
        for p in p_nums:
            if p == 1:
                continue
            if i % p == 0:
                is_p_num = False
                break
        if is_p_num:
            p_nums.append(i)
for i in range(1, int(B**0.5) + 1):
    is_p_num = True
    if A % i == 0 and B % i == 0:
        for p in p_nums:
            if p == 1:
                continue
            if i % p == 0 or i == 1:
                is_p_num = False
                break
        if is_p_num:
            p_nums.append(i)

print(len(p_nums))

Submission status: Wrong Answer

Solution code:
#import sys

#input = sys.stdin.readline

#import heapq
import math

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=math.sqrt(max(a,b))
    count=1
    sosu=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
    for i in range(len(sosu)):
        if a%sosu[i]==0 and b%sosu[i]==0:
            count+=1
            a//=sosu[i]
            b//=sosu[i]
        elif a%sosu[i]==0:
            a//=sosu[i]
        elif b%sosu[i]==0:
            b//=sosu[i]


    c = math.sqrt(max(a, b))
    while m < c:
        m = 6 * k +1
        if a % m == 0 and b % m == 0:
            count += 1
            a//=m
            b//=m
            c=math.sqrt(max(a,b))
        elif a%m==0:
            a//=m
            c=math.sqrt(max(a,b))
        elif b%m==0:
            b//=m
            c=math.sqrt(max(a,b))
 #           print(count)
        k += 1

    k = 1
    m = 2
    while m < c:
        m = 6 * k -1
        if a % m == 0 and b % m == 0:
            count += 1
            a//=m
            b//=m
            c=math.sqrt(max(a,b))
        elif a%m==0:
            a//=m
            c=math.sqrt(max(a,b))
        elif b%m==0:
            b//=m
            c=math.sqrt(max(a,b))
        k += 1

    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    while b!=0:
        a, b = b, a%b
    return a

def main():
    a, b = map(int, input().split())
    g = gcd(a, b)
    i, c = 2, {1}
    while i<g/2:
        if g%i==0:
            l, r = i, g//i
            for j in range(2, l):
                if l%j==0:
                    l = 1; break
            for j in range(2, r):
                if r%j==0:
                    r = 1; break
            c.add(l); c.add(r)
        i += 1
    print(len(c))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

i = 1
A_div = list()
B_div = list()
while i * i <= min(A, B):
    if A % i == 0:
        A_div.append(i)
        A_div.append(A//i)
    if B % i == 0:
        B_div.append(i)
        B_div.append(B//i)
    i += 1

com_div = list(set(A_div) & set(B_div))[1:]

l = list()

while True:
    flag = 1
    if len(com_div) == 0:
        break
    last = com_div.pop(-1)
    for c in com_div:
        if last % c == 0:
            flag = 0
            break
    if flag:
        l.append(last)

print(len(l) + 1, end='')

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(2, 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())

a = set(make_divisors(A))
b = set(make_divisors(B))

c = sorted(list(a & b))

cnt = 1 + len(c)

for i in range(1, len(c)):
    for j in range(i):
        if c[i] % c[j] == 0:
            cnt -= 1
            break


print(cnt)

Submission status: Wrong Answer

Solution code:
import random

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

def is_prime(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
 
a, b = map(int,input().split())
 
c = 1
m = gcd(a,b)
for i in range(1,int(m**0.5)+1):
	if a % i == 0 and b % i == 0:
		if is_prime(i):
			c+=1
print(c)

Submission status: Wrong Answer

Solution code:
a, b = [int(x) for x in input().split()]
if a > b:
  a, b = b, a

cnt = 1 # 公約数１の分

if a != 1:
  f = a
  if b % f == 0:
    cnt += 1

  f = 2
  if a % f == 0:
    if b % f == 0:
      cnt += 1

  f = 3
  while f <= a:
    if a % f == 0:
      if b % f == 0:
        cnt += 1
      a //= f
    f += 2

print(cnt)

Submission status: Wrong Answer

Solution code:
import numpy as np
A, B = (int(i) for i in input().split())

i=1
c=0
while(1):
    if (A/i == int(A/i) and B/i == int(B/i)):
        c=c+1
        A=A/i
        B=B/i
    i=i+1
    if (i > min(np.sqrt(A),np.sqrt(B))+1):
        break

print(c)

Submission status: Wrong Answer

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

a,b = map(int,input().split())
if gcd(a,b) == 1:
	k = [1]
	no = 2
else:
	k = []
	no = 1
large = max(a,b)
small = min(a,b)
while no * no <= small:
	if no % 2 == 0 and no != 2:
		no += 1
		continue
	if small % no == 0 and large % no == 0:
		k.append(no)
		if small // no != no:
			k.append(small//no)
	no += 1
k.sort()

l = []
l.append(k[0])
ans = 1

for i in range(1,len(k)):
	flag = True
	for j in range(len(l)):
		if gcd(k[i],l[j]) != 1:
			flag = False
			break
	if flag:
		l.append(k[i])
		ans += 1

print(ans)