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

Fixed submission:
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(h):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h+1):
    for k in range(1, w+1):
        if arr[j][k] == "#":
            if (arr[j-1][k] == '.') and (arr[j][k-1] == '.') and (arr[j+1][k] == '.') and (arr[j][k+1] == '.'):
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(h):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h+1):
    for k in range(1, w+!):
        if arr[j][k] == "#":
            if (arr[j-1][k] == '.') and (arr[j][k-1] == '.') and (arr[j+1][k] == '.') and (arr[j][k+1] == '.'):
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(w):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

print(arr)
flg = 0    

for j in range(1, h+1):
    for k in range(1, w+1):
        if arr[j][k] == "#":
            if (arr[j-1][w] == '.') and (arr[j][w-1] == '.') and (arr[j+1][w] == '.') and  (arr[j][w+1] == '.'):
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(w):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h):
    for k in range(1, w):
        if arr[j][k] == "#":
            if (arr[j-1][w] == '.') and (arr[j][w-1] == '.') and (arr[j+1][w] == '.') and  (arr[j][w+1] == '.'):
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(w):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h):
    for k in range(1, w):
        if arr[j][k] == "#":
            if arr[j-1][w] == arr[j][w-1] == arr[j+1][w] == arr[j][w+1] == '.':
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):

N = int(input())
Z=[]
for i in range(N):
	t, x, y = map(int, input().split())
	if t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			Z.append(1)
		else:
			Z.append(0)
	else:
		if x + y <= t and (x + y) % 2 == 1:
			Z.append(1)
		else:
			Z.append(0)
	i += 1
if Z.count(0) >=1:
	print('No')
else:
	print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
a, b = map(int, input().split())
if  b == 100:
    z = a*100 + b
elif b >= 10 and  b < 100:
    z = a*100 + b
elif b >= 0 and  b < 10:
    z = a*10 + b

e = np.sqrt(z)
f = float(e) - int(e)
if bool(f) == False:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a*b/2 % 0:
  print("Even")
  else:
    print("Odd")
Problem p03457 (python)

Fixed submission:

N = int(input())
Z=[]
for i in range(N):
	t, x, y = map(int, input().split())
	if t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			Z.append(1)
		else:
			Z.append(0)
	else:
		if x + y <= t and (x + y) % 2 == 1:
			Z.append(1)
		else:
			Z.append(0)
	i += 1
if Z.count(0) >=1:
	print('No')
else:
	print('Yes')

Buggy submission (verdict: Runtime Error):

N = int(input())
Z=[]
for i in range(N):
	t, x, y = map(int, input().split())
	if t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			Z.append(1)
		else:
			Z.append(0)
	else:
		if x + y <= t and (x + y) % 2 == 1:
			Z.append(1)
		else:
			Z.append(0)
	i += 1

if Z.index(0) >= 1:
	print('No')
else:
	print('Yes')
Problem p03478 (python)

Fixed submission:

N, A, B = map(int,input().split())
ans = 0
arr = []
for y in range(N+1):
	i = y
	while i >= 1:
		arr.append(int(i % 10))
		i /= 10
	if sum(arr) <= B and sum(arr) >= A:
		ans += y
		arr = []
	else:
		arr = []

print(ans)

Buggy submission (verdict: Runtime Error):

N = int(input())
A, B = map(int,input().split())
ans = 0
arr = []
for y in range(N+1):
	i = y
	while i >= 1:
		arr.append(int(i % 10))
		i /= 10
	if sum(arr) <= B and sum(arr) >= A:
		ans += sum(arr)
		arr = []
	else:
		arr = []

print(ans)
Problem p03854 (python)

Fixed submission:
s = input()

while len(s)>4:
    if s[-5:] == 'dream':
        s = s[:-5]
        continue
    elif s[-7:] == 'dreamer':
        s = s[:-7]
        continue
    elif s[-5:] == 'erase':
        s = s[:-5]
        continue
    elif s[-6:] == 'eraser':
        s = s[:-6]
        continue
    else:
        break
if len(s)>0 :
    print('NO')
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
s = input()

while len(s)>4:
    if s[-5:] == 'dream':
        s = s[:-5]
        continue
    elif s[-7:] == 'dreamer':
        s = s[:-7]
        continue
    elif s[-5:] == 'erase':
        s = s[:-5]
        continue
    elif s[-6:] == 'eraser':
        s = s[:-6]
        continue
    else:
        beak
if s =='' :
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = input()

while len(s)>4:
    if s[-5:] == 'dream':
        s = s[:-5]
    elif s[-7:] == 'dreamer':
        s = s[:-7]
    elif s[-5:] == 'erase':
        s = s[:-5]
    elif s[-6:] == 'eraser':
        s = s[:-6]
    else:
        beak
if s =='' :
    print('YES')
else:
    print('NO')
Problem p02778 (python)

Fixed submission:
s= input()
x = "x" * len(s)
print(x)

Buggy submission (verdict: Runtime Error):
s= input()
for i in range(len(s)):
  puts("x")
Problem p02612 (python)

Fixed submission:
N = int(input())
yen = 1000

if N % 1000 == 0:
    ans = 0
else:
    while N > 0:
        N = N - yen
    ans = abs(N)

print(ans)

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

yen = 1000

if N % 1000 == 0:
    ans = 0
else:
    n = str(N)
    a = int(n[1:])
    ans = yen - a

print(ans)
Problem p02657 (python)

Fixed submission:
a, b = map(int, input().split())

print(a*b)

Buggy submission (verdict: Runtime Error):
import functools
import operator
n = int(input())
a = list(map(int, input().split()))

ans = functools.reduce(operator.mul, a)
if ans > 10 ** 18:
    print('-1')
else:
    print(ans)
Problem p02675 (python)

Fixed submission:
a = input(str())

# print(a[-1])

hon = ['2', '4', '5', '7', '9']
pon = ['0', '1', '6', '8']

for h in hon:
    if a[-1] == h:
        print('hon')

for p in pon:
    if a[-1] == p:
        print('pon')

if a[-1] == '3':
    print('bon')

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np 

exit_list = []
feature_fish = []
count=0
N = int(input())
num_fish = np.arange(N)
for i in range(N):
    A, B = (int(x) for x in input().split())
    feature_fish.append([A, B])

num_fish_seq = list(itertools.combinations(num_fish,2))
for i in range(len(num_fish_seq)):
    x = feature_fish[num_fish_seq[i][0]]
    y = feature_fish[num_fish_seq[i][1]]
    hontei = x[0]*y[0] + x[1]*y[1]
    if hontei != 0:
        count += 1
    else:
        exit_list.append(num_fish_seq[i])

for i in range(2, N):
    demo = list(itertools.combinations(num_fish, i+1))
    for k in range(len(demo)):
        check = 0
        for i in range(len(exit_list)):
            if not(set(exit_list[i]) <= set(demo[k])):
                check += 1
                if check == len(exit_list):
                    count += 1

result = count + len(num_fish)
answer = result % 1000000007
print(answer)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
a = t[-1]

S = s + a
if t == S:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(2*A + B - K)
Problem p02911 (python)

Fixed submission:
from collections import Counter
import numpy as np

N, K, Q = input().split()
A = np.array([int(input()) for i in range(int(Q))])
T = np.full(int(N), int(K))
T -= int(Q)
#unique, counts = np.unique(A, return_counts=True)
#s =  dict(zip(unique, counts))
s = Counter(A)
for key, value in s.items():
    T[(key-1)] += value
for i in T:
    if i <= 0:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K, Q = input().split()
A = np.array([int(input()) for i in range(int(Q))])
T = np.full(int(N), int(K))
unique, counts = np.unique(A, return_counts=True)
s =  dict(zip(unique, counts))
for key, value in s.items():
    T[0:(key-1)] -= value
    T[key:len(T)] -= value
for i in T:
    if i <= 0:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K, Q = input().split()
A = np.array([int(input()) for i in range(int(Q))])
T = np.full(int(N), int(K))
unique, counts = np.unique(A, return_counts=True)
s =  dict(zip(unique, counts))
for key, value in s.items():
    T[0:(key-1)] -= value
    T[key:len(T)] -= value
for i in T:
    if i <= 0:
        print("No")
    else:
        print("Yes")
Problem p02952 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N + 1):
	if len(str(i)) % 2 == 1:
		ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1, N + 1):
	if len(str(i)) % 2 == 1:
	ans += 1
print(ans)
Problem p02958 (python)

Fixed submission:
import copy

N = int(input()) 
s = list(map(int, input().split()))
s2 = copy.deepcopy(s)
s.sort()
n = 0
for i in range(0, len(s)):
    if s[i] - s2[i] != 0:
        #print(s[i], s2[i])
        n+=1

if n == 2:
  print("YES")
elif n == 0:
    print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import copy

N = int(input()) 
s = list(map(int, input().split()))
s2 = copy.copy(s)
s.sort(reverse=True)
n = 0
for i in range(0, len(x)):
    if x[i] - x2[i] != 0:
        n+=1
if n == 2:
  print("YES")
else:
  print("NO")
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
A_sorted = sorted(A)
for i in range(N):
    if A[i] != A_sorted[-1]:
        print(A_sorted[-1])
    else:
        j = len(A_sorted) - 1
        count = 0
        while A[i] == A_sorted[j] and count <= 0:
            j -= 1
            count += 1
        print(A_sorted[j])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
A_sorted = sorted(A)
for i in range(N):
    if A[i] != A_sorted[-1]:
        print(A_sorted[-1])
    else:
        j = len(A_sorted) - 1
        count = 0
        while A[i] == A_sorted[j] and count =< 0:
            j -= 1
            count += 1
        print(A_sorted[j])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
A_sorted = sorted(A)
for i in range(N):
    if A[i] != A_sorted[-1]:
        print(A_sorted[-1])
    else:
        j = len(A_sorted) - 1
        while A[i] == A_sorted[j]:
            j -= 1
        print(A_sorted[j])
Problem p03005 (python)

Fixed submission:
line = input().split()
a, b = int(line[0]), int(line[1])
print(a%b)

Buggy submission (verdict: Runtime Error):
import sys
line = sys.stdin.readline().strip("\n").split(" ")
print(line[0]%line[1])

Buggy submission (verdict: Runtime Error):
import sys
line = sys.stdin.readline().strip("\n").split(" ")
return line[0]%line[1]
Problem p03280 (python)

Fixed submission:
A,B = input().split(" ")
A = int(A)
B = int(B)
print((A-1) * (B-1))

Buggy submission (verdict: Runtime Error):
A,B = input().split("")
A = int(A)
B = int(B)
if A == B:
  print((A-1) * (B-1))
else:
  print((A-1)*B)
Problem p02609 (python)

Fixed submission:
import sys

input = sys.stdin.readline

n = int(input())
y = str(input())
# n = 10**5
# y  = '1' * n
ones = 0
for i in y:
    if i == '1': ones += 1
x = int(y, 2)

def get(z):
    ret = 0
    while z > 0:
        if z % 2 == 1:
            ret += 1
        z //= 2
    return ret

out = []
rem1 = -1
rem2 = -1
if ones > 1:
    rem1 = x % (ones - 1)
if ones < n:
    rem2 = x % (ones + 1)

def calc(p, m):
    if p <= 2:
        return (1 << p) % m
    a = p // 2
    ret = calc(a, m)
    ret = (ret * ret) % m
    if p % 2 == 1:
        ret = (ret * 2) % m
    return ret



for i in range(n):
    # tmp = (1 << i) * -1
    o = ones - 1
    if y[n - i - 1] == '0':
        # tmp = 1 << i
        o = ones + 1

    # tmp = tmp + x
    if o == 0:
        out.append(0)
        continue
    if o == 1:
        out.append(1)
        continue


    if o > ones:
        tmp = (rem2 % o + calc(i, o)) % o
    else:
        tmp = (rem1 % o - calc(i, o) + o) % o


    cnt = 1
    while tmp > 0:
        tmp %= get(tmp)
        cnt += 1

    out.append(cnt)

for i in range(n):
    print(out[n-i-1])

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

n = int(input())
y = str(input())
ones = 0
for i in y:
    if i == '1': ones += 1
x = int(y, 2)

def get(z):
    ret = 0
    while z > 0:
        if z % 2 == 1:
            ret += 1
        z //= 2
    return ret

out = []
for i in range(n):
    tmp = (1 << i) * -1
    o = ones - 1
    if y[n - i - 1] == '0':
        tmp = 1 << i
        o = ones + 1

    tmp = tmp + x
    if tmp == 0:
        out.append(0)
    cnt = 1
    tmp %= o
    while tmp > 0:
        tmp %= get(tmp)
        cnt += 1

    out.append(cnt)

for i in range(n):
    print(out[n-i-1])
Problem p02621 (python)

Fixed submission:
a = int(input())
sum_a = a + a**2 + a**3
print(sum_a)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(sum(a+a**2+a**3))
Problem p02687 (python)

Fixed submission:
S = input()

if (S == "ARC"):
    print("ABC")
else:
    print("ARC")

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

if (S == "ARC):
    print("ABC")
else:
    print("ARC")
Problem p02783 (python)

Fixed submission:
h, a = map(int, input().split())

i = 0

while h > 0:
    h = h - a
    i += 1

print(i)

Buggy submission (verdict: Runtime Error):
import math
H,S = map(int,input().split())
i=1
if(H<=S):
  print(1)
elif(H>S):
  N = math.floor(H/S)
print(N)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
i=1
for(i in range(N)):
    He=N*i
    if(H<He):
      break
    else:
      continue
print(i)
Problem p02811 (python)

Fixed submission:
K,X = input().split()
res=int(K)*500
if(res>=int(X)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
K,X = input().split()
res=int(K)*500
if(res=>int(X)):
    print("Yes")
else:
    print("No")
Problem p02830 (python)

Fixed submission:
n = int(input())
s,t = input().split()
 
ans = []
 
for i in range(n):
    ans.append(s[i])
    ans.append(t[i])
    
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T = input("Enter a two value: ").split(' ') 
if((len(S)==N)&&(len(T)==N)):
  print(S+T)

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T = input("Enter a two value: ").split() 
if((len(S)==N)&&(len(T)==N)):
  print(S+T)

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T = map(String, input().split()) 
if(len(S)==len(T)):
  print(S+T)
Problem p02899 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
arrN=[0]*N
for i in range(N):
    arrN[A[i]-1]=i+1
print(*arrN)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
arrN=[0]*n
for i in range(N):
    arrN[A[i]-1]=i+1
print(*arrN)
Problem p03219 (python)

Fixed submission:
n,m = map(int,input().split())
print(n+(m//2))

Buggy submission (verdict: Runtime Error):
X, Y = int(input().split)
T=0
T=Y/2
print(X+T)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())

def calculate(W, H, x, y):
	way = 0
	area = W*H/2.0
	if(x==W/2 and y==H/2):
		way = 1
	return area, way

area, way = calculate(W, H, x, y)

print("%f %d" % (area, way))

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

def calculate(W, H, x, y):
	total_area = W*H
	way = 0
	if(x==W/2 or y==H/2):
		area = total_area/2
	if(x==W/2 and y==H/2):
		way = 1
	return area, way

area, way = calculate(W, H, x, y)

print("%f %d" % (area, way))

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

def calculate(W, H, x, y):
	total_area = W*H
	if(x==W/2 or y==H/2):
		area = total_area/2
	if(x==W/2 and y==H/2):
		way = 1
	else:
		way = 0
	return area, way

area, way = calculate(W, H, x, y)

print("%f %d" % (area, way))
Problem p03005 (python)

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

if(K==1):
  print(0)
else:
  print(N-K)

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

if(K==1 or N==K):
  return 0
return N-K
Problem p03032 (python)

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

ans = -10**9
R = min(N, K)
A = R
for a in range(0, A+1):
    B = R-a
    for b in range(0, B+1):
        if b>0:
            v = V[:a] + V[-b:]
        else:
            v = V[:a]
        
        v.sort()
        
        cnt = 0
        for vv in v:
            if vv<0:
                cnt += 1
            else:
                break
        ans = max(ans, sum(v[min(K-a-b, cnt):]))
        
print(ans)

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

ans = -10**9
R = min(N, K)
A = R
for a in range(0, A+1):
    B = R-a
    for b in range(0, B+1):
        if b>0:
            v = V[:a] + V[-b:]
        else:
            v = V[:a]
        
        v.sort()
        
        cnt = 0
        for vv in v:
            if vv<0:
                cnt += 1
            else:
                break
        ans = max(ans, sum(v[min(K-a-b, cnt):]))
        
print(ans)
Problem p02608 (python)

Fixed submission:
n = int(input())

ans = [0]*10001
a = [1,1,1]

while (a[0]+1)**2 <= n-2:
    a[1]=1
    while (a[1]+a[0])*(a[1]+1)+a[0]**2<=n-1:
        a[2]=1
        while a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0] <= n:
            ans[a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0]] += 1
            a[2] += 1
        a[1]+=1
    a[0]+=1
for i in range(1,n+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())

ans = [0]*10000
a = [1]*3

while (a[0]+1)**2 <= n-2:
    a[1]=1
    while (a[1]+a[0])*(a[1]+1)+a[0]**2<=n-1:
        a[2]=1
        while a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0] <= n:
            ans[a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0]] += 1
            a[2] += 1
        a[1]+=1
    a[0]+=1
for i in range(n):
    print(ans[i])
Problem p02582 (python)

Fixed submission:
a = input()
emp = 0
l = a.split('S')
while("" in l):
   l.remove("")
if not l:
   print(emp)
else:
   print(len(l[0]))

Buggy submission (verdict: Runtime Error):
a = input()
l = a.split('S')
while("" in l):
   l.remove("")
print(len(l[0]))
Problem p03085 (python)

Fixed submission:
z =input()

if z == "A":
    print("T")
elif z == "T":
    print("A")
elif z == "G":
    print("C")
elif z == "C":
    print("G")

Buggy submission (verdict: Runtime Error):
z =input()

if z == "A":
    print("T")
else if z == "T":
    print("A")
else if z == "G":
    print("C")
else if z == "G":
    print("G")
Problem p02606 (python)

Fixed submission:
L, R, d = map(int, input().split())

cnt = 0
for i in range(L, R+1):
    if i % d == 0:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
cnt = 0
for i in range(L, R+1):
    if i % d == 0:
        cnt += 1
print(cnt)
Problem p02641 (python)

Fixed submission:
#!/usr/bin/env python3

#!/usr/bin/env python3

X,N = map(int, input().split())
if N == 0:
    print(X)
    exit()

A = list(map(int, input().split()))
Min = 101

cnt = -200
for i in range(1,400):
    #print(cnt)
    if cnt in A:
        cnt += 1
        continue
    if abs(cnt-X) < Min:
        ans = cnt
        Min = abs(cnt-X)
    cnt += 1
print(ans)

Buggy submission (verdict: Runtime Error):
X,N = map(int, input().split())
A = list(map(int, input().split()))
Min = 101

for i in range(1,101):
    if i in A:
        continue
    if abs(i-X) < Min:
        ans = i
        Min = abs(i-X)
print(ans)
Problem p02645 (python)

Fixed submission:
S = input()
print(S[:3])

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if (W-V) == 0:
    print("NO")
elif (A-B) % (V-W) != 0:
    print("NO")
else:
    ans = (A-B)//(V-W)
    #print(ans)
    if 1 <= ans <= T:
        print("YES")
    else:
        print("NO")
Problem p02678 (python)

Fixed submission:
from collections import deque
    
def bfs(graph,start): #def bfs(graph,start,limit): 
    dist = [-1] * (N)
    ans = [-1] *(N)
    dist[start]= 0
    q = deque([start])
    cnt = 0
    while q:
        x = q.popleft()
        for i in graph[x]:
            #if dist[x] >= limit:
            #    break
            if dist[i] == -1:
                dist[i] = dist[x] + 1
                ans[i] = x+1
                q.append(i)
    return dist, ans

N,M  = map(int,input().split())# 頂点数
X = [[] for i in range(N)] #辺リスト

for i in range(M):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

dist,ans = bfs(X,0)
#print(dist,ans)
if -1 in dist:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
import collections
from collections import defaultdict

N = int(input())
iwa = []
mod = 10**9+7
cnt = 0
for i in range(N):
    a, b = map(int,input().split())
    if a == 0 and b == 0:
        cnt = 1
        continue
    elif b == 0:
        iwa.append((1,0))
    elif a == 0:
        iwa.append((0,1))
    elif b > 0:
        c = math.gcd(a,b)
        iwa.append((a/c, b/c))#bは正
    else:
        c = math.gcd(a,b)
        iwa.append((-a/c, -b/c))#bは正
        
S = set(iwa)
I = collections.Counter(iwa)
#print(I)
jdg = defaultdict(int)

ans = 1
for i in S:
    if jdg[i] == 1:
        continue
    elif i == (1,0) or i == (0,1):
        k = I[(1,0)]
        l = I[(0,1)]
        if min(k,l) == 0:
            ans *= pow(2,max(l,k),mod)
        else:
            ans *= (pow(2,l,mod)-1) + (pow(2,k,mod)-1)+1
        jdg[(1,0)] = 1
        jdg[(0,1)] = 1
    else:
        k = I[i]
        a, b = i
        if a < 0:
            l = I[(b,-a)]
            jdg[(b, -a)] = 1
        else:
            l = I[(-b,a)]
            jdg[(-b,a)] = 1
        if min(l,k) == 0:
            ans *= pow(2,max(l,k),mod)
        else:
            ans *= (pow(2,l,mod)-1) + (pow(2,k,mod)-1)+1
        jdg[i] = 1
print(ans+cnt-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
    
def bfs(graph,start): #def bfs(graph,start,limit): 
    dist = [-1] * (N)
    ans = [-1] *(N)
    dist[start]= 0
    q = deque([start])
    cnt = 0
    while q:
        x = q.popleft()
        for i in graph[x]:
            #if dist[x] >= limit:
            #    break
            if dist[i] == -1:
                dist[i] = dist[x] + 1
                ans[i] = x+1
                q.append(i)
    return dist, ans

N,M  = map(int,input().split())# 頂点数
X = [[] for i in range(M)] #辺リスト
P = [[] for i in range(M)]
for i in range(M):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

dist,ans = bfs(X,0)
#print(dist,ans)
if -1 in dist:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(ans[i])