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:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
if A == 0 or B == 0:
    print(0)
else:
    for i in range(max(int(np.sqrt(A))+1, int(np.sqrt(B))+1)):
        if A % (i+1) == 0 and B % (i+1) == 0:
            if i == 0:
                pass
            else:
                if 0 not in (i + 1)%np.array(C):
                    C.append(i + 1)
                    count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
for i in range(max(int(np.sqrt(A))+1, int(np.sqrt(B))+1)):
    if A % (i+1) == 0 and B % (i+1) == 0:
        if i == 0:
            pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
for i in range(max(int(np.sqrt(A)), int(np.sqrt(B)))):
    if A % (i+1) == 0 and B % (i+1) == 0:
        if i == 0:
            pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
import numpy as np
if A % B == 0 or B % A == 0:
    for i in range(min(A, B)):
        if A % (i+1) == 0 and B % (i+1) == 0:
            if i == 0:
                pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
    print(count)
else:
    for i in range(min(int(np.sqrt(A)), int(np.sqrt(B)))):
        if A % (i+1) == 0 and B % (i+1) == 0:
            if i == 0:
                pass
            else:
                if 0 not in (i + 1)%np.array(C):
                    C.append(i + 1)
                    count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
import numpy as np
if A % B == 0 or B % A == 0:
    for i in range(min(A, B)):
        if A % (i+1) == 0 and B % (i+1) == 0:
            if i == 0:
                pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
    print(count)
else:
    for i in range(min(int(np.sqrt(A)), int(np.sqrt(B)))):
        if A % (i+1) == 0 and B % (i+1) == 0:
            if i == 0:
                pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
C = []
import numpy as np
count = 1
import numpy as np
for i in range(min(int(np.sqrt(A)), int(np.sqrt(B)))):
    if A % (i+1) == 0 and B % (i+1) == 0:
        if i == 0:
            pass
        else:
            if 0 not in (i + 1)%np.array(C):
                C.append(i + 1)
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
A = [int(i) for i in input().split()]

prime_num = [[],[]]

prime_num[0].append(1)
prime_num[1].append(1)

for i in range(2):
    a = 2
    n = A[i]
    while A[i] >= a*a:
        if n%a == 0:
            prime_num[i].append(a)
            n /= a
        else:
            a+=1

print(len(set(prime_num[0])&set(prime_num[1])))

Submission status: Wrong Answer

Solution code:
import math

def is_prime(x):
  flag = True
  for n in range(2, int(math.sqrt(x)+1)):
    if x % n == 0:
      return(False)
      break
  return flag
    
A, B = map(int, input().split())

prime_divs = []
for n in range(2, int(math.sqrt(min(A, B)) + 1)):
  if is_prime(n):
    if (A % n == 0) and  (B % n == 0):
        prime_divs.append(n)

print(len(prime_divs)+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

ans = 0
i = 2
check = False
while c != 1:
    #print(c,i)
    while c % i == 0:
        #print('a')
        c = c // i
        check = True
    i = i + 1
    if check:
        ans += 1
    check = False
    if i > 1000:
        print(ans+2)
        exit()
print(ans + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
    check = False
print(ans + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
 
def primeNum(n):
  ans = 1
  if n == 1:
    return ans
  if n % 2 == 0:
    ans += 1
    while n % 2 == 0:
      n = n // 2
  for k in range(3, int(n**0.5)+1, 2):
    if n % k == 0:
      ans += 1
      while n % k == 0:
        n = n // k
    if n == 1:
      return ans
  if n != 1:
    ans += 1
    return ans
  
a,b = list(map(int, input().split()))
n=gcd(a,b)
print(primeNum(n))

Submission status: Wrong Answer

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


input_values = list(map(int, input().split()))
print(len(list(set(factorization(input_values[0])) & set(factorization(input_values[1])))) + 1)

Submission status: Wrong Answer

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


input_values = list(map(int, input().split()))
print(len(list(set(factorization(input_values[0])) & set(factorization(input_values[1])))))

Submission status: Wrong Answer

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

def solve(A: int, B: int):
    # math.gcd()は3.5から
    # g = math.gcd(A, B)
    g = gcd(A, B)
    f = factorize(g)
    print(1 + len(f))


def gcd(x: int, y: int):
    return gcd(y, x % y) if y else x


def factorize(n: int):
    res = []
    for i in range(2, int(n ** 0.5//1 + 2)):
        if n % i:
            continue
        s = 0
        while n % i == 0:
            n /= i
            s += 1
        res.append([i, s])
    return res


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from fractions import gcd
 
def primeNum(n):
  prime=[1]
  for k in range(2, n):
    if n % k == 0:
      prime.append(k)
      while n % k == 0:
        n = n // k
  return prime
 
a,b = list(map(int, input().split()))
n=gcd(a,b)
print(len(primeNum(n)))

Submission status: Wrong Answer

Solution code:
def get_gcd(a, b):
    if b > a:
        a, b = b, a
    r = a%b
    if r == 0:
        return b
    else:
        return get_gcd(b, r)


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

A, B = map(int, input().split())
gcd = get_gcd(A, B)
factors = prime_factorize(gcd)
print(len(set(factors)))

Submission status: Wrong Answer

Solution code:
def get_gcd(a, b):
    if b > a:
        a, b = b, a
    r = a%b
    if r == 0:
        return b
    else:
        return get_gcd(b, r)
      
def prime_factorize(n):
    answers = []
    while n % 2 == 0:
        answers.append(2)
        n //= 2
    f = 3
    while f**2 <= n:  # instead of f <= n**0.5
        if n % f == 0:
            answers.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        answers.append(n)
    return answers

A, B = map(int, input().split())
gcd = get_gcd(A, B)
factors = prime_factorize(gcd)
len(set(factors))

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = []
    for num in range(2, int(n**0.5+1)):
        while n % num == 0:
            n //= num
            factor.append(num)
    if n != 1:
        factor.append(n)
    return factor
    
g = gcd(A, B)
f = factorize(g)
# print(g)
# print(f)
print(len(f) + 1)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = []
    for num in range(2, int(n**0.5+1)):
        while n % num == 0:
            n //= num
            factor.append(num)
    factor.append(n)
    return factor
    
g = gcd(A, B)
f = factorize(g)
# print(g)
# print(f)
print(len(f) + 1)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = [1]
    for num in range(2, int(n**0.5+1)):
        while n % num == 0:
            n //= num
            factor.append(num)
    return set(factor)
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Submission status: Wrong Answer

Solution code:
import fractions

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

x = fractions.gcd(A, B)

ans = 1

for i in range(2, x):
    n = 0
    while x % i == 0:
        x //= i
        n += 1
    if n != 0:
        ans += 1
    if x == 1:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import fractions

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

x = fractions.gcd(A, B)

ans = 1

for i in range(2, int(x**0.5)+2):
    n = 0
    while x % i == 0:
        x //= i
        n += 1
    if n != 0:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(x, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = [1]
    for num in range(2, int(n**0.5+1)):
        while n % num == 0:
            n //= num
            factor.append(num)
    return set(factor)
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(x, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = [1]
    for num in range(2, int(n*0.5+1)):
        while n % num == 0:
            n //= num
            factor.append(num)
    return set(factor)
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
# https://www.iandprogram.net/entry/2015/03/18/003511
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(x, x%y)
# https://qiita.com/kageyasai2/items/48ef81f39b4e31c6d396
def factorize(n):
    factor = [1]
    for num in range(2, n*n+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    return set(factor)
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
import fractions


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


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

    gcd = fractions.gcd(a, b)
    table = prime_factorization(gcd)
    print(len(table) + 1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
import fractions


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


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

    gcd = fractions.gcd(a, b)
    table = prime_factorization(gcd)
    print(len(table) + 1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math as m
import fractions

A, B = list(map(int, input().split()))
#A , B = 12, 18

def sieve_of_eratosthenes(n):
    candidate = [1 for i in range(n+1)]
    candidate[0] = 0
    candidate[1] = 0
    for i in range(len(candidate)):
        if (candidate[i] == 0):
            continue
        j = 2
        while j * i < len(candidate):
            candidate[i * j] = 0
            j = j + 1
    primes = [i for i in range(n) if candidate[i] == 1]
    return primes

def prime_factorize(A):
    p = sieve_of_eratosthenes(m.floor(A**0.5))
    a = [0 for i in p]
    for i in range(len(p)):
        if A % p[i] != 0:
            a[i] = 0
        else:
            temp = A
            while temp % p[i] == 0:
                temp = temp / p[i]
                a[i] = a[i] + 1
    return a

#pf = prime_factorize(fractions.gcd(A, B))
# num = 1

# for x in pf:
#     if x >= 1:
#         num = num + 1



# print(num)

g = fractions.gcd(A,B)
primes = sieve_of_eratosthenes(g)

num = 1
for p in primes:
    if g % p == 0:
        num = num + 1
print(num)

Submission status: Wrong Answer

Solution code:
import math as m
import fractions

A, B = list(map(int, input().split()))
#A , B = 12, 18

def sieve_of_eratosthenes(n):
    candidate = [1 for i in range(n+1)]
    candidate[0:2] = [0 , 0]
    for i in range(len(candidate)):
        if (candidate[i] == 0):
            continue
        j = 2
        while j * i < len(candidate):
            candidate[i * j] = 0
            j = j + 1
    primes = [i for i in range(n) if candidate[i] == 1]
    return primes

def prime_factorize(A):
    p = sieve_of_eratosthenes(A)
    a = [0 for i in p]
    for i in range(len(p)):
        if A % p[i] != 0:
            a[i] = 0
        else:
            temp = A
            while temp % p[i] == 0:
                temp = temp / p[i]
                a[i] = a[i] + 1
    return a

#pf = prime_factorize(fractions.gcd(A, B))
# num = 1

# for x in pf:
#     if x >= 1:
#         num = num + 1



# print(num)

g = fractions.gcd(A,B)
primes = sieve_of_eratosthenes(g)

num = 1
for p in primes:
    if g % p == 0:
        num = num + 1
print(num)

Submission status: Wrong Answer

Solution code:
import math as m
import fractions

A, B = list(map(int, input().split()))
#A , B = 12, 18

def sieve_of_eratosthenes(n):
    candidate = [1 for i in range(n+1)]
    candidate[0:2] = [0 , 0]
    for i in range(len(candidate)):
        if (candidate[i] == 0):
            continue
        j = 2
        while j * i < len(candidate):
            candidate[i * j] = 0
            j = j + 1
    primes = [i for i in range(n) if candidate[i] == 1]
    return primes

def prime_factorize(A):
    p = sieve_of_eratosthenes(A)
    a = [0 for i in p]
    for i in range(len(p)):
        if A % p[i] != 0:
            a[i] = 0
        else:
            temp = A
            while temp % p[i] == 0:
                temp = temp / p[i]
                a[i] = a[i] + 1
    return a

pf = prime_factorize(fractions.gcd(A, B))
num = 1

for x in pf:
    if x >= 1:
        num = num + 1

print(num)

Submission status: Wrong Answer

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

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

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


gcd = GCD(A, B)
divs = prime_decomposition(gcd)

print(1 + len(divs))

Submission status: Wrong Answer

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

cd = [1]
factors = {}
temp = A
for i in range(2, int(-(-A**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            print(temp)
            cnt+=1
            temp //= i
        factors[i] = 1
if temp!=1:
    factors[temp] = 1
print(factors)
temp = B
for i in range(2, int(-(-B**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            cnt+=1
            temp //= i
        #print(i)
        if i in factors:
            factors[i] = 2
        else:
            pass
if temp!=1:
    if temp in factors:
        factors[temp] = 2
#print(factors)
count = 1
for k, v in factors.items():
    if v==2:
        count+=1

print(count)

Submission status: Wrong Answer

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

cd = [1]
factors = {}
temp = A
for i in range(2, int(-(-A**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            cnt+=1
            temp //= i
        factors[i] = 1
    if temp!=1:
        factors[temp] = 1
#print(factors)
temp = B
for i in range(2, int(-(-B**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            cnt+=1
            temp //= i
        #print(i)
        if i in factors:
            factors[i] = 2
        else:
            pass
    if temp!=1:
        if temp in factors:
            factors[temp] = 2
#print(factors)
count = 1
for k, v in factors.items():
    if v==2:
        count+=1

print(count)

Submission status: Wrong Answer

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

cd = [1]
factors = {}
temp = A
for i in range(2, int(-(-A**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            cnt+=1
            temp //= i
        factors[i] = 1
#print(factors)
temp = B
for i in range(2, int(-(-B**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            cnt+=1
            temp //= i
        #print(i)
        if i in factors:
            factors[i] = 2
        else:
            pass
#print(factors)
count = 1
for k, v in factors.items():
    if v==2:
        count+=1

print(count)

Submission status: Wrong Answer

Solution code:
A, B = map(int, input().split())
def gcd(x, y):
        while y != 0:
            x, y = y, x%y
        return x
    
def factorize(n):
    factor = []
    for num in range(2, n*n+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    return factor
    
g = gcd(A, B)
f = factorize(g)
print(len(f))

Submission status: Wrong Answer

Solution code:
import math
def euqlid(x,y):
    while x % y != 0:
        tmp = x % y
        x = y
        y = tmp
    return y
a, b = map(int, input().split())
if a < b:
    tmp = a
    a = b
    b = tmp
k = euqlid(a, b)
sum = 0
i = 2
if k == 1:
    print(1)
    exit()
while i <= math.sqrt(k):
    flag = False
    while k % i == 0:
        k = k // i
        flag = True
    if flag:
        sum += 1
    i += 1
print(sum + 2)

Submission status: Wrong Answer

Solution code:
import math
def euqlid(x,y):
    while x % y != 0:
        tmp = x % y
        x = y
        y = tmp
    return y
a, b = map(int, input().split())
if a < b:
    tmp = a
    a = b
    b = tmp
k = euqlid(a, b)
sum = 0
i = 2
if k == 1:
    print(1)
    exit()
while i < math.sqrt(k):
    flag = False
    while k % i == 0:
        k = k // i
        flag = True
    if flag:
        sum += 1
    i += 1
print(sum + 2)

Submission status: Wrong Answer

Solution code:
import math
def euqlid(x,y):
    while x % y != 0:
        tmp = x % y
        x = y
        y = tmp
    return y
a, b = map(int, input().split())
if a < b:
    tmp = a
    a = b
    b = tmp
k = euqlid(a, b)
sum = 0
i = 2
while i <= math.sqrt(k):
    flag = False
    while k % i == 0:
        k = k // i
        flag = True
    if flag:
        sum += 1
    i += 1
print(sum + 2)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from itertools import chain


def gcd(a, b):
    # 最大公約数
    while b:
        a, b = b, a % b
    return a


def fast_prime_set(n):
    # nまでの素数リスト高速版 setで返す
    # chainの読み込みが必要！
    if n < 4:
        return ({}, {}, {2}, {2, 3})[n]
    n_sqrt = int(n ** 0.5) + 1
    primes = {2, 3} | set(chain(range(5, n + 1, 6), range(7, n + 1, 6)))
    for i in range(5, n_sqrt, 2):
        if i in primes:
            primes.difference_update(range(i * i, n, i * 2))
    return primes


def prime_factorization(x):
    # 素因数分解
    # 事前に素数のセットが必要
    primes = fast_prime_set(10 ** 6)

    fact = defaultdict(int)
    for prime in primes:
        while x % prime == 0:
            fact[prime] += 1
            x //= prime
        if x == 1:
            break
        if x in primes:
            fact[x] += 1
            break
    return fact


if __name__ == '__main__':
    a, b = map(int, input().split())
    gcd_a_b = gcd(a, b)
    prime_fact = prime_factorization(gcd_a_b)
    print(1 + len(prime_fact))

Submission status: Wrong Answer

Solution code:
def euqlid(x,y):
    if x < y:
        tmp = x
        x  = y
        y = tmp
    while x % y != 0:
        tmp = x % y
        x = y
        y = tmp
    return y
a, b = map(int, input().split())
k = euqlid(a, b)
data = [1]
for i in range(2, (k//2) + 1):
    if k % i != 0:
        continue
    flag = True
    for j in data:
        if i % j == 0 and j != 1:
            flag = False
            break
    if flag:
        data.append(i)
print(len(data))

Submission status: Wrong Answer

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

def common_divisor(a, b):
    res = []
    i = 1
    m = min(a, b)
    M = max(a, b)
    
    while i ** 2 <= m:
        if m % i == 0 and M % i == 0:
            res.append(i)
            
            if i ** 2 != m and M % (m // i) == 0:
                res.append(m // i)
                
        i += 1
        
    return res

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

cd = common_divisor(a, b)
ans = 1

for x in cd:
    if is_prime(x):
        ans += 1
        
print(ans)

Submission status: Wrong Answer

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

def common_divisor(a, b):
    res = []
    i = 1
    m = min(a, b)
    
    while i ** 2 <= m:
        if a % i == 0 and b % i == 0:
            res.append(i)
            
            if i ** 2 != a and b % (a // i) == 0:
                res.append(a // i)
                
        i += 1
        
    return res

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

cd = common_divisor(a, b)
ans = 1

for x in cd:
    if is_prime(x):
        ans += 1
        
print(ans)

Submission status: Wrong Answer

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

def gcd(x,y):

  while y!=0:
    x,y=y,x%y
  return x

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

ans = len(factorization(gcd))
if ans != 1:
  ans += 1
print(ans)

Submission status: Wrong Answer

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

def gcd(x,y):

  while y!=0:
    x,y=y,x%y
  return x

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

ans = len(factorization(gcd))
if ans == 1:
  ans += 1
print(ans)

Submission status: Wrong Answer

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

def gcd(x,y):

  while y!=0:
    x,y=y,x%y
  return x

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

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

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

    return arr

print(len(factorization(gcd)) + 1)

Submission status: Wrong Answer

Solution code:
def gcd(A,B):
  if B == 0:
    return A
  return gcd(B,A%B)

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

n = gcd(A,B)
count = 1

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

print(count)

Submission status: Wrong Answer

Solution code:
import fractions

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

n = fractions.gcd(A,B)
count = 1

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

print(count)

Submission status: Wrong Answer

Solution code:
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c

# 素因数リスト

import math
def factor(num):
    divisor_list = []
    divisor = 2
    while num  > divisor:
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor

        else:
            divisor += 1
    divisor_list.append(num)
    return divisor_list

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

cd_list = set(factor(gcd(a, b)))
print(len(cd_list)+1)

Submission status: Wrong Answer

Solution code:
# 以下ペースト可
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c

# 素因数リスト

import math
def factor(num):
    divisor_list = []
    divisor = 2
    while num  > divisor:
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor

        else:
            divisor += 1
    divisor_list.append(num)
    return divisor_list

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

cd_list = set(factor(gcd(a, b)))


# 公約数でかつ素数の数を求める
import math
cnt = 1
for i in cd_list:
    prime_flag = True

    if i in [1, 2]:
        pass
    else:
        for k in range(2, int(math.sqrt(i) +1)):
            if i % k == 0:
                prime_flag = False
                break

    if prime_flag:
        cnt += 1

# 数をこたえる
print(cnt)

Submission status: Wrong Answer

Solution code:
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c

# 素因数リスト

import math
def factor(num):
    divisor_list = []
    divisor = int(math.sqrt(num))
    while num  > divisor:
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor

        else:
            divisor -= 1
    divisor_list.append(num)
    return divisor_list


a_list = factor(a)
b_list = factor(b)
cd_list = []

for item in set(a_list):
    if item in set(b_list):
        cd_list.append(item)

# 公約数でかつ素数の数を求める
cnt = 1
for i in cd_list:
    prime_flag = True

    if i in [1, 2]:
        pass
    else:
        for k in range(2, int(math.sqrt(i) +1)):
            if i % k == 0:
                prime_flag = False
                break

    if prime_flag:
        cnt += 1

# 数をこたえる
print(cnt)

Submission status: Wrong Answer

Solution code:
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c

# 素因数リスト

import math
def factor(num):
    divisor_list = []
    divisor = 2
    while num  > divisor:
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor

        else:
            divisor += 1
    divisor_list.append(divisor)
    return divisor_list


a_list = factor(a)
b_list = factor(b)
cd_list = []

for item in set(a_list):
    if item in set(b_list):
        cd_list.append(item)

# 公約数でかつ素数の数を求める
cnt = 1
for i in cd_list:
    prime_flag = True

    if i in [1, 2]:
        pass
    else:
        for k in range(2, int(math.sqrt(i) +1)):
            if i % k == 0:
                prime_flag = False
                break

    if prime_flag:
        cnt += 1


# 数をこたえる
print(cnt)

Submission status: Wrong Answer

Solution code:
# 以下ペースト可
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c

# 素因数リスト

import math
def factor(num):
    divisor_list = []
    divisor = 2
    while num  > divisor :
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor
        else:
            divisor += 1
    return divisor_list


a_list = factor(a)
b_list = factor(b)

cd_list = []

for item in set(a_list):
    if item in set(b_list):
        cd_list.append(item)


# 公約数でかつ素数の数を求める
cnt = 1
for i in cd_list:
    prime_flag = True

    if i in [1, 2]:
        pass
    else:
        for k in range(2, int(math.sqrt(i) +1)):
            if i % k == 0:
                prime_flag = False
                break

    if prime_flag:
        cnt += 1


# 数をこたえる
print(cnt)