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

Fixed submission:
N, K, Q =  map(int, input().split())
A = [0] * N

for index in range(Q):
    temp = int(input())
    A[temp - 1] += 1

for index in range(N):
    if A[index] > Q - K:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N, K, Q = [int(e) for e in input().split()]
A = [0] * N

for index in range(Q):
    temp = int(input())
    A[temp - 1] += 1

for index in range(N):
    if A[index] > Q - K:
        print("Yes")
    else:
Problem p02936 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10000000)
input = sys.stdin.readline

N, Q = map(int, input().split())

tree = [[0] * 1 for i in range(N)]


tree_list = [0] * N
end = [0] * N

for index in range(N - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    tree[a].append(b)
    tree[b].append(a)

for index in range(Q):
    a, b = map(int, input().split())
    a -= 1
    tree_list[a] += b


def iter(node):
    end[node] = -1
    child = tree[node]
    for c in child:
        if end[c] == 0:
            tree_list[c] += tree_list[node]
            iter(c)


iter(0)

print(*tree_list)

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

tree = [[0] * 1 for i in range(N)]


tree_list = [0] * N
end = [0] * N

for index in range(N - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    tree[a].append(b)
    tree[b].append(a)

for index in range(Q):
    a, b = map(int, input().split())
    a -= 1
    tree_list[a] += b


def iter(node):
    end[node] = -1
    child = tree[node]
    for c in child:
        if end[c] == 0:
            tree_list[c] += tree_list[node]
            iter(c)


iter(0)

print(*tree_list)

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

tree = [[0] for i in range(N)]


tree_list = [0] * N
end = [0] * N

for index in range(N - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    tree[a].append(b)
    tree[b].append(a)

for index in range(Q):
    a, b = map(int, input().split())
    a -= 1
    tree_list[a] += b


def iter(node):
    end[node] = -1
    child = tree[node]
    for c in child:
        if end[c] == 0:
            tree_list[c] += tree_list[node]
            iter(c)


iter(0)

print(*tree_list)

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

tree = [[] for i in range(N)]


tree_list = [0] * N
end = [0] * N

for index in range(N - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    tree[a].append(b)
    tree[b].append(a)

for index in range(Q):
    a, b = map(int, input().split())
    a -= 1
    tree_list[a] += b


def iter(node):
    end[node] = -1
    child = tree[node]
    for c in child:
        if end[c] == 0:
            tree_list[c] += tree_list[node]
            iter(c)


iter(0)

print(*tree_list)

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

tree = [[] for i in range(N)]


tree_list = [0] * N
for index in range(N - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    tree[a].append(b)

for index in range(Q):
    a, b = map(int, input().split())
    a -= 1
    tree_list[a] += b


def iter(node):
    child = tree[node]
    for c in child:
        tree_list[c] += tree_list[node]
        iter(c)


iter(0)

print(*tree_list)
Problem p02963 (python)

Fixed submission:
import math

s = int(input())

rot = int(math.sqrt(s) // 1)
if s == rot**2:
    print("0 0 " + str(rot) + " 0 0 " + str(rot))
    exit()

rot += 1
ans = (rot**2) - s
print("0 0 " + str(rot) + " 1 " + str(ans) + " " + str(rot))

Buggy submission (verdict: Runtime Error):
import math

s = int(input())

rot = int(math.sqrt(s) // 1)
if s == rot**2:
    print(f"0 0 0 {rot} 0 0 {rot}")
    exit()

rot += 1
ans = (rot**2) - s
print(f"0 0 {rot} 1 {ans} {rot}")
Problem p02613 (python)

Fixed submission:
a = int(input())
c = {}
c['AC'] = c['WA'] = c['TLE'] = c['RE'] = (int)(0)
for _ in range(a):
  c[input()]+=1
print('AC x ', end = '')
print(c['AC'])

print('WA x ', end = '')
print(c['WA'])

print('TLE x ', end = '')
print(c['TLE'])

print('RE x ', end = '')
print(c['RE'])

Buggy submission (verdict: Runtime Error):
a = int(input())
c['AC'] = c['WA'] = c['TLE'] = c['RE'] = 0
for _ in range(a):
  c[input()]+=1
print('AC x ', en = '')
print(c['AC'])

print('WA x ', en = '')
print(c['WA'])

print('TLE x ', en = '')
print(c['TLE'])

print('RE x ', en = '')
print(c['RE'])
Problem p02639 (python)

Fixed submission:
a = [int(x) for x in input().split()]
for i in range(5):
  if a[i] == 0:
    print(i+1)
    exit(0)

Buggy submission (verdict: Runtime Error):
x, y = [int(x) for x in input().split()]
if 4 * x >= y and (y%4 ==0 or (y %2 == 0 and (y-2)%4==0)):
  print("Yes")
else:
  print("No")
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
p = list(map(int, input().split()))
for d in range(X + 1):
  for s in [-1, +1]: 
    a=X+s*d
    if p.count(a) == 0:
      print(a)
      exit(0)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
p = list(map(int, input().split()))
for d in range(X + 1):
  for s in [-1, +1]: a=X+s*d
    if p.count(a) == 0:
      print(a)
      exit(0)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
p = list(map(int, input().split()))
for d in range(X + 1):
  for s in [-1, +1]: a=X+s*d
    if p.count(a) == 0:
      print(a)
      exit(0)
Problem p02803 (python)

Fixed submission:
from collections import deque
H,W = map(int,input().split())
maze = []
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(H):
    maze.append(list(input()))
def bfs(sx,sy):
    INF = -1
    cost = [[INF]*W for _ in range(H)]
    P = deque()
    P.append([sx,sy])
    cost[sx][sy] = 0
    while len(P) != 0:
        p = P.popleft()
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] != "#" and cost[nx][ny] == INF:
                P.append([nx,ny])
                cost[nx][ny] = cost[p[0]][p[1]]+1
    return cost
def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if maze[i][j] != "#":
                sx,sy = i,j
                cs = bfs(sx,sy)
                for k in range(len(cs)):
                    if max(cs[k]) > ans:
                        ans = max(cs[k])
    return ans
print(solve())

Buggy submission (verdict: Runtime Error):
    from collections import deque
    H,W = map(int,input().split())
    maze = []
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    ls = []
    count = 0
    for i in range(H):
        tmp = list(input())
        maze.append(tmp)
        for j in range(W):
            if tmp[j] != "#":
                ls.append([i,j])
                count += 1
    def bfs(sx,sy):
        INF = -1
        cost = [[INF]*W for _ in range(H)]
        P = deque()
        P.append([sx,sy])
        cost[sx][sy] = 0
        while len(P) != 0:
            p = P.popleft()
            for i in range(4):
                nx = p[0] + dx[i]
                ny = p[1] + dy[i]
                if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] != "#" and cost[nx][ny] == INF:
                    P.append([nx,ny])
                    cost[nx][ny] = cost[p[0]][p[1]]+1
        return cost
    def solve():
        ans = 0
        for i in ls:
            sx,sy = i[0],i[1]
            cs = bfs(sx,sy)
            for k in range(len(cs)):
                if ans == count:
                    break
                if max(cs[k]) > ans:
                    ans = max(cs[k])
        return ans
    print(solve())

Buggy submission (verdict: Runtime Error):
from collections import deque
H,W = map(int,input().split())
maze = []
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(H):
    maze.append(list(input()))
def bfs(sx,sy):
    INF = -1
    cost = [[INF]*W for _ in range(H)]
    P = deque()
    P.append([sx,sy])
    cost[sx][sy] = 0
    while len(P) != 0:
        p = P.popleft()
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] != "#" and cost[nx][ny] == INF:
                P.append([nx,ny])
                cost[nx][ny] = cost[p[0]][p[1]]+1
    return cost
def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if maze[i][j] != "#"
                sx,sy = i,j
                cs = bfs(sx,sy)
                for k in range(len(cs)):
                    if max(cs[k]) > ans:
                        ans = max(cs[k])
    return ans
print(solve())
Problem p02813 (python)

Fixed submission:
from itertools import permutations
N = int(input())
P = "".join(list(map(str,input().split())))
Q = "".join(list(map(str,input().split())))
ls = permutations(list(range(1,N+1)))
ans = []
for i in list(ls):
    ans.append("".join(list(map(str,i))))
ans = sorted(ans)
a,b = 0,0
for i in range(len(ans)):
    if ans[i] == P:
        a = i+1
    if ans[i] == Q:
        b = i+1
print(abs(int(a)-int(b)))

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter
N,M = map(int,input().split())
a = list(map(int,input().split()))
maxa = max(a)
i = 1
p = 1
while True:
    tmp = (i+0.5)*maxa
    if math.ceil(tmp) == math.floor(tmp):
        p = i
        break
    i += 1
lcm = 0
flag = False
for i in range(p,M+1):
    if flag:
        break
    for j in range(N):
        if flag:
            break
        tmp = i/a[j]
        if int(tmp)+0.5 != tmp:
            break
        if int(tmp)+0.5 == tmp and j == N-1:
            lcm = i
            flag = True
if lcm == 0:
    print(0)
else:
    ans = M/lcm
    print(math.ceil(math.floor(ans)/2))
Problem p02854 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mid = sum(A)/2
length = 0
i = 0
while True:
    if length >= mid:
        length = min(abs(length-mid),abs(length-mid-A[i-1]))+mid
        break
    length += A[i]
    i += 1
print(int(length-(sum(A)-length)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
tmp = 0
std = sum(A)/2
index = 0
while tmp < std:
    tmp += A[index]
    index += 1
print(abs(sum(a)-sum(b)))
Problem p02861 (python)

Fixed submission:
import itertools
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
tmp = list(itertools.permutations(list(range(N)),N))
length = []
for i in range(len(tmp)):
    tmplen = 0
    for j in range(N-1):
        tmplen += ((xy[tmp[i][j]][0]-xy[tmp[i][j+1]][0])**2+(xy[tmp[i][j]][1]-xy[tmp[i][j+1]][1])**2)**(1/2)
    length.append(tmplen)
print(sum(length)/len(length))

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
tmp = list(itertools.permutations(list(range(N)),N))
length = []
for i in range(len(tmp)):
    tmplen = ((xy[tmp[i][0]][0]-xy[tmp[i][1]][0])**2+(xy[tmp[i][0]][1]-xy[tmp[i][1]][1])**2)**(1/2)
    tmplen += ((xy[tmp[i][1]][0]-xy[tmp[i][2]][0])**2+(xy[tmp[i][1]][1]-xy[tmp[i][2]][1])**2)**(1/2)
    length.append(tmplen)
print(sum(length)/len(length))
print(xy)
Problem p02924 (python)

Fixed submission:
N = int(input())
if N == 1:
    print(0)
elif N%2 != 0:
    print((1+(N-1))*((N-1)//2))
else:
    print((1+(N-1))*((N-1)//2)+(N-1)//2+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(sum(list(range(1,N))))
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
maxa = max(A)
for i in range(N):
    if maxa == A[i]:
        tmp = A.pop(i)
        print(max(A))
        insert(i,tmp)
    else:
        print(maxa)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
maxnum = max(A)
for i in range(N):
    if i == A.index(maxnum):
        tmp = A
        del tmp[tmp.index(max(tmp))]
        print(max(tmp))
    else:
        print(maxnum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
maxnum = max(A)
for i in range(N):
    if i == maxindex:
        tmp = A
        del tmp[tmp.index(max(tmp))]
        print(max(tmp))
    else:
        print(maxnum)
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())
if R - L > 2019:
        print(0)
else:
    ans = 10**9
    for i in range(L,R):
        for j in range(i+1,R+1):
            if ans > i*j%2019:
                ans = i*j%2019
                if ans == 0:
                    break
    print(ans)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())
tmp = list(range(L,R+1))
mod = []
rem = []
for i in tmp:
    if i%2019 not in mod:
        mod.append(i%2019)
        rem.append(i)
    if len(mod) == 2019:
        break
ans = 2019
for i in rem:
    for j in rem:
        if i*j%2019 < ans and i < j:
            ans = i*j%2019
        if ans == 0:
            break
print(ans)
Problem p02995 (python)

Fixed submission:
import math
import fractions
A,B,C,D = map(int,input().split())
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)
def cal(n,x,y):
    return n-(n//x + n//y - n//lcm(x,y))
print(cal(B,C,D)-cal(A-1,C,D))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
countC = math.floor(B/C) - math.floor((A-1)/C)
countD = math.floor(B/D) - math.floor((A-1)/D)
def lcm(x,y):
    return(x*y)//math.gcd(x,y)
lcmCD = lcm(C,D)
countlcm = math.floor(B/lcmCD) - math.floor((A-1)/lcm(C,D))
print(B - A + 1 - (countC + countD - countlcm))
Problem p03076 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
from math import ceil
tmp1 = [A,B,C,D,E]
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(0)
    else:
        tmp2.append(10 - tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(sum(tmp1)-max(tmp2))

Buggy submission (verdict: Runtime Error):
from math import ceil
tmp1 = list(map(int,input().split()))
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(0)
    else:
        tmp2.append(10 - tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(sum(tmp1)-max(tmp2))

Buggy submission (verdict: Runtime Error):
from math import ceil
tmp1 = list(map(int,input().split()))
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(0)
    else:
        tmp2.append(10 - tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(tmp1)
print(tmp2)
print(sum(tmp1)-max(tmp2))

Buggy submission (verdict: Runtime Error):
from math import ceil
tmp1 = list(map(int,input().split()))
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(float("inf"))
    else:
        tmp2.append(tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(tmp1)
print(tmp2)
print(sum(tmp1)-min(tmp2))
Problem p03160 (python)

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
INF = 10**9
dp = [INF]*N
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2,N):
    dp1 = abs(h[i]-h[i-1])+dp[i-1]
    dp2 = abs(h[i]-h[i-2])+dp[i-2]
    dp[i] = min([dp1,dp2])
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
def main():
    INF = 10**9
    N = int(input())
    h = list(map(int,input().split()))
    dp = [INF]*N
    dp[0] = 0
    dp[1] = h[0]
    for i in range(2,N):
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
    print(dp[N])

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))
INF = 10**9
dp = [INF]*N
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(2,N):
    dp1 = abs(h[i]-h[i-1])+dp[i-1]
    dp2 = abs(h[i]-h[i-2])+dp[i-2]
    dp[i] = min([dp1,dp2])
    print(dp)
Problem p03211 (python)

Fixed submission:
S = input()
tmp = []
for i in range(len(S)-2):
    tmp.append(S[i:i+3])
for j in range(len(S)-2):
    tmp[j] = abs(753-int(tmp[j]))
print(min(tmp))

Buggy submission (verdict: Runtime Error):
S=input()
tmp=[]
for i in range(len(S)-2):
  tmp.append(S[i:i+2])
for j in range(len(S)-2):
  tmp[i]=abs(753-int(tmp[i]))
print(int(min(tmp)))

Buggy submission (verdict: Runtime Error):
S=input()
tmp=[]
for i in range(len(S)-2):
  tmp.append(S[i:i+2])
for j in range(len(tmp)):
  tmp[i]=abs(753-int(tmp[i]))
print(int(min(tmp)))

Buggy submission (verdict: Runtime Error):
S=input()
tmp=[]
for i in range(len(S)-2):
  tmp.append(S[i:i+2])
for j in range(len(tmp)):
  tmp[i]=abs(753-int(tmp[i]))
print(min(tmp))
Problem p03261 (python)

Fixed submission:
N = int(input())
W = [input() for i in range(N)]
ans = "Yes"
if sorted(set(W)) != sorted(W):
    ans = "No"
else:
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            ans = "No"
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
words = [input() for i in range(N)]
ans = "Yes"
tmp = list(dict.fromkeys(words))
if words == tmp:
    for j in range(1,N):
        if words[j][0] != word[j-1][-1]:
            ans = "No"
            break
    print(ans)
else:
    print("No")
Problem p03361 (python)

Fixed submission:
H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]

def check(h,w):
    dx = [0,0,-1,1]
    dy = [1,-1,0,0]
    for k in range(len(dx)):
        if 0 <= h+dy[k] <= (H-1) and 0 <= w+dx[k] <= (W-1):
            if s[h+dy[k]][w+dx[k]] == "#":
                break
            elif k == 3:
                return True
    return False

ans = "Yes"
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            if check(i,j):
                ans = "No"
                break
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
mat = [list(input()) for _ in range(H)]
ans = "Yes"

def judge(i, j):
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
    for k in range(4):
        if 0 <= i+dy[k] <= (W-1) and 0 <= j+dx[k] <= (H-1):
            if mat[i+dy[k]][j+dx[k]] == "#":
                return True
    return False

for x in range(W):
    for y in range(H):
        if mat[x][y] == "#":
            if not judge(x,y):
                ans = "No"
                break
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
mat = [list(input()) for _ in range(H)]
ans = "Yes"

def judge(i, j):
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
    for k in range(4):
        if 0 <= i+dy[k] <= (W-1) and 0 <= j+dx[k] <= (H-1):
            if mat[i+dy[k]][j+dx[k]] == "#":
                return True
    return False

for i in range(W):
    for j in range(H):
        if mat[i][j] == "#":
            if not judge(i,j):
                ans = "No"
                break
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
mat = [list(input()) for _ in range(H)]
ans = "Yes"

def judge(i, j):
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
    for k in range(4):
        if 0 <= i+dx[k] <= (W-1) and 0 <= j+dy[k] <= (H-1):
            if mat[i+dx[k]][j+dy[k]] == "#":
                return True
    return False

for i in range(W):
    for j in range(H):
        if mat[i][j] == "#":
            if not judge(i,j):
                ans = "No"
                break
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
mat = [list(input()) for _ in range(H)]
ans = "Yes"
dx = [-1,0,1,0]
dy = [0,1,0,-1]
for i in range(W):
    for j in range(H):
        if mat[i][j] == "#":
            for k in range(4):
                if 0 <= i+dx[k] <= W-1 and 0 <= j+dy[k] <= H-1:
                    if mat[i+dx[k]][j+dy[k]] == "#":
                        break
                    elif k == 3:
                        ans = "No"
                        break
print(ans)
Problem p03386 (python)

Fixed submission:
A,B,K = map(int,input().split())
if A == B:
    print(A)
else:
    if K > B - A:
        K = B - A
    tmp1 = list(range(A,A+K))
    tmp2 = list(range(B-K+1,B+1))
    ans = sorted(list(set(tmp1 + tmp2)))
    for i in ans:
        print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
tmp = list(range(A,B+1))
if K > len(tmp):
    K = len(tmp)
small = tmp[:K]
big = tmp[-K:]
tmp = sorted(list(set(small + big)))
for i in tmp:
    print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
tmp = list(range(A,B+1))
small = tmp[:K]
big = tmp[-K:]
tmp = sorted(list(set(small + big)))
for i in tmp:
    print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
tmp1 = list(range(A,A+min([len(list(range(A,B+1))),K])))
tmp2 = list(range(B-min([len(list(range(A,B+1))),K])+1,B+1))
ans = sorted(list(set(tmp1+tmp2)))
for i in range(len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
tmp = list(range(A,B+1))
ans = []
flag = 1
for i in range(min([len(tmp),K])):
    ans.append(tmp[i])
for j in range(min([len(tmp),K])):
    ans.append(tmp[-j-1])
ans = sorted(list(set(ans)))
for k in range(len(ans)):
    print(ans[k])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
tmp = list(range(A,B+1))
ans = []
flag = 1
for i in range(K):
    ans.append(tmp[i])
for j in range(K):
    ans.append(tmp[-j-1])
ans = list(set(ans))
for k in range(len(ans)):
    print(ans[k])
Problem p03471 (python)

Fixed submission:
N,Y = map(int,input().split())
A,B,C = -1,-1,-1
flag = False
for i in range(N+1):
    if flag:
        break
    for j in range(N+1-i):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y and (N-i-j) >= 0:
            A,B,C = i,j,(N-i-j)
            flag = True
            break
print(A,B,C)

Buggy submission (verdict: Runtime Error):
for i in range(N):
    if flag:
        break
    for j in range(N-i):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y and (N-i-j) >= 0:
            A,B,C = i,j,(N-i-j)
            flag = True
            break
print(A,B,C)
Problem p03501 (python)

Fixed submission:
N,A,B = map(int,input().split())
print(min([A*N,B]))

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
print(min([A*T,B]))
Problem p03544 (python)

Fixed submission:
N = int(input())
L = [2,1]
if N > 1:
    for i in range(2,N+1):
        L.append(L[i-1]+L[i-2])
print(L[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [2,1]
if N > 3:
    for i in range(2,N+1):
        L.append(L[i-1]+L[i-2])
print(L[N])
Problem p03574 (python)

Fixed submission:
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
S.insert(0,[0]*W)
S.append([0]*W)
for i in range(len(S)):
    S[i].insert(0,0)
    S[i].append(0)
dx = [1,0,-1,0,1,-1,-1,1]
dy = [0,1,0,-1,1,1,-1,-1]
tmp = [[0] * W for i in range(H)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == "#":
            tmp[i-1][j-1] = "#"
            continue
        num = 0
        for k in range(len(dx)):
            if S[i+dx[k]][j+dy[k]] == "#":
                num += 1
                tmp[i-1][j-1] = num
for j in range(len(tmp)):
    print(*tmp[j],sep = "")

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
S.insert(0,[0]*W)
S.append([0]*W)
for i in range(len(S)):
    S[i].insert(0,0)
    S[i].append(0)
dx = [1,0,-1,0,1,-1,-1,1]
dy = [0,1,0,-1,1,1,-1,-1]
tmp = [[0] * W for i in range(H)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == "#":
            tmp[i-1][j-1] = "#"
            continue
        num = 0
        for k in range(len(dx)):
            if S[i+dx[k]][j+dy[k]] == "#":
                num += 1
                tmp[i-1][j-1] = str(num)
for j in range(len(tmp)):
    print("".join(tmp[j]))