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 number(a):
    MAX=int(a**0.5)+1
    l=[]
    for i in range(1,MAX):
        if(a%i==0):
            l.append(i)
            l.append(a//i)
    l=sorted(l)
    return l

def check(c,t):
    for i in c:
        if(t%i==0):
            if(i!=1):
                return False
    
    return True


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

listA=number(A)
listB=number(B)
a=0
b=0
c=[]
while(True):
    if(listA[a]==listB[b]):
        if(check(c,listA[a])):
            c.append(listA[a])
        a+=1
        b+=1
    elif(listA[a]>listB[b]):
        b+=1
    else:
        a+=1
    if(len(listA)==a or len(listB)==b):
        print(len(c))
        exit()

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from collections import Counter

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

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

if gcd(A,B) == 1:
    print(1)
else:
    print(prime_factorize(gcd(A,B)))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from collections import Counter

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

# 素因数分解
def prime_factorize(n):
    a = []
    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

if gcd(A,B) == 1:
    print(1)
else:
    print(len(Counter(prime_factorize(gcd(A,B))))+1)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
import fractions
import collections
import copy
def prime_factorization(n):
    a = [1]
    n1 = copy.deepcopy(n)
    while n % 2 == 0:
        n //= 2
    if n1 != n:
        a.append(2)
    f = 3
    while f * f <= n:
        if n % f == 0:
            n //= f
        else:
            f += 2
        if a[-1] != f:
            a.append(f)
    if a[-1] != n and n != 1:
        a.append(n)
    return a
print(len(prime_factorization(fractions.gcd(a,b))))

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
import fractions
import collections
import copy
def prime_factorization(n):
    a = [1]
    n1 = copy.deepcopy(n)
    while n % 2 == 0:
        n //= 2
    if n1 != n:
        a.append(2)
    f = 3
    while f * f <= n:
        n1 = copy.deepcopy(n)
        if n % f == 0:
            n //= f
        else:
            f += 2
        if a[-1] != f:
            a.append(f)
    if a[-1] != n:
        a.append(n)
    return a
print(len(prime_factorization(fractions.gcd(a,b))))

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
import fractions
import collections
import copy
def prime_factorization(n):
    a = []
    n1 = copy.deepcopy(n)
    while n % 2 == 0:
        n //= 2
    if n1 != n:
        a.append(2)
    f = 3
    while f * f <= n:
        n1 = copy.deepcopy(n)
        if n % f == 0:
            n //= f
        else:
            f += 2
        if n1 != n:
            a.append(f)
    if n != 1:
        a.append(n)
    return a

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

Submission status: Wrong Answer

Solution code:

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

divisor = []

for i in xrange(2, min(A,B)):
    if A % i == 0 and B % i == 0:
        divisor.append(i)
        A /= i
        B /= i
        while (A%i == 0) or (B%i == 0):
            A /= i
            B /= i
    
print len(divisor)

Submission status: Wrong Answer

Solution code:

import fractions

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

a,b=map(int,input().split())
g=fractions.gcd(a,b)
#print(g)
ans=1
i=2
while i*i<=g:
    if(g%i==0):
        ans+=1
        g/=i
    i=i+1
if(g!=1):ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def factrize(n):
    b = []
    while n % 2 == 0:
        if len(b) == 0:
            b.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if len(b) == 0 or b[-1] != f:
                b.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        b.append(n)
    return b

a, b = map(int, input().split())
d = gcd(a, b)
p = factrize(d)
print(len(p) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def factrize(n):
    b = []
    if n % 2 == 0:
        b.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if len(b) == 0 or b[-1] != f:
                b.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        b.append(n)
    return b

a, b = map(int, input().split())
d = gcd(a, b)
p = factrize(d)
print(len(p) + 1)

Submission status: Wrong Answer

Solution code:

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

def main():
    a,b = map(int,input().split())
    cnt = 1
    A = set()
    B = set()
    for i in range(2,int(a**0.5) + 2):
        if a%i == 0:
            A.add(i)
            A.add(a // i)
    for i in range(2,int(b**0.5) + 2):
        if b%i == 0:
            B.add(i)
            B.add(a // i)
    common = list(A & B)
    for i in common:
        if prime(i):
            cnt += 1
    print(cnt)
    return

main()

Submission status: Wrong Answer

Solution code:
import fractions
a,b = map(int,input().split())
longer = max(a,b)
lcm = fractions.gcd(a,b)
i = 1
ans = 1
while True:
  i += 1
  if i * i >= longer:
    break
  elif lcm == 1:
    break

  if lcm % i == 0:
    # print(i)
    ans += 1
    while lcm % i == 0:
      lcm //= i
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

def gcd(a, b):
    if a % b == 0 or b % a == 0:
        return min(a, b)
    else:
        if a // b >= b // a:
            c = abs(a - b * (a // b))
        else:
            c = abs(b - a * (b // a))
        d = min(a, b)
        return gcd(c, d)

gcd_ = gcd(a, b)
d = []
for i in range(2, max(4, int(math.sqrt(gcd_))+1)):
    if not gcd_ % i:
        d.extend([i, gcd_ // i])

d.sort()
if d != [] and d[0] == 1:
    del d[0]
ans = [1]

for i in d:
    for j in ans:
        if gcd(i, j) == 1 and j == ans[-1]:
            ans.append(i)
        elif gcd(i, j) != 1:
            break

print(len(ans))

Submission status: Wrong Answer

Solution code:
import math

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

def gcd(a, b):
    if a % b == 0 or b % a == 0:
        return min(a, b)
    else:
        if a // b >= b // a:
            c = abs(a - b * (a // b))
        else:
            c = abs(b - a * (b // a))
        d = min(a, b)
        return gcd(c, d)

gcd_ = gcd(a, b)
d = []
for i in range(2, int(math.sqrt(gcd_))+1):
    if not gcd_ % i:
        d.extend([i, gcd_ // i])

d.sort()
ans = [1]

for i in d:
    for j in ans:
        if gcd(i, j) == 1 and j == ans[-1]:
            ans.append(i)
        elif gcd(i, j) != 1:
            break

print(len(ans))

Submission status: Wrong Answer

Solution code:
#a,b = (int(i) for i in input().split())
def kouyaku(a,b):
    if a<b:
        temp = a
        a = b
        b = temp
    if b == 0:
        return a
    r = a%b
    if r == 0:
        return b
    else:
        return kouyaku(b,r)

if __name__ == "__main__":
    a,b = (int(i) for i in input().split())
    s = kouyaku(a,b)
    if s == 1:
        print(1)
        exit()
    ans = 1
    for i in range(2, s):
        if s == 1: break
        if s%i == 0:
            ans += 1
            while s%i == 0:
                s = s/i
    print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def sieve_eratosthenes(n):
  sieve = [True] * (n+1)
  sieve[0] = sieve[1] = False
  i = 2
  while i * i <= n:
    if sieve[i]:
      k = i*i
      while k <= n:
        sieve[k] = False
        k += i
    i += 1
  return filter(lambda x: sieve[x], range(n+1))

a, b = map(int, input().split())
g = gcd(a, b)
if g == 1:
  print(1)
else:
  cnt = 1
  for p in sieve_eratosthenes(int(g ** 0.5)):
    if g % p == 0:
      cnt += 1
  print(cnt)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
lst=set()
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(set([i[0] for i in factorization(A)])&set([i[0] for i in factorization(B)]))+1)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
lst=[]
for i in range(2,int(min(A,B)**.5+1)):
    if A%i==0 and B%i==0:
        flag=1
        for l in lst:
            if i%l==0:
                flag=0
                break
        if flag:
            lst.append(i)

lst+=[1]
#print(lst)
print(len(lst))

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())
lst=[]
for i in range(2,int(max(A,B)**.5+1)):
    if A%i==0 and B%i==0:
        flag=1
        for l in lst:
            if i%l==0:
                flag=0
                break
        if flag:
            lst.append(i)

lst+=[1]
#print(lst)
print(len(lst))

Submission status: Wrong Answer

Solution code:
#[素因数]の1次元リスト

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


L = list(map(int,input().split()))
A = max(L)
B = min(L)
S_A = factorize(A)
S_B = factorize(B)
count = 1

for _ in S_B:
	if _ in S_A:
		count += 1

if B != 1:
	if A % B == 0:
		count += 1

print(count)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import sqrt

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

L = []

if a < b: a,b = b,a
while b!=0:
    r = a%b
    a,b = b,r
    
G = a

for i in range(2,G+1):
    for j in L:
        if i%j==0: 
            break
        if G%i==0: 
            L.append(i)

print(len(L)+1)

Submission status: Wrong Answer

Solution code:
import fractions
import math
A,B=map(int, input().split())
n=fractions.gcd(A, B)
divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    lag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+1):
        if i%j==0 and i!=j:
          flag=1
          break
      if i != n // i :
        lag=0
        for j in range(2, int((n // i)**0.5)+1):
          if (n // i)%j==0 and i!=j:
            lag=1
            break
    if flag==0:
      divisors.append(i)
    if lag==0:
      divisors.append(n//i)
#flag=0
#print(divisors)
#for j in range(2, int(n**0.5)+1):
#    if n%j==0:
#     flag=1
 #     break
#if flag==0:
 #     divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

Solution code:
import fractions
import math
A,B=map(int, input().split())
n=fractions.gcd(A, B)
divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    lag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+1):
        if i%j==0 and i!=j:
          flag=1
          break
      if i != n // i :
        lag=0
        for j in range(1, int((n // i)**0.5)+1):
          if (n // i)%j==0 and i!=j:
            lag=1
            break
    if flag==0:
      divisors.append(i)
    if lag==0:
      divisors.append(n//i)
#flag=0
#print(divisors)
#for j in range(2, int(n**0.5)+1):
#    if n%j==0:
#     flag=1
 #     break
#if flag==0:
 #     divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

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

divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    lag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+2):
        if i%j==0 and i!=j:
          flag=1
          break
      if i != n // i :
        lag=0
        for j in range(2, int((n // i)**0.5)+2):
          if (n // i)%j==0 and i!=j:
            lag=1
            break
    if flag==0:
      divisors.append(i)
    if lag==0:
      divisors.append(n//i)
#flag=0
#print(divisors)
#for j in range(2, int(n**0.5)+1):
#    if n%j==0:
#     flag=1
 #     break
#if flag==0:
 #     divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

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

divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    lag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+2):
        if i%j==0 and i!=j:
          flag=1
          break
      if i != n // i :
        lag=0
        for j in range(2, int((n // i)**0.5)+2):
          if (n // i)%j==0 and i!=j:
            lag=1
            break
    if flag==0:
      divisors.append(i)
    if lag==0:
      divisors.append(n//i)
flag=0
print(divisors)
#for j in range(2, int(n**0.5)+1):
#    if n%j==0:
#     flag=1
 #     break
#if flag==0:
 #     divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

Solution code:
import fractions
import math
#A,B=map(int, input().split())
#n=fractions.gcd(A, B)
n=65
divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    lag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+2):
        if i%j==0 and i!=j:
          flag=1
          break
      if i != n // i :
        lag=0
        for j in range(2, int((n // i)**0.5)+2):
          if (n // i)%j==0 and i!=j:
            lag=1
            break
    if flag==0:
      divisors.append(i)
    if lag==0:
      divisors.append(n//i)
# flag
#for j in range(2, int(n**0.5)+1):
#    if n%j==0:
#     flag=1
 #     break
#if flag==0:
 #     divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

Solution code:
import fractions
import math
A,B=map(int, input().split())
n=fractions.gcd(A, B)
divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    lag=-1
    if n % i == 0:
      flag=0
      lag=0
      for j in range(2, int(i**0.5)+2):
        if i%j==0 and i!=j:
          flag=1
          break
      if i != n // i :
        for j in range(2, int(n // i**0.5)+2):
          if i%j==0 and i!=j:
            lag=1
            break
    if flag==0:
      divisors.append(i)
    if lag==0:
        divisors.append(n//i)
flag=0
for j in range(2, int(n**0.5)+1):
    if n%j==0:
      flag=1
      break
if flag==0:
      divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

Solution code:
import fractions
import math
A,B=map(int, input().split())
n=fractions.gcd(A, B)
divisors = []
for i in range(1, int(n**0.5)+2):
    flag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+2):
        if i%j==0 and i!=j:
          flag=1
          break
    if flag==0:
      divisors.append(i)
      #if i != n // i :
      #  divisors.append(n//i)
flag=0
for j in range(2, int(n**0.5)+1):
    if n%j==0:
      flag=1
      break
if flag==0:
      divisors.append(n)
print(len(divisors))

Submission status: Wrong Answer

Solution code:
import fractions
import math
A,B=map(int, input().split())
n=fractions.gcd(A, B)
divisors = []
for i in range(1, int(n**0.5)+1):
    flag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+1):
        if i%j==0 and i!=j:
          flag=1
          break
    if flag==0:
      divisors.append(i)
      #if i != n // i :
      #  divisors.append(n//i)
flag=0
for j in range(2, int(n**0.5)+1):
    if n%j==0:
      flag=1
      break
if flag==0:
      divisors.append(n)
print(len(divisors)+1)

Submission status: Wrong Answer

Solution code:
import fractions
import math
A,B=map(int, input().split())
n=fractions.gcd(A, B)
divisors = []
for i in range(1, int(n**0.5)+1):
    flag=-1
    if n % i == 0:
      flag=0
      for j in range(2, int(i**0.5)+1):
        if i%j==0 and i!=j:
          flag=1
          break
    if flag==0:
      divisors.append(i)
      #if i != n // i :
      #  divisors.append(n//i)
flag=0
for j in range(1, int(n**0.5)+1):
    if n%j==0:
      flag=1
      break
if flag==0:
      divisors.append(n)
print(len(divisors)+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, cnt])

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

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

    return arr

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

a = factorization(A)
b = factorization(B)
check = 1
for i in range(0,len(a)):
    for j in range(0,len(b)):
        if a[i][0] == b[j][0]:
            check += 1
print(check)

Submission status: Wrong Answer

Solution code:
#互除法により最大公約数を出力
def gcd(x,y):
    while y != 0:
        x , y = y , x % y
    return x

#素因数分解
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

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

Z = gcd(A,B)
#print(Z)

I = factorization(Z)
L = len(I)
ans = L
if ans != 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
# 2019-11-18 23:58:23(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def primeFactorize(n):
    from math import floor, sqrt
    res = set()
    before = n
    while n % 2 == 0:
        n //= 2
    if n < before:
        res.add(2)
    for i in range(3, floor(sqrt(n))+1, 2):
        before = n
        while n % i == 0:
            n //= i
        if n < before:
            res.add(i)
        if n == 1:
            return res
    res.add(n)
    return res

def main():
    a, b = [int(x) for x in sys.stdin.readline().split()]
    ans = len(primeFactorize(a) & primeFactorize(b)) + 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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

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

F=factorization(k)
if len(F)!=1:
  print(len(F)+1)
else:
  print(1)

Submission status: Wrong Answer

Solution code:
import math


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


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


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


a, b = map(int, input().split())
d_a = set(make_divisors(a))
d_b = set(make_divisors(b))
matched_list = list(d_a & d_b)


count = 0

for i in matched_list:
    if is_prime(i):
        count += 1

print(count+1)

Submission status: Wrong Answer

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

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

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

    return arr
aa,bb=factorization(a),factorization(b)
print(aa,bb)
cnt=0
for i in aa:
  if i in bb:
    cnt+=1
if a==1 and b==1:
  print(1)
else:
  print(cnt+1)

Submission status: Wrong Answer

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

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

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

    return arr
aa,bb=factorization(a),factorization(b)

cnt=0
for i in aa:
  if i in bb:
    cnt+=1
print(cnt+1)

Submission status: Wrong Answer

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

n = [1]
while a % 2 == 0 and b % 2 == 0:
    n.append(2)
    a //= 2
    b //= 2

f = 3

while f * f <= a or f * f <= b:
    if a % f == 0 and b % f ==0:
        n.append(f)
        a //= f
        b //= f
    else:
        f += 2

print(len(set(n)))

Submission status: Wrong Answer

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

def factorize(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i not in factors:
                factors.append(i)
    if n > 1:
        factors.append(n)
    return factors


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

g = gcd(a, b)
ans = factorize(g)

print(len(ans) + 1)

Submission status: Wrong Answer

Solution code:
import fractions

def factor(x):
  t = x
  p = [1]
  for i in range(2, -int(-x**0.5//1)+1):
    if x % i == 0:
      p += [i]
      while x % i == 0:
        x /= i
  if len(p) == 1 and t != 1:
    p += [t]
  return p

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


A, B = list(map(int, input().split()))
d = fractions.gcd(A, B)
#p = factor(d)
p = factorization(d)
print(len(p) + 0 if p[0][0] == 1 else 1)

Submission status: Wrong Answer

Solution code:
import fractions

def factor(x):
  t = x
  p = [1]
  for i in range(2, -int(-x**0.5//1)+1):
    if x % i == 0:
      p += [i]
      while x % i == 0:
        x /= i
  if len(p) == 1 and t != 1:
    p += [t]
  return p

A, B = list(map(int, input().split()))
d = fractions.gcd(A, B)
p = factor(d)
print(len(p))

Submission status: Wrong Answer

Solution code:
import fractions

def factor(x):
  t = x
  p = [1]
  for i in range(2, -int(-x**0.5//1)+1):
    if x % i == 0:
      p += [i]
      while x % i == 0:
        x /= i
  if len(p) == 1:
    p += [t]
  return p

A, B = list(map(int, input().split()))
d = fractions.gcd(A, B)
p = factor(d)
print(len(p))

Submission status: Wrong Answer

Solution code:
import fractions

def factor(x):
  p = [1]
  for i in range(2, -int(-x**0.5//1)+1):
    if x % i == 0:
      p += [i]
      while x % i == 0:
        x /= i
  return p

A, B = list(map(int, input().split()))
d = fractions.gcd(A, B)
p = factor(d)
print(len(p))

Submission status: Wrong Answer

Solution code:
import fractions

def factorize(n):
    fct = [1]  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while not n % b:
            n //= b
        fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return fct
  
a,b = map(int, input().split())
GCD = fractions.gcd(a,b)
print(len(factorize(GCD)))

Submission status: Wrong Answer

Solution code:
import fractions

def factorize(n):
    fct = set([1])  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n //= b
        fct.add(b)
        b += 1
    if n > 1:
        fct.add(n)
    return fct
  
a,b = map(int, input().split())
GCD = fractions.gcd(a,b)
print(len(factorize(GCD)))

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

x = gcd(A,B)
y = factorization(x)
if len(y) == 1:
	print(1)
else:
	print(len(y)+1)

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

x = gcd(A,B)
y = factorization(x)
print(len(y)+1)

Submission status: Wrong Answer

Solution code:
import math
A,B = map(int, input().split())
while True:
  if A < B:
    tmp = A
    A = B
    B = tmp
  if A%B == 0:
    C = B
    break
  else:
    A = A%B
    
counter = 1

def isPrime(n):
  if n == 2:
    return True
  whileFin = n
  i = 2
  while True:
    if i > whileFin:
      return True
    if n%i == 0:
      return False
    else:
      whileFin = math.ceil((n)/(i+1))
    i += 1

i = 2
whileFin = C
while True:
  if i > whileFin:
    break
  if C%i == 0:
    if isPrime(i):
      counter += 1
    if isPrime(C/i):
      counter += 1
    whileFin = math.ceil(C/(i+1))
  i += 1
 
print(counter)

Submission status: Wrong Answer

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

def isPrime(n):
  if n == 2:
    return True
  whileFin = n
  i = 2
  while True:
    if i > whileFin:
      return True
    if n%i == 0:
      return False
    else:
      whileFin = int((n)/(i+1)) + 1
    i += 1

i = 2
whileFin = C
while True:
  if i > whileFin:
    break
  if C%i == 0:
    if isPrime(i):
      counter += 1
    if isPrime(C/i):
      counter += 1
    whileFin = int(C/(i+1)) + 1
  i += 1
 
print(counter)

Submission status: Wrong Answer

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

i = 1
whileFinN = C
while True:
  if i>whileFinN:
    break
  if C%(i+1) == 0:
    k = i+1
    j = 2
    whileFin = k
    while True:
      if j > whileFin or k == 2:
        counter += 1
        break
      if (k)%j == 0:
        break
      else:
        whileFin = int((k)/(j+1)) + 1
      j += 1
    k = C/(i+1)
    j = 2
    whileFinN = k
    while True:
      if j > whileFin or k == 2:
        counter += 1
        break
      if (k)%j == 0:
        break
      else:
        whileFin = int((k)/(j+1)) + 1
      j += 1
  i+= 1
  

print(counter)

Submission status: Wrong Answer

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

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

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

count = 1
num = gcd(A, B)
cur = 2
while num != 1:
    if isPrime(cur):
        while num % cur == 0:
            num //= cur
        count += 1
    cur += 1

print(count)

Submission status: Wrong Answer

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

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[i] = cnt

    if temp!=1:
        arr[temp] = 1

    if arr == {} :
        arr[n] =  1
    if not 1 in arr:
      arr[1] = 1
    return arr

A, B = map(int,input().split())
g = gcd(A,B)
fac = factorization(g)
count = 0
for i in fac:
  count += fac[i]
print(count)

Submission status: Wrong Answer

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

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[i] = cnt

    if temp!=1:
        arr[temp] = 1

    if arr == {} :
        arr[n] =  1

    return arr

A, B = map(int,input().split())
g = gcd(A,B)
fac = factorization(g)
count = 0
for i in fac:
  count += fac[i]
print(count)

Submission status: Wrong Answer

Solution code:
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)

    for x in range(3,end,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    if k != 1:
        a.append(k)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))

Submission status: Wrong Answer

Solution code:
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)

    for x in range(3,k+1,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))