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 numpy as np

N = 5
data = [int(input()) for i in range(N)]
data_1 = []
sum = 0

for i in range(N):
    temp = 0
    temp = data[i] - int(np.floor(data[i] / 10) * 10)
    data_1.append(temp)
    sum += int(np.ceil(data[i] / 10 ) * 10)
    
last_index = -1
for i in range(N):
    if data_1[i] != 0:
        if last_index == -1:
            last_index = i
        elif data_1[i] < data_1[last_index]:
            last_index = i
if last_index == -1:
    last_index =0
sum = int(sum - np.ceil(data[last_index] / 10) * 10 + data[last_index])
print(sum)

Submission status: Accepted

Solution code:
from math import ceil

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ai = ceil(a/10)*10
bi = ceil(b/10)*10
ci = ceil(c/10)*10
di = ceil(d/10)*10
ei = ceil(e/10)*10
sm = ai+bi+ci+di+ei
r = [sm-ai+a, sm-bi+b, sm-ci+c, sm-di+d, sm-ei+e]
print(min(r))

Submission status: Accepted

Solution code:
import itertools
import numpy as np

N = 5
data = [int(input()) for i in range(N)]
result =[]

data_per = list(itertools.permutations(data))
for i in range(len(data_per)):
    sum = 0
    for j in range(N-1):
        sum += int(np.ceil(data_per[i][j] / 10) * 10)
    sum += data_per[i][N-1]
    result.append(sum)

result.sort()
print(result[0])

Submission status: Accepted

Solution code:
import math
# 定義
minutes = [int(input()) for i in range(5)]
m = [0]*5

for k in range(5):
	if minutes[k] % 10 == 0:
		m[k] = minutes[k]
	else:
		m[k] = math.ceil(minutes[k] / 10) * 10

# 最後に注文するやつを決める
mx = min([(minutes[0] - 1) % 10, (minutes[1] - 1) % 10, (minutes[2] - 1) % 10, (minutes[3] - 1) % 10, (minutes[4] - 1) % 10])

mx = mx + 1

#　出力
print(m[0] + m[1] + m[2] + m[3] + m[4] + mx - 10)

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-

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

max_t = sum(map(lambda x: (x+9)//10*10, table))

ndiff = max(map(lambda x: (x+9)//10*10-x, table))

print(max_t-ndiff)

Submission status: Accepted

Solution code:
import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

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

def mod(n):
    return n % 10

low = map(mod, [A,B,C,D,E])
top = map(roof, [A,B,C,D,E])

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

if low == []: low = [10]
ans = sum(top) + min(low) - 10
print(ans)

Submission status: Accepted

Solution code:
data = [int(input()) for i in range(5)]
 
m = 0   # 最後の差分(diff)の最大値
res = 0 # 全ての調理時間を差分込みで集計した時間
for d in data:
    if d % 10 != 0:
        diff = 10 - d % 10
    else:
        diff = 0
    res += d + diff
    m = max(m,diff)
 
print(res-m)

Submission status: Accepted

Solution code:
import itertools
dishes=[int(input()) for i in range(5)]
all_comb=list(itertools.permutations(dishes))
t_min=123*50
for comb in all_comb:
  t=0
  for i in range(4):
    t=int((t+comb[i]-1)/10)*10+10
  t=t+comb[4]
  if t < t_min:
    t_min=t
print(t_min)

Submission status: Accepted

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

if minutes[0] % 10 == 0:
    m0 = minutes[0]
else:
    m0 = minutes[0] + 10 - (minutes[0] % 10)

if minutes[1] % 10 == 0:
    m1 = minutes[1]
else:
    m1 = minutes[1] + 10 - (minutes[1] % 10)

if minutes[2] % 10 == 0:
    m2 = minutes[2]
else:
    m2 = minutes[2] + 10 - (minutes[2] % 10)

if minutes[3] % 10 == 0:
    m3 = minutes[3]
else:
    m3 = minutes[3] + 10 - (minutes[3] % 10)

if minutes[4] % 10 == 0:
    m4 = minutes[4]
else:
    m4 = minutes[4] + 10 - (minutes[4] % 10)

mx = min([(minutes[0] - 1 ) % 10, (minutes[1] - 1 ) % 10, (minutes[2] - 1 ) % 10, (minutes[3] - 1) % 10, (minutes[4] - 1) % 10])

mx = mx + 1

print(m0 + m1 + m2 + m3 + m4 + mx - 10)

Submission status: Accepted

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

l = [a, b, c, d, e]
l_times_ten = []
amari_list = []
for i in range(len(l)):
    amari = l[i] % 10
    if amari == 0:
        l_times_ten.append(l[i])
    elif amari != 0:
        amari_list.append(amari)
        l_tmp =  l[i] +(10 - amari)
        l_times_ten.append(l_tmp)
# print(l_times_ten)
# print(amari_list)
max_total_time = sum(l_times_ten)
# print(min(amari_list))
if len(amari_list) != 0:
    adding = 10 - min(amari_list)
else:
    adding = 0
min_total_time = max_total_time - adding
print(min_total_time)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
r = [10 if i % 10 == 0 else i %  10 for i in l]
m = [i  if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(sum(m) + min(r) - 10)

Submission status: Accepted

Solution code:
from functools import reduce
l = [int(input()) for _ in range(5)]
r = [10 if i % 10 == 0 else i %  10 for i in l]
m = [i  if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(sum(m) + min(r) - 10)

Submission status: Accepted

Solution code:
N = 5
a = [int(input()) for i in range(N)]
b = [i % 10 for i in a]
c = []
for i in b:
    c.append((10 - i)%10)
d = [i // 10 for i in a]
e = len([i for i in c if i > 0])

ans = (10-max(c)) + (sum(d)+e-1)*10
print(ans)

Submission status: Accepted

Solution code:
s=m=0
for a in open(0).readlines():
  a=int(a)
  t=(a+9)//10*10
  s+=t
  m=max(m,t-a)
print(s-m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
time_list = [A, B, C, D, E]
# 最後の一品以外は切り上げ時刻の和を取ることに等しい
time_list_upper = [(((time - 1)//10)+1)*10 for time in time_list]
# 最後の一品は1の位が1～9で最小のやつ。
time_list_ones = [(time - 1) % 10 for time in time_list]
smallest_idx = time_list_ones.index(min(time_list_ones))
smallest = time_list.pop(smallest_idx)
time_list_upper.pop(smallest_idx)
 
print(sum(time_list_upper) + smallest)

Submission status: Accepted

Solution code:
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
if len(A) != 0:
	A.remove(max(A))
print(sum(B)+sum(A))

Submission status: Accepted

Solution code:
from functools import reduce
l = [int(input()) for _ in range(5)]
r = [10 if i % 10 == 0 else i %  10 for i in l]
m = [i  if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, m) + min(r) - 10)

Submission status: Accepted

Solution code:
from functools import reduce
l = [int(input()) for _ in range(5)]
r = min([10 if i % 10 == 0 else i % 10 for i in l])
m = [i if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, m) + r - 10)

Submission status: Accepted

Solution code:
ans=0
mai=0
for _ in range(5):
    x=int(input())
    ans += (x+9)//10*10
    if x%10 != 0:
        mai = max(mai,10-x%10)
print(ans - mai)

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
# 届く時間を1の位で切り上げたとき、届く時間の和
Menu = [A,B,C,D,E]
L1=[0]
L2=[]
time_max=0
extra=[]
"""
解答1
"""
for i in Menu:
    if i%10==0:
        L1.append(i)
    else:
        L2.append(i + 10 - int(i%10))
        extra.append(i%10)

if len(L2)>0:        
	tmp = 10 - min(extra)
	time_max=sum(L1)+sum(L2)
	print(time_max-tmp)
else: #全部10で割れる場合
  print(sum(L1))

Submission status: Accepted

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

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

min_val = 100
idx = 0
for i, cost in enumerate(cost_list):
    val = cost % 10
    if val == 0:
        continue

    if val < min_val:
        min_val = val
        idx = i

ans = cost_list[idx]
for i, cost in enumerate(cost_list):
    if i == idx:
        continue

    wait_next_order = 0
    if cost%10 != 0:
        wait_next_order = 10 - cost%10

    ans += cost + wait_next_order

print(ans)

Submission status: Accepted

Solution code:
#マックスから引くやり方
import numpy as np
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
# 届く時間を1の位で切り上げたとき、届く時間の和
Menu = [A,B,C,D,E]
L1=[0]
L2=[]
time_max=0
extra=[]
"""
解答1
"""
for i in Menu:
    if i%10==0:
        L1.append(i)
    else:
        L2.append(i + 10 - int(i%10))
        extra.append(i%10)

if len(L2)>0:        
	tmp = 10 - min(extra)
	time_max=sum(L1)+sum(L2)
	print(time_max-tmp)
else: #全部10で割れる場合
  print(sum(L1))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

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

l = [x%10 for x in cooking_time]
if sum(l)==0:
    mindiv10=0
else:
    mindiv10 = min(list(filter(lambda n:n>0, l)))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)

Submission status: Accepted

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

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

min_val = 100
idx = 0
for i, cost in enumerate(cost_list):
    val = cost % 10
    if val == 0:
        continue

    if val < min_val:
        min_val = val
        idx = i

ans = cost_list[idx]
for i, cost in enumerate(cost_list):
    if i == idx:
        continue

    wait_next_order = 0
    if cost_list[i]%10 != 0:
        wait_next_order = 10 - cost_list[i]%10

    ans += cost_list[i] + wait_next_order

print(ans)

Submission status: Accepted

Solution code:

list = [int(input()) for i in range(5)]
kList = []
for j in range(0,10):
    for i in list:
         if (i+j) % 10 == 0:
            if len(kList) < 4:
                kList.append(i+j)
            else:
                kList.append(i)
print(sum(kList))

Submission status: Accepted

Solution code:
a=eval('int(input()),'*5);print(min(~-i%10for i in a)-sum(-i//10*10for i in a)-9)

Submission status: Accepted

Solution code:
A=[]#元の値
for i in range(5):
    a=int(input())
    A.append(a) 
    def key_func(x):
        one_keta=x%10
        if one_keta==0:
            return 10
        else:
            return x%10
    A.sort(reverse=True,key=key_func)
    
    #1の位に着目して小さい順にソートしたい
#print(A)

t=0
for i in range(4):
    if A[i]%10==0:
        t+=A[i]
    else:
        for j in range(10):
            if A[i]%10==j:
                t+=A[i]+10-j
                break

t=t+A[4]
print(t)

Submission status: Accepted

Solution code:
import math
li1 = []
li2 = []
mod = [99, -1]
for i in range(5):
  n = int(input())
  li1.append(n)
  li2.append(math.ceil(n / 10) * 10)
  if n % 10 < mod[0] and n % 10 != 0:
    mod[0] = n % 10
    mod[1] = i
if mod[0] == 99:
  ans = 0
  for j in range(5):
    ans += li1[j]
else:
  li2[mod[1]] = li1[mod[1]]
  ans = 0
  for j in range(5):
    ans += li2[j]
print(ans)

Submission status: Accepted

Solution code:
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
if len(A) != 0:
	A.remove(max(A))
print(sum(B)+sum(A))

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:
x = [int(input()) for i in range(5)]
n,a = 10,0
for i in x:
  if i%10: n,a = min(i%10,n),a+i-i%10+10
  else: a+=i
print(a+n-10)

Submission status: Accepted

Solution code:
mod0 = []
lst = []
for i in range(5):
    inp = int(input())
    if inp % 10 == 0:
        mod0.append(inp)
    else:
        lst.append([inp, inp % 10])
ans = sum(mod0)
lst.sort(key= lambda x :x[1])

if len(lst) != 0:
    last = lst.pop(0)
    ans = sum(mod0)
    for i,imod in lst:
        ans += (i//10 +1)*10
    ans+=last[0]

print(ans)

Submission status: Accepted

Solution code:
import itertools

def main():
    a = [int(input()) for i in range(5)]
    ans = float("inf")
    for i in list(itertools.permutations(a)):
        ans = min(ans, sum(i) + (200 - i[0])%10 + (200 - i[1])%10 + (200 - i[2])%10 + (200 - i[3])%10)
    print(ans)

main()

Submission status: Accepted

Solution code:
from functools import reduce
l = [int(input()) for _ in range(5)]
r = [i % 10 for i in l if i % 10 != 0]
l = [i if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, l) + (min(r) - 10 if r else 0))

Submission status: Accepted

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

for i in range(5):
    machi[i] = 10 - (L[i] % 10)
    if machi[i] == 10:
        machi[i] = 0

machi = sorted(machi, reverse=True)
print(sum(L)+sum(machi[1:]))

Submission status: Accepted

Solution code:
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time = [a,b,c,d,e]
test = list(itertools.permutations(time))
mnm = 100000
for i in range(len(test)):
    temp = 0
    for k in range(5):
        if temp%10 == 0:
            temp += test[i][k]
        else:
            temp += (10-temp%10)+test[i][k]
    if temp < mnm:
        mnm = temp
print(mnm)

Submission status: Accepted

Solution code:
N = sorted([(input())for i in range(5)],key=lambda x:x[-1])
S = list(map(int,N))
#合計時間
num = 0
key = 0
for x in S:
  if x % 10 == 0:
    num += x
  elif key == 0 and x % 10 != 0:
    num += x 
    key = 1
  else:
    num += x + 10 - int(str(x)[-1])
print(num)

Submission status: Accepted

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

dis_a = 10 - a % 10
dis_b = 10 - b % 10
dis_c = 10 - c % 10
dis_d = 10 - d % 10
dis_e = 10 - e % 10

time = [a,b,c,d,e]
next_time = []
N = 5
for i in range(N):
	if(time[i] % 10 == 0 ): next_time.append(time[i])
	else: next_time.append( time[i] + 10 - time[i] % 10 )

besttime = 999999999

for i in range(N):
	sumtime = 0
	for j in range(N):
		if (i == j) :
			sumtime += time[j]
		else:
			sumtime += next_time[j]
	besttime = min(besttime,sumtime)

print(besttime)

Submission status: Accepted

Solution code:
import itertools

l = [int(input()) for i in range(5)]
p = list(itertools.permutations(l))

ans = 2 ** 31
for i in range(len(p)):
    t = 0
    for j in range(5):
        if t % 10 == 0:
            t += p[i][j]
        else:
            t //= 10
            t += 1
            t *= 10
            t += p[i][j]
    ans = min(ans, t)
print(ans)

Submission status: Accepted

Solution code:
Menu = [int(input()) for _ in range(5)]
# 届く時間を1の位で切り上げたとき、届く時間の和
time_max = sum(map(lambda x: (x + 9) // 10 * 10, Menu))
# 1の位で切り上げたとき、最も元の時間との差が大きいもの
tmp = max(map(lambda x: (x + 9) // 10 * 10 - x, Menu))
print(time_max - tmp)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
b = []
for i in range(5):
    b.append(a[i]-a[i]//10*10)
mini = 10
index = 0
for i in range(5):
    if mini > b[i] and b[i] > 0:
        index = i
        mini = b[i]

ans = 0
for i in range(5):
    if i == index:
        ans += a[i]
    else:
        ans += ((a[i]-1)//10+1)*10
print(ans)

Submission status: Accepted

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

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

for i in range(5):
    if cook[i] % 10 != 0:
        amari.append(10 - cook[i] % 10)

print(t - max(amari))

Submission status: Accepted

Solution code:
import itertools

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

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

dec = [n % 10 for n in input]
pair = zip(dec, input)
min_val = 999
for num in dec:
  if num != 0 and min_val > num:
    min_val = num

sum = 0
min_flag = False
for d, n in pair:
  if not min_flag and d == min_val:
    min_flag = True
    sum += n
  elif d == 0:
    sum += n
  else:
    sum += (n + (10 - d))
      
print(sum)

Submission status: Accepted

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

b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        b.append(a[j]-10)
        c.append(10)
    else:
        #10で割った余りを引く
        num = a[j]%10
        c.append(num)
        b.append(a[j] - c[j])

b_sum = sum(b)
c_min = min(c)
c_sum = c_min + 4*10
 
print(b_sum + c_sum)

Submission status: Accepted

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10

S = []
sum = 0
if A != 0:
  S.append(A)
if B != 0:
  S.append(B)
if C != 0:
  S.append(C)
if D != 0:
  S.append(D)
if E != 0:
  S.append(E)
if len(S) == 0:
  sum = a + b + c + d + e
else:
  sum = (a //10 + b //10 + c //10 + d //10 + e //10)*10 + 10*(len(S) - 1) +min(S)
print(sum)

Submission status: Accepted

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

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

adjust.sort()
if len(adjust) > 0:
    total -= 10-adjust[0]

print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(5):
    list += [int(input())]

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

for ii in range(1, 5):
    list[ii] = (list[ii] // 10 + (list[ii] % 10 > 0)) * 10

print(sum(list))

Submission status: Accepted

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

Submission status: Accepted

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

b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        c.append(10)
        b.append(a[j]-10)
    else:
        #10で割った余りを引く
        num = a[j] % 10
        c.append(num)
        b.append(a[j] - c[j])

b_sum = sum(b)
c_min = min(c)
c_sum = c_min + 4*10
 
print(b_sum + c_sum)

Submission status: Accepted

Solution code:
# B
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
a = (10 - A) % 10
b = (10 - B) % 10
c = (10 - C) % 10
d = (10 - D) % 10
e = (10 - E) % 10
 
print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))

Submission status: Accepted

Solution code:
a = []
for _ in range(5):
    b = int(input())
    t = 10 if b%10 == 0 else b%10
    a.append((t, b))
a.sort()
a.reverse()
c = 0
for i in range(4):
    if a[i][0] == 10:
        c += (a[i][1]  - a[i][1] % 10)
    else:
        c += (a[i][1] + (10 - a[i][1] % 10))
c += a[-1][1]
print(c)

Submission status: Accepted

Solution code:
times = [int(input()) for _ in range(5)]
fractions = [10 - t % 10 for t in times if t % 10 != 0]
if fractions:
    fraction = max(fractions)
else:
    fraction = 0
print(sum([(t + 9) // 10 * 10 for t in times]) - fraction)

Submission status: Accepted

Solution code:
a = []

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


def ceil10(n):
    return ((n + 9) // 10) * 10


ans = 999

for i in range(5):
    t = 0

    for j in range(5):
        if j == i:
            t += a[j]
        else:
            t += ceil10(a[j])
    ans = min(ans, t)

print(ans)

Submission status: Accepted

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

b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        b.append(a[j]-10)
        c.append(10)
    else:
        c.append(a[j] % 10)
        b.append(a[j] - c[j])
        

b_sum = sum(b)
c_min = min(c)
c_sum = c_min + 4*10

print(b_sum + c_sum)

Submission status: Accepted

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

b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        c.append(10)
        b.append(a[j]-10)
    else:
        num = a[j] % 10
        c.append(num)
        b.append(a[j] - c[j])
        

b_sum = sum(b)
c_min = min(c)
c_sum = c_min + 4*10

print(b_sum + c_sum)

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]
mod=0
mx=0
for i in range(5):
    if mod<10-a[i]%10 and a[i]%10!=0:
        mx=i
        mod=10-a[i]%10
ans=0
for i in range(5):
    if i!=mx and a[i]%10!=0:
        ans+=a[i]+10-a[i]%10
    else:
        ans+=a[i]
print(ans)

Submission status: Accepted

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

# 最下位桁の値が0以外で最も小さい料理を最後に届けさせる
lsd = 10  # 最下位桁の値
lsd_min_index = -1
for k, time in enumerate(Menu):
    if time % 10 < lsd and not time % 10 == 0:
        lsd = time % 10
        lsd_min_index = k
ans = 0
for k, time in enumerate(Menu):
    if k == lsd_min_index or time % 10 == 0:
        ans += time
    else:
        ans += time // 10 * 10 + 10  # 1の位を切り上げ
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 21:54:27 2019

@author: yuta
"""

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

def main(x):
    rest = list(map(lambda y: 10 - y%10,x))
    for i in range(5):
        if rest[i] == 10:
            rest[i] = 0
    rest_sort = sorted(rest)
    t = sum(x) + sum(rest_sort[0:4])
    print(t)

main(ABCDE)

Submission status: Accepted

Solution code:
sum = 0
back = 0
for i in range(5):
    a = int(input())
    if a % 10 != 0:
        b = 10 - a%10
    else:
        b = 0
    back = max(back, b)
    sum += a + b

print(sum-back)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = 0
g = 0
h = 0
i = 0
j = 0

if a%10!=0:
  f = (a+(10-a%10))-a  
if b%10!=0:
  g = (b+(10-b%10))-b
if c%10!=0:
  h = (c+(10-c%10))-c
if d%10!=0:  
  i = (d+(10-d%10))-d
if e%10!=0:  
  j = (e+(10-e%10))-e

k = [f,g,h,i,j]
k.sort()



if a%10!=0:
  a = a+(10-a%10)
  
if b%10!=0:
  b = b+(10-b%10)  
  
if c%10!=0:
  c = c+(10-c%10)  
  
if d%10!=0:
  d = d+(10-d%10)  
  
if e%10!=0:
  e = e+(10-e%10)  
  
ans = a + b + c + d + e - k[4]

print(ans)

Submission status: Accepted

Solution code:
import math
A = [0] * 5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
ans = 0
min1 = 10
for i in range(0,5):
    m = A[i] % 10
    if ((m > 0) and (m < min1)):
        min1 = m        
    ans += math.ceil(A[i] / 10) * 10
print(ans - (10 - min1))

Submission status: Accepted

Solution code:
data_ls = []
for i in range(5):
    data_ls.append(int(input()))
data_ls.sort(key= lambda x:x%10)
_sum = 0
flg = 0
for i in data_ls:
    if flg == 0:
        if i % 10 == 0:
            _sum += i
        else:
            _sum += i
            flg = 1
    else:
        _sum += (i // 10 + 1) * 10
print(_sum)

Submission status: Accepted

Solution code:
from itertools import permutations
A = [ int( input()) for _ in range(5)]
ans = 1000
for p in permutations( range(5)):
    now = A[p[0]]
    for i in range(4):
        if now%10 == 0:
            now += A[p[i+1]]
        else:
            now = (now//10+1)*10
            now += A[p[i+1]]
    ans = min( ans, now)
print( ans)

Submission status: Accepted

Solution code:
from math import ceil

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

ans = float('inf')
for i in range(5):
    # 最後の注文i
    t = 0
    for j in range(5):
        # 加算対象の注文j
        if i == j:
            t += v[j]
        else:
            t += ceil(v[j] / 10) * 10
    ans = min(ans, t)
print(ans)

Submission status: Accepted

Solution code:
times = list()
dish_num = 5
for i in range(dish_num):
    times.append(int(input()))

last = 0
for i in range(1, dish_num):
    if ((times[last]+9) % 10) > ((times[i]+9) % 10):
        last = i

for i in range(dish_num):
    if i != last:
        times[i] += (10 - times[i] % 10) % 10

result = 0
for t in times:
    result += t

print(result)

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)

l = [i for i in range(5)]
p = [int(input()) for _ in range(5)]

res = 10**100
for ll in perm(l):
    now = 0
    for ii,i in enumerate(ll):
        now += p[i]
        if now % 10 != 0 and ii!=4:
            now //= 10
            now += 1
            now *= 10
    res = min(res, now)
print(res)

Submission status: Accepted

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

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


m = 10
cnt = 0
for i in memo:
    if i % 10 == 0:
        cnt += int(i/10)
    else:
        cnt += int(i/10)+1

    if i%10 < m and i%10 != 0:
        m = i%10

print(cnt*10-(10-m))

Submission status: Accepted

Solution code:
def maxtime(x):
  return (x + 9) // 10 * 10

def restime(x):
  return maxtime(x) - x

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

sumtime = maxtime(A)+maxtime(B)+maxtime(C)+maxtime(D)+maxtime(E)
maxrestime = max(restime(A),restime(B),restime(C),restime(D),restime(E))
print(sumtime - maxrestime)

Submission status: Accepted

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

b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        c.append(10)
        b.append(a[j]-10)
    else:
        c.append(a[j] % 10)
        b.append(a[j] - c[j])
        

b_sum = sum(b)
c_min = min(c)
c_sum = c_min + 4*10

print(b_sum + c_sum)

Submission status: Accepted

Solution code:
a=eval('int(input())-1,'*5);print(min(i%10for i in a)+sum((i//10+1)*10for i in a)-9)

Submission status: Accepted

Solution code:
list = [int(input()) for i in range(5)]
list_amari = [(i-1) % 10 +1 for i in list]
min = min(list_amari)
for i in range(5):
  min += list[i] - list_amari[i] +10
  
print(min-10)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = 0
lst = [a,b,c,d,e]
lst2 = []
for i in lst:
  if i%10 == 0:
    lst2.append(10)
  else:
    lst2.append(i%10)
y = lst[lst2.index(min(lst2))]
del lst[lst2.index(min(lst2))]
for i in lst:
  if i%10 == 0:
    x += i
  else:
    x += (i//10+1)*10
x = x + y
print(x)

Submission status: Accepted

Solution code:
li = []
for i in range(5):
  li.append(int(input()))
mi = 1e10
ans = 0
for i in range(5):
  ans+=(li[i]//10+(li[i]%10!=0))*(10)
  mi = min(mi,li[i]%10+(li[i]%10==0)*10)
print(ans - 10 + mi)

Submission status: Accepted

Solution code:
#print('Enter values!!')
abc = int(input())
arc = int(input())
agc = int(input())
apc = int(input())
atc = int(input())

food_time = [abc, arc, agc, apc, atc]
sort_time = [0, 0, 0, 0, 0]
total_time = 0


for i in range(5):
    sort_time[i] = food_time[i] % 10
    if food_time[i] % 10 == 0:
        total_time += food_time[i]
    else:
        a = food_time[i] // 10
        a = a * 10 + 10
        total_time += a

sort_time.sort()

for j in range(5):
    if sort_time[j] != 0:
        b = 10-sort_time[j]
        total_time -= b
        break

print(total_time)

Submission status: Accepted

Solution code:
# A~Eの１の位が（0を除いて）最も小さいものを最後に頼めばよい
import numpy as np
A = np.zeros(5)
B = np.zeros(5)
time = 0
for i in range(5):
    A[i] = int(input())
    if A[i] % 10 == 0:
        B[i] = 10
    else:
        B[i] = A[i] % 10
B = np.sort(B)
for h in range(5):
    time += A[h] + 10 - B[h]
time = time-10+B[0]
print("{}".format(int(time)))

Submission status: Accepted

Solution code:
import numpy as np
import math

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

#１の位が0以外でより小さい値のものを最後にする
dishes=np.array([A,B,C,D,E])
dishes_1=np.array(list(map(lambda x: x%10, dishes)))
# print(dishes)
# print(dishes_1)
last=0
ans=0
if np.all(dishes_1==0):
  print(A+B+C+D+E)
else:
  dishes=np.dstack([dishes, dishes_1])
  dishes=dishes[0]
  dishes=sorted(dishes, key=lambda x: x[1])
  for i in range(len(dishes)):
      if dishes[i][1]!=0:
          last=dishes[i]
          dishes=np.delete(dishes, [i], axis=0)
          break
  for j in range(len(dishes)):
      ans=ans+dishes[j][0]+((10-dishes[j][0]%10)%10)
  print(ans+last[0])

Submission status: Accepted

Solution code:
p = []
for i in range(5):
    p.append(input())
u = 10
v = 0
for i in range(5):
    if int(p[i][-1]) < u and int(p[i][-1]) != 0:
        u = int(p[i][-1])
        v = int(p[i])
q = []
r = 0
for i in range(5):
    if v != int(p[i]) or r == 1:
        if int(p[i][-1]) != 0:
            q.append(int(p[i]) + 10 - int(p[i][-1]))
        else:
            q.append(int(p[i]))
    else:
        r = 1
print(sum(q) + v)

Submission status: Accepted

Solution code:

lst=[input()for i in range(5)]
lst.sort(key=lambda x:str(int(x[-1])+9)[-1])
ans=0
for i in lst[1:]:
    if int(i[-1])!=0:
        if len(i)!=1:
            tmp=str(int(i[:-1])+1)+"0"
            ans+=int(tmp)
        elif len(i)==1:
            ans+=10
    elif int(i[-1])==0:
        ans+=int(i)

print(ans+int(lst[0]))

Submission status: Accepted

Solution code:
from itertools import permutations

A = [int(input()) for i in range(5)]
ans = 1e10 
for a in permutations(A):
    tmp = 0
    for x in a:
        if tmp % 10 != 0:
            tmp += 10 - (tmp % 10)
        tmp += x
    ans = min(ans, tmp)
print(ans)