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


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

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

c = sorted(list(a & b))

c.insert(0, 1)

# print('c', c)
# print('d', c[1:])

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

print(len(c)-cnt)

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


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

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

c = sorted(list(a & b))

# c.insert(0, 1)

cnt = 0

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

    cnt += 1


print(cnt+1)

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


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

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

c = sorted(list(a & b))

c.insert(0, 1)

cnt = 0

for i in range(1, len(c)):
    p_cnt = 0
    for j in range(i):
        if c[i] % c[j] == 0:
            p_cnt += 1

    if p_cnt == 1:
        cnt += 1

print(cnt+1)

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


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

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

c = sorted(list(a & b))

c.insert(0, 1)

cnt = 0

for i in range(1, len(c)):
    p_cnt = 0
    for j in range(i):
        print(c[i], c[j])
        if c[i] % c[j] == 0:
            p_cnt += 1

    if p_cnt == 1:
        cnt += 1

print(cnt+1)

Submission status: Wrong Answer

Solution code:
# from math import gcd
from fractions import gcd

def cd(x):
    return [i for i in range(1, int(x**0.5+1)+1) if x%i==0]

def prime(x):
    for i in range(2, int(x**0.5)+1):
        if x%i == 0:
            return False
    return True

def main():
    a, b = map(int, input().split())

    # 最大公約数
    c = gcd(a, b)

    #最大公約数の約数のリスト
    c = cd(c)

    #素数判定
    ans = 0
    for i in c:
        if i == 1 or i==2:
            ans += 1
        elif prime(i):
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def prime_factorization(x):
    table = []
    i = 2
    while i * i <= x :
        if x % i == 0 :
            table.append(i)
        i += 1

    if x > 1 :
        table.append(x)
    return table

v = set(prime_factorization(a))
w = set(prime_factorization(b))

print(len(v&w) + 1)

Submission status: Wrong Answer

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


I=[int(c) for c in input().split()]
a=max(I)
b=min(I)

g=gcd(a,b)

count=1

#for i in range(2,int(g**(1/2))+2):
for i in range(2,g):
  if(g%i==0):
    count+=1   
  while(g%i==0):
    g/=i


print(count)

Submission status: Wrong Answer

Solution code:



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


I=[int(c) for c in input().split()]
a=max(I)
b=min(I)

g=gcd(a,b)

count=1

for i in range(2,int(g**(1/2))+2):
  if(g%i==0):
    count+=1   
  while(g%i==0):
    g/=i


print(count)

Submission status: Wrong Answer

Solution code:

I=[int(c) for c in input().split()]
a=max(I)
b=min(I)


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

g=gcd(a,b)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
A, B = [int(x) for x in input().split()]
N = gcd(A, B)
p_list = set({})
for i in range(1, int(math.sqrt(N))+1):
    if (N != (N//i * i)):
        continue
    is_prime = True
    for p in p_list:
        if (p != 1 and i == (i//p * p)):
            is_prime = False
    if (is_prime):
        p_list.add(i)
ans = set(list(p_list))
for p1 in p_list:
    q = N // p1 
    is_prime = True
    for p2 in p_list:
        if (p2 == 1): continue
        if (q == (q//p2 * p2)):
            is_prime = False
    if (is_prime):
        ans.add(q)
print(len(ans))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
A, B = [int(x) for x in input().split()]
N = gcd(A, B)
p_list = set({})
for i in range(1, int(math.sqrt(N))+1):
    if (N != (N//i * i)):
        continue
    is_prime = True
    for p in p_list:
        if (p != 1 and i == (i//p * p)):
            is_prime = False
    if (is_prime):
        p_list.add(i)
ans = set(list(p_list))
for p in p_list:
    q = N // p 
    for p in p_list:
        if (p == 1): continue
        if (q == q//p * p):
            ans.add(q)
print(len(ans))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
A, B = [int(x) for x in input().split()]
N = gcd(A, B)
p_list = set({})
for i in range(1, int(math.sqrt(N))+1):
    if (N != (N//i * i)):
        continue
    is_prime = True
    for p in p_list:
        if (p != 1 and i == (i//p * p)):
            is_prime = False
    if (is_prime):
        p_list.add(i)
ans = set(list(p_list))
for p in p_list:
    q = N // p 
    for p in p_list:
        if (p == 1): continue
        if (q == q//p * p):
            ans.add(q)
print(len(p_list))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
A, B = [int(x) for x in input().split()]
N = gcd(A, B)
p_list = set({})
for i in range(2, int(math.sqrt(N))+1):
    if (N != (N//i * i)):
        continue
    is_prime = True
    for p in p_list:
        if (i == (i//p * p)):
            is_prime = False
    if (is_prime):
        p_list.add(i)
    j = N // i
    is_prime = True
    for p in p_list:
        if (j == (j//p * p)):
            is_prime = False
    if (is_prime):
        p_list.add(j)
print(1+len(p_list))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
A, B = [int(x) for x in input().split()]
N = gcd(A, B)
p_list = set({})
for i in range(1, int(math.sqrt(N))+1):
    if (N != (N//i * i)):
        continue
    if (i == 1):
        p_list.add(i)
    else:
        is_prime = True
        for p in p_list:
            if (p != 1 and i == (i//p * p)):
                is_prime = False
        if (is_prime):
            p_list.add(i)
        j = N // i
        is_prime = True
        for p in p_list:
            if (p != 1 and j == (j//p * p)):
                is_prime = False
        if (is_prime):
            p_list.add(j)
print(len(p_list))

Submission status: Wrong Answer

Solution code:
import math
A,B = (map(int, input().split()))
prime_NA,prime_NB = [],[]
cntA,cntB=0,0
minAB = min([A,B])
for i in range(int(math.sqrt(minAB))):
    if A%(i+1)==0:
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                cntA+=1
        if cntA<=2:
            prime_NA.append(i+1)
        cntA = 0
    if B%(i+1)==0:
        for j in range(i+1):
            if (i+1)%(j+1)==0:
                cntB+=1
        if cntB<=2:
            prime_NB.append(i+1)
        cntB = 0
print(len(set(prime_NA)&set(prime_NB)))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
while(1):
  r=b%a
  if r==0:
    print(a)
    break
  else:
    b=a
    a=r

Submission status: Wrong Answer

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


def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True


if __name__ == "__main__":    
    a, b = map(int, input().split())
    a_list = calcDiv(a)
    b_list = calcDiv(b)
    d_list = set(a_list) & set(b_list)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True

if __name__ == "__main__":    
    a, b = map(int, input().split())
    d_list = []
    for i in range(1, int(max(a, b)**(1/2))+2):
        if a%i == 0 and b%i == 0:
            d_list.append(i)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
def isPrime(n):
    for i in range(2, int(n**(1/2))+2):
        if n % i == 0:
            return False
    return True

if __name__ == "__main__":    
    a, b = map(int, input().split())
    d_list = []
    for i in range(1, int(max(a, b)**(1/2))+2):
        if a%i == 0 and b%i == 0:
            d_list.append(i)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True

if __name__ == "__main__":    
    a, b = map(int, input().split())
    d_list = []
    for i in range(1, int(max(a, b)**(1/2))+1):
        if a%i == 0 and b%i == 0:
            d_list.append(i)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
import math

def pf(n):
    ans=[1]
    i=2
    if(n%i==0):
        while(n%2==0):
            n = n/i
        ans.append(i)
    i+=1
    while(i<math.sqrt(n) and n!=1):
        if (n%i==0):
            while(n%i==0):
                n=n/i
            ans.append(i)
        i+=2
    if(n!=1):
        ans.append(n)
    return set(ans)

a,b = map(int,input().split())
pfa=pf(a)
pfb=pf(b)
a=0
for i in pfa:
    if(i in pfb):
        a+=1
print(a)

Submission status: Wrong Answer

Solution code:
import math

def pf(n):
    ans=[1]
    i=2
    while(n!=1):
        if (n%i==0):
            while(n%i==0):
                n=n/i
            ans.append(i)
        i+=1
    return ans

a,b = map(int,input().split())
pfa=pf(a)
pfb=pf(b)
ans=0
for i in pfa:
    if(i in pfa):
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import fractions
import math
a,b = map(int,input().split())
ans = 0
num = fractions.gcd(a,b)
for i in range(1,math.ceil(math.sqrt(num))+1):
  key = 1
  for j in range(2,math.ceil(math.sqrt(i))+1):
    if i % j == 0:
      key = 0
  if num % i == 0 and (key == 1 or i == 2):
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
if a < b:
    n = a
    N = b
else:
    n = b
    N = a

#素数をリストにまとめる
C = [1]
if n >= 2:
    C.append(2)
i = 1
while (2 * i + 1) <= n:
    C.append(2 * i + 1)
    i += 1
    
if 2 < n:
    l = len(C) - 1
    i = 2
    while i < l:
        j = 2
        while j < l:
            if C[l] % C[j] == 0:
                C.remove(C[l])
                l -= 1
            j += 1
        i += 1

#nとNの公約数を求める
j = len(C) - 1
while j > 0:
    if n % C[j] != 0 or N % C[j] != 0:
        C.remove(C[j])
    j -= 1
    
print(len(C))

Submission status: Wrong Answer

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

inp = [int(e) for e in input().split()]
a = inp[0]
b = inp[1]

count = 0

factors = []

for i in range(1,min(a,b)+1):
  if(a%i == 0 and b%i == 0):
    factors.append(i)
    

for i in range(len(factors)-1):
  if(gcd(factors[i],factors[i+1]) == 1):
    count += 1


print(count+1)

Submission status: Wrong Answer

Solution code:
a, b = [int(i) for i in 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

ad = make_divisors(a)
bd = make_divisors(b)
ans = 0
for i in ad:
  if i in bd:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([], dtype='int')
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a //= i

soin_b = np.array([], dtype='int')
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b //= i

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size != 0:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([], dtype='int')
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a //= i

soin_b = np.array([], dtype='int')
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b //= i

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size != 0:
        ans += 1

print(a, soin_a)
print(b, soin_b)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([])
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a = a / i

soin_b = np.array([])
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b = b / i

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size != 0:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([])
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a = a / i

soin_b = np.array([])
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b = b / i

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size == 1:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

if a>b: x,y=a,b
else: x,y=b,a
  
while True:
  if x%y != 0:
    x,y=y,x%y
    continue
  break

gdc=y


primes=[1,]
      
for n in range(2, int(math.sqrt(gdc)) + 2):
  if (gdc % n) != 0:
    continue

  while (gdc % n) == 0:
    gdc /= n
  
  primes+=[n]

print(len(primes))

Submission status: Wrong Answer

Solution code:
import math
def gcd(a,b):
  if a<b:
    a,b = b,a
  if b == 0:
    return a
  else:
    a,b = b,a%b
    return(gcd(a,b))

def prime_factorization(k):
  ans = []
  i = 2
  while i <= k:
    if k % i == 0:
      ans.append(i)
      k /= i
    else:
      i += 1
  return ans
n,k = map(int,input().split())
#print(gcd(n,k))
l = prime_factorization(gcd(n,k))
print(l,len(set(l))+1)

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 = [int(x) for x in input().split()]

d = 1
d_list = []
while(d <= a and d <= b):
  if a % d == 0 and b % d == 0:
    d_list.append(d)
  d += 1

length = len(d_list)

x = prime_factorize(d_list[-1])
print(len(x))

Submission status: Wrong Answer

Solution code:
from fractions import gcd as bltin_gcd

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

d = 1
d_list = []
while(d <= a and d <= b):
  if a % d == 0 and b % d == 0:
    d_list.append(d)
  d += 1

length = len(d_list)

answer = 0
is_sosu = True
for i in range(length):
  is_sosu = True
  for j in range(length):
    if i != j:
      if bltin_gcd(d_list[i],d_list[j]) != 1:
        is_sosu = False
        length = len(d_list)
        break
  if not is_sosu:
    answer += 1
print(answer)

Submission status: Wrong Answer

Solution code:
from fractions import gcd as bltin_gcd

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

d = 1
d_list = []
while(d <= a and d <= b):
  if a % d == 0 and b % d == 0:
    d_list.append(d)
  d += 1

length = len(d_list)

answer = 0
for i in range(length):
  is_sosu = True
  for j in range(length):
    if i != j:
      if bltin_gcd(d_list[i],d_list[j]) != 1:
        is_sosu = False
        length = len(d_list)
        break
  if is_sosu:
    answer += 1
print(answer)

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
n = 1
m = min([A,B])
ls = [1]
t = 2
while n*t < m:
    tf = True
    for i in ls[1:]:
        if(t%i == 0):
            tf = False
            #n *= 2
            break
    if(tf):        
        if(A%t == 0 and B%t == 0):
            ls.append(t)
            n *= t
            t += ls[max([0,len(ls)-2])] -1
    t += 1
print(len(ls))

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
n = 1
m = min([A,B])
ls = [1]
t = 2
while n < m//2:
    tf = True
    for i in ls[1:]:
        if(t%i == 0):
            tf = False
            #n *= 2
            break
    if(tf):        
        if(A%t == 0 and B%t == 0):
            ls.append(t)
            n *= t
            t += ls[max([0,len(ls)-2])] -1
    t += 1
print(len(ls))

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
n = 1
m = min([A,B])
ls = [1]
t = 2
while n < m:
    tf = True
    for i in ls[1:]:
        if(t%i == 0):
            tf = False
            n *= 2
            break
    if(tf):        
        if(A%t == 0 and B%t == 0):
            ls.append(t)
            n *= t
            t += ls[max([0,len(ls)-2])]
        else:
            t += 1
print(len(ls))

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
n = 1
m = min([A,B])
ls = [1]
t = 2
while n < m:
    tf = True
    for i in ls[1:]:
        if(t%i == 0):
            tf = False
            n *= 2
            break
    if(tf):        
        if(A%t == 0 and B%t == 0):
            ls.append(t)
            n *= t
    t += 1
print(ls)

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
n = 1
m = min([A,B])
ls = [1]
t = 2
while n < m:
    tf = True
    for i in ls[1:]:
        if(t%i == 0):
            tf = False
            n *= t
            break
    if(tf):        
        if(A%t == 0 and B%t == 0):
            ls.append(t)
            n *= t
    t += 1
print(len(ls))

Submission status: Wrong Answer

Solution code:
import math 

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

factors = []
for i in range(2, math.ceil(min(a,b)**0.5)):
	if a%i==0 and b%i==0: 
		factors.append(i)
		if b%(a//i)==0: factors.append(a//i)

factors.sort()
for i in range(len(factors)):
	power = 2
	if factors[i]:
		temp = factors[i]
		for j in range(len(factors)):
			if factors[j]:
				if factors[j]!=factors[i]:
					if temp%factors[j]==0:
						factors[j] = False
					temp *= power
					power += 1

count = 0
for i in factors:
	if i: count += 1
print(count+1)

Submission status: Wrong Answer

Solution code:
from math import sqrt
a, b = map(int, input().split())
diva = set();	divb = set()
sa = int(sqrt(a))+1
sb = int(sqrt(b))+1
for i in range(1,sa):
  if a%i == 0:
    diva.add(i)
    if a%i != i:
      diva.add(a//i)
for i in range(1,sb):
  if b%i == 0:
    divb.add(i)
    if b%i != i:
      divb.add(b//i)
ans = list(diva & divb)
ans.sort()
l = len(ans)-1
print((l*(l-1))//2)

Submission status: Wrong Answer

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

for i in range(2, A+1):
  A_sur = A % i
  B_sur = B % i
  if A_sur == 0 and B_sur == 0: #公約数を求める
    if (i-1) **2 > A: #約数の性質より、これ以降のiは考えなくて良い
      break
    else:
      dj_list = list(map(lambda x: i % x , ans_list)) #iをans_listに入っている各要素で割った余りをdj_listに入れる
      if 0 not in dj_list: #dj_listに0がない時、
        ans_list.append(i) #ans_listに公約数が入る

ans_list.insert(0, 1)
print(len(ans_list))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
m = max(a, b)
n = min(a, b)
c = 0
li = 0

while n != 0:
    c = m % n
    m = n
    n = c

i = 1
while m >= i:
    if m % i == 0:
        li += 1
        m /= i
    i += 1

print(li)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
m = max(a, b)
n = min(a, b)
c = 0
li = 0

while n != 0:
    c = m % n
    m = n
    n = c

for i in range(1, m+1):
    if m % i == 0:
        li += 1
        m /= i

print(li)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
m = max(a, b)
n = min(a, b)
c = 0
li = []

while n != 0:
    c = m % n
    m = n
    n = c

for i in range(1, m+1):
    if m % i == 0:
        li.append(i)
        m /= i
        
print(li)

Submission status: Wrong Answer

Solution code:
import math

def su(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n%k==0:
            return 1
    return n

a,b = [int(n) for n in input().split()]
ans = []
for i in range(2, min(a,b)):
    if a%i==0 and b%i==0:
        if i==2 or i%2!=0:
            ans.append(su(i))
print(len(set(ans)))

Submission status: Wrong Answer

Solution code:
import math

def su(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n%k!=0:
            return n

a,b = [int(n) for n in input().split()]
ans = []
for i in range(2, min(a,b)):
    if (a%i==0 and b%i==0) or i%2!=0:
        ans.append(su(i))
print(len(ans))

Submission status: Wrong Answer

Solution code:
import math


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


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


s = int(math.sqrt(g))
print(s)

f = {}
for i in range(2, s):
    while g % i == 0:
        f[i] = f.get(i, 0) + 1
        g = g/i
print(len(f)+1)

Submission status: Wrong Answer

Solution code:
#素因数分解をする
from fractions import gcd
import numpy as np
a,b = [int(i) for i in input().split()]
g = gcd(a,b)
primes = []

for n in range(2, int(np.sqrt(g))+1):
    q,r = divmod(g, n)
    if r!=0:
        continue
    while r==0:
        g = q
        q,r = divmod(g,n)
    primes.append(n)

print(len(primes)+1)

Submission status: Wrong Answer

Solution code:
# 入力を2つの数値として扱う
a, b = map(int, input().split())

# 最大公約数を求める関数(ユークリッド互除法)
def gcd(i, j):
    while j != 0:
        i, j = j, i % j
    return i

# 公約数のリストを返す関数(最大公約数の約数)
def divisor(n):
    i = 1
    ret = []
    while i * i <= n:
        if n % i == 0:
            ret.append(i)
            ret.append(n//i)
        i += 1
    ret = list(set(ret))
    return ret

# 互いに素(最大公約数が1)の場合Trueを返す関数
def coprime(i, j):
    return gcd(i, j) == 1

# 最大公約数を求める
g = gcd(a, b)

# 公約数のリストを求める
dl = divisor(g)

# 公約数を調べる
cnt = 1
# 1より大きい約数について
while cnt < len(dl):
    lc = 1
    # 次の約数と比較
    while cnt + lc < len(dl):
        # for debug:print(str(dl[cnt]) + ',' + str(dl[cnt + lc]))
        # 素でない場合は削除
        if not coprime(dl[cnt], dl[cnt + lc]):
            dl.remove(dl[cnt + lc])
            lc -= 1
        lc += 1
    cnt += 1

# 答えの出力
print(len(dl))

Submission status: Wrong Answer

Solution code:
import sys,math

def input():
    return sys.stdin.readline()[:-1]
def yakusuu(N):
    P = [1,N]
    for k in range(2,math.floor(math.sqrt(N))+1):
        if N % k == 0:
            P.append(k)
            P.append(N//k)
    return P
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def main():
    A, B = map(int,input().split())
    C = sorted(list(set(yakusuu(A))&set(yakusuu(B))))

    if len(C) == 1:
        print(1)
        exit(0)
    D = [1]
    for k in range(1,len(C)):
        f = 1
        for l in range(k-1):
            if gcd(C[k],C[l]) != 1:
                f = 0
                break
        if f == 1:
            D.append(C[k])
    print(len(D))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])

def factorize(g):
  factor = []
  for i in range(2, int(np.sqrt(g))+2):
    if g % i != 0:
      continue
    while g % i == 0:
      g //= i
    factor.append(i)
  #print(factor)
  return factor
print(len(factorize(g))+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])

def factorize(g):
  factor = []
  for i in range(2, int(np.sqrt(g))+1):
    if g % i != 0:
      continue
    while g % i == 0:
      g //= i
    factor.append(i)
  return factor
print(len(factorize(g))+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)

primes = primes.nonzero()[0]
#print(primes.nonzero()[0])

factor = []
for i in primes:
  if g % i == 0:
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
#print(primes.nonzero()[0])

factor = []
for i in primes:
  if g % i == 0:
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+10
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
print(len(factor) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
if 1 != original_g and g == original_g:
  print(len(factor) + 1)
else:
  print(len(factor))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
if 1 == original_g or g == original_g:
  print(len(factor) + 1)
else:
  print(len(factor))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
original_g = g
max_prime = int(np.sqrt(g))+2
primes = np.ones(max_prime)
#print(g+1, primes.shape)
primes[0] = 0
#print(primes)
for i in range(2, max_prime):
  if primes[i] and i * 2 < g + 2:
    primes[i*2::i] = 0
    #print(i, primes)
    
primes = np.arange(max_prime)[primes == 1]
#print(primes)

factor = []
for i in primes:
  if g % i == 0:
    g //= i
    #print(g)
    factor.append(i)

#print(g, original_g, factor)
if 1 == original_g:
  print(len(factor) + 1)
else:
  print(len(factor))