Problem:


Score : 400 points

Problem Statement

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.

Constraints

All values in input are integers.

1 \leq A, B \leq 10^{12}

Input

Input is given from Standard Input in the following format:

A B

Output

Print the maximum number of divisors that can be chosen to satisfy the condition.

Sample Input 1

12 18

Sample Output 1

3

12 and 18 have the following positive common divisors: 1, 2, 3, and 6.

1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.

Sample Input 2

420 660

Sample Output 2

4

Sample Input 3

1 2019

Sample Output 3

1

1 and 2019 have no positive common divisors other than 1.



Sample input:
12 18


Sample output:
3

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num /= i
            factorize_list.append([i, count])
        i += 1
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num) + 1))

Submission status: Runtime Error

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

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

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

    return arr

a,b = map(int,input().split())
c = gcd(a,b)
d = factorization(c)
print(len(d)+1-(c==1))

Submission status: Runtime Error

Solution code:
from fractions import gcd

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


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


a, b = map(int, input().split())
cf = cf(a,b)
if len(cf) == 0:
    print(1)
else:
    ans = [1, cf[0]]
    for i in cf[1:]:
        for j in ans[1:]:
            if i % j == 0:
                break

print(ans)

Submission status: Runtime Error

Solution code:
import math
from math import gcd as bltin_gcd
a, b = map(int, input().split())


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]


def coprime2(a, b):
    return bltin_gcd(a, b) == 1


a_s = set(make_divisors(a))
b_s = set(make_divisors(b))

tmp = a_s & b_s
_max = max(tmp)


def isPrime(n):
    if n < 2:
        # 2未満は素数でない
        return False
    if n == 2:
        # 2は素数
        return True
    for p in range(2, n):
        if n % p == 0:
            # nまでの数で割り切れたら素数ではない
            return False
    # nまでの数で割り切れなかったら素数
    return True


cnt = 0
for i in tmp:
    if isPrime(i):
        cnt += 1

print(cnt + 1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

def primes(max_number):
    pr = list(range(3, max_number+1, 2))
    lpr = len(pr)
    for i,n in enumerate(pr):
        if n:
            if n*n > max_number:
                break
            for j in range(i+n, lpr, n):
                pr[j] = 0
    yield 2
    yield from[i for i in pr if i]

if b > a:
    a, b = b, a

cnt = 0
for i in list(primes(b)):
    if a%i == 0 and b%i == 0:
        cnt += 1
print(cnt+1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

def primes(max_number):
    pr = list(range(3, max_number+1, 2))
    lpr = len(pr)
    for i,n in enumerate(pr):
        if n:
            if n*n > max_number:
                break
            for j in range(i+n, lpr, n):
                pr[j] = 0
    yield 2
    yield from[i for i in pr if i]

if b > a:
    a, b = b, a
cnt = 0
for i in list(primes(a)):
    if a%i == 0 and b%i == 0:
        cnt += 1
print(cnt+1)

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

gcd=gcd(a,b)

f=[]
for i in range(2,int(gcd(a,b)**0.5)+1):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)
        break
print(len(set(f))+1)

Submission status: Runtime Error

Solution code:
import math
import itertools

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]

def main():
    a, b = map(int, input().split())
    k = []
    for i in make_divisors(a):
        if i > b:
            break
        elif b % i == 0:
            k.append(i)
    count = 0
    for i in itertools.product([0,1], repeat=len(k)):
        if i.count(1) < 1:
            continue
        l = [k[j[0]] for j in enumerate(i) if j[1] == 1]
        for x, y in itertools.combinations(l, 2):
            if math.gcd(x, y) != 1:
                break
        else:
            count = max(count, len(l))
    print(count)
                
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

n = min(a, b)
prime = [True] * (n + 1)
prime[0] = False
ans = []
for i in range(2, int(n ** 0.5) + 1):
    for j in range(i * 2, n + 1, i):
        prime[j] = False

tmp = [x for x in range(n + 1) if prime[x]]

for k in tmp:
    if a % k == 0 and b % k == 0:
        ans.append(k)
print(len(ans))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

n = min(a, b)
prime = [True] * (n + 1)
prime[0] = False
ans = []
for i in range(2, int(n ** 0.5) + 1):
    for j in range(i * 2, n + 1, i):
        prime[j] = False

tmp = [i for i in range(n + 1) if prime[i]]

for k in tmp:
    if a % k == 0 and b % k == 0:
        ans.append(i)
print(len(ans))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

n = min(a, b)
prime = [True] * (n + 1)
prime[0] = False
ans = []
for i in range(2, int(n ** 0.5) + 1):
    for j in range(i * 2, n + 1, i):
        prime[j] = False

tmp = [i for i in range(n + 1) if prime[i]]

for i in tmp:
    if a % i == 0 and b % i == 0:
        ans.append(i)
print(len(ans))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

n = min(a, b)
prime = [True] * (n + 1)
prime[0] = False
ans = []
for i in range(2, int(n ** 0.5) + 1):
    if not prime[i]:
        continue
    for j in range(i * 2, n + 1, i):
        prime[j] = False

tmp = [i for i in range(n + 1) if prime[i]]

for i in tmp:
    if a % i == 0 and b % i == 0:
        ans.append(i)
print(len(ans))

Submission status: Runtime Error

Solution code:
import math

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

g = math.gcd(A, B)

def prime_decompose(x):
    decomposed = []
    for i in range(2,int(pow(x,0.5))+1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed

g_dec = set(prime_decompose(g))
print(len(g_dec)+1)

Submission status: Runtime Error

Solution code:
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
mama = int(g ** (1/2))
for i in range(2,mama+2):
    while True:
        if g%i != 0:
            break
        else:
            g = g/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if g != 1:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import math

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

g = math.gcd(A, B)
d = []
p = []

for i in range(1,int(math.sqrt(g))+1):
    if g % i == 0:
        d.append(i)
        if i != g//i:
           d.append(g//i)

for i in d:
    s = 0
    for j in range(1,int(math.sqrt(i))+1):
        if i % j == 0:
            s += 1

    if s == 1:
        p.append(i)

print(len(p))

Submission status: Runtime Error

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
a,b=n1()
# from math import gcd
from fractions import gcd
m=gcd(a,b)

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)

    divisors.sort()
    return divisors

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

gcd_list=make_divisors(m)
if len(gcd_list)==1:
    print(1)
else:
    prime_list=primes(gcd_list[-1])
    ans=1
    for i in gcd_list[1:]:
        if i in prime_list:
            ans+=1
    print(ans)

Submission status: Runtime Error

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
a,b=n1()
from math import gcd
m=gcd(a,b)

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)

    divisors.sort()
    return divisors

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

gcd_list=make_divisors(m)
if len(gcd_list)==1:
    print(1)
else:
    prime_list=primes(gcd_list[-1])
    ans=1
    for i in gcd_list[1:]:
        if i in prime_list:
            ans+=1
    print(ans)

Submission status: Runtime Error

Solution code:
def p(n):
    i = 2
    t = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            t.append(i)
        i += 1
    if n > 1:
        t.append(n)
    return t


def main():
    from math import gcd
    a, b = map(int, input().split())
    g = gcd(a, b)
    print(len(set(p(g))) + 1)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

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

#最大公約数: greatest common divisor(gcd)
g = math.gcd(a,b)

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
print(len(set(prime_decomposition(g)))+1)

Submission status: Runtime Error

Solution code:
import math

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

#最大公約数: greatest common divisor(gcd)
g = math.gcd(a,b)
print(g)
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
print(len(set(prime_decomposition(g)))+1)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
from math import gcd
print(gcd(a,b))

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
from math import gcd
from itertools import combinations
gcd_n = gcd(a,b)

L = [i for i in range(1,gcd_n+1) if gcd_n%i==0]

def div(num):
    l = [1]
    if(num==1):
        return [1]
    while(num%2==0):
        num //=2
        l.append(2)
    f = 3
    while(f*f<=num):
        if num%f==0:
            num //= f
            l.append(f)
        else:
            f += 2
    
    if num!=1:
        l.append(num)
    return l

l = div(gcd_n)
cnt = 0
pre = 0
for i in range(len(l)):
    if pre==l[i]:
        continue
    pre = l[i]
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import math

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

def main():
    A, B = map(int, input().split())
    C = math.gcd(A,B)
    if C == 1:
        print(1)
    else:
        ans = prime_factorize(C)
        print(len(set(ans)) + 1)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import math

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

g = math.gcd(A, B)

print(len(set(prime_decomposition(g)))+1)

Submission status: Runtime Error

Solution code:
import collections
A, B = map(int, input().split())

a = collections.Counter(prime_factorize(A))
b = collections.Counter(prime_factorize(B))

l_a = list(a.keys())
l_b = list(b.keys())

ans = 1
for i in l_b:
  if i in l_a:
    ans += 1
    
print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd,sqrt

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

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

x = gcd(a,b)

print(len(factorization(x))+ (1 if len(factorization(x)) != 1 else 0))

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

limit = int((10**12 + 1)**0.5)
prime_table = [True] * (limit + 1)

for i in range(2, limit):
    if prime_table[i] is True:
        for j in range(i + i, limit, i):
            prime_table[j] = False

ans = set()
g = gcd(a, b)

for i in range(1, g + 1):
    if a % i == 0 and b % i == 0 and prime_table[i] is True:
        ans.add(i)

print(len(ans))

Submission status: Runtime Error

Solution code:
import math

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

limit = int((10**12 + 1)**0.5)
prime_table = [True] * (limit + 1)

for i in range(2, limit):
    if prime_table[i] is True:
        for j in range(i + i, limit, i):
            prime_table[j] = False

ans = set()
g = math.gcd(a, b)

for i in range(1, g + 1):
    if a % i == 0 and b % i == 0 and prime_table[i] is True:
        ans.add(i)

print(len(ans))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

limit = int((10**12 + 1)**0.5)
prime_table = [True] * (limit + 1)

for i in range(2, limit):
    if prime_table[i] is True:
        for j in range(i + i, limit, i):
            prime_table[j] = False

ans = set()

for i in range(1, a + 1):
    if a % i == 0 and prime_table[i] is True:
        ans.add(i)

for i in range(1, b + 1):
    if a % i == 0 and prime_table[i] is True:
        ans.add(i)

print(len(ans))

Submission status: Runtime Error

Solution code:
import math

A,B = map(int,input().split())
G = math.gcd(A,B)
count = 0
p = 1
for i in range(1,math.ceil(math.sqrt(G))+1,1):
    if G%i ==0:
        if math.gcd(p,i)==1:
            count +=1
            p = p*i
print(count)

Submission status: Runtime Error

Solution code:
import fractions as math

A,B = map(int,input().split())
G = math.gcd(A,B)
count = 0
p = 1
for i in range(1,math.ceil(math.sqrt(G))+1,1):
    if G%i ==0:
        if math.gcd(p,i)==1:
            count +=1
            p = p*i
print(count)

Submission status: Runtime Error

Solution code:
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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


# ===CODE===


def main():
    a, b = ns()

    g = math.gcd(a, b)

    def search(n):
        i = 2
        so = []
        while n != 1:
            while n % i == 0:
                n //= i
                so.append(i)
            i += 1
        return so

    print(len(set(search(g))) + 1)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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


# ===CODE===


def main():
    a, b = ns()

    g = math.gcd(a, b)

    def search(n):
        i = 2
        so = set()
        while n != 1:
            while n % i == 0:
                n //= i
                so.add(i)
            i += 1
        return so

    print(len(search(g)) + 1)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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


# ===CODE===


def main():
    a, b = ns()

    g = math.gcd(a, b)

    def search(n):
        i = 2
        so = set()
        while n != 1:
            while n % i == 0:
                n //= i
                so.add(i)
            i += 1

    print(len(search(g)) + 1)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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


# ===CODE===


def main():
    def make_divisors(a, b):
        divisors = []
        for i in range(1, min(a, b) + 1):
            if a % i == 0 and b % i == 0:
                divisors.append(i)

        # divisors.sort()
        return divisors

    a, b = ns()
    gcd = make_divisors(a, b)

    ans=0
    for i in range(len(gcd)):
        for j in range(i + 1, len(gcd)):
            if math.gcd(gcd[i], gcd[j]) == 0:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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


# ===CODE===


def main():
    def make_divisors(a, b):
        divisors = []
        for i in range(1, min(a, b) + 1):
            if a % i == 0 and b % i == 0:
                divisors.append(i)

        # divisors.sort()
        return divisors

    a, b = ns()
    gcd = make_divisors(a, b)

    ans=0
    for i in range(len(gcd)):
        for j in range(i + 1, len(gcd)):
            if gcd(gcd[i], gcd[j]) == 0:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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


# ===CODE===


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

        # divisors.sort()
        return divisors

    a, b = ns()
    a_gcd = make_divisors(a)
    b_gcd = make_divisors(b)

    ans=0
    for a in a_gcd:
        for b in b_gcd:
            if math.gcd(a,b)==1:
                ans+=1
    
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import fractions
from collections import defaultdict
A, B = map(int, input().split())
C = fractions.gcd(A, B)
D = set([1])
c = C
for i in range(2, C1):
    while c % i == 0:
        D.add(i)
        c //= i

print(len(D))

Submission status: Runtime Error

Solution code:
import math
from collections import defaultdict
A, B = map(int, input().split())
C = math.gcd(A, B)
D = set([1])
c = C
for i in range(2, C//2+1):
    while c % i == 0:
        D.add(i)
        c //= i

print(len(D))

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
koyaku = []
for i in range(a):
  if b % i == 0:
    koyaku.append(i)

youso = len(koyaku)
for i in range(youso):
  for j in range(youso):

Submission status: Runtime Error

Solution code:
import math

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

def factorization(n):
  factor=[]
  tmp=int(math.sqrt(n))+1
  for num in range(2,tmp):
    while n%num==0:
      n//=num
      factor.append(num)
      break
    if not factor:
      return 'prime number'
    else:
      factor.append(n)
      return factor

a_list=factorization(a)
b_list=factorization(b)

a_b_and=set(a_list)&set(b_list)
print(len(a_b_and)+1)

Submission status: Runtime Error

Solution code:
import math

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

def factorization(n):
  factor=[]
  tmp=int(math.sqrt(n))+1
  for num in range(2,tmp):
    while n%num==0:
      n//=num
      factor.append(num)
      break
    if not factor:
      return 'prime number'
    else:
      factor.append(n)
      return factor
a_list=factorization(a)
b_list=factorization(b)

a_b_and=set(a_list)&set(b_list)
print(len(a_b_and)+1)

Submission status: Runtime Error

Solution code:
import math

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:
            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
  
d = math.gcd(a,b)

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

Solution code:
import math

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:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    return arr

d = math.gcd(a,b)
print(len(factorization(d)) + 1)

Submission status: Runtime Error

Solution code:
import math

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:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)
    if temp!=1:
        arr.append(temp)
    return arr
  
a_list = factorization(a)
b_list = factorization(b)

d = math.gcd(a,b)
d_list = factorization(d)
print(len(d_list)+1)

Submission status: Runtime Error

Solution code:
import math

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

def factorization(n):
  arr=[]
  temp=n
  for i in range(2,int(math.sqrt(n))+1):
    if temp % i == 0:
      cnt = 0
      while temp % i == 0:
        cnt += 1
        temp /= int(i)
      arr.append(i)
    if temp != 1:
      arr.append(temp)
    return arr
d=math.gcd(a,b)
print(len(factorization(d))+1)

Submission status: Runtime Error

Solution code:
import math

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

def factorization(n):
  arr=[]
  temp=n
  for i in range(2,int(math.sqrt(n))+1):
    if temp % i == 0:
      cnt = 0
      while temp % i == 0:
        cnt += 1
        temp //= i
      arr.append(i)
    if temp != 1:
      arr.append(temp)
    return arr
d=math.gcd(a,b)
print(len(factorization(d))+1)

Submission status: Runtime Error

Solution code:
import math

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

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

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


    return arr
  
d = math.gcd(a,b)  
print(len(factorization(d)) + 1)

Submission status: Runtime Error

Solution code:
import math

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:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

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


    return arr
  
d = math.gcd(a,b)  
print(len(factorization(d)) + 1)

Submission status: Runtime Error

Solution code:
import math

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:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

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


    return arr
  
d = math.gcd(a,b)  
print(len(factorization(d)) + 1)

Submission status: Runtime Error

Solution code:
import math

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:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr
  
a_list = factorization(a)
b_list = factorization(b)

a_b_and = set(a_list) & set(b_list)
print(len(a_b_and) + 1)

Submission status: Runtime Error

Solution code:
import math
#素因数分解
def factorization(n):
    arr = [[1, 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, cnt])

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

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

    return arr

a, b = map(int, input().split())
g = math.gcd(a, b)
l = factorization(g)
print(len(l))

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    A, B = map(int, readline().split())
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(n**0.5)+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    print(len(factorize(gcd(A, B)))+1) 
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

A, B = min(A, B), max(A, B)

r = A
q = B % r

while not q == 0:
    N = q
    q = r % q
    r = q


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

r = set(prime_factorize(N))
num = len(r) + 1

print(num)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())

A, B = min(A, B), max(A, B)

r = A
q = B % r

while not q == 0:
    N = q
    q = r % q
    r = q

n = int(N**0.5)
num = 1

N1 = N

for i in range(2, N1):
    
    if N % i == 0:
        num += 1
    while N % i == 0:
        N /= i

    if N == 1:
        break

print(num)