Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
tree = [list() for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
c = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    subtree = tree[p-1].copy()
    c[p-1] += x

for i, subnode in enumerate(tree):
    for s in subnode:
        c[s] += c[i]

print(*c)


Fixed submission:
n, q = map(int, input().split())
tree = [list() for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
c = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    c[p-1] += x

stack = [0]
j = [False] * n # すでに探索したか
while stack:
    node = stack.pop()
    j[node] = True
    for snode in tree[node]:
        if j[snode]:
            continue
        c[snode] += c[node]
        stack.append(snode)

print(*c)

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
tree = [list() for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
c = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    subtree = tree[p-1].copy()
    c[p-1] += x
    while subtree:
        snode = subtree.pop()
        c[snode] += x
        subtree += tree[snode]
print(*c)


Fixed submission:
n, q = map(int, input().split())
tree = [list() for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
c = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    c[p-1] += x

stack = [0]
j = [False] * n # すでに探索したか
while stack:
    node = stack.pop()
    j[node] = True
    for snode in tree[node]:
        if j[snode]:
            continue
        c[snode] += c[node]
        stack.append(snode)

print(*c)

Buggy python submission (verdict: Runtime Error):
from collections import deque

n, q = map(int, input().split())
tree = [list() for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
c = [0] * n
deq = deque()
for i in range(q):
    p, x = map(int, input().split())
    subtree = tree[p-1].copy()
    c[p-1] += x
    while subtree:
        snode = subtree.pop()
        c[snode] += x
        subtree += tree[snode]
print(*c)


Fixed submission:
n, q = map(int, input().split())
tree = [list() for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
c = [0] * n
for i in range(q):
    p, x = map(int, input().split())
    c[p-1] += x

stack = [0]
j = [False] * n # すでに探索したか
while stack:
    node = stack.pop()
    j[node] = True
    for snode in tree[node]:
        if j[snode]:
            continue
        c[snode] += c[node]
        stack.append(snode)

print(*c)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
d = []
count = 0
t = [0] * n
for _ in range(n):
    s = input()
    dic = defaultdict(int)
    for c in s:
        dic[c] += 1
    for i in range(len(d)):
        if all(dic[key] == d[i][key] for key in dic):
            if t[i] != 0:
                count += t[i] + 1
                t[i] += 1
                break
            else:
                count += 1
                t[i] += 1
    d.append(dic)


print(count)


Fixed submission:
import collections

n = int(input())
S = []
count = 0
for _ in range(n):
    S.append(''.join(sorted(list(input()))))

for i, v in collections.Counter(S).items():
    for i in range(1, v):
        count += i

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n = int(input())
d = []
count = 0
for _ in range(n):
    s = input()
    dic = defaultdict(int)
    for c in s:
        dic[c] += 1
    for i in range(len(d)):
        if all(dic[key] == d[i][key] for key in dic):
            count += 1
    d.append(dic)


print(count)


Fixed submission:
import collections

n = int(input())
S = []
count = 0
for _ in range(n):
    S.append(''.join(sorted(list(input()))))

for i, v in collections.Counter(S).items():
    for i in range(1, v):
        count += i

print(count)
Buggy python submission (verdict: Runtime Error):
import heapq
n, m = map(int, input().split())
day = [[] for _ in range(m+1)]
for _ in range(n):
    a, b = map(int, input().split())
    day[a].append(b)
benefit = []
heapq.heapify(benefit)
ans = 0
for i in range(1, m+1):
    for j in day[i]:
        heapq.heappush(benefit, -j)
    if benefit:
        ans -= heapq.heappop(benefit)  # 最大値を加算
print(ans)


Fixed submission:
import heapq
n, m = map(int, input().split())
day = [[] for _ in range(10**5+1)]
for _ in range(n):
    a, b = map(int, input().split())
    day[a].append(b)
benefit = []
heapq.heapify(benefit)
ans = 0
for i in range(1, m+1):
    for j in day[i]:
        heapq.heappush(benefit, -j)
    if benefit:
        ans -= heapq.heappop(benefit)  # 最大値を加算
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
dp = [[0]*13 for j in range(len(S)+1)]
dp[0][0] = 1
mod = 10**9 + 7
for i, s in enumerate(S[::-1]):
    if s == '?':
        for c in range(10):
            for j in range(13):
                dp[i+1][((10**i)*c+j) % 13] += dp[i][j] % mod
    else:
        c = int(s)
        for j in range(13):
            dp[i+1][((10**i)*c+j) % 13] += dp[i][j] % mod
print(dp[-1][5] % mod)


Fixed submission:
mod = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= mod
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= mod
    mul = mul * 10 % 13  # 計算量削減のためここで13で割っている

print(dp[-1][5])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
a = np.zeros(n, dtype=np.int64)
for i in range(n):
    a[i] = int(input())
for i in range(n):
    max1 = 0
    max2 = 0
    if len(a[:i]) != 0:
        max1 = np.max(a[:i])
    if len(a[i+1:]) != 0:
        max2 = np.max(a[i+1:])
    print(max(max1, max2))


Fixed submission:
n = int(input())
max1 = 0
max2 = 0
index = 0
for i in range(n):
    a = int(input())
    new_max = max(a, max1)
    if (a == new_max and max2 <= max1) or (a == new_max and max2 <= max1 and a == max1):
        max2 = max1
        index = i
    elif (a != new_max and max2 <= a) or (a != new_max and max2 <= a and a == max1):
        max2 = a
    max1 = new_max

for i in range(n):
    if i != index:
        print(max1)
    else:
        print(max2)

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

n = int(input())
a = np.zeros(n, dtype=np.int64)
for i in range(n):
    a[i] = int(input())
for i in range(n):
    max1 = 0
    max2 = 0
    if len(a[:i]) != 0:
        max1 = np.max(a[:i])
    if len(a[i+1:]) != 0:
        max2 = np.max(a[i+1:])
    print(max(max1, max2))


Fixed submission:
n = int(input())
max1 = 0
max2 = 0
index = 0
for i in range(n):
    a = int(input())
    new_max = max(a, max1)
    if (a == new_max and max2 <= max1) or (a == new_max and max2 <= max1 and a == max1):
        max2 = max1
        index = i
    elif (a != new_max and max2 <= a) or (a != new_max and max2 <= a and a == max1):
        max2 = a
    max1 = new_max

for i in range(n):
    if i != index:
        print(max1)
    else:
        print(max2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
for i in range(n):
    max1 = 0
    max2 = 0
    if a[:i] != []:
        max1 = max(a[:i])
    if a[i+1:] != []:
        max2 = max(a[i+1:])
    print(max(max1, max2))


Fixed submission:
n = int(input())
max1 = 0
max2 = 0
index = 0
for i in range(n):
    a = int(input())
    new_max = max(a, max1)
    if (a == new_max and max2 <= max1) or (a == new_max and max2 <= max1 and a == max1):
        max2 = max1
        index = i
    elif (a != new_max and max2 <= a) or (a != new_max and max2 <= a and a == max1):
        max2 = a
    max1 = new_max

for i in range(n):
    if i != index:
        print(max1)
    else:
        print(max2)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

flag = 0
for i in range(l, r+1):
    if i % 2019 == 0:
        flag = 1
        break

if flag == 0:
    a = (l % 2019) * ((l+1) % 2019)) % 2019
    print(a)
elif flag == 1:
    print(0)


Fixed submission:
l, r = map(int, input().split())

if (r-1) * r < 2019:
    print(l * (l+1))
elif r - l > 2019:
    print(0)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(i+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(ans)

Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
# m = 2 * (10 ** 9)
# n = 2 * (10 ** 9) + 2
flag = 0
for i in range(l, r+1):
    if i != 0 and i % 2019 == 0:
        flag = 1
        break
#     a = m
#     m = min(m, i % 2019)
#     if a == m:
#         n = min(n, i % 2019)
#     else:
#         n = min(n, a)
#
# print('m', m)
# print('n', n)

if flag != 1:
    if l == 0:
        a = (l+1 % 2019) * (l+2 % 2019) % 2019
    else:
        a = (l % 2019) * (l+1 % 2019) % 2019

if l == 0 and a == 0:
    flag = 2

if flag == 0:
    print(a)
elif flag == 1:
    print(0)
else:
    print(2019)


Fixed submission:
l, r = map(int, input().split())

if (r-1) * r < 2019:
    print(l * (l+1))
elif r - l > 2019:
    print(0)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(i+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(ans)

Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
# m = 2 * (10 ** 9)
# n = 2 * (10 ** 9) + 2
flag = 0
for i in range(l, r+1):
    if i != 0 and i % 2019 == 0:
        flag = 1
        break
#     a = m
#     m = min(m, i % 2019)
#     if a == m:
#         n = min(n, i % 2019)
#     else:
#         n = min(n, a)
#
# print('m', m)
# print('n', n)

if flag != 1:
    if l == 0:
        a = (l+1 % 2019) * (l+2 % 2019) % 2019
    else:
        a = (l % 2019) * (l+1 % 2019) % 2019

if l == 0 and a == 0:
    flag = 2

if flag == 0:
    print(a)
elif flag == 1:
    print(0)
else:
    print(2019)


Fixed submission:
l, r = map(int, input().split())

if (r-1) * r < 2019:
    print(l * (l+1))
elif r - l > 2019:
    print(0)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(i+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = map(int, input().split())
S = []
for _ in range(m):
    *a, = map(int, input().split())
    l = a[1:]
    S.append(l)
*p, = map(int, input().split())

ans = 0
for i in range(2**n):
    tmp = np.array([i >> j & 1 for j in range(n)])
    if p == [sum(tmp[np.array(s)-1]) % 2 for s in S]:
        ans += 1
print(ans)


Fixed submission:
import numpy as np

n, m = map(int, input().split())
S = []
for _ in range(m):
    *a, = map(int, input().split())
    l = a[1:]
    S.append(l)
*p, = map(int, input().split())

ans = 0
for i in range(2**n):
    tmp = np.array([i >> j & 1 for j in range(n)])
    if p == [sum(tmp[np.array(s)-1]) % 2 for s in S]:
        ans += 1
print(ans)

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

n, m = map(int, input().split())
S = []
for _ in range(m):
    *a, = map(int, input().split())
    l = a[1:]
    S.append(l)
*p, = map(int, input().split())

ans = 0
for i in range(2**n):
    tmp = np.array([i >> j & 1 for j in range(n)])
    if p == [sum(tmp[np.array(s)-1]) % 2 for s in S]:
        ans += 1
print(ans)


Fixed submission:
import numpy as np

n, m = map(int, input().split())
S = []
for _ in range(m):
    *a, = map(int, input().split())
    l = a[1:]
    S.append(l)
*p, = map(int, input().split())

ans = 0
for i in range(2**n):
    tmp = np.array([i >> j & 1 for j in range(n)])
    if p == [sum(tmp[np.array(s)-1]) % 2 for s in S]:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
card = [0] * n
l = []
r = []

for i in range(m):
    l1, r1 = map(int, input().split())
    l.append(l1)
    r.append(r1)

for i in range(m):
    for j in range(l[i], r[i]+1):
        card[j-1] += 1


ans = 0
for c in card:
    if c >= m:
        ans += 1
print(ans)


Fixed submission:
from itertools import accumulate

n, m = map(int, input().split())
card = [0] * (n + 1)

for _ in range(m):
    l, r = map(int, input().split())
    card[l-1] += 1
    card[r] -= 1

ans = 0
for i in accumulate(card):
    if i == m:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
tree = [list() for _ in range(N)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    tree[u-1].append((v-1, w))
    tree[v-1].append((u-1, w))
stack = [0]
ans = [0] * N
searched = [False] * N
while stack:
    node = stack.pop()
    for v, w in tree[node]:
        if not searched[v]:
            searched[v] = True
            if w % 2 != 0:
                ans[v] = ans[node] ^ 1
            else:
                ans[v] = ans[node]
        stack.append(v)
print(*ans, sep='\n')


Fixed submission:
n = int(input())
tree = [list() for _ in range(n)]
ans = [1] * n
for _ in range(n-1):
    u, v, w = map(int, input().split())
    tree[u-1].append((v-1, w))
    tree[v-1].append((u-1, w))

stack = [0]
judge = [False] * n
while stack:
    node = stack.pop()
    judge[node] = True
    for snode, distance in tree[node]:
        if judge[snode]:
            continue
        if distance % 2 != 0:
            ans[snode] = ans[node] ^ 1
        else:
            ans[snode] = ans[node]
        stack.append(snode)
print(*ans, sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

length = len(V)
conb = []
for i in range(length+1):
    conb.append(list(itertools.combinations(V,i)))

cost = []
for c in conb:
    for i in c:
        idx = []
        x = 0
        y = 0
        for k in i:
            idx.append(V.index(k))
        for a in idx:
            x += V[a]
            y += C[a]
        cost.append(x-y)

print(max(cost))


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

ans = sum([ max( 0, (V[i]-C[i]) ) for i in range(N) ])

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
cost = [0 for i in range(n)]
cost[1] = abs(h[1]-h[0])
min_cost = 10000
for i in range(1,n-1):
    for j in range(k):
        if i >= j:
            min_cost = min(min_cost, cost[i-j]+abs(h[i+1]-h[i-j]))
    cost[i+1] = min_cost

print(cost[i+1])


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
cost = [float('inf') for i in range(n)]
cost[0] = 0
for i in range(1,n):
    for j in range(1, k+1):
        if i >= j:
            cost[i] = min(cost[i], cost[i-j]+abs(h[i]-h[i-j]))

print(cost[n-1])
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
# dp[i][w] : i個目の時の重さwの最大値
dp = [[0] * 10010 for _ in range(N+1)]
for i in range(N):
    w_i, v_i = map(int, input().split())
    for w in range(W+1):
        if w >= w_i:
            dp[i+1][w] = max(dp[i][w-w_i]+v_i, dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])


Fixed submission:
N, W = map(int, input().split())
# dp[i][w] : i個目の時の重さwの最大値
dp = [[0] * 100010 for _ in range(N+1)]
for i in range(N):
    w_i, v_i = map(int, input().split())
    for w in range(W+1):
        if w >= w_i:
            dp[i+1][w] = max(dp[i][w-w_i]+v_i, dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])

Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
# dp[i][j] : i日めにjをした。(j=0:持つ, j=1:持たない)
dp = [[0] * 10010 for _ in range(N+1)]
for i in range(N):
    w_i, v_i = map(int, input().split())
    for w in range(W+1):
        if w >= w_i:
            dp[i+1][w] = max(dp[i][w-w_i]+v_i, dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])


Fixed submission:
N, W = map(int, input().split())
# dp[i][w] : i個目の時の重さwの最大値
dp = [[0] * 100010 for _ in range(N+1)]
for i in range(N):
    w_i, v_i = map(int, input().split())
    for w in range(W+1):
        if w >= w_i:
            dp[i+1][w] = max(dp[i][w-w_i]+v_i, dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

key = S[K]
result = 'a'

for i in range(N):
    if S[i] == key:
        result += S[i]
    elif S[i] != key:
        result += '*'
        

print(result[1:])

Fixed submission:
N = int(input())
S = input()
K = int(input())

key = S[K - 1]
result = 'a'

for i in range(N):
    if S[i] == key:
        result += S[i]
    elif S[i] != key:
        result += '*'
        

print(result[1:])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

MOD = 1000000007
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= MOD

print(dp[n])

Fixed submission:
l = list(map(int, input().split()))
l.sort()
print(sum(l[:2]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

MOD = 1000000007
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= MOD

print(dp[n])

Fixed submission:
import sys
input = sys.stdin.readline

MOD = 1000000007
n, m = map(int, input().split())
hole = [0]*(n+1)

for i in range(m): hole[int(input())] = 1

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    if hole[i]: dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= MOD

print(dp[n])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

MOD = 1000000007
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= MOD

print(dp[n])

Fixed submission:
import sys
input = sys.stdin.readline

MOD = 1000000007
n, m = map(int, input().split())
hole = [0]*(n+1)

for i in range(m): hole[int(input())] = 1

dp = [0]*(n+1)
dp[0] = 1

for i in range(1, n+1):
    if hole[i]: dp[i] = 0
    else:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= MOD

print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

r, g, b, n = map(int, input().split())



cnt = 0
for i in range(int(n/r) + 1):
    for j in range(int((n-r*i)/g) + 1):

        if (n - (r*i + g*j))%b==0 and n - (r*i + g*j) >= 0:
            cnt += 1
print(cnt)

Fixed submission:
import sys
input = sys.stdin.readline

r, g, b, n = map(int, input().split())



cnt = 0
for i in range(int(n/r) + 1):
    for j in range(int((n-r*i)/g) + 1):

        if (n - (r*i + g*j))%b==0 and n - (r*i + g*j) >= 0:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


n = int(input())
s = input()
s = list(s)
# print(s)



pre = s[0]
for i in range(1, n):
    if pre=='#' and s[i]=='.':
        temp = i
        break
    pre = s[i]


# print(temp)
try:
    s = s[temp:]
    ans = sum(1 for x in s if x=='.')
    ans2 = sum(1 for x in s if x=='#') + 1
    if s[-1]=='#':
        ans -=1
        ans2 -=1

    print(min(ans, ans2))
except:
    print(0)

Fixed submission:
import sys
input = sys.stdin.readline

a, b, c = map(int, input().split())

flag = False
if a<=c and c<=b:
    flag = True

if b<=c and c<=a:
    flag = True


if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):

import math

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)


for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)

Fixed submission:
import math

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)

flag = 0
for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m
        flag = 1

if flag ==0:
    index = 0

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n)] #カウント用
x = [list(input().split()) for i in range(q)]


for i in range(q):#呪文ループ
  for j in range(n):#マスループ　左から
    if x[i][0] == s[j]:
      if x[i][1]=='L':

        if j-1>=0:
          L[j-1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

      elif x[i][1]=='R':

        if (j+1)<=(n-1):
          L[j+1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

sum = 0
for i in range(n):
  sum += L[i]

print(sum)

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

if a==b and b==c:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n)] #カウント用
x = [list(input().split()) for i in range(q)]


for i in range(q):#呪文ループ
  for j in range(n):#マスループ　左から
    if x[i][0] == s[j]:
      if x[i][1]=='L':

        if j-1>=0:
          L[j-1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

      elif x[i][1]=='R':

        if (j+1)<=(n-1):
          L[j+1] +=L[j]
          L[j] = 0
        else:
          L[j] = 0

sum = 0
for i in range(n):
  sum += L[i]

print(sum)

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

if a==b and b==c:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
L = [1 for i in range(n+2)] #カウント用
L[0] = -99999
L[n+1] = -99999
x = [list(input().split()) for i in range(q)]
    
S = [c  for c in s] #一文字ずつにわける
    
for i in range(q):
    index = [k for k, X in enumerate(S) if X == x[i][0]]
    for _, j in enumerate(index):
    if x[i][1]=='L':
        L[j+1-1] +=L[j+1]
        L[j+1] = 0
    else:
        L[j+1+1] +=L[j+1]
        L[j+1] = 0
     
print(sum(L[1:n+1]))

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

if a==b and b==c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = input()
x= input()

count = 0
me = 0
for i in range(n):
  if x[i] == "R":
    count +=1
  else:
    me +=1
    

if count > me:
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())
x= input()

count = 0
me = 0
for i in range(n):
  if x[i] == "R":
    count +=1
  else:
    me +=1
    

if count > me:
  print("Yes")
else:
  print("No")