Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03555 (python)

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    c1 = input()
    c2 = input()
    if c1 == c2[::-1] and c2 == c1[::-1]:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
num = 0
for i in range(1,N):
    if i*i> N:
        break
    else:
        num = i*i
print(num)
Problem p03556 (python)

Fixed submission:
N = int(input())
num = 0
for i in range(1,100000000):
    if i*i> N:
        break
    else:
        num = i*i
print(num)

Buggy submission (verdict: Runtime Error):
N = (input())
nums = []
for i in range(N):
    if i**2 <= N:
        nums.append(i)
print(max(nums)**2)
Problem p03657 (python)

Fixed submission:
def func(a, b):
    result = 'Possible' if (a + b) % 3 == 0 or a % 3 == 0 or b % 3 == 0 else 'Impossible'
    return result

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

print(func(A, B))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())
print('Possible' if A+B%3==0 else 'Impossible')
Problem p03672 (python)

Fixed submission:
# -*- coding: utf-8 -*-


def main():

    result = ''

    for i in range(1, len(S)):
        s = S[0:len(S) - i]

        if len(s) % 2 == 0 and s[0:len(s)//2] == s[len(s)//2:]:
            result = len(s)
            break

    print(result)


if __name__ == '__main__':
    S = input()
    main()

Buggy submission (verdict: Runtime Error):
S = input()
result = ''
for i in range(1, len(S)):
    s = S[0:len(S) - i]
	if len(s) % 2 == 0 and s[0:len(s)//2] == s[len(s)//2:]:
        result = len(s)
        break

print(result)
Problem p03693 (python)

Fixed submission:
c = input().split()
c = int(''.join(c))
if c % 4 == 0:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
r,g,b = input().split()
print('YES' if r+g+b%4==0 else 'NO')

Buggy submission (verdict: Runtime Error):
r, g, b = map(str, input().split())
rgb = r + g + b
if rgb % 4 == 0:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
r, g, b = map(str, input().split())
rgb = r + g + b
if rgb % == 0:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
# coding: utf-8

c = input()
c = int(''.join(c))
if c % 4 == 0:
	print('Yes')
else:
	print('NO')
Problem p03694 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
count = 0
for i in range(len(a)-1):
    count += int(a[0]) - int(a[1])
    a.pop(0)
print(count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    input()
    a = map(int, input().split())
    print(max(a) - min(a))
    

if __name__ == '__main__':
    main()
Problem p03712 (python)

Fixed submission:
H, W = map(int, input().split())
a = [input() for i in range(H)]
block = '#' * (W+2)
print(block)
for s in a:
    print('#' + s + '#')
print('#' * (W+2))

Buggy submission (verdict: Runtime Error):
H, W = map(input().split())
a = [input() for i in range(H)]
block = '#' * (W+2)
print(block)
for s in a:
    print('#' + s + '#')
print('#' * (W+2))
Problem p03760 (python)

Fixed submission:
O = input()
E = input()
S = ''
for i in range(len(E)):
    S += O[i] + E[i]
print(S if len(O) == len(E) else S+O[-1])

Buggy submission (verdict: Runtime Error):
O = input()
E = input()
S = ''
for i in range(len(E)):
    S += O[i] + E[i]
print(S if len(O) == len(E) else S+0[-1])
Problem p03826 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
area1 = A * B
area2 = C * D
print(area1 if area1 >= area2 else area2)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
print(max(A*B. C*D))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
list_area = [A * B, C * D]
print(list.max(list_area))
Problem p03827 (python)

Fixed submission:
x = 0
max_value = [0]

n = int(input())
s = input()

list = [i for i in s]

for j in list:
    if j == 'I':
        x += 1
        max_value.append(x)
    else:
        x -= 1
        max_value.append(x)
print(max(max_value))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

x = 0
l = []

for i in S:
    if i == 'I':
        x += 1
    elif i == 'D':
        l.append(x)
        x -= 1
print(max(l))

Buggy submission (verdict: Runtime Error):
 x = nums =0
 dic = {'I': 1, 'D': -1}
 for i in s:
     x += dic[i]
     nums = max(x, nums)
print(nums)
Problem p03957 (python)

Fixed submission:
s = list(input())
ans = ''
for i in s:
    if i in 'C':
        ans += i
    elif i in 'F':
        ans += i
print('Yes' if 'CF' in ans else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
res = [i for i in s if i == 'C' or i == 'F']
print('Yes' if res[0] + res[1] == 'CF' or res[1] + res[2] == 'CF' else'No')
Problem p03998 (python)

Fixed submission:
a = input()
b = input()
c = input()
sa = [a[i] for i in range(len(a))]
sb = [b[i] for i in range(len(b))]
sc = [c[i] for i in range(len(c))]
next = a[0]
while True:
    if next == 'a':
        if len(sa) == 0:
            print("A")
            exit(0)
        next = sa[0]
        sa.pop(0)
    if next == 'b':
        if len(sb) == 0:
            print("B")
            exit(0)
        next = sb[0]
        sb.pop(0)
    if next == 'c':
        if len(sc) == 0:
            print("C")
            exit(0)
        next = sc[0]
        sc.pop(0)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
turn = A[0]

while True:
    if turn == 'a':
        if len(A) == 0:
            print('A')
            break
        turn = A[0]
        A = A[:-1]
    if turn == 'b':
        if len(sb) == 0:
            print('B')
            break
        turn = B[0]
        B = B[:-1]
    if turn == 'c':
        if len(sc) == 0:
            print('C')
            break
        turn = C[0]
        C = C[:-1]

Buggy submission (verdict: Runtime Error):
b = input()
c = input()

sa = [i for i in a]
sb = [i for i in b]
sc = [i for i in c]

turn = sa[0]

while True:

    if turn == 'a':
        if len(sa) == 0:
            print('A')
            break
        turn = sa[0]
        sa.pop(0)

    if turn == 'b':
        if len(sb) == 0:
            print('B')
            break
        turn = sb[0]
        sb.pop(0)

    if turn == 'c':
        if len(sc) == 0:
            print('C')
            break
        turn = sc[0]
        sc.pop(0)
Problem p04019 (python)

Fixed submission:
# -*- coding: utf-8 -*-

s=set(input())
if s in [{'W','E'},{'N','S'},{'N','E','W','S'}]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


s = set(input())
if s in {{'N', 'S'}, {'W', 'E'}, {'N', 'W', 'S', 'N'}}:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


s = set(input())
if s in {{'N', 'S'}, {'W', 'E'}, {'N', 'W', 'S', 'N'}}:
    print('yes')
else:
    print('No')
Problem p04030 (python)

Fixed submission:
string = []
S = input()
for i in S:
    if i == '0':
        string += '0'
    elif i == '1':
        string += '1'
    elif i == 'B':
        if len(string) == 0:
            pass
        else:
            del string[-1]
print(''.join(string))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
for i in s:
    if i == '0' or i == '1':
        ans.append(i)
    elif i == 'B':
        ans.pop()
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
for i in s:
    if i =='0' or i == '1':
        ans.append(i)
    elif i == 'B':
        del ans[-1]
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
for i in s:
    if i =='0' or i == '1':
        ans.append(i)
    elif i == 'B':
        ans.pop(-1)
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
for i in s:
    if i =='0' or i == '1':
        ans.append(i)
    else:
        ans.pop()
print(''.join(ans))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
print(''.join(s))

Buggy submission (verdict: Runtime Error):
L, N = map(int, input().split())
nums = sorted([input() for i in range(N)])
print(''.join(nums))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    n.l = map(int, input().split())
    s = [input() for _ in range(n)]
    s.sort()
    print(''.join(s))

if __name__ == '__main__':
    main()
Problem p03071 (python)

Fixed submission:
A, B = map(int, input().split())
if A>B:
  print(2*A-1)
if A<B:
  print(2*B-1)
if A==B:
  print(A+B)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A>B:
  print("2A-1")
if A<B:
  print("2B-1")
if A==B:
  print("A+B")

Buggy submission (verdict: Runtime Error):
if A>B:
  print("2A-1")
if A<B:
  print("2B-1")
if A==B:
  print("A+B")
Problem p03071 (python)

Fixed submission:
def main():
    A,B = list(map(int, input().split()))

    ans = 0
    if A < B:
        ans += B
        B = B - 1
    else:
        ans += A
        A = A - 1

    if A < B:
        ans += B
        B = B - 1
    else:
        ans += A
        A = A - 1

    print(ans)

    return

if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):

def main():
    A = int(input())
    B = int(input())

    ans = 0
    if A < B:
        ans += B
        B = B - 1
    else:
        ans += A
        A = A - 1

    if A < B:
        ans += B
        B = B - 1
    else:
        ans += A
        A = A - 1

    print(ans)

    return

if __name__ == '__main__' :
    main()
Problem p03260 (python)

Fixed submission:
if __name__ == '__main__' :
    A,B = list(map(int, input().split()))
    if A%2 == 0 or B%2 == 0:
        print('No')
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    r = modlog(x, y)
    while r != 0:
        x = y
        y = r
        r = modlog(x, y)
    return y

def modlog(x, y):
    r = x % y
    return r

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    if len(dist_list) == 1:
        print (dist_list[0])
        exit()
        
    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    r = modlog(x, y)
    while r != 0:
        x = y
        y = r
        r = modlog(x, y)
    return y

def modlog(x, y):
    r = x % y
    return r

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

Buggy submission (verdict: Runtime Error):
from fraction import gcd

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

Buggy submission (verdict: Runtime Error):
from math import gcd
import functools

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    print(functools.reduce(gcd, dist_list))
Problem p03262 (python)

Fixed submission:
def gcd(x, y):
    r = modlog(x, y)
    while r != 0:
        x = y
        y = r
        r = modlog(x, y)
    return y

def modlog(x, y):
    r = x % y
    return r

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    if len(dist_list) == 1:
        print (dist_list[0])
        exit()
        
    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    r = modlog(x, y)
    while r != 0:
        x = y
        y = r
        r = modlog(x, y)
    return y

def modlog(x, y):
    r = x % y
    return r

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

Buggy submission (verdict: Runtime Error):
from fraction import gcd

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

Buggy submission (verdict: Runtime Error):
from math import gcd

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)
Problem p03264 (python)

Fixed submission:
N = int(input())

if (N % 2) == 0:
    ans = (N/2) ** 2
else:
    ans = int(N/2) * int(N/2 + 1)

print(int(ans))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())

ans = int(N/K) ** 3
if K%2 == 0:
    ans += int(N/int(K/2) - int(N/K)) ** 3
    
print(ans)
Problem p03085 (python)

Fixed submission:
#!/usr/bin/env python
a = input()
s = (("A", "T"), ("C", "G"))
d = dict(s)
d.update(dict(i[::-1] for i in s))

print(d[a])

Buggy submission (verdict: Runtime Error):
a = input()
s = (("A", "T"), ("C", "G"))
d = dict(s)+ dict(i[::-1] for i in s)

print(d[a])
Problem p03080 (python)

Fixed submission:
N = int(input())
s = input()

R = 0
B = 0
for c in s:
    if c == 'R':
        R += 1
    else:
        B +=1
        
if R > B:
    re = 'Yes'
else:
    re = 'No'
    
print(re)

Buggy submission (verdict: Runtime Error):
Jupyter Notebook
Untitled
(unsaved changes)
Current Kernel Logo
Python 3 
File
Edit
View
Insert
Cell
Kernel
Widgets
Help

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

if A == B and B == C:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
A, B, C = list(map(int, input().split()))
​
if A == B and B == C:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
3 4 5
No
1
N = int(input())
s = input()
​
R = 0
B = 0
for c in s:
    if c == 'R':
        R += 1
    else:
        B +=1
        
if R > B:
    re = 'Yes'
else:
    re = 'No'
    
print(re)
4
BRBR
No
​
Problem p03197 (python)

Fixed submission:
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    if a[i] % 2 == 0:
        s += 1
        
if s == N:
    re = 'second'
else:
    re = 'first'
    
print(re)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    s += a[i]

if N >= 2:
    if s == N or s == len(collections.Counter(a)):
        if s % 2 ==0:
            re = 'second'
        else:
            re = 'first'
    else:
        a.sort()
        diff = a[-1] - a[-2]
        if diff > 0:
            if diff % 2 == 0:
                re = 'second'
            else:
                re = 'first'
else:
    if a[0] % 2==0:
        re = 'second'
    else:
        re = 'first'
    
print(re)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))

a.sort()
diff = a[-1] - a[-2]
if diff % 2 == 0:
    re = 'second'
else:
    re = 'first'
    
print(re)
Problem p03231 (python)

Fixed submission:
# A
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N, M = list(map(int, input().split()))
S = input()
T = input()

re = -1
if S == T:
    re = N
elif S[0] == T[0]:
    min_num = (N * M)  // gcd(N, M) # 最小公倍数を求める（基本はこれが答え）
    re = min_num
    # 重なる部分が同じ文字かを調べる
    s_d = min_num // N
    t_d = min_num // M
    # 最小公倍数みる
    st_min = (s_d * t_d) // gcd(s_d, t_d)
    st = st_min
    i = 1
    while st // s_d < N and st // t_d < M:
        if S[st // s_d] != T[st // t_d]:
            re = -1
            break
        else:
            i += 1
            st = st_min * i

print(re)

Buggy submission (verdict: Runtime Error):
# A
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N, M = list(map(int, input().split()))
S = input()
T = input()

re = -1
# 1文字目が必ず一緒であること
if S[0] == T[0]:
    min_num = (N * M)  // gcd(N, M) # 最小公倍数を求める（基本はこれが答え）
    re = min_num
    # 重なる部分が同じ文字かを調べる
    s_d = min_num // N
    t_d = min_num // M
    # 最小公倍数みる
    st_min = (s_d * t_d) // gcd(s_d, t_d)
    st = st_min
    i = 1
    while st // s_d <= N and st // t_d <= M:
        if S[st // s_d] != T[st // t_d]:
            re = -1
            break
        else:
            i += 1
            st = st * i

print(re)

Buggy submission (verdict: Runtime Error):
import math

N, M = list(map(int, input().split()))
S = input()
T = input()

# L はNとMのどちらでも割り切れる
# Xの1, L/N + 1 , 2 *  L/N + 1, ... (N-1) * L/N + 1の文字列を連結するとS 長さはN
# Xの1, L/M + 1 , 2 *  L/M+ 1, ... (M-1) * L/M + 1の文字列を連結するとT 長さはM

re = -1
# 1文字目が必ず一緒であること
if S[0] == T[0]:
    min_num = (N * M)  // math.gcd(N, M) # 最小公倍数を求める（基本はこれが答え）
    re = min_num
    # 重なる部分が同じ文字かを調べる
    s_d = min_num // N
    t_d = min_num // M
    # 最小公倍数みる
    st_min = (s_d * t_d) // math.gcd(s_d, t_d)
    st = st_min
    while st < N and st < M:
        if S[st // (min_num // N)] != T[st // (min_num // M)]:
            re = -1
            break

print(re)
Problem p03241 (python)

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


def divisorize(fct):
    b, e = fct.pop() 
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

N, M = list(map(int, input().split()))

if M == 1:
    print(1)
else:
    re = 1
    fa = factorize(M)
    div_list = divisorize(fa)

    for i in range(len(div_list)):
        num = 1
        for j in range(len(div_list[-1 - i])):
            l = div_list[-1-i][j]
            num *= l[0] ** l[1]
        d = M // num 
        if d >= N and num > re:
            re = num
    print(re)

Buggy submission (verdict: Runtime Error):
def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop() 
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

N, M = list(map(int, input().split()))

re = 1
fa = factorize(M)
div_list = divisorize(fa)

for i in range(len(div_list)):
    num = 1
    for j in range(len(div_list[-1 - i])):
        l = div_list[-1-i][j]
        num *= l[0] ** l[1]
    d = M // num 
    if d >= N and num > re:
        re = num
print(re)
Problem p03251 (python)

Fixed submission:
N, M , X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

min_y = min(y)
max_x = max(x)

count_x = sum(t < min_y for t in x)

re = 'War'
if count_x == N : # and count_y == M:
    if  X < min_y and min_y <= Y:
        re = 'No War'
    elif X < max_x + 1 and max_x + 1 <= Y:
        re = 'No War'
    
print(re)

Buggy submission (verdict: Runtime Error):
N, M , X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

min_y = min(y)
max_x = max(x)

count_x = sum(min_y < Z for t in x)

re = 'War'
if count_x == N : # and count_y == M:
    if  X < min_y and min_y <= Y:
        re = 'No War'
    elif X < max_x + 1 and max_x + 1 <= Y:
        re = 'No War'
    
print(re)
Problem p03274 (python)

Fixed submission:
N,K = list(map(int,input().split()))
x = list(map(int,input().split()))

s = 0
e = K - 1

re = min(abs(x[s]) + abs(x[s] - x[e]), abs(x[e]) + abs(x[e] - x[s]))
while e < N:
    tmp = min(abs(x[s]) + abs(x[s] - x[e]), abs(x[e]) + abs(x[e] - x[s]))
    re = min (re, tmp)
    s += 1
    e += 1
    
print(re)

Buggy submission (verdict: Runtime Error):
# C
N,K = list(map(int,input().split()))
x = list(map(int,input().split()))

def binarySearch(D, target):
    left = 0
    right = len(D)
    while left < right:
        mid = (left + right) // 2
        if D[mid] == target:
            return mid, 0
        elif target < D[mid]:
            right = mid
        else:
            left = mid + 1
    return mid, 1

# 全てが正の場合
if x[0] >= 0:
    re = x[K-1]
# 全てが負の場合
elif x[-1] <= 0:
    re = abs(x[-K]) # 絶対値
else:
    zero, plus = binarySearch(x, 0)
    s = zero + plus
    e = s + K +1
    if e > N:
        s = s - (e - N) + 1
        e = N - 1
    if N == K:
        s = 0
        e = N
    d_plus = x[e]
    d_minor =  abs(min(x[s], 0)) 
    d_min = 2 * min(d_plus, d_minor) + max(d_plus, d_minor)
    while True:
        d_plus = x[e]
        if d_plus < 0:
            d_plus = 0
        d_minor =  abs(min(x[s], 0)) 
        d = 2 * min(d_plus, d_minor) + max(d_plus, d_minor)
        d_min = min(d_min, d)
#        print(x[s], x[e], d_min)
        e -= 1
        s -= 1
        if e < zero + plus or s < 0:
            break
    re = d_min
    
print(re)
Problem p03281 (python)

Fixed submission:
import math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

re = 0
for i in range(1, N+1, 2):
    num = search_divisor_num(i)
    if num == 8:
        re += 1
        
print(re)

Buggy submission (verdict: Runtime Error):
# B
import math
N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

re = 0
for i in range(1, N+1, 2):
    num = search_divisor_num(i)
    if num == 8:
        re += 1
        
print(re)