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=1
for i in range(2,int(max(a**.5,b**.5))+2):
    if a%i==0==b%i:
        c+=1
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i
if a%b==0 or b%a==0:
    c+=1
print(c)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
c=1
for i in range(2,int(max(a**.5,b**.5))+2):
    if a%i==0==b%i:
        c+=1
        print(i,a,b)
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i
if a%b==0 or b%a==0:
    c+=1
print(c)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
c=1
for i in range(2,int(min(a**.5,b**.5))+2):
    if a%i==0 and b%i==0:
        c+=1
        print(i,a,b)
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i    
print(c)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
from fractions import *
c=gcd(a,b)
d=0
for i in range(1,c+1):
    if c%i==0:
        c//=i
        d+=+1
print(d)

Submission status: Wrong Answer

Solution code:
a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

ans = 0
for i in range(2,100000000):
  if temp % i == 0:
    ans += 1
    while temp % i == 0:
      temp = temp // i
  if temp == 1:
    break

print(ans+1)

Submission status: Wrong Answer

Solution code:
a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

ans = 0
for i in range(2,10000000):
  if temp % i == 0:
    ans += 1
    while temp % i == 0:
      temp = temp // i
  if temp == 1:
    break

print(ans+1)

Submission status: Wrong Answer

Solution code:
a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

primes = [2]
def is_prime(p):
  for i in range(len(primes)):
    if p % primes[i] == 0:
      return False
    if primes[i] * primes[i] >= p:
      break
  return True

for p in range(3, 500009, 2):
  if is_prime(p):
    primes.append(p)
ans = 0
for p in primes:
  if temp % p == 0:
    ans += 1
print(ans+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num /= i
            factorize_list.append([i, count])
        i += 1
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num)) + 1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
import math

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


def cf(x1, x2):
    cnt = 1
    for i in range(2, int(math.sqrt(min(x1, x2)))+1):
        if x1 % i == 0 and x2 % i == 0:
            if is_prime(i):
                cnt += 1
    return cnt

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

print(ans)

Submission status: Wrong Answer

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


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


a_s = set(make_divisors(a))
b_s = set(make_divisors(b))
tmp_l = list(a_s & b_s)


def isPrime(n):
    if n < 2:
        # 2未満は素数でない
        return False
    if n == 2:
        # 2は素数
        return True
    aa = tmp_l[:tmp_l.index(i)]
    for p in aa:
        if p == 1:
            continue
        if n % p == 0:
            # nまでの数で割り切れたら素数ではない
            return False
    # nまでの数で割り切れなかったら素数
    return True


cnt = 0
for i in tmp_l:
    if isPrime(i):
        cnt += 1

print(cnt + 1)

Submission status: Wrong Answer

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


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


a_s = set(make_divisors(a))
b_s = set(make_divisors(b))
tmp_l = list(a_s & b_s)


def isPrime(n):
    if n < 2:
        # 2未満は素数でない
        return False
    if n == 2:
        # 2は素数
        return True
    aa = tmp_l[1:tmp_l.index(i)]
    for p in aa:
        if n % p == 0:
            # nまでの数で割り切れたら素数ではない
            return False
    # nまでの数で割り切れなかったら素数
    return True


cnt = 0
for i in tmp_l:
    if isPrime(i):
        cnt += 1

print(cnt + 1)

Submission status: Wrong Answer

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


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


a_s = set(make_divisors(a))
b_s = set(make_divisors(b))
tmp_l = list(a_s & b_s)

cnt = 0
for i in tmp_l:
    aa = tmp_l[1:tmp_l.index(i)]
    judge = True
    for j in aa:
        if j == 1:
            continue

        if i % j == 0:
            judge = False
            break

    if judge:

        cnt += 1
print(cnt)

Submission status: Wrong Answer

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


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


a_s = make_divisors(a)
b_s = make_divisors(b)

tmp = set(a_s + b_s)


def isPrime(n):
    if n < 2:
        # 2未満は素数でない
        return False
    if n == 2:
        # 2は素数
        return True
    for p in range(2, n):
        if n % p == 0:
            # nまでの数で割り切れたら素数ではない
            return False
    # nまでの数で割り切れなかったら素数
    return True


cnt = 0
for i in tmp:
    if isPrime(i):
        cnt += 1

print(cnt + 1)

Submission status: Wrong Answer

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

def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True

if b > a:
    a, b = b, a
c = []
vals = []
for i in range(1, int(math.sqrt(b))+1):
    if a%i == 0 and b%i == 0:
        if is_prime(i):
            c.append(i)
        k = b//i
        if a%k == 0:
            if is_prime(k):
                c.append(k)
print(len(set(c))+1)

Submission status: Wrong Answer

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

def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True

if b > a:
    a, b = b, a
c = []
for i in range(1, int(math.sqrt(b))+1):
    if a%i == 0 and b%i == 0:
        if is_prime(i):
            c.append(i)
        k = b//i
        if a%k == 0:
            if is_prime(k):
                c.append(k)
print(len(c)+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

gcd=gcd(a,b)
ab_gcd=gcd

f=[]
for i in range(2,int(ab_gcd**0.5)+2):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)

print(len(set(f))+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

gcd=gcd(a,b)
ab_gcd=gcd

f=[]
for i in range(2,int(ab_gcd**0.5)+1):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)
        break
print(len(set(f))+1)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

gcd=gcd(a,b)

f=[]
for i in range(2,int(gcd**0.5)+1):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)
        break
print(len(set(f))+1)

Submission status: Wrong Answer

Solution code:
def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, n):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return 0
  # nまでの数で割り切れなかったら素数
  return 1


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


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

def main():
    a, b = map(int, input().split())
    g = gcd(a, b)
    d = divisor(g)
    print(d)
    cnt = 0
    for num in d:
        cnt += isPrime(num)
    print(cnt + 1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def is_prime(n):
    if n == 1:
        return False

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

    return True


def solve():
    A, B = map(int, input().split())

    ans = 1
    max_n = int(math.sqrt(max(A, B))) + 1

    if A == B:
        if is_prime(A):
            ans += 1

    for n in range(2, max_n):
        if A == 1 or B == 1:
            break

        if A % n == 0 and B % n == 0:
            ans += 1

            while True:
                if A % n == 0 and B % n == 0:
                    A = A // n
                    B = B // n
                else:
                    break

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def is_prime(n):
    if n == 1:
        return False

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

    return True


def solve():
    A, B = map(int, input().split())

    ans = 1
    max_n = int(math.sqrt(min(A, B))) + 1

    if A == B:
        if is_prime(A):
            ans += 1

    for n in range(2, max_n):
        if A == 1 or B == 1:
            break

        if A % n == 0 and B % n == 0:
            ans += 1

            while True:
                if A % n == 0 and B % n == 0:
                    A = A // n
                    B = B // n
                else:
                    break

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def solve():
    A, B = map(int, input().split())

    ans = 1
    max_n = int(math.sqrt(max(A, B))) + 2
    for n in range(2, max_n):
        if A == 1 or B == 1:
            break

        if A % n == 0 and B % n == 0:
            ans += 1

            while True:
                if A % n == 0 and B % n == 0:
                    A = A // n
                    B = B // n
                else:
                    break

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def solve():
    A, B = map(int, input().split())

    ans = 1
    max_n = int(math.sqrt(min(A, B))) + 1
    for n in range(2, max_n + 1):
        if A == 1 or B == 1:
            break

        if A % n == 0 and B % n == 0:
            ans += 1

            while True:
                if A % n == 0 and B % n == 0:
                    A = A // n
                    B = B // n
                else:
                    break

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def solve():
    A, B = map(int, input().split())

    ans = 1
    max_n = int(math.sqrt(min(A, B))) + 1

    for n in range(2, max_n):
        if A == 1 or B == 1:
            break

        if A % n == 0 and B % n == 0:
            ans += 1

            while True:
                if A % n == 0 and B % n == 0:
                    A = A // n
                    B = B // n
                else:
                    break

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit


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


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


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

    g = gcd(a, b)

    ans = 1

    for i in range(2, int(g ** 0.5) + 1):
        if g % i == 0:
            if is_prime(i):
                ans += 1
            if is_prime(g // i) and i != g // i:
                ans += 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit


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


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


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

    g = gcd(a, b)

    ans = 1

    for i in range(2, int(g ** 0.5) + 1):
        if g % i == 0:
            if is_prime(i):
                ans += 1
            if is_prime(g // i):
                ans += 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Wrong Answer

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

a,b = list(map(int,input().split()))
c = gcd(a,b)
c0 = c
r = 2
lis = [1]
count = 1
while c != 1 and r <= int(pow(c0,0.5))+1:
    if c%r == 0:
        c = c//r
        lis.append(r)
        r = 2
    else:
        r += 1
d = list(set(lis))
print(len(d))

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, cnt])

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

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

    return arr

s = set([i for i,k in factorization(a)])
t = set([i for i,k in factorization(b)])
print(len(s&t)+1)

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
def prime_factorize(n):
    ans = 1
    flag = 0
    while n % 2 == 0:
        if flag == 0:
            ans += 1
            flag = 1
        n //= 2
    f = 3
    while f * f <= n:
        flag = 0
        if n % f == 0:
            if flag == 0:
                ans += 1
                flag = 1
            n //= f
        else:
            f += 2
    if n != 1:
        ans += 1
    return ans
print(prime_factorize(g))

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+2):
    while True:
        if g%i != 0:
            break
        else:
            g = g/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+2):
    while True:
        if g%i != 0:
            break
        else:
            g = g/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if b == a and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+2):
    while True:
        if g%i != 0:
            break
        else:
            g = g/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if g == a and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+1):
    while True:
        if g%i != 0:
            break
        else:
            g = g/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if g == a and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+1):
    while True:
        if a%i != 0 or b%i != 0:
            break
        else:
            a = a/i
            b = b/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if g == a and ans == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = [int(x) for x in input().split()]
ans = 1
flag = 0
m = min(a,b)
mama = int(m**(1/2))
for i in range(2,mama+1):
    while True:
        if a%i != 0 or b%i != 0:
            break
        else:
            a = a/i
            b = b/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt

a,b = map(int,input().split())
n = gcd(a,b)
k = n
s = set()
s.add(1)
for i in range(2,int(sqrt(n))+1):
  while n%i == 0:
    n = n//i
    s.add(i)
  if n == 1:
    break
  s.add(n)
if len(s) == 1 and k != 1:
  print(len(s)+1)
else:
  print(len(s))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt

a,b = map(int,input().split())
n = gcd(a,b)
k = n
s = set()
s.add(1)
for i in range(2,int(sqrt(n))+10**7):
  while n%i == 0:
    n = n//i
    s.add(i)
  if n == 1:
    break
if len(s) == 1 and k != 1:
  print(len(s)+1)
else:
  print(len(s))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt

a,b = map(int,input().split())
n = gcd(a,b)
k = n
s = set()
s.add(1)
for i in range(2,int(sqrt(n))+10**6):
  while n%i == 0:
    n = n//i
    s.add(i)
  if n == 1:
    break
if len(s) == 1 and k != 1:
  print(len(s)+1)
else:
  print(len(s))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt

a,b = map(int,input().split())
n = gcd(a,b)
k = n
s = set()
s.add(1)
for i in range(2,int(sqrt(n))+10**5):
  while n%i == 0:
    n = n//i
    s.add(i)
  if n == 1:
    break
if len(s) == 1 and k != 1:
  print(len(s)+1)
else:
  print(len(s))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt

a,b = map(int,input().split())
n = gcd(a,b)
k = n
s = set()
s.add(1)
for i in range(2,int(sqrt(n))+2):
  while n%i == 0:
    n = n//i
    s.add(i)
  if n == 1:
    break
if len(s) == 1 and k != 1:
  print(len(s)+1)
else:
  print(len(s))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from math import sqrt

a,b = map(int,input().split())
n = gcd(a,b)
k = n
s = set()
s.add(1)
for i in range(2,int(sqrt(n))+1):
  while n%i == 0:
    n = n//i
    s.add(i)
  if n == 1:
    break
if len(s) == 1 and k != 1:
  print(len(s)+1)
else:
  print(len(s))

Submission status: Wrong Answer

Solution code:
from fractions import gcd

a,b = map(int,input().split())
n = gcd(a,b)
ans = 1
for i in range(2,n):
  if n%i == 0:
    ans += 1
  while n%i == 0:
    n = n//i
  if n == 1:
    break
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

Submission status: Wrong Answer

Solution code:
def f(n):
    res = {1}
    for i in range(2, int(n ** .5) + 5):
        if n == 1:
            break
        c = 0
        while n % i == 0:
            c += 1
            n = n // i
        if c > 0:
            res.add(i)
    return res


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

    ans = len(x & y)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def f(n):
    res = set()
    for i in range(2, int(n ** .5) + 5):
        if n == 1:
            break
        c = 0
        while n % i == 0:
            c += 1
            n = n // i
        if c > 0:
            res.add(i)
    return res


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

    ans = len(x & y) + 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def f(n):
    res = set()
    for i in range(2, int(n ** .5) + 1):
        if n == 1:
            break
        c = 0
        while n % i == 0:
            c += 1
            n = n // i
        if c > 0:
            res.add(i)
    return res


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

    ans = len(x & y) + 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
a,b=map(int,input().split())
ans=0
for i in range(1,int(math.sqrt(min(a,b)))+1):
  c=0
  cc=0
  if a%i==0 and b%i==0:
    for j in range(2,int(math.sqrt(i))+1):
      if i%j==0:
        c=1
    if c==0:
      ans+=1
    if i!=(min(a,b)//i):
      for k in range(2,int(math.sqrt(min(a,b)//i))+1):
        if (min(a,b)//i)%k==0:
          cc=1
          break
      if cc==0:
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
a,b=map(int,input().split())
cnt=0
for i in range(1,int(math.sqrt(min(a,b)))+1):
  k=0
  if a%i==0 and b%i==0:
    for j in range(2,int(math.sqrt(i))+1):
      if i%j==0:
        k=1
    if k==0:
      cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
def c(n):
    b = 2
    f = set()
    while b * b <= n:
        while n % b == 0:
            n //= b
            f |= {b}
        b += 1
    if n > 1:
        f |= {n}
    return f
a, b = map(int, input().split())
print(len(c(a) & c(b)))

Submission status: Wrong Answer

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

from fractions import gcd

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

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

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

    return arr

print(len(factorization(gcd(A,B)))+1)

Submission status: Wrong Answer

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

g = fractions.gcd(a, b)
gs = [1]

f = 2
if g % 2 == 0:
  gs.append(2)
while g % 2 == 0:
  print(g)
  g = g // 2
f = 3
while f * f <= g:
  if g % f == 0:
    gs.append(f)
  while g % f == 0:
    g = g // f
  f += 2
if g != 1:
  gs.append(g)
print(len(gs))

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
def prime(x):
    i = 2
    while i<=x**0.5:
        if x%i==0:
            return False
        i+=1
    return True
i=2
ans = 1
while i<=max(a**0.5,b**0.5):
    if a%i==0 and b%i==0 and prime(i):
        ans += 1
    i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
def prime(x):
    i = 2
    while i<=x**0.5:
        if x%i==0:
            return False
        i+=1
    return True
i=2
ans = 1
while i<=min(a**0.5,b**0.5):
    if a%i==0 and b%i==0 and prime(i):
        ans += 1
    i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
def prime(x):
    i = 2
    while i<=x**0.5:
        if x%i==0:
            return False
        i+=1
    return True
i=2
ans = 1
while i<min(a**0.5,b**0.5):
    if a%i==0 and b%i==0 and prime(i):
        ans += 1
    i+=1
print(ans)

Submission status: Wrong Answer

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

for i in range(2,int(math.sqrt(A)+1)):
    while A % i ==0:
        A //= i
        if i not in Anum:
            Anum.append(i)
Anum.append(A)

for i in range(2,int(math.sqrt(B)+1)):
    while B % i ==0:
        B //= i
        if i not in Bnum:
            Bnum.append(i)
Bnum.append(B)

ABnum=set(Anum) & set(Bnum)
if len(ABnum) == 0:
    print(1)
else:
    print(len(ABnum))

Submission status: Wrong Answer

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

for i in range(2,int(math.sqrt(A)+1)):
    while A % i ==0:
        A //= i
        if i not in Anum:
            Anum.append(i)
Anum.append(A)

for i in range(2,int(math.sqrt(B)+1)):
    while B % i ==0:
        B //= i
        if i not in Bnum:
            Bnum.append(i)
Bnum.append(B)

ABnum=set(Anum) & set(Bnum)
if len(ABnum) == 0:
    print(0)
else:
    print(len(ABnum)+1)

Submission status: Wrong Answer

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

for i in range(2,int(math.sqrt(A)+1)):
    while A % i ==0:
        A //= i
        if i not in Anum:
            Anum.append(i)
Anum.append(A)
for i in range(2,int(math.sqrt(B)+1)):
    while B % i ==0:
        B //= i
        if i not in Bnum:
            Bnum.append(i)
Anum.append(B)



ABnum=set(Anum) & set(Bnum)
print(len(ABnum)+1)

Submission status: Wrong Answer

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

for i in range(2,int(math.sqrt(A)+1)):
    while A % i ==0:
        A //= i
        if i not in Anum:
            Anum.append(i)
for i in range(2,int(math.sqrt(B)+1)):
    while B % i ==0:
        B //= i
        if i not in Bnum:
            Bnum.append(i)
ABnum=set(Anum) | set(Bnum)
print(len(ABnum)+1)

Submission status: Wrong Answer

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

for i in range(2,int(math.sqrt(A)+1)):
    while A % i ==0:
        A //= i
        if i not in Anum:
            Anum.append(i)
for i in range(2,int(math.sqrt(B)+1)):
    while B % i ==0:
        B //= i
        if i not in Bnum:
            Bnum.append(i)
ABnum=len(set(Anum) & set(Bnum))
print(ABnum+1)

Submission status: Wrong Answer

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

#from math import gcd
from fractions import gcd

def get_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: # NNが平方数のときに√Nを2個出力しないようにする
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def get_primes(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes = list(primes)
    
    return primes

g = gcd(a,b)
primes = get_primes(g)
ans = 1 # 1は素数ではないが答えには入る

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

Submission status: Wrong Answer

Solution code:
def factorization(n,m):
    temp = n
    temp2 = m
    cnt=1
    for i in range(2, int(-(-min(n,m)**0.5//1))+1):
        if temp%i==0:
            if temp2%i == 0:
                cnt += 1
                while temp2%i==0:
                    temp2 //= i
            while temp%i==0:
                temp //= i
        elif temp2%i == 0:
            while temp2%i==0:
                temp2 //= i

    return cnt

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

Submission status: Wrong Answer

Solution code:
def factorization(n,m):
    temp = n
    temp2 = m
    cnt=1
    for i in range(2, int(-(-min(n,m)**0.5//1))+1):
        if temp%i==0:
            if temp2%i == 0:
                cnt += 1
                while temp2%i==0:
                    temp2 //= i
            while temp%i==0:
                temp //= i
        elif temp2%i == 0:
            while temp2%i==0:
                temp2 //= i

    if temp != 1 and temp2 != 2:
        if max(temp, temp2) % min(temp, temp2) == 0: cnt += 1

    return cnt

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

Submission status: Wrong Answer

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

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

    # divisors.sort()
    return divisors
L = make_divisors(a)
cv=[]
for i in range(len(L)):
	if b % L[i] == 0:
		cv.append(L[i])
cnt=1
cv=set(cv)

for d in cv:
	if d<=1:
		pass
	for i in range(2, int(d**0.5)+1):
		f=0
		if d%i==0:
			f+=1
		if f==0:
			cnt+=1

print(cnt)

Submission status: Wrong Answer

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

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

    # divisors.sort()
    return divisors
L = make_divisors(a)
cv=[]
for i in range(len(L)):
	if b % L[i] == 0:
		cv.append(L[i])
cnt=1
cv=set(cv)
for d in cv:
	if d<=1:
		break
	for i in range(2, int(d**0.5)+1):
		f=0
		if d%i==0:
			f+=1
		if f==0:
			cnt+=1

print(cnt)