Problem p02900 (python)

Fixed submission:
C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]
I = []

for i in range(1,N):
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            I.extend([J[i]])
            if int(len(I)) >=2:
                break
    if int(len(I)) == 1:
        M.extend([J[i]])
    I = []


M = int(len(M))

print(M)

Buggy submission (verdict: Runtime Error):
C,D = [int(e) for e in input().split()]
if C <= D:
    m = D
    n = C
else:
    m = C
    n = D
while  n != 0 :
    a = m%n
    m = n
    n = a
J = []
for i in range(1,int(m**0.5)+1):　#与えられた2整数の最大公約数を元に公約数を列挙している.
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)
J.sort()
#N = int(len(J))
count = 1
#I = []
for j in J:　　　#公約数のうちどれとも互いに素であるもの、すなわち素数を探している.
    cnt = 0
    for p in range(1,int(j**0.5)+1):
        if j%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if cnt == 1:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]

for i in range(1,N):
    cnt = 0
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if icnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

Buggy submission (verdict: Runtime Error):
C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]

for i in range(1,N):
   cnt = 0
   for p in range(1,int(J[i]**0.5)+1):
       if J[i]%p == 0:
           cnt += 1
           if cnt >=2:
               break
    if cnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

Buggy submission (verdict: Runtime Error):
C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]
I = []

for i in range(1,N):
   cnt = 0
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if cnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

Buggy submission (verdict: Runtime Error):
C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []
for i in range(1, int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]
I = []

for i in range(1,N):
    for p in range(1,int(J[i]**0.5)+1:
        if J[i]%p == 0:
            I.extend([J[i]])
    if int(len(I)) == 1:
        M.extend([J[i]])
    I = []


M = int(len(M))

print(M)