TnT/Multi_CodeNet4Repair huggingface dataset:
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):
import math


def main():
    a, b = map(int, input().split())
    gcd = math.gcd(a, b)
    ans = [1]
    while gcd % 2 == 0:
        ans.append(2)
        gcd = gcd // 2
    f = 3
    while f * f <= gcd:
        if gcd % f == 0:
            ans.append(f)
            gcd = gcd // f
        else:
            f += 2
        if gcd != 1:
            ans.append(gcd)
    print(len(set(ans)))


if __name__ == '__main__':
    main()


import fractions
a, b = map(int, input().split())
abMax = fractions.gcd(a, b)
gcdList = [1]
if fractions.gcd(a, b) % 2 == 0:
    gcdList.append(2)
for i in range(1, int((abMax+1)/2)):
    c = 2*i + 1
    if a % c == 0 and b % c == 0:
        swi = 0
        for k in gcdList:
            if fractions.gcd(k, c) != 1:
                swi = 1
                break
        if swi == 0:
            gcdList.append(c)

print(len(gcdList))


import math


def main():
    a, b = map(int, input().split())
    gcd = math.gcd(a, b)
    ans = [1]
    while gcd % 2 == 0:
        ans.append(2)
        gcd = gcd // 2
    f = 3
    while f * f <= gcd:
        if gcd % f == 0:
            ans.append(f)
            gcd = gcd // f
        else:
            f += 2
    if gcd != 1:
        ans.append(gcd)
    print(len(set(ans)))


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Time Limit Exceeded

Accepted
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 = map(int, input().split())


while b:
    a, b = b, a % b



if a == 1 :
    print(1)
    break

def factorization(a):
    arr = []
    temp = a
    for i in range(2, int(-(-a**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([a, 1])

    return arr

print(len(factorization(a) + 1))

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


while b:
    a, b = b, a % b



if a == 1 :
    print(1)
    exit

def factorization(a):
    arr = []
    temp = a
    for i in range(2, int(-(-a**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([a, 1])

    return arr

print(len(factorization(a) + 1))

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


while b:
    a, b = b, a % b



if a == 1 :
    print(1)
else :
    def factorization(a):
        arr = []
        temp = a
        for i in range(2, int(-(-a**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([a, 1])

        return arr

    print(int(len(factorization(a)) + 1))

Verdicts: Runtime Error

Runtime Error

Accepted
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 =[int(x) for x in input().split()]

def bunkai(n):
    sosu= {1}
    tmp = n

    for i in range(2,int(n/2)+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.add(i)

    if tmp!=1:
        sosu.add(tmp)
                
    if sosu==[]:
        sosu.add[n]
    
    return sosu

ans = len(bunkai(A)&bunkai(B))
print(ans)



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

def bunkai(n):
    sosu= {1}
    tmp = n
    
    if tmp%2 == 0:
        while tmp%2==0:
            tmp //=2
        sosu.add(2)
    
    for i in range(3,int(n**0.5)+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.add(i)
            
    if tmp!=1:
        sosu.add(tmp)
                
    if sosu==[1]:
        sosu.add(n)
    
    return sosu

def check_sosu(n,x):
    ans=0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans+=1
    return ans

ans = check_sosu(B,bunkai(A))

print(ans)

Verdicts: Wrong Answer

Accepted
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):
import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)


while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)


L = deque([1])
n = int(math.sqrt(gcd))+1
for i in range(2, n):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
    if gcd < i:
        break
L = set(L)
print(len(L))

import sys
from collections import deque
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)


while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)


L = deque([1])
n = int(math.sqrt(gcd))
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
L = set(L)
print(len(L))

import sys
from collections import deque

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)


while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)


L = deque([1])
n = int(gcd**0.5)
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
    if gcd < i:
        break
L = set(L)
print(len(L))

import sys
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)


while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)


L = [1]
n = int(math.sqrt(gcd))
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
if gcd>1:
    L.append(gcd)
L = set(L)
print(len(L))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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 = map(int, input().split())
m = max(a, b)
n = min(a, b)
c = 0
li = []

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

for i in range(1, m+1):
    if m % i == 0:
        li.append(i)
        m /= i
        
print(li)


a, b = map(int, input().split())
m, n = a, b
c = 0

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

li = [1]
for i in range(2, int(m ** 0.5)+1):
    while m % i == 0:
        m //= i
        li.append(i)
li.append(m)

print(len(set(li)))


Verdicts: Wrong Answer

Accepted
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):
from collections import deque
A, B = [int(x) for x in input().split()]

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

t = gcd(A, B)
l = deque([1])
sqrt_t = t ** 0.5 + 1
for  i in range(2, sqrt_t + 1):
  if t % i == 0:
    l.append(i)
    while t % i == 0:
      t //= i
print(len(set(l)))


from collections import deque
A, B = [int(x) for x in input().split()]

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

t = gcd(A, B)
l = deque([1])
sqrt_t = t ** 0.5 + 1
for  i in range(2, sqrt_t + 1):
  if t % i == 0:
    l.append(i)
    while t % i == 0:
      t //= i
  i += 1
print(len(set(l)))


from collections import deque
A, B = [int(x) for x in input().split()]

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

t = gcd(A, B)
l = deque([1])
sqrt_t = t ** 0.5 + 1
for i in range(2, sqrt_t + 1):
  if t % i == 0:
    l.append(i)
    while t % i == 0:
      t //= i
print(len(set(l)))


from collections import deque
A, B = [int(x) for x in input().split()]

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

t = gcd(A, B)
l = deque([1])
sqrt_t = int(t ** 0.5) + 1
for i in range(2, sqrt_t + 1):
  if t % i == 0:
    l.append(i)
    while t % i == 0:
      t //= i
      
l.append(t)
print(len(set(l)))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
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):
def fatora(n):
	ans = []
	for i in range(1, n+1):
		if i*i > n:
			break
		else:
			if n % i == 0:
				ans.append(i)
				ans.append(n//i)
	return set(ans)

def eh_primo(n):
	if n == 0:
		return False
	elif n == 1:
		return True
	elif n == 2:
		return True
	else:
		for i in range(2, n+10):
			if i*i > n:
				break
			else:
				if n % i == 0:
					return False
		return True



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

def fatora(n):
	ans = []
	for i in range(1, n+1):
		if i*i > n:
			break
		else:
			if n % i == 0:
				ans.append(i)
				ans.append(n//i)
	return set(ans)

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


def eh_primo(n):
	if n == 0:
		return False
	elif n == 1:
		return True
	elif n == 2:
		return True
	else:
		for i in range(2, n+10):
			if i*i > n:
				break
			else:
				if n % i == 0:
					return False
		return True



a, b = map(int, input().split())
print(len(list(filter(eh_primo, fatora(gcd(a, b))))))

Verdicts: Wrong Answer

Accepted
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 numpy as np
A, B = map(int, input().split())
while A%B > 0:
    c = A
    A = B
    B = c%B
P = [1]
if B%2 == 0:
    P.append(2)
for i in range(3, B//2 + 1, 2):
    if B%i == 0:
        P.append(i)
if B > 2:
    P.append(B)
    
l = len(P)
for i in range(2, l):
    if P[i] == 0:
        continue
    for j in range(i + 1, l):
        if P[j]%P[i] == 0:
            P[j] = 0
P = np.array(P)
print(np.where(P != 0)[0].size)

def gcd(x, y):
    
    while True:
        r = x%y
        if r == 0:
            break
        x = y
        y = r
    return y
    
def prime_factorize(x):
    
    res = []
    while x%2 == 0:
        res.append(2)
        x = x//2
    p = 3
    while p*p <= x:
        while x%p == 0:
            res.append(p)
            x = x//p
        p += 2
    if x != 1:
        res.append(x)
    return res


A, B = map(int, input().split())
print(len(set(prime_factorize(gcd(A, B)))) + 1)

Verdicts: Runtime Error

Accepted
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):
import math
A, B = map(int, input().split())

def is_prime(n):
    a = 0
    for k in range(1 + 1, int(math.sqrt(n)) + 1):
        if n % k == 0:
            a = 1
    if a == 1: return False
    else :return True

list = [1]
list.extend([i for i in range(1+1, min(A, B)+1) if A % i == 0 and B % i == 0 and A % i != 2 and B % i != 2 and A % i != 3 and B % i != 3])
print(list)
cnt = 0
for i in list:
    if is_prime(i) == True:
        cnt += 1
print(cnt)

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
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
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=map(int,input().split())

def get_cd(x1,x2):
    cd=[]
    for i in range(1,min(x1,x2)+1):
        if x1%i==0 and x2%i==0:
            cd.append(i)
    return cd

cd_AB=get_cd(A,B)

for j in range (0,len(cd_AB)-1):
    for k in range(j+1,len(cd_AB)):
            if(len(get_cd(cd_AB[j],cd_AB[k]))>1):
            cd_AB[k]=0

print(len(cd_AB)-cd_AB.count(0))

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        count=0
        while n % b == 0:
            n //= b
            count+=1
            if(count==1):
                fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

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

A,B=map(int,input().split())
g=gcd(A,B)
if(g==1):
    print("1")
else:
    print(len(factorize(g))+1)

Verdicts: Runtime Error

Accepted
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 = map(int,input().split())
yakusuu = []
ans = 1
for i in range (2,min(a,b)+1):
         if a % i == 0 and b% i == 0:
                  yakusuu.append(i)
for j in range(len(yakusuu)):
         for k in range(2,yakusuu[j]**(1/2)):
                  if yakusuu[j] % k == 0:
                           break
         else:
                  ans += 1
print(ans)


aa,bb = map(int,input().split())
n = min(aa,bb)
b = max(aa,bb)
ans = 1
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==[] and n != 1:
         arr.append(n)

for j in range(len(arr)):
         if b % arr[j] == 0:
                  ans += 1
print (ans)


Verdicts: Runtime Error

Accepted
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):
import fractions

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



n = fractions.gcd(A, B)

data = [i + 1 for i in range(1, n)]
ans = []

while data != []:
  p = data[0]
  if A % p == 0 and B % p == 0:
    ans.append(p)
  data = [e for e in data if e % p != 0]

ans.insert(0, 1)

print(len(ans))


import fractions

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



n = fractions.gcd(A, B)

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

data = divisor(n)
# print(data)
data.remove(1)
ans = []

while data != []:
  p = data[0]
  ans.append(p)
  data = [e for e in data if e % p != 0]

ans.insert(0, 1)

print(len(ans))


import fractions

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



n = fractions.gcd(A, B)

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

data = divisor(n)
data.remove(1)
ans = []

while data != []:
  p = data[0]
  if A % p == 0 and B % p == 0:
    ans.append(p)
  data = [e for e in data if e % p != 0]

ans.insert(0, 1)

print(len(ans))


import fractions

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

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 = set(prime_factorize(A))
b = set(prime_factorize(B))
c = a & b

print(len(c))


import fractions

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

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 = set(prime_factorize(A))
b = set(prime_factorize(B))
c = a & b

print(len(c) + 1)


Verdicts: Time Limit Exceeded

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
import fractions

def coprime2(a, b):
    return fractions.gcd(a, b) == 1

A,B = map(int, input().split())
num_set = set()
i=2
while True:
    if(A%i==0 and B%i==0):
        num_set.add(i)
        A = A//i
        B = B//i
        if(coprime2(A,B)==1):
            break
    else:
        i = i+1
print(len(num_set)+1)

def prime_factor(n):
    ass = set()
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
    if n != 1:
        ass.add(n)
    return ass

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

A_set = prime_factor(A)
B_set = prime_factor(B)

num_set = A_set.intersection(B_set)

#while True:
#    if(A%i==0 and B%i==0):
#        num_set.add(i)
#        A = A//i
#        B = B//i

#            break
#    else:

print(len(num_set)+1)

Verdicts: Time Limit Exceeded

Accepted
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):
def main():
  A, B = map(int,input().split())

  

  ans = 0
  import fractions as math

  if math.gcd(A,B) == 1:
    ans = 1
  else:
    
    cdlist =[]

    for i in range(1, min(A,B) + 1):
      if A % i == 0 and B % i == 0:
        cdlist.append(i)

    # print(cdlist)

    for i,cd1 in enumerate(cdlist):
      for cd2 in cdlist[i+1:]:
        # print(cd1,cd2)
        if math.gcd(cd1,cd2) == 1:
          ans += 1

  print(ans)

main()

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



ans = 0
import fractions as math

if math.gcd(A,B) == 1:
  ans = 1
else:
  
  cdlist =[]

  for i in range(1, min(A,B) + 1):
    if A % i == 0 and B % i == 0:
      cdlist.append(i)

  # print(cdlist)

  for i,cd1 in enumerate(cdlist):
    for cd2 in cdlist[i+1:]:
      # print(cd1,cd2)
      if math.gcd(cd1,cd2) == 1:
        ans += 1

print(ans)



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



ans = 0
import math

if math.gcd(A,B) == 1:
  ans = 1
else:
  
  cdlist =[]

  for i in range(1, min(A,B) + 1):
    if A % i == 0 and B % i == 0:
      cdlist.append(i)

  # print(cdlist)

  for i,cd1 in enumerate(cdlist):
    for cd2 in cdlist[i+1:]:
      # print(cd1,cd2)
      if math.gcd(cd1,cd2) == 1:
        ans += 1

print(ans)




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, B = map(int, input().split())
A_list = set(prime_factorize(A))
B_list = set(prime_factorize(B))

print(len(A_list & B_list) + 1)



Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
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=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
    print(A,B)
if B==1:
    print(1)
else:
    count=2
    i=2
    while i**2<B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    print(count)

a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=1
    i=2
    while i**2<=B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    if B!=1:
        count+=1
    print(count)

Verdicts: Wrong Answer

Accepted
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):
import math
def gcd(a,b):
  if a<b:
    a,b = b,a
  if b == 0:
    return a
  else:
    a,b = b,a%b
    return(gcd(a,b))

def prime_factorization(k):
  ans = []
  i = 2
  while i <= k:
    if k % i == 0:
      ans.append(i)
      k /= i
    else:
      i += 1
  return ans
n,k = map(int,input().split())
#print(gcd(n,k))
l = prime_factorization(gcd(n,k))
print(l,len(set(l))+1)


import math
def gcd(a,b):
  if a<b:
    a,b = b,a
  if b == 0:
    return a
  else:
    a,b = b,a%b
    return(gcd(a,b))

""" return a list of the prime factors for a nutural numbers"""
def prime_factorization(k):
  if k < 2:
    return []
  r = math.ceil(math.sqrt(k))
  ans = []
  i = 2
  while i <= r:
    if k % i == 0:
      ans.append(i)
      k //= i
    else:
      i += 1
  if k > 1:
    ans.append(k) 
  return ans

if __name__ == "__main__":
  n,k = map(int,input().split())
  #print(gcd(n,k))
  l = prime_factorization(gcd(n,k))
  print(len(set(l))+1)


Verdicts: Wrong Answer

Accepted
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):
import math

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

def factorize(x):
    ans=1
    div=2
    while div**2<=x:
        while x%div==0:
            x=x//div
            flag=1
        if flag==1:
            ans+=1
        div+=1
        flag=0
    if n>1:
        ans+=1
    return ans

a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(f)


import math

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

def factorize(x):
    f=[]
    div=2
    while div**2<=x:
        while x%div==0:
            f.append(div)
            x=x//div
        div+=1
    if x>1:
        f.append(x)
    return f



a,b=map(int,input().split())
g=gcd(a,b)
f=factorize(g)
print(len(set(f))+1)


Verdicts: Runtime Error

Accepted
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):
def div(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

a,b = map(int,input().split())
c = list(set(div(a)) & set(div(b)))
ans = 0
for i in range(len(c)):
    for j in range(2,c[i]):
        if j*j>c[i]:
            break
        if c[i] % j == 0:
            break
    else:
        ans += 1
print(ans)

import math
def div(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 is_primeplus(n):
    if n == 1:
        return 1
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return 0
    return 1
a,b = map(int,input().split())
c = list(set(div(a)) & set(div(b)))
ans = 0
for i in range(len(c)):
    if is_primeplus(c[i]):
        ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
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):
import fractions
a,b=list(map(int,input().split()))
cnt=0

def f(a,b):
  max=fractions.gcd(a,b)
  if min(a,b)==1:re=[max]
  else:re=[1,max]
  for i in range(2,max):
    if a%i==0 and b%i==0:re.append(i)
  return re
 
def g(n):
  if n==0:return False
  for i in range(2,n):
    if n%i==0:return False
  else:return True

for i in f(a,b):
  if g(i)==True:
    cnt+=1
print(cnt)

import fractions
a,b=list(map(int,input().split()))

def f(a,b):
  max=fractions.gcd(a,b)
  re=[1,max]
  for i in range(2,max):
    if a%i==0 and b%i==0:re.append(i)
  return re

def g(n):
  if n==0:return False
  for i in range(2,n):
    if n%i==0:return False
  else:return True

ans=[g(n) for n in f(a,b)]
print(ans.count(True))



import math,fractions
a,b=list(map(int,input().split()))

def f(n):
    a=[1]
    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

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))

Verdicts: Time Limit Exceeded

Wrong Answer

Accepted
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):
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)




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)
if A!=1:
    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)
if B!=1:
    Bnum.append(B)

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




Verdicts: Wrong Answer

Accepted
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):
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def factorize(n):
    res = set()
    i = 2
    while i*i <= n:
        print(n)
        if n % i != 0:
            continue
        while n % i == 0:
            n //= i
            res.add(i)
        i += 1
    if n != 1:
        res.add(n)
    return res

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

    g = gcd(A, B)
    f = factorize(g)
    ans = len(f) + 1
    print(ans)

if __name__ == '__main__':
    main()

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

def factorize(n):
    res = set()
    i = 2
    while i*i <= n:
        if n % i != 0:
            i += 1
            continue
        while n % i == 0:
            n //= i
            res.add(i)
        i += 1
    if n != 1:
        res.add(n)
    return res

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

    g = gcd(A, B)
    f = factorize(g)
    ans = len(f) + 1
    print(ans)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
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=map(int,input().split())
import sys
input=sys.stdin.readline
sys.setrecursionlimit(1000000000)
def gcd(a,b):
    if a<b:
        a,b=b,a
    if b==0:
        return a
    return gcd(b,a%b)
c=gcd(A,B)
#print(c)
if c==1:
    print(1)
else:
    sqrtc=int(c**(1/2))
    lf=[0 for i in range(c-1)]#2,3,,,,c
    #print(lf)
    for i in range(sqrtc):
        if lf[i]==0:
            #for j in range(i+2,c//(i+2)+1):
            for j in range(i+2,c+1,i+2):
                lf[j-2]=1
    #print(lf)
    ans=1
    for i in range(c-1):
        if lf[i]==0 and c%(i+2)==0:
            ans+=1

    #print(c-sum(lf)+1)
    print(ans)



A,B=map(int,input().split())
import sys
input=sys.stdin.readline
sys.setrecursionlimit(1000000000)
def gcd(a,b):
    if a<b:
        a,b=b,a
    if b==0:
        return a
    return gcd(b,a%b)
c=gcd(A,B)
#print(c)
sqrtc=int(c**(1/2))
vc=c
ans=1
for i in range(2,sqrtc+1):
    if vc%i==0:
        ans+=1
        vc/=i
        while vc%i==0:
            vc/=i
if vc!=1:
    ans+=1
print(ans)


Verdicts: Wrong Answer

Accepted
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 = map(int, input().split())
ls = [0]*(max(int(A**0.5)+1, int(B**0.5)+1)+1)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
    else:
      continue
    for n in range(2,int(i**0.5)+1):
      if i%n==0:
        break
    else:
      ans += 1
    j = A//i
    if B%j!=0:
      continue
    if ls[j]==0:
      ls[j] = 1
    else:
      continue
    for n in range(2,int(j**0.5)+1):
      if j%n==0:
        break
    else:
      ans += 1
print(ans)

from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      print(i)
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A//i
    if B%j!=0:
      continue
  elif B%i==0:
    j = B//i
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)

from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A//i
    if B%j!=0:
      continue
  elif B%i==0:
    j = B//i
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
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):
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)

GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

_GCD=int(np.sqrt(GCD))
num_list=np.arange(1,_GCD+1)
count=0
ans_list=np.array([])

while not list(num_list) == [] :
    num=num_list[0]
    if A%num==0 and B%num==0:
        count+=1
        ans_list=np.append(ans_list,num)
        if num==1:
            num_list=num_list[~(num_list==1)]
        else:
            num_list=num_list[~(num_list % num == 0)]
    else:
        num_list=num_list[~(num_list % num == 0)]
        
num_list= 6/ans_list

while not list(num_list) == [] :
    num=num_list[0]
    if A%num==0 and B%num==0:
        count+=1
        if num==1:
            num_list=num_list[~(num_list==1)]
        else:
            num_list=num_list[~(num_list % num == 0)]
    else:
        num_list=num_list[~(num_list % num == 0)]

print(count)

import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)

GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

if GCD==1:
    print(1)
else:
    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

    _GCD=factorization(GCD)
    num_list=[1]
    for num in _GCD:
        num_list+=[num[0]]
    
    print(len(num_list))

Verdicts: Wrong Answer

Accepted
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):
def solve(n):
    res = set()
    for i in range(2, n):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1) break
    res.add(1)
    return res
 
 
A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

from math import sqrt


def get_divisors(n):
    
    res = {1}
    cnt = 1
    for i in range(2, int(sqrt(n)) + 1):
        if n % i == 0:
            cnt += 1

        while n % i == 0:
            res.add(i)
            n /= i
        if (n <= 1): break

    if n > 1:  
        res.add(n)
    return cnt, res


A, B = [int(_) for _ in input().split()]
print(len(get_divisors(A)[1] & get_divisors(B)[1]))


Verdicts: Runtime Error

Accepted
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):
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall




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

G = math.gcd(A,B)

c = collections.Counter(factorizzation(G))
print(len(list(c.keys()))+1)

from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
 
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a


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

G = gcd(A,B)

c = collections.Counter(factorize(G))
print(len(list(c.keys()))+1)


Verdicts: Runtime Error

Accepted