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):
C,D = [int(e) for e in input().split()]
if C <= D:
    m = D
    n = C
else:
    m = C
    n = D
while  n != 0 :
    a = m%n
    m = n
    n = a
J = []
for i in range(1,int(m**0.5)+1):　
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)
J.sort()
#N = int(len(J))
count = 1
#I = []
for j in J:　　　
    cnt = 0
    for p in range(1,int(j**0.5)+1):
        if j%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if cnt == 1:
        count += 1
print(count)

C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []
for i in range(1, int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]
I = []

for i in range(1,N):
    for p in range(1,int(J[i]**0.5)+1:
        if J[i]%p == 0:
            I.extend([J[i]])
    if int(len(I)) == 1:
        M.extend([J[i]])
    I = []


M = int(len(M))

print(M)

C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]

for i in range(1,N):
   cnt = 0
   for p in range(1,int(J[i]**0.5)+1):
       if J[i]%p == 0:
           cnt += 1
           if cnt >=2:
               break
    if cnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]

for i in range(1,N):
    cnt = 0
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if icnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]
I = []

for i in range(1,N):
   cnt = 0
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if cnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []
for i in range(1, int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
print(J)
M = [1]
I = []

for i in range(1,N):
    for p in range(1,J[i]+1):
        if J[i]%p == 0:
            I.extend([J[i]])
    if int(len(I)) == 2:
        M.extend([J[i]])
    I = []


M = int(len(M))

print(M)

C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]

for i in range(1,N):
    cnt = 0
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if cnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted