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:
import math

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

min1 = map(lambda x: x % 10, t)
min1 = min([10 if i == 0 else i for i in min1])

print(sum(map(lambda x: math.ceil(x) * 10, [i/10 for i in t])) - (10 - min1))

Submission status: Accepted

Solution code:
a = list(int(input()) for _ in range(5))
s = sum(a)

b = [i for i in a if i % 10 != 0]

if b:
    a_ = list(10-(j % 10) for j in b)
    a_.sort()
    a_.pop(-1)
    print(s + sum(a_))
else:
    print(s)

Submission status: Accepted

Solution code:
s=[int(input()) for i in range(5)]
list=[]
a=0
b=0
for j in range(5):
  if s[j]%10!=0:
    list.append(s[j]%10)
    a+=1
if 0<a:
  list.sort()
  for k in range(5):
    if s[k]%10==0:
      b+=s[k]
    else:
      c=s[k]%10
      b+=s[k]+10-c
  b=b-10+list[0]
  print(b)
else:
  for l in range(5):
    b+=s[l]
  print(b)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
ans = 0
m = 0
for i in l:
    if i % 10 != 0:
        p = 10 - i % 10
    else:
        p = 0
    ans += i + p
    m = max(m, p)
print(ans - m)

Submission status: Accepted

Solution code:
import math
src = [input() for _ in range(5)]
k_li = []
v_li = []
sum = 0
for s in src:
    if int(s[-1]) != 0:
        k_li.append(int(s[-1]))
        v_li.append(int(s))
    else:
        sum += int(s)
flag = False
if len(k_li)>0:
    m = min(k_li)
    for k,v in zip(k_li,v_li):
        if k == m and flag == False:
            sum += v
            flag = True
        else:
            sum += math.ceil(v/10)*10
print(sum)

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
a =[0]*5
ans = sum(L)
for i in range(5):
    if L[i]%10>0:
        a.append(10-L[i]%10)
#print(a)
print(sum(L)+sum(a)-max(a))

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """29
20
7
35
120"""
        output = """215"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """101
86
119
108
57"""
        output = """481"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """123
123
123
123
123"""
        output = """643"""
        self.assertIO(input, output)

def resolve():
    a=[]
    count=0
    for i in range(5):
        x=int(input())
        if x%10==0:
            count+=x
        else:
            a.append(x)
    if len(a)==0:
        print(count)
    else:
        a.sort(key= lambda xx: xx%10 , reverse= True)

        for i in a[:-1]:
            count+=i-i%10+10
        else:
            count+=a[-1]
        print(count)
if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import math

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

last_menu = min(menu, key=lambda x: (x - 1) % 10)
menu.remove(last_menu)

print(sum(map(lambda x: math.ceil(x / 10) * 10, menu)) + last_menu)

Submission status: Accepted

Solution code:
import itertools
lst = []
for e in range(5):
    lst.append(int(input()))
ans = 10**9
for pl in list(itertools.permutations(lst)):
    minute = 0
    for i,w in enumerate(pl):
        while True:
            if minute%10 == 0:
                minute += w 
                break
            else:
                minute += 1
    ans = min(ans, minute)
print(ans)

Submission status: Accepted

Solution code:
dish_list = [int(input()) for _ in range(5)]
last_num_list = [int(str(dish_i)[-1]) for dish_i in dish_list]

if sum(last_num_list) % 10 == 0:
  print(sum(dish_list))
else:  
  target_index = min(list(filter(lambda x: x>0, last_num_list)))

  last_num_min_index = last_num_list.index(target_index)
  ceiling_dish_list = [-10* (-i//10) for i in dish_list]

  print(sum(ceiling_dish_list) - ceiling_dish_list[last_num_min_index] + dish_list[last_num_min_index])

Submission status: Accepted

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

min_under10 = 10
min_under10_number = 100
time_10_number = []
for i in range(5):
    tmp = dishes[i] % 10
    if tmp < min_under10 and tmp != 0:
        min_under10 = tmp
        min_under10_number = i
    if tmp == 0:
        time_10_number.append(i)

sum_times = 0
for i in range(5):
    if i != min_under10_number and i not in time_10_number:
        sum_times += (dishes[i] // 10 + 1) * 10
    elif i == min_under10_number:
        sum_times += dishes[i]
    elif i in time_10_number:
        sum_times += dishes[i]

print(sum_times)

Submission status: Accepted

Solution code:
r = [int(input()) for i in range(5)]
import math
print(sum(sorted([math.ceil(x*0.1)*10 - x for x in r])[:4]) + sum(r))

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]
Y = [[x, 10-x%10] for x in X]
acc = 0
for y in Y:
    if y[1] == 10:
        acc += y[0]
    else:
        acc += y[0] + y[1]
Z = [10-a%10 for a in X if (10-a%10) < 10]
if Z:
    acc -= max(Z)
print(acc)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
dishes = [0]*5
last_order = 0
lo_mod = 10
for i in range(5):
    dishes[i] = int(input())
    tmp_mod = dishes[i] % 10
#    print(tmp_mod)
    if (tmp_mod != 0) & (tmp_mod < lo_mod):
        last_order = i
        lo_mod = tmp_mod
count = 0
for i in range(5):
    if i == last_order:
        count += dishes[i]
    else:
        mod = dishes[i] % 10
        if mod != 0:
            count += dishes[i] // 10 * 10 + 10
        else:
            count += dishes[i]
print(count)

Submission status: Accepted

Solution code:
A = []
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.sort(key=lambda x: x % 10)
ans = 0
isMin = True
for a in A:
  if a % 10 == 0:
    ans += a
  else:
    if isMin:
      ans += a
      isMin = False
    else:
      ans += a // 10 * 10 + 10
print(ans)

Submission status: Accepted

Solution code:
import math

ans = 0
diff = 0
for m in [ int(input()) for i in range(5) ]:
  time = math.ceil(m / 10) * 10
  ans += time
  diff = max(diff, time - m)
print(ans - diff)

Submission status: Accepted

Solution code:
menu = [int(input()) for _ in range(5)]
last_order_index = 0
time = 10
for i in range(5):
  if menu[i] % 10 != 0 and time > menu[i] % 10:
    time = menu[i] % 10
    last_order_index = i
cnt = menu[last_order_index]
for j in range(5):
  if j == last_order_index:
    continue
  if menu[j] % 10 != 0:
    cnt += ((menu[j]//10) + 1) * 10
  else:
    cnt += menu[j]
print(cnt)

Submission status: Accepted

Solution code:
l = []
for _ in range(5):
  l.append(int(input()))
can = []
for i in range(5):
  tmp = 0
  for j in range(5):
    if j == i:
      tmp += l[j]
    else:
      tmp += ((l[j]-1) // 10 + 1) * 10
  can.append(tmp)
print(min(can))

Submission status: Accepted

Solution code:
time = []
for i in range(5):
  time.append(int(input()))
  
time_diff = [(10-(i%10))%10 for i in time]
time_ten = [i+(10-i%10)%10 for i in time]


max_diff = time_diff.index(max(time_diff))

ans = sum(time_ten) - time_ten[max_diff] + time[max_diff]

print(ans)

Submission status: Accepted

Solution code:
x=[]
total=[]
for i in range(5):
  t=list(input())
  if t[-1]=='0':
    total.append(t)
  else:
    x.append(t)
x=sorted(x, key=lambda x: x[-1])
for i in range(1,len(x)):
  total.append(x[i])
if len(x)!=0:
  last=int(''.join(x[0]))

for i in range(4):
  total[i]=int(''.join(total[i]))
  total[i]=-(-total[i]//10)*10
if len(x)==0:
  total[-1]=int(''.join(total[-1]))
  print(sum(total))
else:
  print(sum(total)+last)

Submission status: Accepted

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

saigo = 9
nonzero = 0
for i in range(5):
    if t[i] % 10 != 0:
        saigo = min(saigo,t[i]%10)
        nonzero += 1
if nonzero == 0:
    saigo = 10

jikan = 0
for i in range(5):
    if t[i] % 10 == 0:
        jikan += t[i]
    else:
        jikan += t[i] + 10 - t[i]%10

jikan -= 10 - saigo
print(jikan)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
dish = [a,b,c,d,e]
# 10 - (10で割った余り)が一番大きいものを最後に
total_time=0
next_order=0
max_next=0
for d in dish:
    total_time += d
    if d%10!=0:
        # m: 次の注文までにかかる時間
        next_order=10-d%10
        total_time += next_order
        if next_order > max_next:
            max_next=next_order
total_time-=max_next
print(total_time)

Submission status: Accepted

Solution code:
x=[int(input()) for i in range(5)]
y=[0]*5
for i in range(5):
  if x[i]%10>0:
    y[i]=(x[i]//10+1)*10
  else:
    y[i]=x[i]
    
z=[x[i]%10 for i in range(5)]
for i in range(5):
  if z[i]==0:
    z[i]=10
    
t=sum(y)-10+min(z)
print(t)

Submission status: Accepted

Solution code:
import math

time = 0
diff = 0
for i in range(5):
    t = int(input())
    tt = math.ceil(t / 10) * 10
    time += tt
    diff = max(diff, tt-t)
print(time - diff)

Submission status: Accepted

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

L2 = [0 for i in range(5)]
time = 0
for i in range(5):
    L2[i] = L[i]%10
    if L2[i] > 0:
        time += L[i]//10*10+10
    else:
        time += L[i]
    
L2.sort()
for i in range(5):
    if L2[i] > 0:
        time -= (10-L2[i])
        break

print(time)

Submission status: Accepted

Solution code:
x=[int(input())for i in range(5)]
y=0
for i in range(5):
    y+=x[i]+(-x[i]%10)
z=max(-x[i]%10 for i in range(5))
print(y-z)

Submission status: Accepted

Solution code:
import math
xs = [int(input()) for _ in range(5)]
print(sum(xs) + sum(sorted([math.ceil(x*0.1)*10 - x  for x in xs])[:4]))

Submission status: Accepted

Solution code:
x = [int(input()) for _ in range(5)]
y = []
sum_x = 0
for i in range(5):
    if x[i]%10 != 0:
        sum_x += (x[i]//10)*10+10
        y.append(x[i]%10)
    else:
        sum_x += x[i]
if len(y) != 0:
     sum_x = sum_x + min(y) - 10
print(sum_x)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
mod_list = [a % 10 for a in A]
mod_list = [10 if a == 0 else a for a in mod_list]

comb_list = [[a, b] for a, b in zip(A, mod_list)]
sort_list = sorted(comb_list, key=lambda x: -x[1])

res = 0

for i, a in enumerate(sort_list):
    if i < 4:
        res += a[0] + (10-a[1])
    else:
        res += a[0]

print(res)

Submission status: Accepted

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

min_fraction = 9
min_fraction_index = 0
for i in range(5):
    if cooking_time[i] % 10 != 0 and cooking_time[i] % 10 < min_fraction:
        min_fraction = cooking_time[i] % 10
        min_fraction_index = i



total_time = 0
for i in range(5):
    if i != min_fraction_index:
        if cooking_time[i] % 10 != 0:
            total_time += ((cooking_time[i] // 10) + 1) * 10
        else:
            total_time += cooking_time[i]
total_time += cooking_time[min_fraction_index]

print(total_time)

Submission status: Accepted

Solution code:
x=[]
x=[int(input()) for _ in range(5)]
print(sum(map(lambda i:-(-i//10*10)-i,x))+sum(x)-max(map(lambda i:-(-i//10*10)-i,x)))

Submission status: Accepted

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

min_remainder_num = 0
for i in range(1, 5):
    if order_list[min_remainder_num]%10 > order_list[i]%10 > 0:
        min_remainder_num = i

ans = 0

for j in range(5):
    if j == min_remainder_num:
        ans += order_list[j]
    else:
        ans += -((-1 * order_list[j])//10)*10

print(ans)

Submission status: Accepted

Solution code:
A,B,C,D,E=(int(input()) for i in range(5))
def m(x):
    if x%10==0:
        return x
    else:
        return((x//10)+1)*10
      
a=m(A)
b=m(B)
c=m(C)
d=m(D)
e=m(E)
aa=A+b+c+d+e
bb=a+B+c+d+e
cc=a+b+C+d+e
dd=a+b+c+D+e
ee=a+b+c+d+E
print(min(aa,bb,cc,dd,ee))

Submission status: Accepted

Solution code:
A = []
for i in range(5):
	A.append(int(input()))
B = []
for i in range(5):
	B.append((10-A[i]%10)%10)

print(sum(A) + sum(B) - max(B))

Submission status: Accepted

Solution code:
import math
k=[]
sa=[]
for i in range(5):
	a = int(input())
	j=math.ceil(a/10)*10
	k.append(j)
	m=j-a
	sa.append(m)
print(sum(k)-max(sa))

Submission status: Accepted

Solution code:
import math
l=[]
k=[]
sa=[]
for i in range(5):
	a = int(input())
	l.append(a)
	j=math.ceil(a/10)*10
	k.append(j)
	m=j-a
	sa.append(m)
print(sum(k)-max(sa))

Submission status: Accepted

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

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

tmp = 10
for i, f in enumerate(food):
    if (f - 1) % 10 < tmp:
        tmp = (f - 1) % 10
        index = i

ans = 0
for i, f in enumerate(food):
    if i != index:
        ans += ((f - 1) // 10 + 1) * 10
    else:
        ans += f

print(ans)

Submission status: Accepted

Solution code:
a = []
b = []
for i in range(5):
    temp = int(input())
    amari = (10 - temp % 10) % 10
    a.append(temp)
    b.append(amari)

print(sum(a)+sum(b)-max(b))

Submission status: Accepted

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

B=[]
for i in range(5):
  B.append((10-A[i]%10)%10)

print(sum(A)+sum(B)-max(B))

Submission status: Accepted

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

B=[]
for i in range(5):
  B.append(10-A[i]%10 if A[i]%10 else 0)
#print(B)

for i in range(5):
  if B[i]==max(B):
    B[i]=0
    break
#print(B)

for i in range(5):
  A[i]+=B[i]
#print(A)
print(sum(A))

Submission status: Accepted

Solution code:
import math
r=list(int(input()) for _ in range(5))
_r=list(map(lambda x: math.ceil(x/10)*10, r))

diff=[]
for i in range(5):
    diff.append(_r[i]-r[i])

print(sum(_r)-max(diff))

Submission status: Accepted

Solution code:
import itertools

d = [int(input()) for _ in range(5)]
s = []
min = 999
for i in itertools.permutations(range(5)):
    s.append(i)
for x in s:
    tmp = 0
    for y in x:
        tmp += d[y]
        if y != x[-1] and d[y]%10 != 0:
            tmp += 10 - tmp%10
    if tmp < min:
        min = tmp

print(min)

Submission status: Accepted

Solution code:
A,B,C,D,E=(int(input()) for _ in range(5))
X=[A,B,C,D,E]
time=0
rest=[]
for i in range(5):
    if X[i]%10!=0:
        time+=(X[i]//10+1)*10
    else:
        time+=X[i]
    rest.append((10-X[i]%10)%10)
time-=max(rest)
print(time)

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a=[int(input()) for _ in [0]*5]
c=10
for i in range(5):
	if int(str(a[i])[-1])==0:
		continue
	c=min(int(str(a[i])[-1]),c)
	
for i in range(5):
	a[i]=(-(-(a[i])//10))*10

if c==0:
	print(sum(a))
else:
	print(sum(a)-(10-c))

Submission status: Accepted

Solution code:
import math
l = [int(input()) for _ in range(5)]

l2 = [math.ceil(i/10)*10 for i in l]

diff = max([i-j for i,j in zip(l2,l)])

print(sum(l2) - diff)

Submission status: Accepted

Solution code:
import itertools
A = [int(input()) for _ in range(5)]
tmin = 10**4
for x in itertools.permutations(range(5)):
    t = 0
    for i in range(5):
        a = t%10
        if a>0:
            t = (t//10+1)*10
        t += A[x[i]]
    tmin = min(tmin,t)
print(tmin)

Submission status: Accepted

Solution code:
T = [int(input()) for i in range(5)]
t = 0
R = []
for i in range(5):
  t += -(-T[i]//10)*10
  R += [-(-T[i]//10)*10-T[i]]
print(t - max(R))

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
b = 10-min([a[i]%10 for i in range(5) if 0 < a[i]%10] or [10])
print(sum([(-(-a[i]//10)) for i in range(5)])*10-b)

Submission status: Accepted

Solution code:
A = input()
B = input()
C = input()
D = input()
E = input()
an = [A,B,C,D,E]
s = 0
an = list(map(int,an))
for i in an:
  s += i +(10-i%10 if i%10!=0 else 0)
ans = 10000
for i in range(5):
  ans = min(ans,s-(an[i]+(10-an[i]%10 if an[i]%10!=0 else 0))+an[i])
print(ans)

Submission status: Accepted

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

a=[-(-n[i]//10)*10 for i in range(len(n))]
b=[n[i]%10 for i in range(len(n)) if n[i]%10 != 0]
if b != []:
    print(sum(a) + min(b) -10)
else:
    print(sum(a))

Submission status: Accepted

Solution code:
t = [int(input()) for _  in range(5)]
total = 0
amari = []

for ti in t:
    d, m = divmod(ti, 10)
    total += ti - m
    if m > 0:
        amari.append(m)
if amari:
    total += min(amari) + 10 * (len(amari) - 1)
print(total)

Submission status: Accepted

Solution code:
a=list(int(input()) for i in range(5))

b=[-(-a[i]//10)*10 for i in range(5)]
c=[a[i]%10 for i in range(5) if a[i]%10 != 0]

if c != []:
    print(sum(b) + min(c) -10)
else:
    print(sum(b))

Submission status: Accepted

Solution code:
import math
total = 0
times = []
for i in range(5):
  times.append(int(input()))
  
d1 = 10
for i in range(5):
  total += math.ceil(times[i] / 10) * 10
  if times[i] % 10 != 0:
    d1 = min(d1, times[i] % 10)
  
print(total - 10 + d1)

Submission status: Accepted

Solution code:
import math

times = [0]*5
for i in range(5):
    times[i] = int(input())

#1桁目が一番小さいものを判断する
mini = 10
idx = 9
for time in times:
    if time%10 < mini and time%10 > 0:
        mini = min(mini,time%10)
        idx = times.index(time)

total = 0
for i in range(5):
    if i == idx:
        total += times[i]
    else:
        total += math.ceil(times[i]/10)*10
print(total)

Submission status: Accepted

Solution code:
import math
a = 0
b = 0
c = 0
d = 0
e = 0
ls = [a,b,c,d,e]
for i in range(len(ls)):
    ls[i] = int(input())
for i in ls:
    if i > 9:
        i = i//10
ans = 0
for i in ls:
    ans += math.ceil(i)

lsls = [0]
for i in range(len(ls)):
    ls_one = str(ls[i])
    if int(ls_one[-1]) > 0:
    	lsls.append(10-int(ls_one[-1]))
    
lsls.remove(max(lsls))
print(ans+sum(lsls))

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())
last = -1
mini = 9
for i in range(5):
  if mini >= A[i] % 10 and A[i]%10 != 0:
    mini = A[i] % 10
    last = i
count = 0
for i in range(5):
  if i != last:
    count += (((A[i]-1) // 10) * 10)+10
  else:
    count += A[i]
print(count)

Submission status: Accepted

Solution code:
def f(m):
  if m%10 == 0:
    return 10
  else:
    return m%10

def g(m):
  if m%10 == 0:
    return m
  else:
    return 10*(m//10 + 1)
lis = []
for i in range(5):
  x = int(input())
  lis.append([f(x%10),g(x),x])

a = sorted(lis)
ans = 0
for i in reversed(range(1,5)):
  ans += a[i][1]

ans += a[0][2]
print(ans)

Submission status: Accepted

Solution code:
data=[int(input()) for i in range(5)]
import math
ans=0
a,b,c,d,e=data
mod10=[i%10 if i%10!=0 else 10 for i in data]
m = mod10.index(min(mod10))
ans+=data[m]
data[m]=0
for time in data:
    ans+=math.ceil(time/10)*10
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = [int(input()) for _ in[0]*5]
B = [-(-a//10)*10-a for a in A]

print(sum(A)+sum(B)-max(B))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    T = [int(input()) for _ in range(5)]
    
    del_max = -1
    idx_max = 0
    for i in range(5):
        if T[i]%10 == 0:
            pass
        elif 10 - T[i]%10 > del_max:
            del_max = 10 - T[i]%10
            idx_max = i
    
    count = 0
    for i in range(5):
        if i != idx_max:
            time = (T[i]//10)*10
            if time < T[i]:
                time += 10
            count += time
    count += T[idx_max]
    
    print(count)

Submission status: Accepted

Solution code:
def up(x):
  return x + (10 - x % 10) if x%10!=0 else x
def key(x):
  return 10 if x%10 == 0 else x%10
ans = 0
a = sorted([int(input()) for i in range(5)], key=key)
print(a[0] + sum(list(map(up, a[1:]))))

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())
q = [0]*5
t = 0
for i in range(5):
  q[i] = a[i] % 10
  q[i] = (10 - q[i])%10
  t += (a[i]+9)//10*10
t -= max(q)
print(t)

Submission status: Accepted

Solution code:
a = sorted([int(input()) for i in range(5)])
mina = 10
minban = 0
for i in range(5):
    b = a[i]%10
    if b != 0 and b <= mina:
        mina = b
        minban = i
time = 0
for i in range(5):
    if i == minban:
        time += a[i]
    else:
        time += (-(-a[i]//10))*10
print(time)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
b = [i % 10 for i in a if i % 10]
ans = 0
from math import ceil
for i in a:
  ans += ceil(i / 10) * 10
if b:
  ans = ans - 10 + min(b)
print(ans)

Submission status: Accepted

Solution code:
lst = [int(input()) for _ in range(5)]
t = 0
diff = []
for i in range(5):
    t += -(-lst[i] // 10) * 10
    diff += [-(-lst[i] // 10) * 10 - lst[i]]
print(t - max(diff))

Submission status: Accepted

Solution code:
r=[int(input()) for _ in range(5)]
#print(r)

ans=0
rowMin=9

flag=0
for item in r:
  ans+=(((-1*item)//10)*(-10))
  if item%10 !=0 and item%10<=rowMin%10:
    rowMin=item
    flag=1
if flag==1:
  ans=ans+rowMin-(((-1*rowMin)//10)*(-10))
else:
  ans=ans
print(ans)

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
b=[-(-a//10)*10-a for a in a]
print(sum(a)+sum(b)-max(b))

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = ((A-1)//10)*10 + 10
b = ((B-1)//10)*10 + 10
c = ((C-1)//10)*10 + 10
d = ((D-1)//10)*10 + 10
e = ((E-1)//10)*10 + 10

print(min(A+b+c+d+e,a+B+c+d+e,a+b+C+d+e,a+b+c+D+e,a+b+c+d+E))

Submission status: Accepted

Solution code:
import math
l = [int(input()) for _ in range(5)]
l = sorted(l, key= lambda x: (x-1)%10, reverse = True)
ans = 0

for i in range(4):
    ans += math.ceil(l[i]/10)*10
ans +=l[-1]
print(ans)

Submission status: Accepted

Solution code:
import math
l = [int(input()) for _ in range(5)]

l = sorted(l, key= lambda x: (x-1)%10, reverse = True)
ans = 0

for i in range(4):
  ans += math.ceil(l[i] / 10) * 10
ans += l[-1]

print(ans)

Submission status: Accepted

Solution code:
import math
T = [int(input()) for i in range(5)]
Rest=[0]*5
for i in range(5):
    if T[i]%10 == 0:
        Rest[i] = 10
    else: Rest[i] = T[i]%10
maxrest = 10-min(Rest)
ans = 0
for i in range(5):
    ans += 10*math.ceil(T[i]/10)
print(ans-maxrest)

Submission status: Accepted

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

s_a = [x for x in str(a)]
s_b = [x for x in str(b)]
s_c = [x for x in str(c)]
s_d = [x for x in str(d)]
s_e = [x for x in str(e)]

l = [a,b,c,d,e]
m = [s_a,s_b,s_c,s_d,s_e]
s = []
ans = 0

for i in range(len(m)):
  if int(m[i][-1]) != 0:
    s.append(int(m[i][-1]))
  else:
    s.append(9) 
min_index = s.index(min(s))
max_num = l.pop(min_index)

for i in range(len(l)):
  ans += math.ceil(l[i] / 10) * 10

print(ans + max_num)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
dish = []
min = 10
ans = 0
for _ in range(5):
	tmp = int(input())
	if tmp % 10 < min and tmp % 10 != 0:
		min = tmp % 10
	if tmp % 10 != 0:
		tmp += 10 - (tmp % 10)
	dish.append(tmp)
print(sum(dish)-(10-min))

Submission status: Accepted

Solution code:
a = [ int(input()) for _ in range(5)]
n = float("inf")
for i in range(5):
    if 0 < a[i] % 2 < 10:
        n = min(n,a[i] % 10)
else:
    if n == float("inf"):
        n = 10
print(sum([(-a[i]//10)*-10 for i in range(5)]) -(10-n))

Submission status: Accepted

Solution code:
import math

ts = [int(input()) for _ in range(5)]
rs = [t % 10 for t in ts if t % 10 > 0]
if len(rs) > 0:
    r = min(rs)
else:
    r = 0

res = 0
selected = False
for t in ts:
    if t % 10 == r and not selected:
        res += t
        selected = True
    else:
        res += math.ceil(t / 10) * 10
print(res)

Submission status: Accepted

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

maxIndex = 0;
v = 10;
for i in range(5):
  div = p[i]%10
  if div != 0 and v > div:
    v = div
    maxIndex = i

ans = 0
for i in range(5):
  if i != maxIndex:
    ans += p[i]
    if ans%10 != 0:
      ans += (10-p[i]%10)
print(ans+p[maxIndex])

Submission status: Accepted

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

ans = 0
tmp = 10
for a in A:
    q, mod = divmod(a, 10)
    if mod == 0:
        ans += q
    else:
        ans += q+1
        tmp = min(tmp, mod)
        
print(ans*10 - (10 - tmp))

Submission status: Accepted

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

dish.sort(key=lambda x: (x-1)%10, reverse=True)

t = 0
for i in range(4):
    t += (dish[i]-1) // 10 * 10 + 10
t += dish[4]
print(t)

Submission status: Accepted

Solution code:
dish = [int(input()) for _ in range(5)]
dish = sorted(dish,key = lambda x: x%10)
ans = []
flag = False
for d in dish:
    ans.append(d)
    if flag:
        ans.append(10-(d%10))
    if d % 10 != 0:
        flag = True
print(sum(ans))

Submission status: Accepted

Solution code:
lis = []
for _ in range(5):
  lis.append(int(input()))
mod = []
for i in lis:
  mod.append(i%10)
if mod == [0,0,0,0,0]:
  print(sum(lis))
else:
  k = min(mod) if min(mod) != 0 else sorted(set(mod))[1]
  ans = 0
  for i in range(5):
    if i == mod.index(k):
      ans += lis[i]
    else:
      ans += ((lis[i]+9)//10)*10
  print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = [a, b, c, d, e]
B = []
for x in A:
  if x%10 == 0:
    B.append(x)
    A.remove(x)
A.sort(key = lambda y:y%10, reverse = True)
B.extend(A)
time = 0
for i in range(4):
  if (B[i]) % 10 == 0:
    time += B[i]
  else:
    time += 10*((B[i] // 10) + 1)
print(time+B[4])

Submission status: Accepted

Solution code:
dishes = list(map(int, [input() for _ in range(5)]))
visited = [0, 0, 0, 0, 0]
inf = 777
def dfs(t):
  global visited
  temp = inf
  for i in range(5):
    if visited[i] == 0:
      visited[i] = 1
      ti = dishes[i] + t
      if sum(visited) != 5:
        temp = min(temp, dfs((ti // 10 + bool(ti % 10)) * 10))
      else:
        temp = t + dishes[i]
      visited[i] = 0
  return temp
print(dfs(0))

Submission status: Accepted

Solution code:
menu = [ int(input()) for i in range(5)]
menu_per = []
for j in menu:
  if j % 10 != 0:
    menu_per.append(10 - (j % 10))
  else:
    menu_per.append(0)
ans = sum(menu) + sum(menu_per)
max_menu_per = max(menu_per)
ans = ans - max_menu_per
print(ans)

Submission status: Accepted

Solution code:
a = []
for _ in range(5):
    i = int(input())
    if i %10 == 0:
        q = 10
    else:
        q = i%10
    a.append([q, i])
a.sort()
count = 0
for i in range(1,5):
    if a[i][1] % 10 != 0:
        count += (a[i][1]//10)*10 + 10
    else:
        count += a[i][1]
print(count+a[0][1])

Submission status: Accepted

Solution code:
import math

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

k=min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)+1

sum=(math.ceil(a/10)*10+math.ceil(b/10)*10+math.ceil(c/10)*10+math.ceil(d/10)*10+math.ceil(e/10)*10)

print(sum-10+k)

Submission status: Accepted

Solution code:
import itertools

def main():
    # やり直し
    cnt = 0
    mod = 10
    for i in range(5):
        A = int(input())
        if A % 10 == 0:
            cnt += A
        else:
            cnt += 10 - (A % 10)
            cnt += A
            mod = min(mod, A % 10)

    if mod == 10:
        print(cnt)
    else:
        print(cnt - (10 - mod))

main()

Submission status: Accepted

Solution code:
T = [int(input()) for i in range(5)]
t = 0
R = []
for i in range(5):
  t += -(-T[i]//10)*10
  R += [-(-T[i]//10)*10-T[i]]
print(t - max(R))

Submission status: Accepted

Solution code:
lst = []
min = int(input())
for i in range(4):
    x = int(input())
    if x%10 != 0 and x%10 <= min%10:
       lst.append(min)
       min = x
    else:
        lst.append(x)
sum = 0
for i in lst:
    if i%10 == 0:
        sum += i
    else:
        sum += (i//10)*10 + 10
print(sum+min)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)+1
print(int(-(-a//10))*10+int(-(-b//10))*10+int(-(-c//10))*10+int(-(-d//10))*10+int(-(-e//10))*10+s-10)

Submission status: Accepted

Solution code:
A=[int(input()) for x in range(5)]
B=[(10-s%10)%10 for s in A]
print(sum(A)+sum(B)-max(B))

Submission status: Accepted

Solution code:
A=[int(input()) for x in range(5)]
j=0
for i in range(4):
  if (A[j]-1)%10>(A[i+1]-1)%10:
    j=i+1
B=[(A[i]//10)*10+10 if A[i]%10!=0 else A[i] for i in range(5)]
B[j]=A[j]
print(sum(B))