Problem:


Score: 200 points

Problem Statement

The restaurant AtCoder serves the following five dishes:

ABC Don (rice bowl): takes A minutes to serve.

ARC Curry: takes B minutes to serve.

AGC Pasta: takes C minutes to serve.

APC Ramen: takes D minutes to serve.

ATC Hanbagu (hamburger patty): takes E minutes to serve.

Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.

This restaurant has the following rules on orders:

An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).

Only one dish can be ordered at a time.

No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.

E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

Constraints

A, B, C, D and E are integers between 1 and 123 (inclusive).

Input

Input is given from Standard Input in the following format:

A
B
C
D
E

Output

Print the earliest possible time for the last dish to be delivered, as an integer.

Sample Input 1

29
20
7
35
120

Sample Output 1

215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:

Order ABC Don at time 0, which will be delivered at time 29.

Order ARC Curry at time 30, which will be delivered at time 50.

Order AGC Pasta at time 50, which will be delivered at time 57.

Order ATC Hanbagu at time 60, which will be delivered at time 180.

Order APC Ramen at time 180, which will be delivered at time 215.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 2

101
86
119
108
57

Sample Output 2

481

If we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:

Order AGC Pasta at time 0, which will be delivered at time 119.

Order ARC Curry at time 120, which will be delivered at time 206.

Order ATC Hanbagu at time 210, which will be delivered at time 267.

Order APC Ramen at time 270, which will be delivered at time 378.

Order ABC Don at time 380, which will be delivered at time 481.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 3

123
123
123
123
123

Sample Output 3

643

This is the largest valid case.



Sample input:
29
20
7
35
120


Sample output:
215

Submission status: Accepted

Solution code:
#123B
num_list = [int(input()) for i in range(5)]
max_list = []
count = 0
min_num = 0
for j in range(5):
    max_list.append(int((num_list[j] + 9) / 10) * 10)
    
    if max_list[j] - num_list[j] > count:
        count = max_list[j] - num_list[j]
        min_num = j
    else:
        pass

s = sum(max_list) - max_list[min_num] + num_list[min_num]
print(s)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

x = [a,b,c,d,e]

z = [10-(x[i]%10) for i in range(len(x))]
zz = [0 if z[i] == 10 else z[i] for i in range(len(z))]

ans = sum(x)+sum(zz)-max(zz)

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import re
import math
import fractions

def main():
    lst=[int(input()) for a in range(5)]
    index=0
    mx=0
    total=0
    for a in range(len(lst)):
        if math.ceil(lst[a]/10)*10-lst[a]>mx:
            mx=math.ceil(lst[a]/10)*10-lst[a]
            index=a
    #print(index)
    for a in range(len(lst)):
        if a==index:
            total+=lst[a]
        else:
            total+=math.ceil(lst[a]/10)*10
    print(total)
    
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#A,B,C=map(int,input().split())
#n=int(input())
# global n,A,s,memo,mx,mn,L,B

Submission status: Accepted

Solution code:
time=[];timeloss=[];ans=0
for i in range(5):
    a=input()
    if int(a[-1])==0:
        ans+=int(a)
    else:
        time.append(int(a))
        timeloss.append(10-int(a[-1]))
while len(time)>0:
        for i in range(len(time)):
            if timeloss[i]==min(timeloss):
                ans+=time[i]
                if not len(time)==1:
                    ans+=timeloss[i]
                del time[i];del timeloss[i];break
print(ans)

Submission status: Accepted

Solution code:
time=[];timeloss=[];ans=0
for i in range(5):
    a=input()
    if int(a[-1])==0:
        ans+=int(a)
    else:
        time.append(int(a))
        timeloss.append(10-int(a[-1]))
while len(time)>0:
        for i in range(len(time)):
            if timeloss[i]==min(timeloss):
                ans+=time[i]
                if not len(time)==1:
                    ans+=timeloss[i]
                del time[i];del timeloss[i];break
print(ans)

Submission status: Accepted

Solution code:
r = 10
s = 0
for _ in range(5):
	x = int(input())
	if x%10 == 0:
		s += x
	else:
		s += (x//10+1)*10
		r = min(r, x%10)
if r != 10:
	s -= 10 - r
print(s)

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]

time = 0
flag = 0
Loss = []

for i in range(5):
    if L[i]%10 == 0:
        time+=L[i]
        Loss.append(0)
    else:
        time+=(L[i]-L[i]%10+10)
        Loss.append(10-L[i]%10)

time -= max(Loss)
print(time)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

l = [(x+9)//10*10 for x in [a,b,c,d,e]]
ans=sum(l)
ans-=max([abs(x-y) for x,y in zip(l, [a,b,c,d,e])])
print(ans)

Submission status: Accepted

Solution code:
lists = []
for i in range(5):
	lists.append(input())

f_list = []
for i in lists:
	f_list.append(i[-1])

mins = 10
if not "0" in f_list:
    mins = int(min(f_list))
elif len(set(f_list)) == 1:
    pass
else:
    mins = int(sorted(set(f_list))[1])
sums = 0
for i in lists:
	sums += int((int(i)+9)/10)*10


print(sums-10+mins)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC123 B

LI = [int(input()) for _ in range(5)]
LI2 = [LI[i] % 10 for i in range(5)]

x = [(LI[i],LI2[i]) for i in range(5)]
#print(x)

ans = 0
x = sorted(x, key = lambda x:x[1],reverse = True)
for i in range(5):
    if x[i][1] == 0:
        t = x[i]
        x.remove(t)
        x.insert(0,t)
#print(x)

for i in range(4):
    if x[i][1] != 0:
        ans += x[i][0] + (10 - x[i][1])
    else:
        ans += x[i][0]
ans += x[4][0]
print(ans)

Submission status: Accepted

Solution code:
a=[int(input()) for _ in range(5)]
b=[10-a[i]%10 for i in range(5)]
c=[-(-a[i]//10) for i in range(5)]
d=[0]
for i in range(5):
    if b[i]!=10:
        d.append(b[i])
print(sum(c)*10-max(d))

Submission status: Accepted

Solution code:
from sys import stdin

x = []
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))

time = []
min = 0
for i in range(0,5):
    if x[i] %10 == 0:
        time.append(x[i])
    else:
        time.append(x[i] - (x[i]%10) + 10)
    if ((x[min]-1) % 10) > ((x[i]-1) % 10):
        min = i

time[min] = x[min]

sum_time = 0
for i in range(0,5):
    sum_time += time[i]

print(sum_time)

Submission status: Accepted

Solution code:
time = [int(input()) for _ in range(5)]

m = 0
total = 0

for i in time:
    mod = i%10
    if mod != 0:
        t = 10 - mod
    else:
        t = 0

    total += i + t

    m = max(m, t)

print(total - m)

Submission status: Accepted

Solution code:
time = []
for _ in range(5):
    time.append(int(input()))

mod = []
for i in time:
    mod.append(i % 10)

mod = [i for i in mod if i != 0]

for i in range(len(mod)):
    mod[i] = 10 - mod[i]

if len(mod) == 0:
    add = 0
else:
    add = sum(mod) - max(mod)

print(sum(time) + add)

Submission status: Accepted

Solution code:
import math

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

aa = 10*math.ceil(a/10)
bb = 10*math.ceil(b/10)
cc = 10*math.ceil(c/10)
dd = 10*math.ceil(d/10)
ee = 10*math.ceil(e/10)

adif = aa-a
bdif = bb-b
cdif = cc-c
ddif = dd-d
edif = ee-e

ans = aa+bb+cc+dd+ee - max(adif,bdif,cdif,ddif,edif)
print(ans)

Submission status: Accepted

Solution code:
import itertools
import math
i1 = []
i1.append(int(input()))
i1.append(int(input()))
i1.append(int(input()))
i1.append(int(input()))
i1.append(int(input()))
#i2 =(int(input())
#print(i1)
p_list = list(itertools.permutations(i1, 5))
#print(len(p_list))
tt = []
for i in p_list:
  tt.append((math.ceil(i[0]/10)+math.ceil(i[1]/10)+math.ceil(i[2]/10)+math.ceil(i[3]/10))*10+(i[4]))
  # tt.append(0+i[0]   
print(min(tt))

Submission status: Accepted

Solution code:
def solve(string):
    *abcde, = map(int, string.split())
    abcde.sort(key=lambda x: (x-1) % 10)
    return "{}".format(abcde[0] + sum([((i - 1) // 10 + 1) * 10 for i in abcde[1:]]))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(5)])))

Submission status: Accepted

Solution code:
A = [0] * 5

A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

maximum = 0
for i in range(5):
  tmp = (A[i] // 10 + 1) * 10 - A[i]
  if tmp == 10:
    tmp = 0
  else:
    A[i] = (A[i] // 10 + 1) * 10
  if tmp > maximum:
    maximum = tmp
    
print(sum(A) - maximum)

Submission status: Accepted

Solution code:
import math

lst = list(map(int,[input() for i in range(5)]))

lst_10 = sorted([i%10 for i in lst])
if sum(lst_10)==0:
    print(sum(lst))
    exit()
sum_time = sum([math.ceil(i/10)*10 for i in lst])
min_list=0
while min_list==0:
    min_list = lst_10.pop(0)
print(sum_time-10+min_list)

Submission status: Accepted

Solution code:
S = 0
mns = 0
for i in range(5):
    tmp = int(input())
    S += (tmp + 9) // 10 * 10
    if tmp % 10:
        mns = max(10 - tmp % 10, mns)
print(S - mns)

Submission status: Accepted

Solution code:
import math
a = [[] for i in range(5)]
min_inp = 0
for i in range(5):
    inp = int(input())
    inp_ceil = math.ceil(inp/10)*10
    first = inp - int(inp/10) * 10
    if first == 0:
        first = 10
    a[i].append(inp)
    a[i].append(inp_ceil)
    a[i].append(first)
a = sorted(a, key=lambda x: x[2])
ans = a[0][0]

for i in range(4):
    ans += a[i+1][1]

print(ans)

Submission status: Accepted

Solution code:
list1 = []
cnt = 0
bit = 9
switch = 0
for i in range(5):
  list1.append(int(input()))
for i in range(5):
  amari = list1[i] % 10
  if amari == 0:
    cnt += 1
  else:
    switch = 1
    bit = min(bit,amari)
    list1[i] += 10-amari
if switch ==1:
  
  print(sum(list1)-10+bit)
else:
  print(sum(list1))

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]

time = 0
amari = 10
for a in A:
    am = a % 10
    if am == 0:
        time += (a // 10) * 10
    else:
        time += (a // 10 + 1) * 10
        if am < amari:
            amari = am
k = 0 if amari == 10 else 10 - amari
time -= k
print(time)

Submission status: Accepted

Solution code:
F = [int(input()) for k in range(5)]
t = 0
r = 10
for k in range(5):
    if F[k]%10 != 0:
        if F[k]%10 < r:
            r = F[k]%10
            t = k
ans = 0
for k in range(5):
    if k == t or F[k]%10 == 0:
        ans += F[k]
    else:
        ans += F[k] + (10-F[k]%10)
print(ans)

Submission status: Accepted

Solution code:

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish_list = [a,b,c,d,e]
count = 0
modmin = [10, -1]
for i in range(5):
    if dish_list[i] % 10 != 0:
        count += 1
        if  dish_list[i] % 10 < modmin[0]:
            modmin[0] = dish_list[i] % 10
            modmin[1] = i

if modmin[1] == -1:
    ans = sum(dish_list)
else:
    ans = 0
    for i in range(5):
        if dish_list[i] % 10 != 0 and i != modmin[1]:
            b = dish_list[i] + (10- (dish_list[i] % 10))
        else:
            b = dish_list[i] 
        ans += b

print(ans)

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
mi = min(map(lambda x:(x-1)%10,a))+1
print(sum(map(lambda x:(x+9)//10*10,a))-(10-mi))

Submission status: Accepted

Solution code:
def abc():
    from math import ceil
    menus = []
    for i in range(5):
        t = int(input().rstrip())
        next = ceil(t / 10) * 10
        wait = next - t
        menus.append((t, next, wait))
    menus.sort(key=lambda x: x[2])
    progress = 0
    for i in range(4):
        progress += menus[i][1]
    progress += menus[4][0]
    print(progress)


abc()

Submission status: Accepted

Solution code:
import math
L1=[int(input())/10 for i in range(5)]
L2=[]
for i in L1:
  L2.append(math.ceil(i)*10)
L3=[]
for i in range(5):
  L3.append(sum(L2)-L2[i]+L1[i]*10)
print(int(min(L3)))

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]

ceiled = [(x+9)//10*10 for x in A]
can_save = [y - x for x,y in zip(A,ceiled)]

answer = sum(ceiled) - max(can_save)
print(answer)

Submission status: Accepted

Solution code:
import math
l = [int(input()) for i in range(5)]
e = 10
for i in l:
    re = i%10
    if re !=0:
        e = min(e, re)
l = [math.ceil(i/10)*10 for i in l]
print(sum(l)-(10-e))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

foods = [int(input()) for _ in range(5)]

exist_remainder_list = [(food, food % 10) for food in foods if food % 10 != 0]

if len(exist_remainder_list) != 0:
    last = min(exist_remainder_list, key=lambda value: value[1])
    foods.remove(last[0])

    ans = 0

    for index, food in enumerate(foods):
        ans += food
        while True:
            if ans % 10 == 0:
                break
            else:
                ans += 1

    print(ans + last[0])
else:
    ans = 0

    for index, food in enumerate(foods):
        ans += food
        while True:
            if ans % 10 == 0:
                break
            else:
                ans += 1

    print(ans)

Submission status: Accepted

Solution code:
import math
li = [int(input()) for _ in range(5)]
ans = 0
m = 0
for x in li:
  if x % 10 == 0:
      t = 0
  else:
      t = 10 - x % 10
  ans += x + t

  m = max(m,t)

print(ans-m)

Submission status: Accepted

Solution code:
na1 = []

for i1 in range(5):
    na1.append(int(input()))

r1 = 0
n1 = 0
for i1 in range(5):
    r1 += ((na1[i1] + 9) // 10) * 10
    if (na1[i1] % 10) != 0:
        if n1 == 0:
            n1 = (na1[i1] % 10)
            r1 -= 10 
        elif n1 > (na1[i1] % 10):
            n1 = na1[i1] % 10

r1 += n1
print(r1)

Submission status: Accepted

Solution code:
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a, b, c, d, e]
dishp = list(itertools.permutations(dish, 5))
t = []
x = 0
for i in range(0,120):
    x = 0
    for j in range(0,4):
        if dishp[i][j] %10 == 0:
            x += dishp[i][j]
        else:
            x += (dishp[i][j] // 10 +1) * 10
    x += dishp[i][4]
    t.append(x)
print(min(t))

Submission status: Accepted

Solution code:
import numpy
x=numpy.array([int(input())for _ in[0]*5])
print(sum(((x-1)//10+1)*10)+min((x-1)%10)-9)

Submission status: Accepted

Solution code:
import math

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

a_1 = 9 if int(a[-1]) == 0 else int(a[-1])
b_1 = 9 if int(b[-1]) == 0 else int(b[-1])
c_1 = 9 if int(c[-1]) == 0 else int(c[-1])
d_1 = 9 if int(d[-1]) == 0 else int(d[-1])
e_1 = 9 if int(e[-1]) == 0 else int(e[-1])

m = min(a_1, b_1, c_1, d_1, e_1)
ans = 0

if a_1 == m:
    ans = math.ceil(int(b) / 10) * 10 + math.ceil(int(c) / 10) * 10 + math.ceil(int(d) / 10) * 10 + math.ceil(int(e) / 10) * 10 + int(a)
elif b_1 == m:
    ans = math.ceil(int(a) / 10) * 10 + math.ceil(int(c) / 10) * 10 + math.ceil(int(d) / 10) * 10 + math.ceil(int(e) / 10) * 10 + int(b)
elif c_1 == m:
    ans = math.ceil(int(b) / 10) * 10 + math.ceil(int(a) / 10) * 10 + math.ceil(int(d) / 10) * 10 + math.ceil(int(e) / 10) * 10 + int(c)
elif d_1 == m:
    ans = math.ceil(int(b) / 10) * 10 + math.ceil(int(c) / 10) * 10 + math.ceil(int(a) / 10) * 10 + math.ceil(int(e) / 10) * 10 + int(d)
else:
    ans = math.ceil(int(b) / 10) * 10 + math.ceil(int(c) / 10) * 10 + math.ceil(int(d) / 10) * 10 + math.ceil(int(a) / 10) * 10 + int(e)

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import math

def rnd(n):
    return math.ceil(n / 10) * 10

if __name__ == '__main__':
    meal = [int(input()) for _ in range(5)]
    ans = 0
    for i in meal:
        if i % 10 == 0:
            ans += i
            meal.remove(i)
    m = sorted(meal, key=lambda x: x % 10, reverse=True)
    for i in m[:-1]:
        ans += rnd(i)
    ans += m[-1]

    print(ans)

Submission status: Accepted

Solution code:
import sys
import math

input = sys.stdin.readline

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time_list = [a, b, c, d, e]
round_sum = 0
round_list = []
for t in time_list:
    if t%10 > 0:
        round_sum += t + 10-(t%10)
        round_list.append(t + 10-(t%10))
    else:
        round_sum += t
        round_list.append(t)
cnt_list = []
for r, t in zip(round_list, time_list):
    cnt_list.append(round_sum - r + t)
print(min(cnt_list))

Submission status: Accepted

Solution code:
import itertools
C = []
for i in range(5):
    C.append(int(input()))

ans = float("inf")
for order in itertools.permutations(C, 5):
    total = 0
    for c in order:
        if total % 10 != 0:
            total = (total // 10 + 1) * 10
        total += c

    ans = min(total, ans)

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
num = []
iti = []

for temp in range(5):
    temp2 = input()
    temp3 = int(temp2)
    if temp3 >= 10 and temp2[-2] != "0":
        num.append((int(temp2[0:-2])+1)*10)
    elif temp2[-2] == "0":
        num.append(int(temp2[0:-2])*10)
    else:
        num.append(10)
    if int(temp2[-2]) != 0:
        iti.append(int(temp2[-2]))

if iti == []:
    last = 10
else:
    last = min(iti)
print(sum(num)-10+last)

Submission status: Accepted

Solution code:
A = str(input())
B = str(input())
C = str(input())
D = str(input())
E = str(input())
a = int(A[-1:])
b = int(B[-1:])
c = int(C[-1:])
d = int(D[-1:])
e = int(E[-1:])
F = [a,b,c,d,e]
G = F.count(0)
H = (10-a)+(10-b)+(10-c)+(10-d)+(10-e)
p = 9 if a == 0 else a
q = 9 if b == 0 else b
r = 9 if c == 0 else c
s = 9 if d == 0 else d
t = 9 if e == 0 else e
I = min([p,q,r,s,t])
J = int(A) +int(B) +int(C) + int(D) + int(E)
K = I -10*G -10
if G==5:
  print(J)
else:
  print(H+J+K)

Submission status: Accepted

Solution code:
s=0
rs=0
m=9
for i in range(5):
    n=int(input())
    rs+=n%10
    if n%10!=0:
        m=min(m,n%10)
        n=(n//10+1)*10
    s+=n
if rs==0:
    m=10
print(s-10+m)

Submission status: Accepted

Solution code:
cuisine = [int(input()) for _ in ' '*5]
time = [ ((a+9)//10*10)-a for a in cuisine ]
print(sum(time) + sum(cuisine) - max(time))

Submission status: Accepted

Solution code:
A=[0]*5
A[0]=int(input())
A[1]=int(input())
A[2]=int(input())
A[3]=int(input())
A[4]=int(input())
hikubun=0
for i in range(5):
    hikubun=max(-A[i]%10,hikubun)
    A[i]=(A[i]//10+(A[i]%10!=0))*10
    
ans=sum(A)-hikubun
print(ans)

Submission status: Accepted

Solution code:
ls = [int(input()) for i in range(5)]
ans = []
num = 0
minNum = 10
flag = True
    
for j in ls:
    x = j % 10
    if x < minNum and x > 0:
        num = j
        minNum = x
    elif minNum == 10 and j == ls[-1]:
        flag = False
if flag:
    ans.append(num)
    ls.pop(ls.index(num))

for i in ls:
    y = ((i + 9) // 10) * 10
    ans.append(y)

print(sum(ans))

Submission status: Accepted

Solution code:
a=[int(input()) for _ in range(5)]
b=0
c=[10]
for i in range(5):
    if (b+a[i])%10==0:
        b+=a[i]
    else:
        b+=(a[i]//10+1)*10
for i in range(5):
    if a[i]%10!=0:
        c.append(a[i]%10)
print(b+min(c)-10)

Submission status: Accepted

Solution code:
a=0
c=9
for i in range(5):
    b=int(input())
    a+=((b-1)//10+1)*10
    c=min((b-1)%10,c)
print(a-9+c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
time = []
for i in range(5):
    time.append(int(input()))


def ten_time(x):
    return (x + 9) // 10 * 10


def rem(x):
    return ten_time(x) - x


ans = 0
for i in range(len(time)):
    ans += ten_time(time[i])

ans -= rem(max(time, key=rem))

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
time = []
for i in range(5):
    time.append(int(input()))


def tkey(x):
    rem = x % 10
    return 0 if rem == 0 else 10 - rem


time.sort(key=tkey)

ans = 0
for i in range(len(time)):
    if i != 4 and time[i] % 10 != 0:
        time[i] = 10 * (time[i] // 10 + 1)
    ans += time[i]

print(ans)

Submission status: Accepted

Solution code:
a=[]
for _ in range(5):
    a.append(int(input()))
ans=1000
b=[]
for i in range(5):
    if a[i]%10!=0:
        b.append(a[i]-a[i]%10+10)
    else:
        b.append(a[i])
for i in range(5):
    ans = min(ans,sum(b)-b[i]+a[i])
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

l = []
for _ in range(5):
    l.append(int(input()))

target_idx = -1
dig_1_min  = 10
for a in l:
    dig_1 = a % 10
    if dig_1 != 0 and dig_1 < dig_1_min:
        dig_1_min = dig_1
        target_idx = l.index(a)

total = 0
for i in range(len(l)):
    val = l[i]
    dig_1 = val % 10
    if dig_1 != 0 and i != target_idx:
        val += 10
        val -= dig_1
    total += val

print(total)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math

def ReadInputNum():
    input_num=[]
    for i in range(5):
        input_num.append(int(input()))
    return tuple(input_num)

def CheckRangeInput(*argv):
    for num in argv:
        if 1<=num<=123 and isinstance(num,int):
            pass
        else:
            print("input"+ num +"is unexpected.")
            sys.exit()


def SumTotalTime(Tuple_Input):
    list_input=list(Tuple_Input)
    amari=[]
    # use numpy #                                                                                                                                                                        
    # list_tmp=np.array(list_input)                                                                                                                                                      
    # amari=(list_tmp-1)%10                                                                                                                                                              

    for i in list_input:
        amari.append((i-1) % 10)

    # amari=amari.tolist()                                                                                                                                                               
    last_one=min(amari)
    last_one=list_input.pop(amari.index(last_one))
    # print(last_one)                                                                                                                                                                    
    # print(list_input)                                                                                                                                                                  

    out_put=0
    for i in list_input:
        out_put += math.ceil(i/10)*10
    # print(out_put)                                                                                                                                                                     
    print(out_put+last_one)


# tuple_input= ReadInputNum()                                                                                                                                                            
# CheckRangeInput(tuple_input)                                                                                                                                                           
A,B,C,D,E = ReadInputNum()
CheckRangeInput(A,B,C,D,E)
tuple_input = (A,B,C,D,E)
SumTotalTime(tuple_input)

Submission status: Accepted

Solution code:
l1=[int(input()) for i in range(5)]
l2=[0 if item%10==0 else 10-item%10 for item in l1]

t=0
c=0
for i in range(5):
  if l2[i]==max(l2) and c==0:
    t+=l1[i]
    c+=1
  else:
    t+=(l1[i]+l2[i])
    
print(t)

Submission status: Accepted

Solution code:
x=[int(input()) for _ in range(5)]
y=[x[_]%10 for _ in range(5)]
y.sort()
s=0
a=0
for _ in range(5):
  if y[_]!=0:
    a=y[_]
    s=-1
    break
for _ in range(5):
  s=s-(-x[_] // 10)
print((s)*10+a)

Submission status: Accepted

Solution code:
import math
import sys
import numpy

a = []
for _ in range(5):
    a.append(int(input()))

ans = 0
Q = []
for i in a:
    if i % 10 != 0:
        Q.append(10 - i%10)
    ans += i
Q.sort(reverse=True)
print(ans + sum(Q[1:]))

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]
print(sum(B)-max(diff))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[8]:


import math
ds = [int(input()) for i in range(5)]
"""
29
20
7
35
120
"""


# In[9]:


s1 = [d%10 for d in ds if d%10!=0]
if s1:
    m1 = min(s1)
else:
    m1 = 10


# In[10]:


sum_ = 0
for d in ds:
    sum_ += math.ceil(d/10)*10


# In[11]:


print(sum_-10+m1)


# In[ ]:

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
m = []
flag = l[0]%10
cnt = 0
for i in range(1,5):
    if l[i]%10 < flag and l[i]%10 != 0:
        cnt = i
for i in range(5):
    if i == cnt or l[i]%10 == 0:
        m.append(l[i])
    else:
        m.append(l[i]+(10-(l[i]%10)))
print(sum(m))

Submission status: Accepted

Solution code:
L=[]
for _ in range(5):
   L.append(int(input())) 
   
ans=0
Lamari=[]
   
for i in L:
    if i%10!=0:
        Lamari.append(10-i%10)
    ans+=i

Lamari.sort(reverse=True)

print(ans+sum(Lamari[1:]))

Submission status: Accepted

Solution code:
M = [int(input()) for i in range(5)]
li = []

total = 0

for i in M:
    if i % 10 == 0:
        total += i
    else:
        total += i
        total += 10 - (i%10)
        li.append(i%10)

print(total - (10 - (10 if not li else min(li))))

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

if a%10==0:
  p=10
else:
  p=a%10
  a=a-p+10
  
if b%10==0:
  q=10
else:
  q=b%10
  b=b-q+10
  
if c%10==0:
  r=10
else:
  r=c%10
  c=c-r+10
  
if d%10==0:
  s=10
else:
  s=d%10
  d=d-s+10
  
if e%10==0:
  t=10
else:
  t=e%10
  e=e-t+10
  
x=a+b+c+d+e
y=min(p,q,r,s,t)
print(x+y-10)

Submission status: Accepted

Solution code:
M = [int(input()) for _ in range(5)]
m = []
T = 0
for i in range(5):
    if M[i] % 10 == 0:
        T += M[i]
    else:
        T += M[i]
        T += 10 - M[i] % 10
        m.append(M[i] % 10)
print(T - (10 - (10 if not m else min(m))))

Submission status: Accepted

Solution code:
import sys

def main():
    sinputl = sys.stdin.readline

    input = [int(sinputl()) for _ in range(5)]

    input.sort(key=lambda x: (x - 1) % 10)

    time = input.pop(0)

    for x in input:
        time += (x + 9) // 10 * 10

    print(time)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
mr = 0
sm = 0
for i in range(5):
    nm = int(input())
    r = (10 - nm % 10) % 10
    sm += nm + r
    mr = max(r, mr)
print(sm - mr)

Submission status: Accepted

Solution code:
import math

sm = 0
dishes = []
for i in range(5):
    nm = int(input())
    if nm % 10 == 0:
        sm += nm
        continue
    dishes.append(nm)
last = min(dishes, key=(lambda x: x % 10), default=0)
discovered = False
for e in dishes:
    if e == last and not discovered:
        discovered = True
        continue
    sm += math.ceil(e / 10.0) * 10

print(sm + last)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]

print(sum(B)-max(diff))

Submission status: Accepted

Solution code:
l = []
for i in range(5):
    A = int(input())
    if A%10 == 0:
        l.append([A,A%10])
    else:
        l.append([A,10 - A%10])
l.sort(key = lambda x : x[1])
s = 0
for j in range(4):
    s += l[j][0] + l[j][1]
s += l[4][0]
print(s)

Submission status: Accepted

Solution code:

list = []
for i in range(5):
    list.append(int(input()))

#print(list[0])
list_2 = []
for i in range(5):
    list_2.append(list[i]%10)





list_3 = []

for i in range(5):
    list_3.append(((list[i]+ 9)//10)*10)



ans = 10
for i in range(5):
    if 0<list_2[i]<ans:
        ans = list_2[i]
print(sum(list_3)-(10-ans))

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
ans = 0
I = [i for i, a in enumerate(A) if a % 10 == 0]
for i in reversed(I):
    ans += A.pop(i)
if len(A) == 0:
    print(ans)
    exit()
A.sort(key=lambda a: a % 10)
ans += A.pop(0)
for i in range(len(A)):
    A[i] += 10 - (A[i] % 10)
ans += sum(A)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    M = [int(input()) for _ in range(5)]
    t = 0
    print(min([rec(0, i, M[:]) for i in range(len(M))]))

def rec(total, i, M):
    if len(M) == 1:
        total += M[i]
        return total
    else:
        if M[i] % 10 != 0:
            total += int(M[i] / 10) * 10 + 10
        else:
            total += M[i]
        del M[i]
    return min([rec(total, i, M[:]) for i in range(len(M))])

main()

Submission status: Accepted

Solution code:
L = []
for i in range(5):
    L.append(int(input()))

ans = 0
tmp = []

for i in range(len(L)):
    if(L[i]%10 == 0):
        ans += L[i]
    else:
        ans += L[i] + (10 - L[i]%10)
        tmp.append(L[i]%10)

if(len(tmp) > 0):
    ans -= 10 - min(tmp)

print(ans)

Submission status: Accepted

Solution code:
dic=[]

for i in range(5):
    dic.append(int(input()))

sub=[]
t=0

for line in dic:
    t+=line
    sub.append((10-line%10)%10)

t+=sum(sub)-max(sub)
print(t)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
a = [int(input()) for _ in range(5)]
b = []
last_order = 0

for i in range(5):
	b.append(-(-a[i] // 10) * 10)
	if (a[i] % 10 < a[last_order] % 10) and (a[i] % 10 != 0):
		last_order = i

print(sum(b) - b[last_order] + a[last_order])

Submission status: Accepted

Solution code:
time = [int(input()) for i in range(5)]
result = 0
a = [10]

for i in range(5):
    if time[i] % 10 == 0:
        result += time[i]
    else:
        result += ((time[i] // 10)+1)*10
        a.append(time[i] % 10)
print(result - (10 - min(a)))