Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    w,v = WV[i]
    for j in range(W, w-1, -1):
        tmp = dp[j-w] + v
        dp[j] = max(dp[j], tmp)
print(max(dp))

Fixed submission:
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    w,v = WV[i]
    for j in range(W, w-1, -1):
        tmp = dp[j-w] + v
        dp[j] = max(dp[j], tmp)
print(max(dp))

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    dp_t = dp.copy()
    w,v = WV[i]
    for j in range(W+1):
        if j+w>W:
            break
        tmp = dp[j] + v
        dp_t[j+w] = max(dp[j+w], tmp)
    dp = dp_t.copy()
print(max(dp))

Fixed submission:
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    w,v = WV[i]
    for j in range(W, w-1, -1):
        tmp = dp[j-w] + v
        dp[j] = max(dp[j], tmp)
print(max(dp))

Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    dp_t = dp.copy()
    w,v = WV[i]
    for j in range(W+1):
        if j+w>W:
            break
        tmp = dp[j] + v
        dp_t[j+w] = max(dp[j+w], tmp)
    dp = dp_t.copy()
print(max(dp))

Fixed submission:
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    w,v = WV[i]
    for j in range(W, w-1, -1):
        tmp = dp[j-w] + v
        dp[j] = max(dp[j], tmp)
print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = map(int, input().split())
X = [list(map(int, input().split()))+[1] for _ in range(M)]
X = np.array(X, dtype=int)
for i in range(1,N+1):
    a = X[:,0]==i
    X[a, 2] = np.argsort(np.argsort(X[a, 1]))+1
for x in X:
    print('{:06}{:06}'.format(x[0], x[2]))

Fixed submission:
import numpy as np

N,M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
order = [[] for _ in range(N)]
for p,y in X:
    order[p-1].append(y)
#X = np.array(X, dtype=int)
for i in range(N):
    order[i] = np.argsort(np.argsort(order[i]))
cnts = [0 for _ in range(N)]
for i in range(M):
    p = X[i][0]
    print('{:06}{:06}'.format(p, order[p-1][cnts[p-1]]+1) )
    cnts[p-1] += 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
V = input().split()

def my_sort(d):
    if len(d)==1:
        return list(d.keys())[0], '0', list(d.values())[0], 0
    k_0, k_1, v_0, v_1 = '0', '0', 0, 0
    for k,v in d.items():
        if v_0 < v:
            v_1 = v_0
            k_1 = k_0
            v_0 = v
            k_0 = k
        elif v_1 < v:
            v_1 = v
            k_1 = k
    return k_0, k_1, v_0, v_1


d0, d1 = {}, {}
for i in range(n//2):
    v = V[2*i]
    if v in d0.keys():
        d0[v] += 1
    else:
        d0[v] = 1

    v = V[2*i+1]
    if v in d1.keys():
        d1[v] += 1
    else:
        d1[v] = 1

k0_0, k0_1, v0_0, v0_1 = my_sort(d0)
k1_0, k1_1, v1_0, v1_1 = my_sort(d1)


if k0_0 != k1_0:
    a0 = sum(d0.values()) - v0_0
    a1 = sum(d1.values()) - v1_0
    print(a0 + a1)
else:
    if v0_0 <= v1_0:
        a0 = sum(d0.values()) - v0_1
        a1 = sum(d1.values()) - v1_0
    else:
        a0 = sum(d0.values()) - v0_0
        a1 = sum(d1.values()) - v1_1
    print(a0 + a1)


Fixed submission:
n = int(input())
V = input().split()

d0, d1 = {}, {}
for i in range(n//2):
    v = V[2*i]
    if v in d0:
        d0[v] += 1
    else:
        d0[v] = 1

    v = V[2*i+1]
    if v in d1:
        d1[v] += 1
    else:
        d1[v] = 1

s0 = sorted(d0.items(), key=lambda x: -x[1])
k0_0, v0_0 = s0[0]
s1 = sorted(d1.items(), key=lambda x: -x[1])
k1_0, v1_0 = s1[0]

if k0_0 != k1_0:
    print(n - v0_0 - v1_0)
else:
    k0_1, v0_1 = s0[1] if len(s0)>1 else ('0',0)
    k1_1, v1_1 = s1[1] if len(s1)>1 else ('0',0)
    if v0_0+v1_1 <= v0_1+v1_0:
        print(n - v1_0 - v0_1)
    else:
        print(n - v0_0 - v1_1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
V = input().split()

d0, d1 = {}, {}
for i in range(n//2):
    v = V[2*i]
    if v in d0.keys():
        d0[v] += 1
    else:
        d0[v] = 1

    v = V[2*i+1]
    if v in d1.keys():
        d1[v] += 1
    else:
        d1[v] = 1
s0 = sorted(d0.items(), key=lambda x: -x[1])
k0_0, v0_0 = s0[0]
s1 = sorted(d1.items(), key=lambda x: -x[1])
k1_0, v1_0 = s1[0]

if k0_0 != k1_0:
    a0 = sum(d0.values()) - v0_0
    a1 = sum(d1.values()) - v1_0
    print(a0 + a1)
else:

    k0_1, v0_1 = s0[1] if len(s0)>1 else [0,0]
    k1_1, v1_1 = s1[1] if len(s1)>1 else [0,0]
    if v0_0 <= v1_0:
        a0 = sum(d0.values()) - v0_1
        a1 = sum(d1.values()) - v1_0
    else:
        a0 = sum(d0.values()) - v0_0
        a1 = sum(d1.values()) - v1_1
    print(a0 + a1)


Fixed submission:
n = int(input())
V = input().split()

d0, d1 = {}, {}
for i in range(n//2):
    v = V[2*i]
    if v in d0:
        d0[v] += 1
    else:
        d0[v] = 1

    v = V[2*i+1]
    if v in d1:
        d1[v] += 1
    else:
        d1[v] = 1

s0 = sorted(d0.items(), key=lambda x: -x[1])
k0_0, v0_0 = s0[0]
s1 = sorted(d1.items(), key=lambda x: -x[1])
k1_0, v1_0 = s1[0]

if k0_0 != k1_0:
    print(n - v0_0 - v1_0)
else:
    k0_1, v0_1 = s0[1] if len(s0)>1 else ('0',0)
    k1_1, v1_1 = s1[1] if len(s1)>1 else ('0',0)
    if v0_0+v1_1 <= v0_1+v1_0:
        print(n - v1_0 - v0_1)
    else:
        print(n - v0_0 - v1_1)
Buggy python submission (verdict: Runtime Error):
costs = [2,5,5,4,5,6,3,7,6]

N, M = map(int, input().split())
A = list(map(int, input().split()))
neginf = -1 * 1e10
D = [neginf]*(N+1)

def dp(n_match):
    D[0] = 0
    for n in range(1,n_match+1):
        arr = [D[n-costs[a-1]] if n-costs[a-1]>=0 else neginf for a in A]
        D[n] = max(arr)+1

def main():
    dp(N)
    n = N
    ans = ''
    while n>0:
        for a in A:
            arr = [a for a in A if D[n-costs[a-1]]==D[n]-1]
        a = max(arr)
        ans += str(a)
        n -= costs[a-1]
    print(ans)

main()

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

def main():
    a = (N//K)**3
    if K%2!=0:
        print(a)
        return
    else:
        b = ( (N+(K//2)) // K ) **3
        print(a+b)
        return

main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

def euclid(a, b):
    m = min(a,b)
    n = max(a,b)
    if (n%m==0):
        return m
    else:
        return euclid(m, n%m)

def sub_lcm(X):
    Y = []
    P, Q = len(X)//2, len(X)%2
    for p in range(P):
        a, b = X[2*p], X[2*p+1]
        y = a * b // euclid(a,b)
        Y.append(y)
    if Q!=0:
        Y.append(X[-1])
    return Y

def lcm(X):
    Y = sub_lcm(X)
    while len(Y)>1:
        Y = sub_lcm(Y)
    return Y[0]

y = lcm(A)-1
s = 0
for a in A:
    s += y%a
print(s)


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

def euclid(a, b):
    m = min(a,b)
    n = max(a,b)
    if (n%m==0):
        return m
    else:
        return euclid(m, n%m)

def lcm(X):
    a = X[0]
    for x in X[1:]:
        a = a* x // euclid(a,x)
    return a

y = lcm(A)-1
s = 0
for a in A:
    s += y%a
print(s)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = A.copy()
for i in range(N):
    B[i] -= i+1
B.sort()
if N%2==0:
    n = N//2
    b = (B[n-1]+B[n]) // 2
else:
    b = B[(N-1)//2]
ans = 0
for i,a in enumerate(A):
    ans += abs(a - (b+i+1))
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = A.copy()
for i in range(N):
    B[i] -= i+1
B.sort()
if N%2==0:
    n = N//2
    b = (B[n-1]+B[n]) // 2
else:
    b = B[(N-1)//2]
ans = 0
for i,a in enumerate(A):
    ans += abs(a - (b+i+1))
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

m = np.array(int(input()))

a = 1
b = m

# for i in reversed(range(2, int(round(np.sqrt(n))))):
#     if n % i ==  0:
#         a = int(i)
#         b = int(n / i)
#         break

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

soin = prime_factorize(n)

soin_r = soin[::-1]

tmp = 1
for i in range(len(soin) // 2):
    tmp *= soin[i]

zan = m / tmp

print(int(tmp + zan - 2))

"""
10
5

50
13

10000000019
10000000018

"""

Fixed submission:
n = int(input())
i = 1
ans = n
 
while i * i <= n:
    j, m = divmod(n, i)
    if m == 0:
        ans = min(ans, i + j - 2)
    i += 1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

ans = a // (b * 2)

if ans <= 0:
    ans = 0

print(ans)


Fixed submission:
a, b = map(int, input().split())
ans = a - (b * 2)

if ans <= 0:
    ans = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

if (s[0] == "L" and s[1] == "L") or (s[-1] == "R" and s[-2] == "R"):
        init -= 1

print(init + (2 * k))

Fixed submission:
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

ans = min(n-1, init + (2 * k))

print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

if s[0] == "L" and s[1] == "L":
    # if s[-1] == "R" and s[-2] == "R":
        init -= 1

print(init + (2 * k))

Fixed submission:
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

ans = min(n-1, init + (2 * k))

print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

if s[0] == "L" and s[1] == "L":
    if s[-1] == "R" and s[-2] == "R":
        init -= 1

print(init + (2 * k))

Fixed submission:
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

ans = min(n-1, init + (2 * k))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())

# n_list = np.arange(1, n + 1)
# m_list = np.zeros(n)
# m_list[:-1] = n_list[1:]
# m_list[-1] = n_list[0]

# n_l = np.arange(1, n + 1)
# res = np.cumsum(n_l) 
# print(int(res[-2]))
kekka = 0
for i in range(1, n):
    kekka += i

print(kekka)


Fixed submission:
n = int(input())
 
print(int(n * (n - 1) // 2))

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

n = int(input())

# n_list = np.arange(1, n + 1)
# m_list = np.zeros(n)
# m_list[:-1] = n_list[1:]
# m_list[-1] = n_list[0]

n_l = np.arange(1, n + 1)

res = np.cumsum(n_l) 

print(int(res[-2]))


Fixed submission:
n = int(input())
 
print(int(n * (n - 1) // 2))

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

n = int(input())

n_list = np.arange(1, n + 1)
m_list = np.zeros(n)
m_list[:-1] = n_list[1:]
m_list[-1] = n_list[0]

kekka = 0
amari = n_list % m_list
print(int(sum(amari)))


Fixed submission:
n = int(input())
 
print(int(n * (n - 1) // 2))
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())

a = [0] * n

for i in range(n):
    a[i] = int(input())

# a_s = set(a)

for i in range(n):
    tmp = copy.deepcopy(a)
    # tmp.discard(a[i])
    del tmp[i]
    print(max(tmp))


Fixed submission:
import copy

n = int(input())

a = [0] * n

for i in range(n):
    a[i] = int(input())

a_sort = sorted(a, reverse=True)

for i in range(n):
    if a[i] == a_sort[0]:
        print(a_sort[1])
    else:
        print(a_sort[0])
Buggy python submission (verdict: Runtime Error):
import numpy as np

L, R = map(int, input().split())

a = np.arange(L, R + 1)
a %= 2019
a.sort()

print(a[0] * a[1])

Fixed submission:
import numpy as np

L, R = map(int, input().split())

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019
            if min_ == 0:
                print(min_)
                exit()

print(min_)

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

L, R = map(int, input().split())

a = np.arange(L, R + 1)

# print(a)

a %= 2019

a.sort()

print(a[0] * a[1])

Fixed submission:
import numpy as np

L, R = map(int, input().split())

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019
            if min_ == 0:
                print(min_)
                exit()

print(min_)

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

L, R = map(int, input().split())

a = np.arange(L, R + 1)
a = a % 2019
a_s = sorted(a)

print(int(a_s[0] * a_s[1]))

Fixed submission:
import numpy as np

L, R = map(int, input().split())

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019
            if min_ == 0:
                print(min_)
                exit()

print(min_)

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

L, R = map(int, input().split())

a = np.linspace(L, R, R - L + 1) % 2019
a_s = sorted(a)

print(int(a_s[0] * a_s[1]))

Fixed submission:
import numpy as np

L, R = map(int, input().split())

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019
            if min_ == 0:
                print(min_)
                exit()

print(min_)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

L, R = map(int, input().split())

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019

print(min_)

Fixed submission:
import numpy as np

L, R = map(int, input().split())

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019
            if min_ == 0:
                print(min_)
                exit()

print(min_)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

a = set()
for i in range(m):
    a_tmp = int(input())  # int(input())
    a.add(a_tmp)

# a = [1 for i in range(m)]

dp = [0] * (n + 1)
for i in range(n + 1):
    if i in a:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])


Fixed submission:
import fractions

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

kobai = (c * d) // fractions.gcd(c, d)


def cnt(b, c, d, kobai):
    bc = b // c
    bd = b // d
    b_kobai = b // kobai

    return b - bc - bd + b_kobai


b_num = cnt(b, c, d, kobai)
a_num = cnt(a - 1, c, d, kobai)

ans = b_num - a_num

print(int(ans))
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())

l = list(map(int, input().split()))

sum_ = 0
tmp = []
for i in range(n):
    sum_ += l[i]
    if sum_ > x:
        tmp.append(i)
    elif sum_ == x:
        tmp.append(i + 2)

print(max(tmp))

Fixed submission:
n, x = map(int, input().split())

l = list(map(int, input().split()))

tmp = 0
li = []
for i in range(n):
    tmp += l[i]
    if tmp <= x:
        li.append(i)
    if tmp >= x:
        break

print(max(li) + 2)
# if tmp == x:
#     print(max(li) + 2)
# elif tmp > x:
#     print(max(li) + 1)
Buggy python submission (verdict: Runtime Error):
n, a, b, c, d = map(int, input().split())

s = input()

flagA = True
flagB = True

for i in range(d - b):
    if s[b + i] == "#" and s[b + i + 1] == "#":
        flagB = False

for i in range(c - a):
    if ((s[a + i] == "#") or (a + i == d - 1)) and ((s[a + i + 1] == "#") or (a + i + 1 == d - 1)):
        flagA = False
        for j in range(c - a):
            if (s[a + j] == "." and s[a + j + 1] == "." and s[a + j + 2] == "."):
                flagA = True

if flagA and flagB:
    print("Yes")
else:
    print("No")


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

s = input()

if c < d:
    for i in range(b, d):
        if s[i:i+2] == "##":
            print(('No'))
            exit()
    for i in range(a, c):
        if s[i:i+2] == "##":
            print(('No'))
            exit()
    print('Yes')
else:
    for i in range(b, d):
        if s[i:i+2] == "##":
            print(('No'))
            exit()
    for i in range(a, c):
        if s[i:i+2] == "##":
            print(('No'))
            exit()
    for i in range(b-2, d-1):
        if s[i:i+3] == "...":
            print(('Yes'))
            exit()
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, m = map(int, input().split())

lr_mat = np.zeros((m, 2))

for i in range(m):
    lr_mat[i, :] = list(map(int, input().split()))

cnt = 0
for i in range(n):
    flag = True
    for j in range(m):
        left = lr_mat[j, 0]
        right = lr_mat[j, 1]
        if not ((left <= i+1) and (i+1 <= right)):
            flag = False
            break
    if(flag):
        cnt += 1

print(cnt)


Fixed submission:
import numpy as np

n, m = map(int, input().split())

lr_mat = np.zeros((m, 2))

for i in range(m):
    lr_mat[i, :] = list(map(int, input().split()))

left_max = max(lr_mat[:, 0])
right_min = min(lr_mat[:, 1])

cnt = 0
for i in range(1, n+1):
    if(left_max <= i) and (i <= right_min):
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, m = map(int, input().split())

lr_mat = np.zeros((m, 2))

for i in range(m):
    lr_mat[i, :] = list(map(int, input().split()))

cnt = 0
for i in range(n):
    flag = True
    for j in range(m):
        left = lr_mat[j, 0]
        right = lr_mat[j, 1]
        if not ((left <= i+1) and (i+1 <= right)):
            flag = False
    if(flag):
        cnt += 1

print(cnt)


Fixed submission:
import numpy as np

n, m = map(int, input().split())

lr_mat = np.zeros((m, 2))

for i in range(m):
    lr_mat[i, :] = list(map(int, input().split()))

left_max = max(lr_mat[:, 0])
right_min = min(lr_mat[:, 1])

cnt = 0
for i in range(1, n+1):
    if(left_max <= i) and (i <= right_min):
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if a >= b:
    tmp1 = a
    a -= 1
else:
    tmp2 = b
    b -= 1

if a >= b:
    tmp2 = a
else:
    tmp2 = b

print(tmp1 + tmp2)


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

if a >= b:
    tmp1 = a
    a -= 1
else:
    tmp1 = b
    b -= 1

if a >= b:
    tmp2 = a
else:
    tmp2 = b

print(tmp1 + tmp2)
Buggy python submission (verdict: Runtime Error):
one = []
ten = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(menu[i] % 10)
    ten.append(menu[i] // 10)

for i in range(5):
    if one[i] == 0:
        one[i] = 10

one_min = min(one)

for i in range(5):
    if one[i] == 10:
        one[i] = 0

for i in range(5):
    if one_min == one[i]:
        one_min_idx = i

total = 0

for i in range(5):
    if one_min_idx != i:
        if one[i] == 0:
            total += ten[i] * 10
        else:
            total += ten[i] * 10 + 10

total += menu[one_min_idx]

print(total)


Fixed submission:
one = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(10 - menu[i] % 10)

for i in range(5):
    if one[i] == 10:
        one[i] = 0

total = 0
cnt = 0
for i in range(5):
    if cnt == 0 and one[i] == max(one):
        total += menu[i]
        cnt = 1
    else:
        total += menu[i]
        total += one[i]

print(total)

Buggy python submission (verdict: Runtime Error):
one = []
ten = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(menu[i] % 10)
    ten.append(menu[i] // 10)

for i in range(5):
    if one[i] == 0:
        one[i] = 10000000

one_min = min(one)

for i in range(5):
    if one[i] == 10000000:
        one[i] = 0

for i in range(5):
    if one_min == one[i]:
        one_min_idx = i

total = 0

for i in range(5):
    if one_min_idx != i:
        if one[i] == 0:
            total += ten[i] * 10
        else:
            total += ten[i] * 10 + 10

total += menu[one_min_idx]

print(total)


Fixed submission:
one = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(10 - menu[i] % 10)

for i in range(5):
    if one[i] == 10:
        one[i] = 0

total = 0
cnt = 0
for i in range(5):
    if cnt == 0 and one[i] == max(one):
        total += menu[i]
        cnt = 1
    else:
        total += menu[i]
        total += one[i]

print(total)

Buggy python submission (verdict: Runtime Error):
one = []
ten = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(menu[i] % 10)
    ten.append(menu[i] // 10)

for i in range(5):
    if one[i] == 0:
        one[i] = 100

one_min = min(one)

for i in range(5):
    if one[i] == 100:
        one[i] = 0

for i in range(5):
    if one_min == one[i]:
        one_min_idx = i

total = 0

for i in range(5):
    if one_min_idx != i:
        if one[i] == 0:
            total += ten[i] * 10
        else:
            total += ten[i] * 10 + 10

total += menu[one_min_idx]

print(total)


Fixed submission:
one = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(10 - menu[i] % 10)

for i in range(5):
    if one[i] == 10:
        one[i] = 0

total = 0
cnt = 0
for i in range(5):
    if cnt == 0 and one[i] == max(one):
        total += menu[i]
        cnt = 1
    else:
        total += menu[i]
        total += one[i]

print(total)