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):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


A, B = map(int, input().split())
g = gcd(A,B)
G = []
i = 1
while i*i<=g:
    if g%i==0:
        G.append(i)
        G.append(g/i)
    i += 1

p = {i for i in range(2,g)}
i = 2
while i*i<=g:
    if i in p:
        j = i + i
        print('j=',j)
        while j <= g:
            if j in p:
                p.remove(j)
            j += i
    i += 1
ans = set(G) & p
print(len(ans)+1)

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

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

A, B = map(int, input().split())
g = gcd(A,B)
print(len(factorize(g))+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(a, b):
    while b:
        a, b = b, a % b
    return a

a, b = map(int, input().split())
g = GCD(a,b)
s = 0
i = 2
while(i*i <= g):
    print("1")
    print(i)
    while g % i == 0:
        print(g)
        g = g // i
        print(g)
        s = s +1
    i = i + 1
if g>1:
        s = s+1
print(s+1)

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

a, b = map(int, input().split())
n = GCD(a,b)
i = 2
table = []
while i * i <= n:
    while n % i == 0:
        n = n // i
        table.append(i)
    i += 1
if n > 1:
    table.append(n)
print(len(set(table))+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 primes(n):
    i = 2
    prime = []
    while i**2<= n:
        if n % i:
            i += 1
        else:
            n =n//i
            prime.append(i)
    if n > 1:
        prime.append(n)
    return prime
a = int(input())
b = int(input())
pa=set(primes(a))
pb=set(primes(b))
inte=pa.intersection(pb)
print(len(inte)+1)

import math
def primes(n):
    l= []
    for i in range(2,math.floor(math.sqrt(n))):
        while n % i == 0:
            n = n//i
            l.append(i)
        if n == 1: 
            break
    
    if n > 1:
        l.append(n)
    return l

a,b=map(int,input().split())
sa=set(primes(a))
sb=set(primes(b))
sans=sa.intersection(sb)
print(len(sans)+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 trial(k):
    factor = []
    m = int(math.sqrt(k)) + 1
    for i in range(2,m):
        while k % i == 0:
            k = k // i
            factor.append(i)
    if not factor:
        return [1,k]
    else:
        factor.append(k)
        factor.append(1)
        return factor

k = gcd(a,b)

ps = trial(k)

count = 1
for i in range(len(ps)-1):
    if ps[i] != ps[i + 1]:
        count += 1
        
print(count)



import math
def gcd(a,b):
    while a > 0 and b > 0:
        if a > b:
            a = a % b
        elif a < b:
            b = b % a
        else:
            b = 0
    return max(a,b)

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

def trial(k):
    factor = []
    m = int(math.sqrt(k)) + 1
    for i in range(2,m):
        while k % i == 0:
            k = k // i
            factor.append(i)
    if not factor:
        return [1,k]
    else:
        factor.append(k)
        factor.append(1)
        return factor

k = gcd(a,b)

ps = trial(k)

count = 1
for i in range(len(ps)-1):
    if ps[i] != ps[i + 1]:
        count += 1

print(count)


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 gcd(a,b):
  while b!=0:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)

def ds(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 == 2: return True
  if n == 1 or n & 1 == 0: return False
  d = (n - 1) >> 1
  while d & 1 == 0:
    d >>= 1
  for k in range(12):
    a = [2,3,5,7,11,13,17,19,23,29,31,37][k]
    t = d
    y = pow(a, t, n)
    while t != n - 1 and y != 1 and y != n - 1:
      y = (y * y) % n
      t <<= 1
    if y != n - 1 and t & 1 == 0: return False
  return True

A,B=map(int,input().split())
l=sorted(ds(gcd(A,B)))
n=0
for i in l:
  if is_prime(i)==True:n+=1
print(n+1)

def gcd(a,b):
  while b!=0:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)

def ds(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

import random
def is_prime(n):
  if n == 2: return True
  if n == 1 or n & 1 == 0: return False
  d = (n - 1) >> 1
  while d & 1 == 0:
    d >>= 1
  for k in range(100):
    a = random.randint(1, n - 1)
    t = d
    y = pow(a, t, n)
    while t != n - 1 and y != 1 and y != n - 1:
      y = (y * y) % n
      t <<= 1
    if y != n - 1 and t & 1 == 0: return False
  return True

A,B=map(int,input().split())
l=sorted(ds(gcd(A,B)))
n=0
for i in l:
  if is_prime(i)==True:n+=1
print(n+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):
a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print(1)
    sys.exit(0)

import math

#prime_flag = [True] * (small + 1)


#    if not prime_flag[i]:
#        continue
#    for j in range(i + i, small + 1, i):



#cd = [p for p in primes if (small % p == 0) and (big % p == 0)]
#
#print(len(cd) + 1)


a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print(1)
    sys.exit(0)

import math

prime_flag = [True] * (small + 1)


#    if not prime_flag[i]:
#        continue
#    for j in range(i + i, small + 1, i):



#cd = [p for p in primes if (small % p == 0) and (big % p == 0)]
#
#print(len(cd) + 1)


a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print(1)
    sys.exit(0)

import math

prime_flag = [True] * (small + 1)
limit  = int(math.sqrt(small))
for i in range(2, limit + 2):
    if not prime_flag[i]:
        continue
    for j in range(i + i, small + 1, i):
        prime_flag[j] = False


#cd = [p for p in primes if (small % p == 0) and (big % p == 0)]
#
#print(len(cd) + 1)


a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print(1)
    sys.exit(0)

import math

prime_flag = [True] * (small + 1)
limit  = int(math.sqrt(small))

#    if not prime_flag[i]:
#        continue
#    for j in range(i + i, small + 1, i):



#cd = [p for p in primes if (small % p == 0) and (big % p == 0)]
#
#print(len(cd) + 1)


a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print(1)
    sys.exit(0)

import math
import collections

# FYI: https://ja.wikipedia.org/wiki/%E8%A9%A6%E3%81%97%E5%89%B2%E3%82%8A%E6%B3%95
def prime_factorization(num, divisors=None):
    if num <= 1:
        assert False
    factors = []

    
    
    
    if not divisors:
        divisors = [2] + [i for i in range(3, int(math.sqrt(num)) + 1) if i % 2 != 0]

    for d in divisors:
        
        if num < d:
            break
        while num % d == 0:
            factors.append(d)
            num //= d

    if num != 1:
        factors.append(num)
    return factors




small_factors = set(prime_factorization(small))
big_factors = set(prime_factorization(big))

print(len(small_factors.intersection(big_factors)) + 1)


Verdicts: Wrong Answer

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):
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
L = make_divisors(a)
cv=[]
for i in range(len(L)):
	if b % L[i] == 0:
		cv.append(L[i])
cnt=1
cv=set(cv)
for d in cv:
	if d<=1:
		break
	for i in range(2, int(d**0.5)+1):
		f=0
		if d%i==0:
			f+=1
		if f==0:
			cnt+=1

print(cnt)

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
L = make_divisors(a)
cv=[]
for i in range(len(L)):
	if b % L[i] == 0:
		cv.append(L[i])
s=set()
s.add(1)
import fractions
for i in range(len(cv)-1):
	f=0
	for x in s:
		if fractions.gcd(cv[i+1],x)!=1:
			f+=1
			break
	if f==0:
		s.add(cv[i+1])

print(len(s))


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
L = make_divisors(a)
cv=[]
for i in range(len(L)):
	if b % L[i] == 0:
		cv.append(L[i])
cnt=1
cv=set(cv)

for d in cv:
	if d<=1:
		pass
	for i in range(2, int(d**0.5)+1):
		f=0
		if d%i==0:
			f+=1
		if f==0:
			cnt+=1

print(cnt)


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

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

    for k in range(2, int(n**0.5) + 1):
        if n % k == 0:
            return False

    return True

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
L = make_divisors(a)
cv=[]
for i in range(len(L)):
	if b % L[i] == 0:
		cv.append(L[i])
cnt=1
cv=set(cv)
for d in cv:
	if is_prime(d):
		cnt+=1
print(cnt)


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


#include <algorithm>
#include <math.h>

using namespace std;




template<typename T>
bool isPrime(T x) {
  if (x == 1) return false;
  for (int i = 2; i <= sqrt(x); i += 2) {
    if (x % i == 0) return false;
  }
  return true;
}

template<typename T>
T gcd(T n, T m) {
  while (m != 0) {
    n %= m;
    swap(n, m);
  }
  return n;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll a, b;
  cin >> a >> b;
  
  ll x = gcd(a, b);
  ll ans = 1;
  for (int i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      if (isPrime(i)) {
       ++ans;
       if (i * i != x) {
         if (isPrime(x / i)) ++ans;
       }
      }
    }
  }
  cout << ans << endl;
}

def gcd(n, m):
  while m:
    n, m = m, n%m
  return n

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

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  a, b = na()
  gcd_ = gcd(a, b)
  ans = 1
  for d in divi(gcd_):
    if isprime(d):
      ans += 1
  print(ans)

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

def prime_factorization(x):
    table = []
    i = 2
    while i * i <= x :
        if x % i == 0 :
          	n /= i
            table.append(i)
        i += 1

    if x > 1 :
        table.append(x)
    return table

v = set(prime_factorization(a))
w = set(prime_factorization(b))

print(len(v&w) + 1)


a,b = map(int,input().split())
 
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
  
s = set(prime_decomposition(a))
t = set(prime_decomposition(b))
 
print(len(s&t) + 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 primes(n):
    i = 1
    p = [2]
    while i+2 <= n:
        flag = True
        i += 2
        for j in range(3, int(i**(1/2))+1, 2):
            if i % j == 0:
                flag = False
                break
        if flag:
            p.append(i)
    return p
from fractions import gcd
a, b = map(int, input().split())
c = gcd(a, b)
c_ps = primes(c ** (1 / 2) // 1 + 1)
c_div = set()
for prime_num in c_ps:
    while c % prime_num == 0:
        c_div.add(prime_num)
        c /= prime_num
print(len(c_div)+1)

def prime_factor(n):
    factors = []
    for i in range(2, int(n**0.5)+1):
        count = 0
        while n % i == 0:
            count += 1
            n /= i
        if count != 0:
            factors.append((i, count))
    if n != 1:
        factors.append((n, 1))
    return factors
a, b = map(int, input().split())
apf = prime_factor(a)
bpf = prime_factor(b)
print(len(set(i[0] for i in apf)&set(i[0] for i in bpf))+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):
from math import sqrt


def is_prime(x):
    if x < 2:
        return False
    for i in range(2, int(sqrt(x)) + 1):
        if x % i == 0:
            return False

    return True


def prime_factorization(x):
    if x < 2:
        return []
    li = []
    div = 2
    div_max = int(sqrt(x))
    while x != 1 and div <= div_max:
        if is_prime(div):
            cnt = 0
            if x % div == 0:
                x //= div
                cnt += 1
            li.append((div, cnt))

        if div == 2:
            div += 1
        else:
            div += 2

    if not li:
        li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

print(a_pf)
print(b_pf)

len_min = min(len(a_pf), len(b_pf))

ans = 0
for i in range(len_min):
    if a_pf[i][1] and b_pf[i][1]:
        ans += 1

print(ans)


from math import sqrt


def prime_factorization(x):
    li = []
    num = x
    for i in range(2, int(sqrt(x)) + 1):
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            li.append((i, cnt))

    if num != 1:
        li.append((num, 1))

    #if not li:
    #    li.append((x, 1))

    return li


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

a_pf = [(1, 1)] + prime_factorization(a)
b_pf = [(1, 1)] + prime_factorization(b)

ans = 0
for ap, at in a_pf:
    for bp, bt in b_pf:
        if ap == bp:
            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=int(input())
b=int(input())
l=[]
count=0
for i in range(2,min(a,b)+1):
  if a%i==0 and b%i==0:
    l.append(i)
for j in range(0,len(l)):
  for k in rage(0,j-1):
    
  if l[j+1]%l[k]!=0:
    count=count+1
print(count+1)
    

from math import sqrt, ceil
 
a, b = map(int, input().split())
 
c_a = set()
c_b = set()
 
for i in range(1, ceil(sqrt(a))+1):
  if a % i == 0:
    c_a.add(i)
    if i > 1:
        while a % i == 0:
            a = a // i
if a != 1:
    c_a.add(a)
 
for j in range(1, ceil(sqrt(b))+1):
  if b % j == 0:
    c_b.add(j)
    if j > 1:
        while b % j == 0:
            b = b // j
if b != 1:
    c_b.add(b)
 
ans = c_a.intersection(c_b)
 
print(len(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 math

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

def common_divisor(n):
  if n == 1:
    return [1]
  if n ==2:
    return [1,2,4]
  ret = []
  for i in range(1,math.ceil(math.sqrt(n))):
    if n%i==0:
      ret.append(i)
      ret.append(n//i)      
  return sorted(ret)

ca = common_divisor(a)
cb = common_divisor(b)

sa = set(ca)
c = sa.intersection(cb)

count = 0
for ci in c:
  if len(common_divisor(ci))<=2:
    count+=1    

print(count)

import math

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

def common_divisor(n):
  if n == 1:
    return [1]
  ret = []
  for i in range(1,math.ceil(math.sqrt(n))+1):
    if n%i==0:
      ret.append(i)
      ret.append(n//i)      
  return list(set(ret))

def trial_division(n):
    if n == 2:
        return True
    if n < 2 or n % 2 == 0:
        return False
    for i in range(3, int(math.ceil(math.sqrt(n))) + 1, 2):
        if n % i == 0:
            return False
    return True

ca = common_divisor(a)
cb = common_divisor(b)

sa = set(ca)
c = sa.intersection(cb)

count = 1
for ci in c:
  if trial_division(ci):
    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):
from prime_factorize import prime_factorize
a,b=map(int,input().split())
print(len(set(prime_factorize(a))&set(prime_factorize(b)))+1)

def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n //=2
    f=3
    while f**2<=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())
print(len(set(prime_factorize(a))&set(prime_factorize(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())
def gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0: return a
    r = a % b
    return gcd(b,r)

L = [1]

g = gcd(A, B)
i = 2
while g > 1:
    if i > g ** (1/2): break
    if g % i == 0:
        if L[-1] != i:
            L.append(i)
        g /= i
    else:
        i += 1
print(len(L))


A, B = map(int,input().split())
def gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0: return a
    r = a % b
    return gcd(b,r)

L = [1]

g = gcd(A, B)
g_copy = gcd(A, B)
i = 2
while g > 1:
    if i > g_copy ** (1/2) :
        if g != 1:
            L.append(i)
        break
    if g % i == 0:
        if L[-1] != i:
            L.append(i)
        g /= i
    else:
        i += 1
print(len(L))


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 gcd(x, y):
    if y == 0:
        return x
    else:
        gcd(y, x%y)
n = gcd(a, b)
ndiv = n
i = 2
primecount = 0
divisor = False
while i*i <= n:
    while ndiv%i == 0:
        ndiv = ndiv//i
        divisor = True
    if divisor:
        primecount += 1
        divisor = False
    i += 1

print(primecount+1)


a, b = map(int, input().split())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
n = gcd(a, b)
ndiv = n
if n == 1:
    print(1)
else:
    i = 1
    primecount = 0
    divisor = False
    while True:
        i += 1
        while ndiv%i == 0:
            ndiv = ndiv//i
            divisor = True
        if divisor:
            primecount += 1
            divisor = False
            if ndiv == 1:
                break
        if ndiv != 1 and i*i > n:
            primecount += 1
            break
    print(primecount+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 = [int(i) for i in 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

ad = make_divisors(a)
bd = make_divisors(b)
ans = 0
for i in ad:
  if i in bd:
    ans += 1
print(ans)

a, b = [int(i) for i in 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

  
import math

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

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

    return True
ad = make_divisors(a)
bd = make_divisors(b)
ans = 0
for i in ad:
  if i in bd:
    if is_prime(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 math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
for n in range(2,int(math.sqrt(x))+1):
  if x % n == 0:
    x /= n
    p.append(n)
  else:
    p.append(int(x))
p = list(set(p))
print(len(p))
  
  


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


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p = list(set(p))
print(len(p))
  
  


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


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
for n in range(2,int(math.sqrt(x))+1):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p = list(set(p))
print(len(p))
  
  


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


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
  
  


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):
#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

def gcd(A,B):
    if A>B:
        A,B = B,A

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

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

ans = 1
for i in range(2,math.ceil(math.sqrt(G))+1):
    if G%i==0:
        ans+=1
        while G%i==0:
            G/=i
if G!=1:
    ans+=1

print(ans)


#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

def gcd(A,B):
    if B>A:
        A,B = B,A

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

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

ans = 1
for i in range(2,math.ceil(math.sqrt(G))+1):
    if G%i==0:
        ans+=1
        while G%i==0:
            G/=i
if G!=1:
    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):
a,b=map(int,input().split())
c=1
for i in range(2,int(min(a**.5,b**.5))+2):
    if a%i==0 and b%i==0:
        c+=1
        print(i,a,b)
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i    
print(c)

a,b=map(int,input().split())
c=1
for i in range(2,int(max(a**.5,b**.5))+2):
    if a%i==0==b%i:
        c+=1
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i
if a%b==0 or b%a==0:
    c+=1
print(c)

a,b=map(int,input().split())
c=1
for i in range(2,int(max(a**.5,b**.5))+2):
    if a%i==0==b%i:
        c+=1
        print(i,a,b)
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i
if a%b==0 or b%a==0:
    c+=1
print(c)

a,b=map(int,input().split())
from fractions import *
c=gcd(a,b)
d=0
for i in range(1,c+1):
    if c%i==0:
        c//=i
        d+=+1
print(d)

a,b=map(int,input().split())
c=1
for i in range(2,int(max(a**.5,b**.5))+2):
    if a%i==0==b%i:
        c+=1
    while a%i==0:
        a//=i
    while b%i==0:
        b//=i
if a==b!=1:
    c+=1
print(c)

Verdicts: Wrong Answer

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 itertools
import sys
a,b=map(int,input().split())
def gcd(A,B):
    while B!=0:
        A,B=b,A%B
    return A
l=[]
for i in range(1,gcd(a,b)+1):
    if a%i==0 and b%i==0:
        l.append(i)
for i in range(len(l),0,-1):
    flg=1
    c=list(itertools.combinations(l,i))
    for x,y in list(itertools.combinations(c,2)):
        if gcd(x,y)!=1:
            flg=0
            break
    if flg==1:
        print(i)
        sys.exit() 

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

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

ans=len(factorization(math.gcd(a,b)))
print(ans+1 if math.gcd(a,b)!=1 else 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
n,m=map(int,input().split())
gcd=math.gcd(m,n)
ans=[]
max=int(math.sqrt(gcd))
for i in range(2,max+1):
    if gcd%i==0:
        while True:
            if gcd%(i)==0:
                gcd=gcd//(i)
                ans.append(i)
            else:
                break
print(len(set(ans))+1)

import math
n,m=map(int,input().split())
gcd=math.gcd(m,n)
i=1
ans=[]
max=int(math.sqrt(gcd))
for i in range(2,max+2):
    while gcd%i==0:
        ans.append(i)
        gcd//=i
if gcd>1:
  ans.append(n)

print(len(set(ans))+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):
#input
a, b = map(int, input().split())


def gcd(a, b):
    while b: a, b = b, a % b
    return abs(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

n = gcd(a, b)
pf = factorization(n)

print("{}".format(pf))
print("{}".format(len(pf)+1))

import math

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


def commonDivisor (n1, n2):
    common_divisor=[]
    for i in range(2, min(n1, n2) + 1):
        if n1 % i == 0 and n2 % i == 0:
            common_divisor.append(i)
    return common_divisor


def isPrime(n):
    if n != 2 and n % 2 == 0:
        return False
    for i in range(2, n):
        if n % i == 0:
            return False
    return True

cd = commonDivisor(a, b)
cd.insert(0, 1)
res = []
for num in cd:
    if isPrime(num) and res.count(num) == 0:
        res.append(num)

print("{}".format(res))
print("{}".format(len(res)))

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


def gcd(a, b):
    while b: a, b = b, a % b
    return abs(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

n = gcd(a, b)
pf = factorization(n)
if pf == [[1, 1]]:
    print("{}".format(len(pf)))
else:
    print("{}".format(len(pf)+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 mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)

    for x in range(3,k+1,1):
        if(k % x == 0):
            while k %x == 0:
                k/=x
                a.append(x)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
print(kouyaku)
soinsu =prime_F(kouyaku)
print(soinsu)
print(len(soinsu))

def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)
    for x in range(3,k,1):
        if(k % x == 0):
            while k %x == 0:
                k/=x
                a.append(x)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))


def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        while k %2 == 0:
            k /=2
        a.append(2)
    k =int(k)

    for x in range(3,end,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    if k != 1:
        a.append(k)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))


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 math
from fractions import gcd
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 set(divisors)

def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return set([i for i in range(n + 1) if is_prime[i]])

A, B = map(int, input().split())
g = gcd(A, B)
if g==1:
    print(1)
else:
    nums = make_divisors(g)
    pn = primes(g)
    ans = set.intersection(nums, pn)
    print(len(ans)+1)

import math
from fractions import gcd
def get_primenumber(number):
    prime_list = []
    search_list = list(range(2,number+1))
    while True:
        if search_list[0] > math.sqrt(number):
            prime_list.extend(search_list)
            break
        else:
            head_num = search_list[0]
            prime_list.append(head_num)
            search_list.pop(0)
            search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

A, B = map(int, input().split())
g = gcd(A, B)
if g==1:
    print(1)
else:
    pn = get_primenumber(int(math.sqrt(g)))
    print(len(pn))

import math
A, B = map(int, input().split())
g = gcd(A, B)
pn = [2]
for L in range(3, g):
    chk=True
    for L2 in pn:
        if L%L2==0:chk=False
    if chk==True and gcd(g,L)!=1:pn.append(L)
print(len(pn)+1)

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

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 isprime(n):
    sup = int(n**0.5)
    for i in range(2, sup+1):
        if n%i==0:
            return False
    return True

A, B = map(int, input().split())
g = gcd(A, B)
divs = make_divisors(g)
ans = 0
for d in divs:
    ans += 1 if isprime(d) else 0
print(ans)

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

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


def check_prime(n):
    flag = True

    
    
    if (n % 2 == 0 and n != 2) or n == 0 or n == 1:
        flag = False
        return(flag)

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

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

div = make_divisors(min(A, B))

div2 = []
for n in div:
    if check_prime(n):
        div2.append(n)
print(div2)
cnt = 1
for n in div2:
    if max(A, B) % n == 0:
        cnt += 1

print(cnt)



import math

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

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

def prime_factorize(n):
    res = []
    tmp = n

    for i in range(2, int(math.sqrt(n))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            res.append([i, cnt])

    if tmp != 1:
        res.append([tmp, 1])

    if len(res) == 0 and n != 1:
        res.append([n, 1])

    return(res)






g = gcd(A, B)
div = prime_factorize(g)
ans = len(div) + 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):
from functools import reduce
from fractions import gcd
A, B = map(int,input().split())
a = reduce(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(cnt)
    return arr
print(sum(factorization(a))+1) 

A, B = map(int,input().split())
def factorization(n):
    if n == 1:
      return [1]
    elif n == 2:
      return [1, 2]
    arr = [1]
    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==[]:
        arr.append(n)
    return arr
print(len(set(factorization(A))&set(factorization(B))))

Verdicts: Wrong Answer

Accepted