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):
mport math 

A, B = [int(item) for item in input().split()]

def gdc(A, B):

    while A > 0:
        A, B = B % A, A
    return B

def chk_pn(num):

    flag = True
    if num  <= 3:
        pass

    else:    
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = False
                break
    return flag


def mk_factor(num):

    max_divisor = int(math.sqrt(num))+1
    divisor = 2
    factor_list = [1]

    while divisor <= max_divisor:
        if num % divisor == 0:
            factor_list.append(divisor)
            num /= divisor
        else:
            divisor += 1
    
    return factor_list

GDC = gdc(A, B)
pn_factor = [i for i in mk_factor(GDC) if chk_pn(i) is True]
# print(pn_factor)
print(len(set(pn_factor)))

 以下ペースト可
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c



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


prime_devisor_list = [1]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

for i in range(3, gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        # i can be ans
        

        if is_prime(i):
            prime_devisor_list.append(i)


print(len(prime_devisor_list))


# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c



import math
def factor(num):
    divisor_list = []
    divisor = 2
    while num  > divisor :
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor
        else:
            divisor += 1
    return divisor_list


a_list = factor(a)
b_list = factor(b)

cd_list = []

for item in set(a_list):
    if item in set(b_list):
        cd_list.append(item)



cnt = 1
for i in cd_list:
    prime_flag = True

    if i in [1, 2]:
        pass
    else:
        for k in range(2, int(math.sqrt(i) +1)):
            if i % k == 0:
                prime_flag = False
                break

    if prime_flag:
        cnt += 1



print(cnt)

import math 

A, B = [int(item) for item in input().split()]

def gdc(A, B):

    while A > 1:
        A, B = B, A % B
    return A

def chk_pn(num):

    flag = True
    if num  <= 3:
        pass

    else:    
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = False
                break
    return flag


def mk_factor(num):

    max_divisor = int(math.sqrt(num))+1
    divisor = 2
    factor_list = [1]

    while divisor <= max_divisor:
        if num % divisor == 0:
            factor_list.append(divisor)
            num /= divisor
        else:
            divisor += 1
    
    return factor_list

GDC = gdc(A, B)
pn_factor = [i for i in mk_factor(GDC) if chk_pn(i) is True]
# print(pn_factor)
print(len(set(pn_factor)))


# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c



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


prime_devisor_list = [1]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

GCD_num = gcd(a, b)

cnt = 0

for i in range(2, int(math.sqrt(GCD_num) +1)):
    prime_flag = True
    if i in [1, 2]:
        pass
    else:
        for k in range(2, int(math.sqrt(i) +1)):
            if i % k == 0:
                prime_flag = False
                break

    if prime_flag:
        cnt += 1



print(cnt)


# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c



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


prime_devisor_list = [1]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

for i in range(2, int(math.sqrt(gcd(a, b)))+1):
    if a % i == 0 and b % i == 0:
        # i can be ans
        

        if is_prime(i):
            prime_devisor_list.append(i)


print(len(prime_devisor_list))


# coding: utf-8
# Your code here!

list = [int(item) for item in input().split()]

if list[0] >= list[1]:
    a, b = list
else:
    a, b = list[::-1]


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


GCD_num = gcd(a, b)



import math
compos_list = []

for i in range(2, int(math.sqrt(GCD_num)) +2):
    if GCD_num % i == 0:
        compos_list.append(i)




cnt = 0

for i in compos_list:
    for k in compos_list:
        if i > k and gcd(i, k) == 1:
            cnt += 1
print(cnt)

 以下ペースト可
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c



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


prime_devisor_list = [1]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

for i in range(2, gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        # i can be ans
        

        if is_prime(i):
            prime_devisor_list.append(i)


print(len(prime_devisor_list))


# 

import sys
import os
f=open(r'.\D\D_input.txt', 'r', encoding="utf-8")



sys.stdin=f

#


# num_list = [int(item) for item in input().split()]
# num_list = [input() for _ in range(3)]
##################################
# 

# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c



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


prime_devisor_list = [1, 2]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

for i in range(3, gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        # i can be ans
        

        if is_prime(i):
            prime_devisor_list.append(i)


len(prime_devisor_list)


# 111
list = [int(item) for item in input().split()]

res_list = []
c=0

if list[0] >= list[1]:
    a = list[0]
    b = list[1]
else:
    a = list[1]
    b = list[0]
    
def gcd(a, b):
	while(b>0):
		a, b = b, a%b
	return a

GCD_num = gcd(a, b)

res_list = []
for i in range(1, GCD_num):
    if GCD_num % i == 0:
        res_list.append(i)

new_res = [1]

import math
ditect_base = int(math.sqrt(GCD_num))

for m in range(2, ditect_base):
    base_flag_cnt = 0
    for l in range(2, ditect_base+1):
        if m % l == 0:
            base_flag_cnt += 1
            if base_flag_cnt >= 2:
                break
    if base_flag_cnt <= 1:
        new_res.append(m)

print(len(new_res))


# 111
list = [int(item) for item in input().split()]

res_list = []
c=0

if list[0] >= list[1]:
    a = list[0]
    b = list[1]
else:
    a = list[1]
    b = list[0]
    
def gcd(a, b):
	while(b>0):
		a, b = b, a%b
	return a

GCD_num = gcd(a, b)

res_list = []
for i in range(1, GCD_num):
    if GCD_num % i == 0:
        res_list.append(i)

new_res = [1]

import math
ditect_base = int(math.sqrt(GCD_num))

for m in range(2, ditect_base):
    base_flag_cnt = 0
    for l in range(2, ditect_base+1):
        if m % l == 0:
            base_flag_cnt += 1
            if base_flag_cnt >= 2:
                break
    if base_flag_cnt <= 1:
        new_res.append(m)

print(new_res)
print(len(new_res))


import math 

A, B = [int(item) for item in input().split()]

def gdc(A, B):
    if B == 0:
        return A
    else:
        return gdc(B, A % B)

def chk_pn(num):

    flag = True
    if num  <= 3:
        pass

    else:    
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                flag = False
                break
    return flag


def mk_factor(num):

    max_divisor = int(math.sqrt(num))+1
    divisor = 2
    factor_list = [1]

    while divisor <= max_divisor:
        if num % divisor == 0:
            factor_list.append(divisor)
            num /= divisor
        else:
            divisor += 1
    
    factor_list.append(num)
    return factor_list

GDC = gdc(A, B)
pn_factor = [i for i in mk_factor(GDC) if chk_pn(i) is True]
# print(pn_factor)
print(len(set(pn_factor)))

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted