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

Fixed submission:
import numpy as np
from numba import njit

@njit('i8(i8,i8,i8[:],i8[:],i8)', cache=True)
def main(N, K, plist, slist, max_score):
    for start in range(N):

        total_score_in_loop = 0
        score_loop = []
        now = start
        while True:
            now = plist[now]
            total_score_in_loop += slist[now]
            score_loop.append(slist[now])
            if now == start:
                break
        
        rem_score, loop_score = 0, 0
        for idx in range(1, len(score_loop)+1):
            rem_score += score_loop[idx-1]
            if total_score_in_loop > 0:
                loop_score = ((K - idx) // len(score_loop)) * total_score_in_loop
            max_score = max(max_score, rem_score + loop_score)
    return max_score


N, K = map(int, input().split())
plist = np.array([i-1 for i in map(int, input().split())], dtype='int64')
slist = np.array([i for i in map(int, input().split())], dtype='int64')
max_score = -10**15
max_score = main(N, K, plist, slist, max_score)
print(max_score)

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

def main()
    plist = [i - 1 for i in map(int, input().split())]
    slist = list(map(int, input().split()))
    max_score = -math.inf
    for start in range(N):
        total_score_in_loop = 0
        now = start
        score_loop = []
        while True:
            now = plist[now]
            total_score_in_loop += slist[now]
            score_loop.append(slist[now])
            if now == start:
                break
        score_rem = 0
        loop_score = 0
        for index, score in enumerate(score_loop, start=1):
            score_rem += score
            if total_score_in_loop > 0:
                loop_score = total_score_in_loop * ((K-index) // len(score_loop))
            max_score = max(max_score, score_rem+loop_score)
    print(max_score)

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

Fixed submission:
N = int(input())
ans = {i:0 for i in range(100000)}
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            i = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[i] += 1
for i in range(1, N+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = 10000
ans = {}
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            i = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans.setdefault(i, 0)
                ans[i] += 1
for i in range(1, N+1):
    print(ans[i])
Problem p02909 (python)

Fixed submission:
s = input()
if s == 'Sunny':
    result = 'Cloudy'
elif s == 'Cloudy':
    result = 'Rainy'
else:
    result = 'Sunny'

print(result)

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'Sunny':
    result = 'Cloudy'
elif s == 'Cloudy':
    result = 'Rainy':
else:
    result = 'Sunny'

print(result)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N = int(input())
paths = {}
for i in range(N-1):
    u, v, w = map(int,input().split())
    paths.setdefault(u, {})
    paths[u][v] = w
    paths.setdefault(v, {})
    paths[v][u] = w

node_colors = [-1] * (N+1)

def route(last, now, dist):
    for next_node, next_distance in zip(paths[now].keys(), paths[now].values()):
        node_colors[next_node] = (dist + next_distance) % 2
        if next_node != last:
            route(now, next_node, dist + next_distance)

node_colors[1] = 0

route(0, 1, 0)

for i in range(N):
    print(node_colors[i+1])

Buggy submission (verdict: Runtime Error):
N = int(input())
paths = {}
for i in range(N-1):
    u, v, w = map(int,input().split())
    paths.setdefault(u, {})
    paths[u][v] = w
    paths.setdefault(v, {})
    paths[v][u] = w

node_colors = [-1] * (N+1)

def route(last, now, dist):
    for next_node, next_distance in zip(paths[now].keys(), paths[now].values()):
        node_colors[next_node] = (dist + next_distance) % 2
        if next_node != last:
            route(now, next_node, dist + next_distance)

node_colors[1] = 0

route(0, 1, 0)

for i in range(N):
    print(node_colors[i+1])

Buggy submission (verdict: Runtime Error):
def p_color(here, previous):
    color_here = colors[here]
    next_candidates = []
    for u, v, w in paths:
        if here == u and v != previous:
            next_candidates.append(v)
            if color_here == 0:
                if w % 2 == 0:
                    colors[v] = 0
                else:
                    colors[v] = 1
            else:
                if w % 2 == 0:
                    colors[v] = 1
                else:
                    colors[v] = 0
        elif here == v and u != previous:
            next_candidates.append(u)
            if color_here == 0:
                if w % 2 == 0:
                    colors[u] = 0
                else:
                    colors[u] = 1
            else:
                if w % 2 == 0:
                    colors[u] = 1
                else:
                    colors[u] = 0
    if len(next_candidates) == 0:
        return
    else:
        for p in next_candidates:
            p_color(p, here)

n = int(input())
colors = [0,] * n

paths = []
while True:
    try:
        u, v, w = map(int, input().split())
        paths.append([u - 1, v - 1, w])
    except:
        break

p_color(0, -1)

for c in colors:
    print(c)
Problem p03160 (python)

Fixed submission:
import math
N = int(input())
step_list = list(map(int, input().split()))

dp_table = [math.inf] * N
dp_table[0] = 0

for i in range(1, N):
    if i <= 1:
        dp_table[i] = dp_table[i-1] + abs(step_list[i-1] - step_list[i])
    else:
        dp_table[i] = min(dp_table[i-1] + abs(step_list[i-1] - step_list[i]),
                          dp_table[i-2] + abs(step_list[i-2] - step_list[i]))

print(dp_table[N-1])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, W = map(int, input().split())
items = [list(map(int, input().split())) for i in range(N)]

dpt = [0] * (W+1)

for w, v in items:
    for j in range(W, w-1, -1):
        a = dpt[j]
        b = dpt[j-w]+v
        if a > b:
            dpt[j] = a
        else:
            dpt[j] = b

print(dpt[W])
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

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

paths = [[] for i in range(N)]
longest_paths = [-1 for i in range(N)]

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

def get_longest(node):
    if longest_paths[node] != -1:
        return longest_paths[node]
    if paths[node] == []:
        longest_paths[node] = 0
        return 0
    else:
        result = max([get_longest(nd) for nd in paths[node]]) + 1
        longest_paths[node] = result
        return result

print(max([get_longest(i) for i in range(N)]))

Buggy submission (verdict: Runtime Error):
import resource, sys
resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
sys.setrecursionlimit(10**9)

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

paths = [[] for i in range(N)]
longest_paths = [-1 for i in range(N)]

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

def get_longest(node):
    if longest_paths[node] != -1:
        return longest_paths[node]
    if paths[node] == []:
        longest_paths[node] = 0
        return 0
    else:
        result = max([get_longest(nd) for nd in paths[node]]) + 1
        longest_paths[node] = result
        return result

print(max([get_longest(i) for i in range(N)]))

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

paths = [[] for i in range(N)]
longest_paths = [-1 for i in range(N)]

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

def get_longest(node):
    if longest_paths[node] != -1:
        return longest_paths[node]
    if paths[node] == []:
        longest_paths[node] = 0
        return 0
    else:
        result = max([get_longest(nd) for nd in paths[node]]) + 1
        longest_paths[node] = result
        return result

print(max([get_longest(i) for i in range(N)]))
Problem p03167 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [input() for i in range(H)]
route_count_memory = [[-1] * W for i in range(H)]
route_count_memory[0][0] = 1

def get_route_count(i,j):
    result = 0
    if route_count_memory[i][j] != -1:
        return route_count_memory[i][j]
    if 0 <= i-1 < H and field[i-1][j] != '#':
        result += get_route_count(i-1, j)
    if 0 <= j-1 < W and field[i][j-1] != '#':
        result += get_route_count(i, j-1)
    route_count_memory[i][j] = result
    return result

print(get_route_count(H-1, W-1)%(10**9+7))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
field = [input() for i in range(H)]
route_count_memory = [[-1] * W for i in range(H)]
route_count_memory[0][0] = 1

def get_route_count(i,j):
    result = 0
    if route_count_memory[i][j] != -1:
        return route_count_memory[i][j]
    if 0 <= i-1 < H and field[i-1][j] != '#':
        result += get_route_count(i-1, j)
    if 0 <= j-1 < W and field[i][j-1] != '#':
        result += get_route_count(i, j-1)
    route_count_memory[i][j] = result
    return result

print(get_route_count(H-1, W-1)%(10**9+7))
Problem p03169 (python)

Fixed submission:
import numpy as np
from numba import njit


@njit('f8(i8,i8,i8,i8,f8[:,:,:])')
def get_expv(N, i, j, k, expv):
    result = 0.0
    if expv[i][j][k] != -1:
        return expv[i][j][k]
    nonlp = 1.0 - (N-i-j-k) / N
    result += 1
    if i != 0:
        result += get_expv(N, i-1, j, k, expv) * (i / N)
    if j != 0:
        result += get_expv(N, i+1, j-1, k, expv) * (j / N)
    if k != 0:
        result += get_expv(N, i, j+1, k-1, expv) * (k / N)
    result /= nonlp
    expv[i][j][k] = result
    return result

def main():
    N = int(input())

    sushi_count = {1:0, 2:0, 3:0}
    for a in map(int, input().split()):
        sushi_count[a] += 1
    sh = (N+1, N-sushi_count[1]+1, sushi_count[3]+1)
    expv = np.full(sh, -1.0)

    expv[0][0][0] = 0.0

    print(get_expv(N, sushi_count[1], sushi_count[2], sushi_count[3], expv))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit

N = int(input())

sushi_count = {1:0, 2:0, 3:0}
for a in map(int, input().split()):
    sushi_count[a] += 1

expv = np.array([[[-1.0] * (sushi_count[3]+1) for i in range(N-sushi_count[1]+1)] for i in range(N+1)])

expv[0][0][0] = 0.0

@njit
def get_expv(i, j, k):
    result = 0.0
    if expv[i][j][k] != -1:
        return expv[i][j][k]
    nonlp = 1.0 - (N-i-j-k) / N
    result += 1
    if i != 0:
        result += get_expv(i-1, j, k) * (i / N)
    if j != 0:
        result += get_expv(i+1, j-1, k) * (j / N)
    if k != 0:
        result += get_expv(i, j+1, k-1) * (k / N)
    result /= nonlp
    expv[i][j][k] = result
    return result

print(get_expv(sushi_count[1], sushi_count[2], sushi_count[3]))
Problem p03171 (python)

Fixed submission:
import numpy as np
from numba import njit

N = int(input())
scores = np.array(list(map(int, input().split())), dtype='int64')
dpt = np.full((N, N), -10**18, dtype='int64')

@njit('i8(i8[:],i8[:,:],i8,i8)', cache=True)
def get_max_score(scores, dpt, i, j):
    if i == j:
        dpt[i][j] = scores[i]
        return scores[i]
    else:
        if dpt[i][j] != -10**18:
            return dpt[i][j]
        result = max(scores[i] - get_max_score(scores, dpt, i+1, j), scores[j] - get_max_score(scores, dpt, i, j-1))
        dpt[i][j] = result
        return result

print(get_max_score(scores, dpt, 0, len(scores)-1))

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit

N = int(input())
scores = np.array([int(i) for i in input().split()], dtype='int64')
dpt = np.full((N, N), -10**18, dtype='int64')

#@njit('i8(i8[:],i8[:,:],i8,i8)', cache=True)
def get_max_score(scores, dpt, i, j):
    if i == j:
        dpt[i][j] = scores[i]
        return scores[i]
    else:
        if dpt[i][j] != -10**18:
            return dpt[i][j]
        result = max(scores[i] - get_max_score(scores, dpt, i+1, j), scores[j] - get_max_score(scores, dpt, i, j-1))
        dpt[i][j] = result
        return result

print(get_max_score(scores, dpt, 0, len(scores)-1))
Problem p03172 (python)

Fixed submission:
import numpy as np
from numba import njit

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

max_candies = np.array(list(map(int, input().split())))

dpt = np.full((N+1, K+1), 0, dtype='int64')
for i in range(K+1):
    dpt[0][i] = 1

@njit
def dp(N, K, max_candies, dpt):
    for i in range(1, N+1):
        for j in range(0, K+1):
            dpt[i][j] += dpt[i-1][j]
            t = j - max_candies[i-1] - 1
            if t >= 0:
                dpt[i][j] -= dpt[i-1][t]
            if j > 0:
                dpt[i][j] += dpt[i][j-1]
            dpt[i][j] = dpt[i][j] % (10**9+7)
    return (dpt[N][K] - dpt[N][K-1]) % (10**9+7)

if K > 0:
    print(dp(N, K, max_candies, dpt))
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit

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

max_candies = np.array(list(map(int, input().split())))

dpt = np.full((N+1, K+1), 0, dtype='int64')
for i in range(K+1):
    dpt[0][i] = 1

@njit('i8(i8,i8,i8[:],i8[:,:]', cache=True)
def dp(N, K, max_candies, dpt):
    for i in range(1, N+1):
        for j in range(0, K+1):
            dpt[i][j] += dpt[i-1][j]
            t = j - max_candies[i-1] - 1
            if t >= 0:
                dpt[i][j] -= dpt[i-1][t]
            if j > 0:
                dpt[i][j] += dpt[i][j-1]
            dpt[i][j] = dpt[i][j] % (10**9+7)
    return (dpt[N][K] - dpt[N][K-1]) % (10**9+7)

if K > 0:
    print(dp(N, K, max_candies, dpt))
else:
    print(1)
Problem p03174 (python)

Fixed submission:
import numpy as np

MOD = 10**9 + 7
 
N = int(input())
aff = np.array([map(int, input().split()) for i in range(N)])
dpt = np.zeros((N+1, 1<<N), dtype='int64')
dpt[0][0] = 1

for i, row in enumerate(aff):
    for idx, v in enumerate(row):
        if v == 1:
            dpt[i+1][(1<<idx):] += dpt[i][:-(1<<idx)]
    dpt[i+1] %= MOD

print(dpt[N][(1<<N)-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit

@njit('i8(i8,i4[:,:],i8[:,:],i8)', cache=True)
def solve(N, aff, dpt, MOD):
    for i, row in enumerate(aff):
        for idx, v in enumerate(row):
            if v == 1:
                dpt[i+1][(1<<idx):] += dpt[i][:-(1<<idx)]
        dpt[i+1] %= MOD
    return dpt[N][(1<<N)-1]

def main():
    MOD = 10**9 + 7
 
    N = int(input())
    aff = np.array([list(map(int, input().split())) for i in range(N)], dtype='int32')
    dpt = np.zeros((N+1, 1<<N), dtype='int64')
    dpt[0][0] = 1

    print(solve(N, aff, dpt, MOD))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit
MOD = 10**9 + 7

def main():
 
    N = int(input())
    aff = np.array([list(map(int, input().split())) for i in range(N)], dtype='int32')
    dpt = np.zeros((N+1, 1<<N), dtype='int64')
    dpt[0][0] = 1

    print(solve(N, aff, dpt))

@njit(cache=True)
def solve(N, aff, dpt):
    for i, row in enumerate(aff):
        for idx, v in enumerate(row):
            if v == 1:
                dpt[i+1][(1<<idx):] += dpt[i][:-(1<<idx)]
        dpt[i+1] %= MOD
    return dpt[N][(1<<N)-1]

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit
MOD = 10**9 + 7

def main():
 
    N = int(input())
    aff = np.array([list(map(int, input().split())) for i in range(N)], dtype='int32')
    dpt = np.zeros((N+1, 1<<N), dtype='int64')
    dpt[0][0] = 1

    print(solve(N, aff, dpt))

@njit('i8(i8,i4[:,:],i8[:,:])', cache=True)
def solve(N, aff, dpt):
    for i, row in enumerate(aff):
        for idx, v in enumerate(row):
            if v == 1:
                dpt[i+1][(1<<idx):] += dpt[i][:-(1<<idx)]
        dpt[i+1] %= MOD
    return dpt[N][(1<<N)-1]

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

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

MOD = 10**9 + 7
N = int(input())
paths = {i:[] for i in range(N+1)}
for _ in range(N-1):
    x, y = map(int, input().split())
    paths[x].append(y)
    paths[y].append(x)

dpt = [[-1] * 2 for i in range(N+1)]

def count_cc(prev, node, color):
    if dpt[node][color] != -1:
        return dpt[node][color]
    if paths[node] == [prev]:
        dpt[node][color] = 1
        return 1
    result = 1
    if color == 0:
        for nxt in paths[node]:
            if nxt == prev:
                continue
            result *= (count_cc(node, nxt, 0) + count_cc(node, nxt, 1))
            result %= MOD
    else:
        for nxt in paths[node]:
            if nxt == prev:
                continue
            result *= count_cc(node, nxt, 0)
            result %= MOD

    dpt[node][color] = result
    return result

print((count_cc(0, 1, 0) + count_cc(0, 1, 1)) % MOD)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

MOD = 10**9 + 7
N = int(input())
paths = {i:[] for i in range(N+1)}
for _ in range(N-1):
    x, y = map(int, input().split())
    paths[x].append(y)
    paths[y].append(x)

dpt = [[[-1] * 2 for i in range(N+1)] for j in range(N+1)]

def count_cc(prev, node, color):
    if dpt[prev][node][color] != -1:
        return dpt[prev][node][color]
    if paths[node] == [prev]:
        dpt[prev][node][color] = 1
        return 1
    result = 1
    if color == 0:
        for nxt in paths[node]:
            if nxt == prev:
                continue
            result *= (count_cc(node, nxt, 0) + count_cc(node, nxt, 1))
            result %= MOD
    else:
        for nxt in paths[node]:
            if nxt == prev:
                continue
            result *= count_cc(node, nxt, 0)
            result %= MOD

    dpt[prev][node][color] = result
    return result

print(count_cc(0, 2, 0) + count_cc(0, 2, 1))

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
N = int(input())
paths = {i:[] for i in range(N+1)}
for _ in range(N-1):
    x, y = map(int, input().split())
    paths[x].append(y)
    paths[y].append(x)

dpt = [[[-1] * 2 for i in range(N+1)] for j in range(N+1)]

def count_cc(prev, node, color):
    if dpt[prev][node][color] != -1:
        return dpt[prev][node][color]
    if paths[node] == [prev]:
        dpt[prev][node][color] = 1
        return 1
    result = 1
    if color == 0:
        for nxt in paths[node]:
            if nxt == prev:
                continue
            result *= (count_cc(node, nxt, 0) + count_cc(node, nxt, 1))
            result %= MOD
    else:
        for nxt in paths[node]:
            if nxt == prev:
                continue
            result *= count_cc(node, nxt, 0)
            result %= MOD

    dpt[prev][node][color] = result
    return result

print(count_cc(0, 2, 0) + count_cc(0, 2, 1))
Problem p03176 (python)

Fixed submission:
class BITmax:
    def __init__(self, N, init=0):
        self.init = init
        self.tree = [self.init] * (N+1)
    
    def set(self, x, value):
        while x < N + 1:
            old = self.tree[x]
            if value <= old:
                break
            self.tree[x] = value
            x += x & -x
    
    def find_max_to(self, x):
        result = self.init
        while x > 0:
            result = max(result, self.tree[x])
            x -= x & -x
        return result

N = int(input())
dpt = BITmax(N)

h_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

for h, b in zip(h_list, b_list):
    dpt.set(h, dpt.find_max_to(h-1) + b)

print(max(dpt.tree))

Buggy submission (verdict: Runtime Error):
class BITmax:
    def __init__(self, N, init=0):
        self.init = init
        self.tree = [self.init] * (N+1)
    
    def set(self, x, value):
        while x < N + 1:
            old = self.tree[x]
            if value <= old:
                break
            self.tree[x] = value
            x += x & -x
    
    def find_max_to(self, x):
        result = self.init
        while x > 0:
            result = max(result, self.tree[x])
            x -= x & -x
        return result

def main():
    N = int(input())
    dpt = BITmax(N)

    h_list = list(map(int, input().split()))
    b_list = list(map(int, input().split()))

    for h, b in zip(h_list, b_list):
        dpt.set(h, dpt.find_max_to(h-1) + b)

    print(max(dpt.tree))

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

Fixed submission:
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
p = list(map(int, input().split()))
ma = int(1e18)

for p_ in p:
    if p_ == 0:
        print(0)
        exit()

ans = 1
for p_ in p:
    ans *= p_
    if ans > ma:
        print(-1)
        exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import tqdm
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
p = list(map(int, input().split()))
ma = int(1e18)

for p_ in p:
    if p_ == 0:
        print(0)
        exit()

ans = 1
for p_ in p:
    ans *= p_
    if ans > ma:
        print(-1)
        exit()
print(ans)
Problem p02936 (python)

Fixed submission:
MAX = 200005
G = [[] for i in range(MAX)]
adds = [0] * MAX
ans = [0] * MAX

# def dfs(c, p, count):
#     count += adds[c]
#     ans[c] += count
#     for i in range(len(G[c])):
#         if (G[c][i] != p):
#             dfs(G[c][i], c, count)

n, q = map(int, input().split())
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
               
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    adds[p] += x

# dfs(0, -1, 0)
stack = [(0, -1, adds[0])]
while len(stack) != 0:
    cur, par, count = stack.pop()
    ans[cur] += count
    for i in range(len(G[cur])):
        if G[cur][i] != par:
            stack.append((G[cur][i], cur, count + adds[G[cur][i]]))
            
for i in range(n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
MAX = 200005
G = [[] for i in range(MAX)]
adds = [0] * MAX
ans = [0] * MAX

def dfs(c, p, count):
    count += adds[c]
    ans[c] += count
    for i in range(len(G[c])):
        if (G[c][i] != p):
            dfs(G[c][i], c, count)

n, q = map(int, input().split())
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
               
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    adds[p] += x

dfs(0, -1, 0)
for i in range(n):
    print(ans[i])
Problem p02613 (python)

Fixed submission:
from collections import Counter
lst=[]
for i in range(int(input())):
  lst.append(input())
dic=dict(Counter(lst))
for i in ['AC','WA','TLE','RE']:
  try:
    print(f'{i} x {dic[i]}')
  except KeyError:
    print(f'{i} x 0')

Buggy submission (verdict: Runtime Error):
from collections import Counter
lst=[]
for i in range(int(input())):
  lst.append(input())
dic=dict(Counter(lst))
for i in ['AC','WA','TLE','RE']:
  print(f'{i} × {dic[i]}')
Problem p02724 (python)

Fixed submission:
X=int(input())
a=X//500
X%=500
b=X//5
print(1000*a+5*b)

Buggy submission (verdict: Runtime Error):
X=input()
a=X/500
X%=500
b=X/5
print(1000*a+5*b)
Problem p02730 (python)

Fixed submission:
def f(x):
  return x==x[::-1]
S=input()
n=(len(S)-1)//2
S1,S2=S[:n],S[n+1:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def f(x):
  return x==x[::-1]
S=input()
n=(len(S)-1)/2
S1,S2=S[:n-1],S[n+1:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')