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())
a_prime_factor = []
b_prime_factor = []
for i in range(2, int(a ** 0.5) + 1):
    if a % i == 0:
        a_prime_factor.append(i)
    while a % i == 0:
        a //= i
if a != 1:
    a_prime_factor.append(a)
for i in range(2, int(b ** 0.5) + 1):
    if b % i == 0:
        b_prime_factor.append(i)
    while b % i == 0:
        b //= i
if b != 1:
    b_prime_factor.append(b)
ans = 1
for i in a_prime_factor:
    if i in b_prime_factor:
        ans += 1
print(a_prime_factor)
print(b_prime_factor)
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
a_prime_factor = []
b_prime_factor = []
for i in range(2, int(a ** 0.5) + 1):
    if a % i == 0:
        a_prime_factor.append(i)
    while a % i == 0:
        a //= i
a_prime_factor.append(a)
for i in range(2, int(b ** 0.5) + 1):
    if b % i == 0:
        b_prime_factor.append(i)
    while b % i == 0:
        b //= i
b_prime_factor.append(b)
ans = 1
for i in a_prime_factor:
    if i in b_prime_factor:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
a_prime_factor = []
b_prime_factor = []
for i in range(2, int(a ** 0.5) + 1):
    if a % i == 0:
        a_prime_factor.append(i)
    while a % i == 0:
        a //= i
for i in range(2, int(b ** 0.5) + 1):
    if b % i == 0:
        b_prime_factor.append(i)
    while b % i == 0:
        b //= i
if a_prime_factor == []:
    a_prime_factor.append(a)
if b_prime_factor == []:
    b_prime_factor.append(b)
ans = 1
for i in a_prime_factor:
    if i in b_prime_factor:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
a_prime_factor = []
b_prime_factor = []
for i in range(2, int(a ** 0.5) + 1):
    if a % i == 0:
        a_prime_factor.append(i)
    while a % i == 0:
        a //= i
for i in range(2, int(b ** 0.5) + 1):
    if b % i == 0:
        b_prime_factor.append(i)
    while b % i == 0:
        b //= i
ans = 1
for i in a_prime_factor:
    if i in b_prime_factor:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
A,B = map(int,input().split())
import fractions
p = fractions.gcd(A,B)
pp = set()
for i in range(1,p):
    if p%i==0:
        pp.add(i)
        p //= i
#print(pp)
print(len(pp))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
yakusu_a = []
import math
for i in range(1, int(math.sqrt(a))):
  if a % i == 0:
    yakusu_a.append(i)
    if i != a//i:
      yakusu_a.append(a//i)

cd_list = []
for e in yakusu_a:
  if b % e == 0:
    cd_list.append(e)

cd_list = sorted(cd_list)
def furui(lst):
  data = lst
  ans = []
  while len(data) > 0:
    sentou = data[0]
    ans.append(sentou)
    data = [i for i in data if i % sentou != 0]
  return ans

print(len(furui(cd_list[1:]))+1)

Submission status: Wrong Answer

Solution code:
def M(a,b,n):#最大公約数(n=2)
    if n*n>a and n*n>b:
        return 1
    while 1:
        if a%n==b%n==0:
            a=a/n
            b=b/n
            break
        if n*n>a and n*n>b:
            return 1
        n=n+1
    return n*M(a,b,n)

def S(o,n):#素因数分解(n=2)
    if o==1:
        return 1
    if n*n>o:
        return o
    if o%n!=0:
        return S(o,n+1)
    o=int(o/n)
    return n

def SS(o):
    y=[S(o,2)]
    while 1:
        n=y[-1]
        o=int(o/n)
        if o==1:
            break
        if n*n>o:
            y.append(o)
            break
        y.append(S(o,n))
    return y

a,b=map(int,input().split())
o=M(a,b,2)
y=[SS(o)]
if y==[1]:
    print(1)
else:
    x=y[0]
    A=0
    for i in y:
        if x!=i:
            A=A+1
        x=i
    print(A+2)

Submission status: Wrong Answer

Solution code:
def M(a,b,n):#最大公約数(n=2)
    if n*n>a and n*n>b:
        return 1
    while 1:
        if a%n==b%n==0:
            a=a/n
            b=b/n
            break
        if n*n>a and n*n>b:
            return 1
        n=n+1
    return n*M(a,b,n)

def S(o,n):#素因数分解(n=2)
    if o==1:
        return 1
    if n*n>o:
        return o
    if o%n!=0:
        return S(o,n+1)
    o=int(o/n)
    return n

def SS(o):
    y=[S(o,2)]
    while 1:
        n=y[-1]
        o=int(o/n)
        if o==1:
            break
        if n*n>o:
            y.append(o)
            break
        y.append(S(o,n))
    return y

a,b=map(int,input().split())
o=M(a,b,2)
y=SS(o)
if y==[1]:
    print(1)
else:
    x=y[0]
    A=0
    for i in y:
        if x!=i:
            A=A+1
        x=i
    print(A+2)

Submission status: Wrong Answer

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

if a > b:
    a, b  = b, a

ls = []
for i in range(1, int(a**(1/2)) + 1):
    if a % i == 0:
        ls.append(i)
        ls.append(int(a/i))

ls1 = []
for j in ls:
    if b % j == 0:
        ls1.append(j)

if ls1[1] == 2:
    ans = [1, 2]
    ls1 = ls1[2:]
else:
    ans = [1]
    ls1 = ls1[1:]

for k in ls1:
    if k == 1 or k == 2 or k == 3:
      ans.append(k)
      continue
    for x in range(2, int(k**(1/2)) + 1):
        if k % x == 0:
            break
        if x == int(k**(1/2)):
            ans.append(k)

print(len(ans))

Submission status: Wrong Answer

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


def sosu(n):
    ret = True
    for i in range(2,int((n**0.5)+1)):
        if n % i == 0:
            ret = False
            break
    return ret


def f(n):
    ret = []
    for i in range(1,int((n**0.5)+1)):
        if n % i == 0 and sosu(i):
            ret.append(i)
    return ret

A = f(a)
B = f(b)

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

Submission status: Wrong Answer

Solution code:
import math
def main():
    def pri(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
    ans = 0
    a,b = map(int,input().split())
    c = pri(a)
    d = pri(b)
    for i in range(1,int(min(a,b)**0.5)+1):
        if i in c and i in d:
            ans += 1
    if min(a,b) in c and min(a,b) in d:
        ans += 1
    print(ans+1)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
def main():
    def pri(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
    ans = 0
    a,b = map(int,input().split())
    c = pri(a)
    d = pri(b)
    for i in range(1,int(min(a,b)**0.5)+1):
        if i in c and i in d:
            ans += 1
    print(ans+1)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def M(a,b,n):#最大公約数(n=2)
    if n*n>a and n*n>b:
        return 1
    while 1:
        if a%n==b%n==0:
            a=a/n
            b=b/n
            break
        if n*n>a and n*n>b:
            return 1
        n=n+1
    return n*M(a,b,n)

def S(o,n):#素因数分解(n=2)
    x=n
    y=2
    if o%2==1:
        y=y-1
    if o==1:
        return 1
    while 1:
        while 1:
            if n*n>o:
                return y+1
            if o%n==0:
                o=o/n
                break
            n=n+1
        if x!=n:
            x=n
            y=y+1
        if n*n>o:
            if o!=n:
                y=y+1
            break
    return y

a,b=map(int,input().split())
o=M(a,b,2)
print(S(o,2))

Submission status: Wrong Answer

Solution code:
def M(a,b,n):#最大公約数(n=2)
    if n*n>a and n*n>b:
        return 1
    while 1:
        if a%n==b%n==0:
            a=a/n
            b=b/n
            break
        if n*n>a and n*n>b:
            return 1
        n=n+1
    return n*M(a,b,n)

def S(o,n):#素因数分解(n=2)
    x=n
    y=2
    if o==1:
        return 1
    while 1:
        while 1:
            if n*n>o:
                return y+1
            if o%n==0:
                o=o/n
                break
            n=n+1
        if x!=n:
            x=n
            y=y+1
        if n*n>o:
            if o!=n:
                y=y+1
            break
    return y
    
a,b=map(int,input().split())
o=M(a,b,2)
print(S(o,2))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math

def test(a,b):
  x = gcd(a,b)
  s = []
  for i in range(2, int(math.sqrt(x)) + 1):
    while x % i == 0:
      s.append(i)
      x //= i

  s.append(x)

  return list(set(s))

def main():

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

  num = []

  num = list(test(a, b))
  print(len(num))

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math

def test(a,b):
  x = gcd(a,b)
  s = []
  for i in range(2, int(math.sqrt(x) + 1)):
    while x % i == 0:
      s.append(i)
      x //= i

  s.append(x)

  return list(set(s))

def main():

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

  num = []

  num = list(test(a, b))
  print(len(num))

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

A,B = inputIL()

G = gcd(A,B)

print(len(factorization(G))+1)

Submission status: Wrong Answer

Solution code:
import math

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

num = [1]

for i in range(2, int(math.sqrt(max(a,b)))):
  flag = 0
  if(a % i == 0 and b % i == 0):
    flag = 1
    for j in num:
      if(i % j == 0 and j != 1):
        flag = 0
        break
  if(flag == 1):
    num.append(i)

print(len(num))

Submission status: Wrong Answer

Solution code:
import math

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

num = [1]

for i in range(2, int(math.sqrt(min(a,b)))):
  flag = 0
  if(a % i == 0 and b % i == 0):
    flag = 1
    for j in num:
      if(i % j == 0 and j != 1):
        flag = 0
        break
  if(flag == 1):
    num.append(i)

print(len(num))

Submission status: Wrong Answer

Solution code:
import math

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

num = [1]

for i in range(2, int(math.sqrt(min(a,b)) + 1)):
  flag = 0
  if(a % i == 0 and b % i == 0):
    flag = 1
    for j in num:
      if(i % j == 0 and j != 1):
        flag = 0
        break
  if(flag == 1):
    num.append(i)

print(len(num))

Submission status: Wrong Answer

Solution code:
import math
import fractions
def primefactor(a):
    s=[]
    s.append(1)
    f=0
    while a%2==0:
        f=f+1
        a=a//2
    if f>0:
        s.append(2)
    for i in range(3,int(math.sqrt(a)+1),2):
        if a%i==0:
            s.append(i)
            a=a//i
    if a>2:
        s.append(a)
    return len(s)  

a,b=sorted(map(int,input().split()))
m=fractions.gcd(a,b)
print(primefactor(m))

Submission status: Wrong Answer

Solution code:
import math
def primefactor(a,b):
    s=[]
    s.append(1)
    f=0
    while a%2==0 and b%2==0:
        f=f+1
        a=a//2
        b=b//2
    if f>0:
        s.append(2)
    for i in range(3,int(math.sqrt(b)+1),2):
        if a%i==0 and b%i==0:
            s.append(i)
            a=a//i
            b=b//i
    return len(s)  

a,b=sorted(map(int,input().split()))
print(primefactor(a,b))

Submission status: Wrong Answer

Solution code:
from fractions import gcd

N, M = map(int, input().split())

n = gcd(N, M)
# print(n)
ans = 1

for i in range(2, int(n**(1/2))+2):
    flag = 0
    # print("i", i)
    while True:
        if n%i == 0:
            n //= i
            # print(n)
            flag = 1
        else:
            break
    ans += flag

print(ans)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
import fractions 
import collections
GCD=fractions.gcd(A,B)
a=[]

while GCD % 2 ==0:
  a.append(2)
  GCD //= 2
f = 3
while f * f <= GCD:
  if GCD % f == 0:
    a.append(f)
    GCD //= f
  else:
    f += 2
if GCD != 1:
  a.append(GCD)
c = collections.Counter(a)
print(sum(c.values())+1)

Submission status: Wrong Answer

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

from fractions import gcd
from collections import Counter
# def gcd(x, y):
#     if x < y: x, y = y, x
#     while y != 0:
#         x, y = y, x % y
#     return x

gcd_ab = gcd(a, b)
if gcd_ab == 1:
    print(1)
    exit()

def get_divisor(n):
    divisor = Counter()
    if n % 2 == 0:
        divisor[2] = 1
        # if 2 in divisor:
        #     divisor[2] += 1
        # else:
        #     divisor[2] = 1
        # n //= 2

    i = 3
    while i*i <= n:
        while n % i == 0:
            divisor[i] += 1
            n //= i
        i += 2
    if n > 1:
        divisor[n] += 1
    return divisor

divisor = get_divisor(gcd_ab)
print(len(divisor)+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

if gcd_ab == 1:
    print(1)
    
def get_divisor(n):
    divisor = {}
    while n % 2 == 0:
        divisor[2] = 1
        # if 2 in divisor:
        #     divisor[2] += 1
        # else:
        #     divisor[2] = 1
        # n //= 2

    i = 3
    while i <= n:
        while n % i == 0:
            if i in divisor:
                divisor[i] += 1
            else:
                divisor[i] = 1
            n //= i
        i += 2
    return divisor

divisor = get_divisor(gcd_ab)
print(len(divisor)+1)

Submission status: Wrong Answer

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

def get_divisor(n):
    divisor = []
    if n % 2 == 0:
        divisor.append(2)
    i = 3
    while i*i <= n:
        if n % i == 0:
            is_prime = True
            for d in divisor:
                if i % d == 0:
                    is_prime = False
                    break
            if is_prime:
                divisor.append(i)
        i += 2
    return divisor
    
def get_count_common_divisor(n, divisor):
    cnt = 1
    for d in divisor:
        if n % d == 0:
            cnt += 1
    return cnt

divisor = get_divisor(min(a, b))
print(get_count_common_divisor(max(a, b), divisor))

Submission status: Wrong Answer

Solution code:
import string
import collections
a_prime=[]
b_prime=[]
a,b = map(int, input().split())
def getPrime(a):
  prime=[]
  for i in range(2,int(a**0.5//1)+1):
    if a%i==0:
      while a%i == 0:
        a=a//i
      prime+=[i]
  if a!=1:
    prime.append(a)

  if prime==[]:
    prime.append(a)
  return prime
a_prime=getPrime(a)
b_prime=getPrime(b)
print(len(set(a_prime) & set(b_prime))+1)

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
def getPrime(a):
  prime=[]
  for i in range(2,int(min(a,b)**0.5)+1):
    if a%i == 0:
      for j in prime:
        if i%j == 0:
          break
      else:
        prime+=[i]
  return prime
a_prime=getPrime(a)
b_prime=getPrime(b)
print(len(set(a_prime) & set(b_prime))+1)

Submission status: Wrong Answer

Solution code:
import string
import collections
ans=[]
a,b = map(int, input().split())
for i in range(2, int(min(a,b)**0.5)+1):
  if max(a,b)%i == 0 and min(a,b)%i == 0:
    for j in ans:
      if i%j == 0:
        break
    else:
      ans+=[i]
print(len(ans)+1)

Submission status: Wrong Answer

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

if a > b:
    a, b = b, a

isPrime = [True] * (int(a**0.5) + 1)

isPrime[0] = False

#eratos
for i in range(2, len(isPrime)):
    if isPrime[i] is True:
        for j in range(i + i, len(isPrime), i):
            isPrime[j] = False

ans = 0
for i in range(1, len(isPrime)):
    if isPrime[i] is True and a % i == 0 and b % i == 0:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
def f(n):
    s = set()
    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
            s.add(i)

    if temp != 1:
        s.add(temp)

    if len(s) == 0:
        s.add(n)

    return s


A, B = map(int, input().split())
mini = min(A, B)
maxi = max(A, B)

ss = f(mini)

res = 1
for i in ss:
    if maxi % i == 0:
        res += 1

print(res)

Submission status: Wrong Answer

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

"""素因数分解"""
def factorization(n):
    array = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            array.append([i, cnt])

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

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

    return array

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

Submission status: Wrong Answer

Solution code:
from fractions import gcd  #  from python3.5, use math,gcd
from collections import defaultdict


def prime_factorization(x):
    res = defaultdict(int)
    n = 2
    while n**2 <= x:
        while x % n == 0:
            res[n] += 1
            x //= n
        n += 1
    if x != 1:
        res[x] += 1
    return res


def main():
    A, B = list(map(int, input().split(' ')))
    gcd_ab = gcd(A, B)
    pf = prime_factorization(gcd_ab)
    print(1 + len(pf.keys()))  # +1 for factor `1`
    print(prime_factorization(123))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

#素数
def primes(n):
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1, int(n**0.5)//3+1):
        if sieve[i]:
            k = 3*i+1|1
            sieve[k*k//3::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
            sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2, 3] + [3*i+1|1 for i in range(1, n//3-correction) if sieve[i]]

#素因数分解
from collections import defaultdict
primelist=primes(int(n**0.5+1))+[n+1]
factors=defaultdict(lambda :0)
for prime in primelist:
    if prime>n:
        factors[n]+=1
        break
    while n%prime==0:
        n=n//prime
        factors[prime]+=1
factors[n]=1
print(len(factors))

Submission status: Wrong Answer

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

#素数
def primes(n):
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1, int(n**0.5)//3+1):
        if sieve[i]:
            k = 3*i+1|1
            sieve[k*k//3::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
            sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2, 3] + [3*i+1|1 for i in range(1, n//3-correction) if sieve[i]]

#素因数分解
from collections import defaultdict
primelist=primes(int(n**0.5+1))+[n+1]
factors=defaultdict(lambda :0)
for prime in primelist:
    if prime>n:
        factors[n]+=1
        break
    while n%prime==0:
        n=n//prime
        factors[prime]+=1
print(len(factors))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
import collections
import itertools
import bisect
mod = 10 ** 9 + 7
a, b = list(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 list(arr)


a_fact = factorization(a)
b_fact = factorization(b)
ans = len(set(a_fact) & set(b_fact)) + 1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np


a,b = map(int,input().split())
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

lisa = prime_factorize(a)
lisb = prime_factorize(b)
lis = set(lisa) & set(lisb)
lis.add(1)
lis = sorted(list(lis))
devil = (max(a,b)/lis[-1])
if len(prime_factorize(devil)) == 1:
  if min(a,b) % devil == 0:
    lis.append(devil)
print(len(lis))

Submission status: Wrong Answer

Solution code:
import numpy as np


a,b = map(int,input().split())
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

lisa = prime_factorize(a)
lisb = prime_factorize(b)
lis = set(lisa) & set(lisb)
lis.add(1)
print(lis)
lis = sorted(list(lis))
devil = (max(a,b)/lis[-1])
if len(prime_factorize(devil)) == 1:
  if min(a,b) % devil == 0:
    lis.append(devil)
print(len(lis))

Submission status: Wrong Answer

Solution code:
import numpy as np


a,b = map(int,input().split())
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

lisa = prime_factorize(a)
lisb = prime_factorize(b)
lis = set(lisa) & set(lisb)
lis.add(1)
lis = list(lis)
devil = (max(a,b)/lis[-1])
if len(prime_factorize(devil)) == 1:
  if min(a,b) % devil == 0:
    lis.append(devil)
print(len(lis))

Submission status: Wrong Answer

Solution code:
import numpy as np


a,b = map(int,input().split())
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

lisa = prime_factorize(a)
lisb = prime_factorize(b)
lis = set(lisa) & set(lisb)
lis.add(1)
lis = list(lis)
if min(a,b) % (max(a,b)/lis[-1]) == 0:
  lis.append(max(a,b)/lis[-1])
print(len(lis))

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(max(x1,x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+1)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
if a == b:
  lis.append(a//lis[-1])
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
print(len(s))

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(max(x1,x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+1)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
lis.append(a//lis[-1])
lis.append(b//lis[-1])
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
print(len(s))

Submission status: Wrong Answer

Solution code:
import numpy as np
import fractions

a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(max(x1,x2))+2)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+2)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
s.add(fractions.gcd(a,b))
print(len(s))

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(max(x1,x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+1)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
print(len(s))

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b = map(int,input().split())
def cf(x1,x2):
    cf = []
    for i in range(1,int(np.sqrt(min(x1,x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def prime(num):
  for p in range(2, int(np.sqrt(num)+1)):
    if num % p == 0:
      return False
  return True

lis = cf(a,b)
for k,l in enumerate(lis):
  if prime(l) == False:
    lis[k] = -1
s = set(lis) - set([-1])
print(len(s))

Submission status: Wrong Answer

Solution code:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if DEBUG:
    print(ans)

print(len(ans))

Submission status: Wrong Answer

Solution code:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i < int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if DEBUG:
    print(ans)

print(len(ans))

Submission status: Wrong Answer

Solution code:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = True

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if g % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if DEBUG:
    print(ans)

print(len(ans))

Submission status: Wrong Answer

Solution code:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if g % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while g % i == 0:
        g //= i

    i += 1

if DEBUG:
    print(ans)

print(len(ans))

Submission status: Wrong Answer

Solution code:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

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

ans = [1]
for i in range(2, g+1):
    # print("i: {}".format(i))

    if A % i == 0 and B % i == 0:
        # print("This is a cd of A and B.")
        ans.append(i)

    while g % i == 0:
        g /= i

# print(set(ans))

print(len(set(ans)))

Submission status: Wrong Answer

Solution code:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

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

ans = [1]
for i in range(2, math.ceil(gcd(A, B)**0.5)+1):
    # print("i: {}".format(i))

    if A % i == 0 and B % i == 0:
        # print("This is a cd of A and B.")
        ans.append(i)

    while A % i == 0:
        A /= i
    while B % i == 0:
        B /= i

# print(set(ans))

print(len(set(ans)))

Submission status: Wrong Answer

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

ans = [1]
for i in range(2, int(min(A, B)**0.5)+1):
    # print("i: {}".format(i))
    
    if A % i == 0 and B % i == 0:
        # print("This is a cd of A and B.")
        ans.append(i)
        
    while A % i == 0:
        A /= i
    while B % i == 0:
        B /= i

# print(set(ans))

print(len(set(ans)))