Problem: 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.

Submission attempts (in order):
A,B = input().split()
A,B = int(A),int(B)


min_ = min([A,B])
print(min_)
d = 2
cms = [1]
while(d<min_):
    if(A%d==0 and B%d==0):
        min_ /= d
        A /= d
        B /= d
        min_ = min([A,B])
        if(d not in cms):
            cms.append(d)
    else:
        d+=1
        
print(len(cms))


import collections
A,B = input().split()
A,B = int(A),int(B)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A = collections.Counter(prime_factorize(A)).keys()
B = collections.Counter(prime_factorize(B)).keys()


cms = []
for a in A:
    for b in B:
        if(a==b):
            cms.append(a)
print(len(cms))

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

lcm = 1
cms = []
for i in range(1,max([A,B])+1):
    if(A%i==0 and B%i==0):
        lcm = i
        cms.append(i)

print(len(cms))

A,B = input().split()
A,B = int(A),int(B)
import math

min_ = math.sqrt(min([A,B]))
d = 2
cms = [1]
while(d<=min_):
    if(A%d==0 and B%d==0):
        min_ /= d
        A /= d
        B /= d
        min_ = math.sqrt(min([A,B]))
        if(d not in cms):
            cms.append(d)
    else:
        d+=1
        
print(len(cms),cms)

A,B = input().split()
A,B = int(A),int(B)
import math

min_ = math.sqrt(min([A,B]))
d = 2
cms = [1]
while(d<=min_):
    if(A%d==0 and B%d==0):
        min_ /= d
        A /= d
        B /= d
        min_ = math.sqrt(min([A,B]))
        if(d not in cms):
            cms.append(d)
    else:
        d+=1
        
print(len(cms))


A,B = input().split()
A,B = int(A),int(B)
import math

min_ = math.sqrt(min([A,B]))
d = 2
cms = [1]
while(d<min_):
    if(A%d==0 and B%d==0):
        min_ /= d
        A /= d
        B /= d
        min_ = math.sqrt(min([A,B]))
        if(d not in cms):
            cms.append(d)
    else:
        d+=1
        
print(len(cms))

import collections
A,B = input().split()
A,B = int(A),int(B)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A = collections.Counter(prime_factorize(A)).keys()
B = collections.Counter(prime_factorize(B)).keys()


cms = []
for a in A:
    for b in B:
        if(a==b):
            cms.append(a)
print(len(cms)+1)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted