Problem p02900 (python)

Fixed submission:
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

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

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

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

        return arr

    _GCD=factorization(GCD)
    num_list=[1]
    for num in _GCD:
        num_list+=[num[0]]
    #これで素因数分解の加工が完全に完了
    print(len(num_list))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

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

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

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

    return arr

_GCD=factorization(GCD)
num_list=[]
for num in _GCD:
    num_list+=[num[0]]*num[1]
ans_list=np.array([1])
for n in num_list:
    ans_list=np.r_[ans_list,ans_list*n]
#これで素因数分解の加工が完全に完了

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

Buggy submission (verdict: Runtime Error):
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

num_list=np.arange(1,GCD+1)
count=0

#1から調べていき、逐一倍数をリストから消していく
while not list(num_list) == [] :
    num=num_list[0]
    if A%num==0 and B%num==0:
        count+=1
        if num==1:
            num_list=num_list[~(num_list==1)]
        else:
            num_list=num_list[~(num_list % num == 0)]
    else:
        num_list=num_list[~(num_list % num == 0)]
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

num_list=np.arange(1,GCD+1)
count=0

#1から調べていき、逐一倍数をリストから消していく
while not list(num_list) == [] :
    num=num_list[0]
    if A%num==0 and B%num==0:
        count+=1
        if num==1:
            num_list=num_list[~(num_list==1)]
        else:
            num_list=num_list[~(num_list % num == 0)]
    else:
        num_list=num_list[~(num_list % num == 0)]
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

num_list=np.arange(1,GCD+1)
count=0
while not list(num_list) == [] :
    num=num_list[0]
    if A%num==0 and B%num==0:
        count+=1
        if num==1:
            num_list=num_list[~(num_list==1)]
        else:
            num_list=num_list[~(num_list % num == 0)]
    else:
        num_list=num_list[~(num_list % num == 0)]
print(count)