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):
from math import sqrt
def get_divisor(num):
	return [i for i in range(1,num+1) if num % i == 0]

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in range(2,int(sqrt(num))+1):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print(len(c_prime))

from math import sqrt
def get_divisor(num):
	arr = [i for i in range(2,int(sqrt(num))) if num % i == 0]
	arr += [num // i for i in reversed(arr)]
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))

from math import sqrt
def get_divisor(num):
	arr = [i for i in range(1,int(sqrt(num))+1) if num % i == 0]
	arr += [num // i for i in reversed(arr) if num // i not in arr]
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
print(common)
c_prime = [p for p in common if prime_ch(p)]
print(c_prime)
print((len(c_prime)+1))

from math import sqrt
def get_divisor(num):
	arr = [i for i in range(1,int(sqrt(num))+1) if num % i == 0]
	arr += [num // i for i in reversed(arr) if num // i not in arr]
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))

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

a, b = map(int, input().split())
k = []
for i in range(2, min(a, b)+1):
    if a % i == 0 and b % i == 0:
        k.append(i)
cnt = 1
for n in k:
    flg = "composite"
    for p in range(2, n):
        if n == 2:
            cnt += 1
        elif n % p == 0:
            break
        else:
            flg = "prime"
    if flg == "prime":
        cnt += 1
print(cnt)

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def prime_factorization(n):
    res = []
    for i in range(2, int(pow(n, 0.5)) + 1):
        if n % i == 0:
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append([i, ex])
    if n != 1:
        res.append([n, 1])

    prime = [1]
    for p in res:
        for _ in range(p[1]):
            prime.append(p[0])

    return prime


def resolve():
    a, b = map(int, input().split())
    A = prime_factorization(a)
    B = prime_factorization(b)

    res = set(A) & set(B)
    print(len(res))


if __name__ == '__main__':
    resolve()


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 fractions import gcd
  
a, b = map(int, input().split())
max_d = gcd(a, b)
li = []
for i in range(2, max_d + 1):
  if a % i == 0 and b % i == 0:
    if len(li) == 0:
      li.append(i)
    else:
      ap = 0
      for l in li:
        if i % l == 0:
          ap = 1
          break
      if ap == 0:
        li.append(i)
    
print(len(li) + 1)

import math
from fractions import gcd

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

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

  return 1
  
a, b = map(int, input().split())
ans = 0
for i in range(1, min(a, b) + 1):
  if i > 7 and (i % 2 == 0 or i % 3 == 0 or i % 5 == 0 or i % 7 == 0):
    pass
  else:
    if a % i == 0 and b % i == 0:
      ans += is_prime(i)
    
print(ans)
    


import math
from fractions import gcd

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

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

  return 1
  
a, b = map(int, input().split())
max_d = gcd(a, b)
ans = 0
for i in range(1, max_d + 1):
  if a % i == 0 and b % i == 0:
    ans += is_prime(i)
    
print(ans)
    


import math
from fractions import gcd

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

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

  return 1
  
a, b = map(int, input().split())
max_d = gcd(a, b)
ans = 0
for i in range(1, max_d + 1):
  if i > 7 and (i % 2 == 0 or i % 3 == 0 or i % 5 == 0 or i % 7 == 0):
    pass
  else:
    if a % i == 0 and b % i == 0:
      ans += is_prime(i)
    
print(ans)
    


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
a, b = map(int, input().split())
la = prime_decomposition(a)
lb = prime_decomposition(b)
la_lb_and = list(set(la) & set(lb))
    
print(len(la_lb_and) + 1)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

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

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


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

a = factorization(a)
b = factorization(b)
ans = 1
print(a, b)
if a[0][0] == b[0][0] == 1:
    print(ans)
    sys.exit()
for i in a:
    for j in b:
        if i[0] == j[0]:
            ans += 1
print(ans)


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


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

a = factorization(a)
b = factorization(b)
ans = 1
# print(a, b)
if a[0][0] == b[0][0] == 1:
    print(ans)
    sys.exit()
for i in a:
    for j in b:
        if i[0] == j[0]:
            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 = list(map(int,input().split(' ')))

def gcd(x,y):

  while y!=0:
    x,y=y,x%y
  return x

gcd = gcd(a,b)
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

ans = len(factorization(gcd))
if ans == 1:
  ans += 1
print(ans)


a, b = list(map(int,input().split(' ')))
 
def gcd(x,y):
 
  while y!=0:
    x,y=y,x%y
  return x
 
gcd = gcd(a,b)
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
if gcd == 1:
  print(1)
else:
  print(len(factorization(gcd)) + 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 prime(x):
    global  ans
    m = x ** (0.5)
    for i in range(2,int(m+1)):
        if x % i == 0 :
            while True:
                if x % i != 0 :
                    break
                else:
                    x = (x//i)
            ans +=1
    return ans
A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(prime(t))


def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    if x == 1 :
        return False
    else:
        for i in range(2,int(x**(0.5))+1):
            if x % i == 0 :
                return False
        return True

A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(t)
for i in range(2,t+1):
    if prime(i) and t % i == 0 :
        ans += 1
    else:
        pass

print(ans)

def check2(x,y,p,t):
    for i in range(p,t,1):
        if x % i == 0 and y % i == 0 :
            return int(i)
    if (i+1) == t :
        return 1
A,B = map(int,input().split())
ans = 1
p = 2
while True :
    t = min(A, B)
    p = check2(A,B,p,t)
    if p ==  1  :
        break
    while True :
        if A % p == 0 and B % p == 0 :
            A = (A//p)
            B = (B//p)
        else :
            break
    ans += 1
print(ans)

def check2(x,y,p):
    t = min(x,y)
    for i in range(p+1,t):
        if x % i == 0 and y % i == 0 :
            return i
        if i * i >= t :
            return 0
A,B = map(int,input().split())
ans = 1
p = 1
while True :
    p = check2(A,B,p)
    if p == 0 :
        break
    A = (A // p)
    B = (B // p)
    while True :
        if A % p == 0 and B % p == 0 :
            A = (A//p)
            B = (B//p)
        else :
            break
    ans += 1
print(ans)

def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    global  ans
    m = x ** (0.5)
    for i in range(2,int(m+1)):
        if x % i == 0 :
            while True:
                if x % i != 0 :
                    break
                else:
                    x = (x//i)
            ans +=1
    if x != 1 :
        ans += 1
    return ans
A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(prime(t))

Verdicts: Wrong Answer

Wrong Answer

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):
from math import sqrt, ceil

ab = input().split(' ')
a = int(ab[0])
b = int(ab[1])

tmp = b
if a<b:
	tmp = a
	a = b
	b = tmp

while b != 0:
	tmp = b
	b = a%b
	a = tmp

count = 1

if a == 1:
	return count

if a%2 == 0:
    count += 1
    while a%2 == 0:
        a //= 2

if a == 1:
	return count

while i*i <= a:
    if a%i == 0:
        count += 1
        while a%i == 0:
            a //= i
        if a == 1:
            break
    
return count

if __name__ == "__main__":
    print(main())

from math import sqrt, ceil

def main():

    ab = input().split(' ')
    a = int(ab[0])
    b = int(ab[1])

    tmp = b
    if a<b:
        tmp = a
        a = b
        b = tmp

    while b != 0:
        tmp = b
        b = a%b
        a = tmp

    count = 1

    if a == 1:
        return count

    if a%2 == 0:
        count += 1
        while a%2 == 0:
            a //= 2
        if a == 1:
            return count
    
    i = 3
    while i*i <= a:
        if a%i == 0:
            count += 1
            while a%i == 0:
                a //= i
            if a == 1:
                return count
        i += 2
        
    return count+1

if __name__ == "__main__":
    print(main())

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 math import gcd

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

D = gcd(A, B)
d = D
ans = 1
i = 2
while i <= pow(D, 1/2):
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)

from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)

from math import gcd

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

D = gcd(A, B)
d = D.copy()
ans = 1
i = 2
while i <= pow(D, 1/2):
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)

from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)

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):
from math import gcd
from copy import copy
a, b = map(int, input().split())
data = []
for i in range(1, int(min(a, b) ** 0.5) + 1):
    if a % i == 0 and b % i == 0:
        data.append(i)
        if b % (a // i) == 0:
            data.append(a // i)
        if a % (b // i) == 0:
            data.append(b // i)
data = sorted(list(set(data)))
data_c = copy(data)
for i in range(len(data_c)):
    j = i + 1
    while j < len(data_c):
        if gcd(data_c[i], data_c[j]) != 1:
            del data_c[j]
        else:
            j += 1
i = 0
while i > 0:
    j = i - 1
    while j >= 0:
        if gcd(data[j], data[i]) != 1:
            del data[j]
            i -= 1
        else:
            j -= 1
print(max(len(data_c), len(data)))

from math import gcd

a, b = map(int, input().split())
data = []
for i in range(1, int(min(a, b) ** 0.5) + 1):
    if a % i == 0 and b % i == 0:
        data.append(i)
        if b % (a // i) == 0:
            data.append(a // i)
        if a % (b // i) == 0:
            data.append(b // i)
data = list(set(data)).sort()
for i in range(len(data)):
    j = i + 1
    while j < len(data):
        if gcd(data[i], data[j]) != 1:
            del data[j]
        else:
            j += 1
print(len(data))

from math import gcd
from copy import copy
a, b = map(int, input().split())

def div(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    
    return ret

def judge_prime(x):
    cnt = 0
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            cnt += 1
        if cnt >= 2:
            return False
    return True

div_a = div(a)
div_b = div(b)

data = list(set(div_a) & set(div_b))

ans = 0
for x in data:
    if judge_prime(x):
        ans += 1
print(ans)

Verdicts: 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):
import sys

#+++++
	
def gcd(a,b):
	if a < b:
		a,b = b,a
	
	while b!=1:
		tt=a%b
		if tt==0:
			return b
		a,b=b,tt
		
	return b
	
def is_sosuu(v, pl):
	if v == 2:
		return True
	if v <= 1:
		return False
	for p in pl:
		if v %p==0:
			return False
	return True
	
	
	
def main():
	b , c = map(int, input().split())
	saidai_kouyakusuu=gcd(b,c)
	
	
	ans=1
	sosuu_list=[2,3]
	using=set()
	using.add(1)
	sss=saidai_kouyakusuu
	for i in range(2,int(saidai_kouyakusuu**(0.5))):
		if is_sosuu(i, sosuu_list):
			sosuu_list.append(i)
			while sss % i == 0:
				sss = sss // i
				using.add(i)
			if sss < i:
				using.add(sss)
				break
	
	print(len(using))
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

import sys

#+++++
	
def gcd(a,b):
	if a < b:
		a,b = b,a
	
	while b!=1:
		tt=a%b
		if tt==0:
			return b
		a,b=b,tt
		
	return b
	
def is_sosuu(v, pl):
	if v == 2:
		return True
	if v <= 1:
		return False
	for p in pl:
		if v %p==0:
			return False
	return True
	
def bbb(val):
	return int(val**(0.5))+1
	
def main():
	b , c = map(int, input().split())
	sk=gcd(b,c)
	
	
	ans=1
	sosuu_list=[]
	using=set()
	using.add(1)
	sss=sk
	for i in range(2,bbb(sss)+1):
		while sss % i == 0:
			sss = sss // i
			using.add(i)
			if bbb(sss) < i:
				using.add(sss)
				break
	using.add(sss)
	print(len(using))
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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
# from itertools import combinations
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


def main():
    a, b = [int(x) for x in input().split()]
    gcd_ = math.gcd(a, b)
    cds = {x for x in range(1, int(gcd_ ** 0.5) + 2) if not gcd_ % x}
    cds.add(gcd_)
    cds = list(cds)
    ans = 1
    for num in range(1, (bits := len(cds)) ** 2):
        tmp = [cds[bit] for bit in range(bits) if num >> bit & 1]
        if (length := len(tmp)) > ans:
            if gcd_list(tmp) == 1:
                ans = length
    print(ans)


if __name__ == '__main__':
    main()


import math
from functools import reduce


def prime_factorize(n):
    
    def facs(n):
        
        yield 2
        max_prime = int(pow(n, 0.5)) + 2
        for x in range(3, max_prime, 2):
            yield x

    ans = set()
    for fac in facs(n):
        if n % fac == 0:
            ans.add(fac)
            while n % fac == 0:
                n //= fac
    if n != 1:
        ans.add(n)
    return ans


def gcd_list(numbers):
    
    
    return reduce(math.gcd, numbers)


def main():
    a, b = [int(x) for x in input().split()]
    gcd_ = math.gcd(a, b)
    primes = prime_factorize(gcd_)
    print(len(primes) + 1)


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

d=math.gcd(a,b)

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]
  
r=make_divisors(d)
l=len(r)
ans=1
w=[True]*l
if l>=2:
  for x in range(1,l):
    if w[x]==True:
      ans+=1
      for y in range(x,l):
        if r[y]%r[x]==0:
          w[y]=False
          
print(ans)

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

d=math.gcd(a,b)

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]
  
r=make_divisors(d)
l=len(r)
ans=1
w=[True]*l
if l>=2:
  for x in range(1,l):
    if w[x]==True:
      ans+=1
      for y in range(x,l):
        if r[y]%r[x]==0:
          w[y]=False
          
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):
a,b=map(int,input().split())
def yaku(n):
  l=[]
  m=n
  for i in range(1,int((n)**(1/2))+1):
    if m%i==0:
      l.append(i)
      if m//i!=i:
        l.append(m//i)
  return l
l=yaku(a)
cd=[]
for i in l:
  if a%i==0:
    cd.append(i)
count=0
length=len(cd)
def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
for i in range(length-1):
  for j in range(i+1,length):
    if gcd(i,j)==1:
      count+=1
print(count)

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

def yaku(n):
  l=[]
  m=n
  for i in range(1,int((n)**(1/2))+1):
    if m%i==0:
      l.append(i)
      if m//i!=i:
        l.append(m//i)
  return l

def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a

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

num=gcd(a,b)

l0=yaku(num)

num1=max(l0)

cd=yaku(num1)

pr=[]

for i in cd:
  if i==1:
    pr.append(i)
  else:
    if prime(i):
      pr.append(i)

print(len(pr))

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(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)

from collections import defaultdict
def get_primefactor(n: int) -> dict:
    f = defaultdict(int)
    p = 2
    while p * p <= n:
        while n % p == 0:
            f[p] += 1
        p += 1 if p == 2 else 2
    return f

a, b = map(int, input().split())
factors = factorize(GCD(a, b))

ans = len(factors) + 1

print(ans)


def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)

from collections import defaultdict
def get_primefactor(n: int) -> dict:
    f = defaultdict(int)
    p = 2
    while p * p <= n:
        while n % p == 0:
            f[p] += 1
        p += 1 if p == 2 else 2
    return f

a, b = map(int, input().split())
factors = get_primefactor(GCD(a, b))

ans = len(factors) + 1

print(ans)


def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)

from collections import defaultdict
def get_primefactor(n: int) -> dict:
    f = defaultdict(int)
    p = 2
    while p * p <= n:
        if n % p == 0:
            f[p] += 1
        p += 1 if p == 2 else 2
    return f

a, b = map(int, input().split())
factors = get_primefactor(GCD(a, b))

ans = len(factors) + 1

print(ans)


def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)

from collections import defaultdict
def factorize(n: int) -> dict:
    f = defaultdict(int)
    tmp_n = n
    p = 2
    while tmp_n > 1 and p * p < n:
        while tmp_n % p == 0:
            f[p] += 1
            tmp_n = tmp_n // p
        p += 1 if p == 2 else 2

    if tmp_n != 1:
        f[tmp_n] += 1
    return f

a, b = map(int, input().split())
factors = factorize(GCD(a, b))

ans = len(factors) + 1

print(ans)


Verdicts: Runtime Error

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 sys
sys.setrecursionlimit(10**8)
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:
            while temp%i==0:
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

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

    return arr


af = factorization(A)
bf = factorization(B)
print(af)
print(bf)
ans = 1
for afi in af:
    if afi in bf:
        ans += 1
print(ans)


import sys

input = sys.stdin.readline
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:
            while temp%i==0:
                temp //= i
            arr.append(i)

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

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

    return arr


af = factorization(A)
bf = factorization(B)
print(af)
print(bf)
ans = 1
for afi in af:
    if afi in bf:
        ans += 1
print(ans)


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


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

    if temp!=1:
        arr.append(temp)

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

    return arr


af = factorization(A)
bf = factorization(B)
ans = 0
for afi in af:
    if afi in bf:
        ans += 1
print(ans)


Verdicts: 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
import collections

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

GCD = fractions.gcd(A, B)





def primes_ordered_dict(n):
    #
    prime_list = []
    non_prime_list = []
    number_dict = collections.OrderedDict(
        ((i, None) for i in range(n + 1)))
    #
    del number_dict[0]
    del number_dict[1]
    while True:
        
        prime, _ = number_dict.popitem(False)
        if A % prime == 0 and B % prime == 0:
            prime_list.append(prime)
        # break
        if not (prime * prime <= n):
            break
        
        non_prime_list.append(prime * prime)
        for k in number_dict:
            if prime * k <= n:
                non_prime_list.append(prime * k)
            else:
                break
        
        for non_prime in non_prime_list:
            del number_dict[non_prime]
        non_prime_list.clear()

    # add rest of numbers as prime
    prime_list.extend(
        [prime for prime, _ in number_dict.items() if A % prime == 0 and B % prime == 0])

    return prime_list

if GCD == 1:
    print(1)
else:
    print(len(primes_ordered_dict(GCD))+1)

import collections
import math

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)
     
    return divisors



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

A_div = set(make_divisors(A))
B_div = set(make_divisors(B))
common_div = (A_div & B_div)

cnt = 1
for c in common_div:
    if is_prime(c):
        cnt += 1

print(cnt)

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 prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

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


a,b = map(int,input().split())
gcd = gcd(a ,b)
print(len(np.unique(prime_decomposition(gcd)))+1)

import numpy as np
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

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


a,b = map(int,input().split())
gcd = gcd(a ,b)
print(len(np.unique(prime_decomposition(gcd)))+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 numpy as np
def p(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())
M = np.min([A, B])
a = p(A)
b = p(B)
t = a and b
print(len(t) + 1)


import numpy as np
def so(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
A, B = map(int, input().split())
M = np.min([A, B])
n = 0
for i in range(1, M + 1):
    if so(i):
        if (A % i == 0) and (B % i == 0):
            print(i)
            n = n + 1
print(n+1)

import numpy as np
def p(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())
M = np.min([A, B])
a = p(A)
b = p(B)
t = set(a) & set(b)
print(len(t) + 1)


Verdicts: 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):
def trial_division(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 = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(A),trial_division(B)))+1)

def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%n==0: 
        a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(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):
A, B = map(int,input().split())
A_factors=prime_factorize(A)
B_factors=prime_factorize(B)
B_factors = set(B_factors)
A_factors = set(A_factors)
C = A_factors & B_factors
ans = len(C) + 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_factors=prime_factorize(A)
B_factors=prime_factorize(B)
B_factors = set(B_factors)
A_factors = set(A_factors)
C = A_factors & B_factors
ans = len(C) + 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):



N, M = map(int, input().split())
status_money = [float('inf')] * (1 << N)
key_money = []


for _ in range(M) :
    a, b = map(int, input().split())
    key_money.append(a)
    C = 0
    for c in input().split() :
        C |= (1 << int(c) - 1)
    status_money[C] = min(status_money[C], a)
    

for c in range(1 << N):
    
    if status_money[c] == float('inf'):
        continue
    for d in range(1 << N):
        
        e = c | d
        
        status_money[e] = min(status_money[c] + status_money[d], status_money[e])


if status_money[-1] == float('inf'):
    print(-1)
else:
    print(status_money[-1])

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

def gcd(a, b):
	if b == 0: return(a)
	else : return gcd(b, a % b)
		
G = gcd(A, B)
ctr = 1
for i in range(2, int(math.sqrt(G)) + 1):
    if G == 1: 
        break
    if G % i == 0: 
        ctr += 1
    while G % i == 0:
        G /= i
        
if G == 1:        
    print(ctr)
else:
    print(ctr + 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 fractions, math

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)

    
    return divisors
  
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
import random

def is_prime3(q,k=50):
    q = abs(q)
    
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    
    for i in xrange(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
  
A, B = map(int, input().split()) 
ans = set(make_divisors(A)) &  set(make_divisors(B))
print(sum([is_prime3(i) for i in ans])+1)




from math import gcd
def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print(len(ans) + 1)


if __name__ == "__main__":
    resolve()


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 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)
    if temp != 1:
        arr.append(temp)
    if not arr:
        arr.append(n)
    return arr


input_values = list(map(int, input().split()))
print(len(list(set(factorization(input_values[0])) & set(factorization(input_values[1])))))


def factorization(n):
    if n == 1:
        return []
    else:
        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 not arr:
            arr.append(n)
        return arr


input_values = list(map(int, input().split()))
print(len(list(set(factorization(input_values[0])) & set(factorization(input_values[1])))) + 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 fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)


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

temp=len(factorization(f))


print(temp+1 if temp>1 else temp)

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


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
if f==1:
  print(1)
else:
  temp=len(factorization(f))
  print(temp+1 if temp>1 else temp)

import collections


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

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

def tameshiwari(n):
  result=[]

  f=2
  if n==2:
    result.append(2)
  while f*f<=n:
    if n%f==0:
      result.append(f)
      n=n//f
    else:
      f+=1
  if n!=1:
    result.append(n)
  return result
  

c = collections.Counter(tameshiwari(gcd(a,b)))
print(len(c)+1)


Verdicts: Wrong Answer

Wrong Answer

Accepted