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.

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

now_time = [a, b, c, d, e]
next_time = []

for i in now_time:
    if i % 10 == 0:
        next_time.append(i)
    else:
        while i % 10 != 0:
            i += 1
        next_time.append(i)

combined = sorted([x - y for (x, y) in zip(next_time, now_time)])

best_time = sum(next_time) - max(combined)
print(best_time)

Solution (Python):
import itertools

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

x = float('inf')
for vals in itertools.permutations((a, b, c, d, e)):
    y = 0
    for val in vals[:-1]:
        y += val
        while y % 10 != 0:
            y += 1
    y += vals[-1]
    x = min(x, y)

print(x)

Solution (Python):
import itertools

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

def calc(foods):
    t = 0
    for f in foods:
        if t % 10 == 0:
            t += f
        else:
            t += 10-t%10 + f
    return t

def solve(f):
    ans = 2**32
    for it in itertools.permutations(f):
        ans = min(ans, calc(it))
    return ans

print(solve(foods))

Solution (Python):
import math

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

ABCDE = [a, b, c, d, e]
ABCDE_next = [int(math.ceil(abcde/10)*10) for abcde in ABCDE]

ans = 99999999
for i in range(len(ABCDE)):
    time = sum(ABCDE_next) - ABCDE_next[i] + ABCDE[i]
    ans = min(ans, time)
    
print(ans)

Solution (Python):
import itertools,math
A = [int(input()) for i in range(5)]
res = 10**10
for i in itertools.permutations(A):
	time = 0
	for j in i:
		time = math.ceil(time/10)*10+j
	res = min(res,time)
print(res)

Solution (Python):
import sys

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

time = 0
count = 0

for i,item in enumerate(lines):
	if item%10 == 0:
		time += item
		lines[i] = 0
		count += 1
		

for i in reversed(range(9)):
	
	for j,item in enumerate(lines):
		if item%10 == i+1:
			time += item
			lines[j] = 0
			count += 1
			if count != 5:
				time += (10 - (i+1))
			

print(time)

Solution (Python):
from math import ceil
A = [input() for i in range(5)]
A = sorted(A,key = lambda x:x[-1])
A = [int(a) for a in A]
time = 0
for a in A:
	time += ceil(a/10)*10
for a in A:
	if a%10 != 0:
		time -= 10-(a%10)
		break
print(time)

Solution (Python):
import itertools

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

final_time = float('inf')
for v in itertools.permutations(don):
  time = 0
  for j in v:
    while(time % 10 != 0):
      time += 1
    time += j
  final_time = min(final_time, time)
print(final_time)

Solution (Python):
time = [int(input()) for i in range(5)]
fixedtime = []
bit = 10
arg = None

for i in range(len(time)):
    if time[i]%10 < bit and time[i]%10 != 0:
        bit = time[i]%10
        arg = i

for i in range(len(time)):
    if i == arg or time[i]%10 == 0:
        fixedtime.append(time[i])
    else:
        fixedtime.append(time[i]+10-time[i]%10)

print(sum(fixedtime))

Solution (Python):
dish = [0]*5
t = [0]*5
for i in range(5):
    dish[i] = int(input())
    t[i] = (10-(dish[i]%10))%10
m_t = max(t)
print(sum(dish)+sum(t)-m_t)

Solution (Python):
"全探索で行うパターン(最後に頼む料理によって合計の時間が変わる)"

original_time = [int(input()) for _ in range(5)]  
next_time = [(i+9)//10 * 10 for i in original_time]  

order_time = []
for i in range(len(original_time)):
    sum = 0
    for j in range(len(original_time)):
        if i == j:
            sum += original_time[j]
        else:
            sum += next_time[j]
    order_time.append(sum)

print(min(order_time))

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

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

list2 = [a%10,b%10,c%10,d%10,e%10]  

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


for i in (range(4)):
        for j in range(4,i,-1):
            if list2[j] > list2[j-1]:
                list2[j],list2[j-1] = list2[j-1],list2[j]
                list1[j], list1[j-1] = list1[j-1], list1[j]

s = 0
for i in range(4):
    if int(list1[i])%10 != 0:
        s += int(list1[i])-int(list1[i])%10+10
    else:
        s += int(list1[i])

s += int(list1[4])

print(s)

Solution (Python):
import sys
def fceil(b):
    return   int( b / 10) + 1  if b % 10 else b // 10
aD=[int(_) for _ in sys.stdin.readlines()]
aDM =sorted(set(_%10 for _ in aD))
aD10=[ fceil(_) * 10 for _ in aD]
iM = aDM[0]
if iM == 0:
    if 1 < len(aDM):
        iM = aDM[1]
iD = 10 - iM
if iM == 0:
    iD = 0
print(sum(aD10) - iD)

Solution (Python):
a_list = [int(input()) for _ in range(5)]

min_index = -1
min_num = 9
for i, a in enumerate(a_list):
    last = int(str(a)[-1])
    if last == 0:
        continue
    if last <= min_num:
        min_num = last
        min_index = i

if min_index == -1:
    print(sum(a_list))
    exit()

ans = 0
for i, a in enumerate(a_list):
    last = int(str(a)[-1])
    if i == min_index:
        ans += a
    elif last == 0:
        ans += a
    else:
        ans += a
        ans += 10 - last
print(ans)

Solution (Python):
count = 0
l = []
for i in range(5):
    A = input()
    if int(A[-1]) != 0:
        l.append(int(A[-1]))
        A = round(int(A)+5,-1)
    count = count + int(A)
print(count+(-10 + min(l) if l else 0 ))

Solution (Python):

import math


def main():
    li = sorted([int(input()) for _ in range(5)],
                key=lambda i: i % 10 if i % 10 > 0 else 10,
                reverse=True)
    s = 0
    for i in li[:-1]:
        s += math.ceil(i/10) * 10
    print(s + li[-1])


main()

Solution (Python):
import math
foods = [int(input()) for _ in range(5)]
def hoge(value):
    return 9 if value % 10 == 0 else value % 10

last = min([(i, f) for i, f in enumerate(foods)], key=lambda i: hoge(i[1]))
time = 0
for food in foods[:last[0]] + foods[last[0]+1:]:
    time += math.ceil(food / 10) * 10
print(time+last[1])

Solution (Python):
list_menu = [int(input()) for i in range(5)]

list_time_reminders = []


for i in list_menu:
	reminder_i = 10 - (i % 10)
	if reminder_i == 10:
		reminder_i = 0
	
	list_time_reminders.append(reminder_i)

max_reminder = max(list_time_reminders)

list_time_reminders.remove(max_reminder)

total_cooking_time = 0

for i in list_menu:
	total_cooking_time += i

for i in list_time_reminders:
	total_cooking_time += i


print(total_cooking_time)

Solution (Python):
import itertools

a=[int(input()) for j in range(5)]


x=list(itertools.permutations(a))


def cal(b,c):
  if b <= c:
    return c
  else:
    c+=10
    return cal(b,c)
  
ans=100000000  
for i in range(len(x)):
  time1=cal(x[i][0],0)
  time2=cal(time1+x[i][1],0)
  time3=cal(time2+x[i][2],0)
  time4=cal(time3+x[i][3],0)
  time5=time4+x[i][4]

  if time5 < ans:
    ans=time5
    
print(ans)

Solution (Python):


import sys
import copy

input = sys.stdin.readline



from itertools import permutations

A = [int(input().rstrip()) for _ in range(5)]

ans = 1000000000000000000

for B in list(permutations(A)):
    sum = 0
    for i in range(5):
        sum += B[i]
        if (i < 4):
            sum += (10 - sum % 10) % 10
    ans = min(ans, sum)

print(ans)

Solution (Python):
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n

def zeros2(n, m): return [zeros(m) for i in range(n)] 

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def prob():
    d = Debug()
    d.off()
    N = 5
    dish = zeros(N)
    for i in range(N):
        dish[i] = int(input())
    d.dmp((dish),'dish')
    minDigit1 = 10
    idx = N
    time = 0
    for i in range(N):
        if dish[i] % 10 > 0 and minDigit1 > dish[i] % 10:
            idx = i
            minDigit1 = dish[i] % 10
        time += (dish[i]+9)//10*10
        d.dmp((time),'time')
    d.dmp((time),'time')
    d.dmp((idx),'idx')
    if idx < N:
        time -= (dish[idx]+9)//10*10
        time += dish[idx]
    return time
    

ans = prob()
print(ans)

Solution (Python):
import math

t = []
k = 0
r = 10
for i in range(5):
    v = int(input())
    tmp = v % 10
    if tmp != 0 and tmp < r:
        r = tmp
        k = i
    t.append(v)

tt = 0
for i in range(5):
    if i == k or t[i] % 10 == 0:
        tt = tt+t[i]
    else:
        tt = tt + 10 * math.ceil(t[i]/10)

print(tt)

Solution (Python):
l = [int(input()) for i in range(5)]
s = sum(list(map(lambda x: (x + 9) // 10 * 10, l)))
s -= max(list(map(lambda x: ((x + 9) // 10 * 10) - x, l)))
print(s)

Solution (Python):
A = []
B = []
for i in range(5):
    x = int(input())
    if x % 10 == 0:
        a = x
    else:
        a = (x // 10 + 1) * 10
    A.append(a)
    
    b = a - x
    B.append(b)
    
print(sum(A) - max(B))

Solution (Python):
N = 5
time = [int(input()) for _ in range(N)]
order_time = list()
sabun = list()

for i in range(N):
    if time[i] % 10 == 0:
        order_time.append(time[i])
    else:
        order_time.append(time[i] - time[i] % 10 + 10)
    sabun.append(order_time[i] - time[i])

print(sum(order_time) - max(sabun))

Solution (Python):


dishTime = []

for _ in range(5):
  dishTime.append(int(input()))


minVal = dishTime[0]
minIdx = 0

for i in range(len(dishTime)):
  if dishTime[i] % 10 != 0 and minVal > (dishTime[i] % 10): 
    minVal = dishTime[i] % 10
    minIdx = i 


ans = 0
for i in range(len(dishTime)):
  if i == minIdx:
    ans += dishTime[i]
    continue
  
  if dishTime[i] % 10 == 0:
    ans += dishTime[i]
  else:
    ans += (int(dishTime[i] / 10) + 1) * 10

print(ans)

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
ans = 0
maxtime = []
remain = []
for i in dish:
    maxtime.append((i+9) // 10 * 10)
for i in range(5):
    remain.append(maxtime[i] - dish[i])
ans = sum(maxtime) - max(remain)
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
ans = 0
maxtime = []
remain = []
for i in dish:
    maxtime.append((i+9) // 10 * 10)
for i in range(5):
    remain.append(maxtime[i] - dish[i])
ans = sum(maxtime) - max(remain)
print(ans)

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


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

def nokori(az, sitei):
	tmp = []
	flag = 0
	for a in az:
		if a == sitei and flag == 0 :
			flag = 1
		else:
			tmp.append(a)
	return tmp

def calcOrder(order):
	time = 0
	for o in order:
		if time % 10 != 0:
			time += 10 - time % 10
		time += o
	return time

time = 0
mintime = 1000
res = ''

for fst in orders:
	
	az = nokori(orders, fst)
	for sec in az:
		ax = nokori(az, sec)
		for thd in ax:
			aw = nokori(ax, thd)
			for fth in aw:
				af = nokori(aw, fth)
				for fif in af:
					time = calcOrder([fst,sec,thd,fth,fif])
					if time < mintime:
						mintime = time
						res = str([fst,sec,thd,fth,fif])

print(mintime)

Solution (Python):


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


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


def last_order(nums):
    cnt = 130
    num = 0

    for i in nums:
        if i % 10 != 0:
            if cnt > int(str(i)[-1]):
                cnt = int(str(i)[-1])
                num = i

    return num


def move_up(num):
    if num % 10 != 0:
        return  num + (10 - (num % 10))
    else:
        return num

last = last_order(orders)
if last:
    orders.remove(last)

total_time = 0

for i in orders:
    total_time = total_time + move_up(i)

print(total_time + last)

Solution (Python):
array1 = [int(input()) for i in range(5)]
array2 = [i for i in array1 if i % 10 == 0]
array3 = [i for i in array1 if i % 10 != 0]
array4 = [i % 10 for i in array3]
sum1 = 0
sum2 = sum(array2)
if (len(array3) != 0):
  idx = array4.index(min(array4))
  for k, i in enumerate(array3):
    if (k == idx):
      sum1 += i
    else:
      sum1 += i + (10 - i % 10)
print(sum1 + sum2)

Solution (Python):
from sys import stdin

def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()

A = [0] * 5
for i in range(5): A[i] = ri()
 
tot = 0
ma = 0
for i in range(len(A)):
    tot += (A[i] + 9) // 10 * 10
    if A[i] % 10 > 0 : ma = max(ma, 10 - A[i] % 10)

tot -= ma
print(tot)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):


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)

Solution (Python):
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)

Solution (Python):
data = [int(input()) for i in range(5)]
 
m = 0   
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)


max_total_time = sum(l_times_ten)

if len(amari_list) != 0:
    adding = 10 - min(amari_list)
else:
    adding = 0
min_total_time = max_total_time - adding
print(min_total_time)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

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])

ans=0
for i in range(4):
    ans+=l[s[4-i][0]]+(10-s[4-i][1])
    
print(ans+l[s[0][0]])

Solution (Python):
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]

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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

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: 
  print(sum(L1))

Solution (Python):
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)

Solution (Python):

import numpy as np
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

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: 
  print(sum(L1))

Solution (Python):



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)))


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)

Solution (Python):
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)

Solution (Python):

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))

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

Solution (Python):
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)
    
    


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)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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))

Solution (Python):
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:]))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

time_max = sum(map(lambda x: (x + 9) // 10 * 10, Menu))

tmp = max(map(lambda x: (x + 9) // 10 * 10 - x, Menu))
print(time_max - tmp)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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:
        
        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)

Solution (Python):
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:
        
        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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
A=[int(input())for _ in[0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Solution (Python):


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))

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