Problem p02900 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([], dtype='int')
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a //= i
if a != 1:
    soin_a = np.append(soin_a, a)

soin_b = np.array([], dtype='int')
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b //= i
if b != 1:
    soin_b = np.append(soin_b, b)

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size != 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


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

if a > b:
    max_num = int(np.sqrt(a))
else:
    max_num = int(np.sqrt(b))

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= max_num:
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    if num_list.size == 0:
        break
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


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

if a > b:
    max_num = np.sqrt(a)
else:
    max_num = np.sqrt(b)

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= max_num:
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


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

if a > b:
    max_num = a
else:
    max_num = b

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= np.sqrt(max_num):
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


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

if a > b:
    max_num = a
else:
    max_num = b

prime_list = mk_prime_list(max_num)

ans = 1

for i in prime_list:
    if a % i == 0 and b % i == 0:
        ans += 1

print(ans)