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):
l = [int(input()) for i in range(5)]
ans = sum(l)
tmp_A = [0]*5
for i in range(5):
  tmp_A[i] = 10 - l[i]%10
tmp = 0
count = 0
for k in range(5):
  if tmp_A[k] != 10 and tmp_A[k] >= tmp:
    tmp = tmp_A[k]
  if tmp_A[k] == 10:
    count += 1
ans += sum(tmp_A)
ans = ans - tmp - 10*count
print(ans)

Solution (Python):
a=[int(input()) for _ in range(5)]
one = 10
for i in range(5):
    if a[i] % 10 != 0 and a[i]%10 <one:
        one = a[i]%10
for i in range(5):
    if a[i] % 10 == 0:
        a[i] = a[i] // 10
    else:
        a[i] = a[i] // 10 + 1
print(sum(a)*10 -10 +one)

Solution (Python):
x=[int(input()) for i in range(5)]
x.sort()
ans=0
rem=[]
for t in x:
    ans+=(t-t%10)
    rem.append(t%10)
    rem.sort()
f=0
for r in rem:
    if r==0:
        pass
    else:
        if f==0:
            ans+=r
            f=1
        else:
            ans+=10
print(ans)

Solution (Python):
li=[0]*5
for i in range(5):
  li[i]=int(input())
  
ans=0
cnt=10
for i in range(5):
  if li[i]%10<cnt:
    if li[i]%10==0:
      ans+=li[i]//10
    else:
      cnt=li[i]%10
      ans+=li[i]//10
      ans+=1
  else:
    if li[i]%10==0:
      ans+=li[i]//10
    else:
      ans+=li[i]//10
      ans+=1
  
  
print(ans*10-10+cnt)

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

surplus = 0
for n in nums:
    s = 10 - n % 10
    if s != 10 and s > surplus:
        surplus = s
print(sum([(n+9)//10*10 for n in nums]) - surplus)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
last=0
t = 0
for j,i in enumerate([A,B,C,D,E]):
    if not i//10 * 10 ==i and last < (i//10 +1) * 10 -i:
        last = (i//10 +1) * 10 -i
        t=j
ans= 0
for j,i in enumerate([A,B,C,D,E]):
        if i//10 * 10 ==i and j!=t:
            
            ans += i
        elif  i//10 * 10 !=i and j!=t:
            ans += (i//10 +1) * 10
print(ans+[A,B,C,D,E][t])

Solution (Python):
A = [int(input()) for i in range(5)]
A.sort(key=lambda x:10 if x%10==0 else x%10, reverse=True)
ans = 0
for a in A[:4]:
    ans += a + (-a%10)
print(ans + A[-1])

Solution (Python):
from math import ceil
from itertools import permutations

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
p = permutations([a, b, c, d, e])

ans = 643
for m in p:
    t = 0
    for i in range(4):
        t += m[i]
        t = ceil(t / 10) * 10
    t += m[4]
    if ans > t:
        ans = t

print(ans)

Solution (Python):
s=0
u=10
for t in [int(input()) for _ in range(5)]:
    m=t%10
    n=1 if m>0 else 0
    s+=(t//10+n)*10
    if n==1 and m<u : u=m

if u<10:s-=10-u
print(s)

Solution (Python):
A = [int(input()) for _ in range(5)]
B = [a%10 for a in A]
C = [10 - b for b in B]
while (10 in C):
  C.remove(10)

if (len(C)):
  C.remove(max(C))
print(sum(A) + sum(C))

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

aa=(10-a%10)%10
bb=(10-b%10)%10
cc=(10-c%10)%10
dd=(10-d%10)%10
ee=(10-e%10)%10
m=max(aa,bb,cc,dd,ee)

import math
T=10*math.ceil(a/10)+10*math.ceil(b/10)+10*math.ceil(c/10)+10*math.ceil(d/10)+10*math.ceil(e/10)-m
print(T)

Solution (Python):








lis=[[],[]]
for i in range(5):
    s=int(input())
    lis[0].append(s)
    lis[1].append(s%10)
for i in range(5):
    if lis[1][i]!=0:
        m=i
        break
m=0
for i in range(5):
    if lis[1][m]>lis[1][i] and lis[1][i]!=0:
        m=i
ans=0
for i in range(5):
    if i!=m:
        if lis[1][i]!=0:
            ans+=(lis[0][i]-lis[1][i]+10)
        else:
            ans+=lis[0][i]
ans+=lis[0][m]
print(ans)

Solution (Python):
import math

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

xs = [a,b,c,d,e]
divs = [10 if x % 10 == 0 else x % 10 for x in xs]
mindiv = min(divs)
result = sum([math.ceil(x/10) * 10 for x in xs]) - 10 + mindiv
print(result)

Solution (Python):
from collections import defaultdict as ddic
from collections import deque
from itertools import combinations, permutations, product
import bisect
import heapq
import math
import sys

stdout = sys.stdout
rr = lambda: input().strip()
rri = lambda: int(rr())
rrm = lambda: list(map(int, rr().split()))

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

lst = [[a,-1],[b,-1],[c,-1],[d,-1],[e,-1]]

lst2 = []

for i, num in enumerate(lst):
    lst[i][1] = num[0] % 10

lst.sort(key=lambda arr: arr[1])

for i, l in enumerate(lst):
    if l[1] != 0:
        if i == 4:
            d1 = [item[0] for item in lst]
            print(sum(d1))
            quit()
        else:
            for j, k in enumerate(lst[i+1:]):
                lst[i+j+1][0] += (10 - lst[i+j+1][1])

            d2 = [item[0] for item in lst]
            print(sum(d2))
            quit()

print(sum([a,b,c,d,e]))

Solution (Python):
import numpy as np

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

n = np.array(n)


m=[]
s=0
for p in n:
	t = p % 10
	if (t == 0):
		m.append(10)
	else:
		m.append(t)
for i in range(len(n)):
	if i==np.argmin(m):
		s += n[i]
	else:
		s += n[i] + (10-m[i])
print(s)

Solution (Python):
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
wait_max = max([(130-x)%10 for x in a])
t = sum([(x+9)//10*10 for x in a]) - wait_max
print(str(t))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [10]
if a % 10 > 0:
    l = l + [a % 10]
if b % 10 > 0:
    l = l + [b % 10]
if c % 10 > 0:
    l = l + [c % 10]
if d % 10 > 0:
    l = l + [d % 10]
if e % 10 > 0:
    l = l + [e % 10]
m = min(l)
ma = 10 - m
ls =[]
ls = ls + [-(-a // 10) * 10]
ls = ls + [-(-b // 10) * 10]
ls = ls + [-(-c // 10) * 10]
ls = ls + [-(-d // 10) * 10]
ls = ls + [-(-e // 10) * 10]
s = sum(ls)
print(s -ma)

Solution (Python):

import math

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

last_item_index = -1
largest = -1

for i in range(5):
    if math.ceil(times[i] / 10)* 10 - times[i] > largest:
        largest = math.ceil(times[i] / 10)* 10 - times[i]
        last_item_index = i
        
for i in range(5):
    if not i == last_item_index:
        times[i] = math.ceil(times[i] / 10) * 10

print(sum(times))

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

orders = [A, B, C, D, E]
max_fp = 10
ans = 0
last_order = 0

for i, order in enumerate(orders):
    if order % 10 < max_fp and order % 10 != 0:
        max_fp = order % 10
        last_order = i

for i, order in enumerate(orders):
    if i == last_order or order % 10 == 0:
        ans += order
    else:
        ans += (order // 10 + 1) * 10

print(ans)

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

arr = [a, b, c, d, e]
m = 0
ans = 0
for i in arr:
    ans += i
    if i % 10:
        ans += 10 - (i % 10)
        m = max(m, 10-(i%10))
print(ans - m)

Solution (Python):
from sys import stdin

data = [int(stdin.readline().rstrip()) for _ in range(5)]
data2 = []

for d in data:
    while(True):
        dstr = str(d)
        if int(dstr[-1]) == 0:
            break
        d+=1
    data2.append(d)


mati = -1
mati_index = -1
keta = -1

for i, d in enumerate(data):
    dstr = str(d)
    lastn = int(dstr[-1])
    this_mati = 0
    
    if int(dstr[-1]) == 0:
        this_mati = 0
    else:
        this_mati = 10 - lastn

    if this_mati > mati:
        mati = this_mati
        mati_index = i

res = 0

for i in range(5):
    if i == mati_index:
        continue
    res += data2[i]

res += data[mati_index]

print(res)

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

arr = [a, b, c, d, e]
m = 0
ans = 0
for i in arr:
    ans += i
    if i % 10:
        ans += 10 - (i % 10)
        m = max(m, 10-(i%10))
print(ans - m)

Solution (Python):


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

mod = []

for a in list:
    v = 10-(a%10)
    if v == 10: mod.append(0)
    else:mod.append(10-(a%10))

mod = sorted(mod)

time = sum(list)

time += sum(mod[0:len(list)-1])

print(time)

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

list_inp = [a,b,c,d,e]
min_last = 100
for index, inp in enumerate(list_inp):
  tmp = int(str(inp)[-1])
  if tmp == 0:
    continue
  
  if tmp <= min_last:
    min_last = tmp
    min_last_index = index


if min_last == 100:
  min_last_index = 0


def ceil(src,range):
  if str(src)[-1] == '0':
    return src
  else:
    return ((int)(src / range) + 1 ) * range

ans = 0
for index,value in enumerate(list_inp):
  if index == min_last_index:
    continue
  else:
    ans += ceil(value, 10)


print(ans + list_inp[min_last_index])

Solution (Python):



from sys import stdin




def Combination(n,r):
    tmp_list = []
    for cmb in cmb_list:
        tmp_list.append(cmb)
    for first_data in data_list:
        for second_data in tmp_list:
            split_tmp_list = second_data.split(",")
            obj_list = []
            for split_data in split_tmp_list:
                obj_list.append(split_data)
            if obj_list.count(first_data) == 0:
                obj_list.append(first_data)
                join_data = ",".join(sorted(obj_list))
                if join_data not in cmb_list:
                    cmb_list.append(join_data)
    if r > 2:
        Combination(n,r-1)
    return(cmb_list)

def cal_time(cmb):
    time = 0
    for num,i in enumerate(cmb):
        time += i

        if time%10!=0 and num!=4:
            time += 10 - time % 10

    return time
    

input=[]
for _ in range(5):
    input.append(int(stdin.readline().split()[0]))

cmb_list = []

import itertools
cmb = list(itertools.permutations(input))


prev = 10e6
for x in cmb:
    t = cal_time(x)

    prev = min(t, prev)
print(prev)

Solution (Python):
a = (input())
b = (input())
c = (input())
d = (input())
e = (input())
ary = [a,b,c,d,e]
ary_simo = []
ary_2 = []
for s in ary:
    if int(s[-1]) != 0:
        ary_simo.append(int(s[-1]))
        ary_2.append(int(int(s)/10)*10+10)
    else:
        ary_2.append(int(s))
try:
    print(sum(ary_2) - 10 + min(ary_simo))
except:
    print(sum(ary_2))

Solution (Python):
from itertools import permutations
AE = [int(input()) for _ in range(5)]
perm = list(permutations(AE))
minv = 10**5
for p in perm:
    t = 0
    for i in range(len(p)-1):
        if round(p[i], -1) < p[i]:
            t += round(p[i], -1) + 10
        else:
            t += round(p[i], -1)
    t += p[-1]
    minv = min(minv, t)
print(minv)

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

for i in list:
    if i%10 == 0:
        list_diff.append([0,i,i])
    else:
        list_diff.append([10-i%10,i,10*(i//10+1)])

list_diff.sort()
ans = 0

for i in range(5):
    if i == 4:
        ans += list_diff[i][1]
    else:
        ans += list_diff[i][2]

print(ans)

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

S = [A,B,C,D,E]

s = []

for i in S:
    if i%10 != 0:
        s.append(i%10)

s.sort()

ans = 0

for i in S:
    if i%10 == 0:
        ans += i
    else:
        ans += i + 10 - i%10
if len(s) != 0:
    print(ans - 10 + s[0])
else:
    print(ans)

Solution (Python):
import math

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


m = [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]
n = [m[0]-a, m[1]-b, m[2]-c, m[3]-d, m[4]-e]

ans = sum(m) - max(n)
print(ans)

Solution (Python):
import math
*A,=[int(input()) for i in range(5)]
B=[i%10 for i in A]
C=[int(math.ceil(i/10)*10) for i in A]
while True:
  x=B.index(min(B))
  if B[x]!=0:
    print(sum(C)-C[x]+A[x])
    break
  B[x]=10

Solution (Python):
dishes = []
for i in range(5):
    tmp = int(input())
    rank = 10 if tmp % 10 == 0 else tmp % 10
    dishes.append([rank, tmp])
s_dished = sorted(dishes, reverse=True)

time = 0
for idx,item in enumerate(s_dished):
    time += item[1] + 10 - item[0]

time -= 10 - s_dished[4][0]

print(time)

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

Solution (Python):
import math
t = []
output = 0
amari = 10
for i in range(0, 5):
    t.append(int(input()))
    output = output+math.ceil(t[i]/10)*10
    if 0<t[i]%10<amari:
        amari = t[i]%10
output = output-10+amari
print("{}".format(output))

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
t = 0
mine = 0
k = [a,b,c,d,e]
for i in k:
  if i % 10 > 0:
    if mine%10 > i%10 or mine == 0:
      mine = i
if mine == 0:
  mine = a
k.remove(mine)
for i in k:
  t += math.ceil(i/10)*10
t += mine
print(t)

Solution (Python):
num_list = [int(input()) for _ in range(5)]
res = []
zero = []
one = []
two = []
three = []
four = []
five = []
for n in num_list:
    if n%10 > 5:
        res.append(n)
for n in num_list:
    if n%10 == 0:
        zero.append(n)
    elif n%10 == 1:
        one.append(n)
    elif n%10 == 2:
        two.append(n)
    elif n%10 == 3:
        three.append(n)
    elif n%10 == 4:
        four.append(n)
    elif n%10 == 5:
        five.append(n)
sum = 0
res.extend(zero)
res.extend(five)
res.extend(four)
res.extend(three)
res.extend(two)
res.extend(one)
for i,v in enumerate(res):
    plus = 0
    if v%10==0:
        pass
    else:
        plus = 10-v%10
    if i == 4:
        sum += v
        break
    else:
        sum += v + plus
print(sum)

Solution (Python):
import math
import numpy as np

s = [float(input()) for i in range(5)]
a = []

for i in s:
    a.append(math.ceil(i/10)*10)

ns = np.array(s)
na = np.array(a)
print(int(np.sum(na)-np.amax(na-ns)))

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

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

print(ans)

Solution (Python):
import sys

M = []
N = []
for i in range(5):
    l = int(raw_input().split()[0])
    if l % 10 == 0:
        M.append(l)
    else:
        N.append(l)
N = sorted(N,  key=lambda x: 10 - (x % 10))


ret = 0
for m in M:
    ret += m
for n in N:
    ret += n
    ret += (10 - (n % 10))
if len(N) != 0:
    ret -= (10 - (N[-1] % 10))
print(ret)

Solution (Python):
ans = 0
mod_t = []
for i in range(5):
    t = int(input())
    ans += t
    dif_t = 10 - t % 10
    if dif_t == 10:
      dif_t = 0
    mod_t.append(dif_t)

mod_t.sort()
for i in range(4):
    ans += mod_t[i]
print(ans)

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

h = [i % 10 for i in nums if i%10 != 0]
min1 = 0 if len(h)==0 else min(h)

amount = 0
last = True
for i in nums:
  if last and i% 10 == min1:
    amount += i
    last = False
  else:
    amount += (i //10 + 1)*10 if i %10 != 0 else (i//10)*10
print(amount)

Solution (Python):
import math
menu = list()
for i in range(5):
    menu.append(int(input()))
    
diff_menu = list()
ans_menu = list()
for i in menu:
    amari = i % 10
    if amari == 0:
        amari = 10
    diff_menu.append(i+10-amari-i)
    ans_menu.append(i + 10-amari)
    
print(sum(ans_menu) - max(diff_menu))

Solution (Python):
import math
import numpy as np

a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
x = []
s = 0

if a % 10 != 0:
  x.append(a % 10)

if b % 10 != 0:
  x.append(b % 10)

if c % 10 != 0:
  x.append(c % 10)


if d % 10 != 0:
  x.append(d % 10)


if e % 10 != 0:
  x.append(e % 10)

s = 0

if len(x) != 0:
  if np.amin(x) !=0:
    s = 10
  y = np.amin(x)
else:
  s = 0
  y = 0

print(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 +  y -s )

Solution (Python):
def f(x):
    if x%10 == 0: return x
    return x + 10 - (x%10)

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

res = f(a) + f(b) + f(c) + f(d) + f(e)

l = [a, b, c, d, e]
l = list(map(lambda x: (x-1)%10, l))
res -= (10-(min(l)+1))
print(res)

Solution (Python):
import sys
import io
import math
import re

import sys
import io
import math
import re

menu_num = 5
menu_sum = 0
menu_time_divided = 9
flag_a = 0
flag_b = 0

for num in range(menu_num):
    data_info = input().split()
    menu = int(data_info[0])
    menu_sum += math.ceil(menu / 10) * 10

    if menu % 10 == 0:
        flag_a = 1

    if menu_time_divided >= menu % 10 and menu % 10 != 0:
        menu_time_divided = menu % 10
        flag_b = 1

if flag_a == 0 and flag_b == 1:
    print(menu_sum+menu_time_divided-10)
elif flag_a == 1 and flag_b == 1:
    print(menu_sum+menu_time_divided-10)
else:
    print(menu_sum)

Solution (Python):
n = [int(input()) for i in range(5)]
q = []
for i in n:
    if i%10 == 0:
        q.append(10)
    else:
        q.append(i%10)
ans = 0
for i in range(5):
    ans =  ans + n[i] - q[i] + 10
ans = ans - 10 +q[q.index(min(q))]
print(ans)

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

lastorderval=10
lastorder=0

goukei=0
for i in range(5):
    if S[i]%10!=0:
    
        if S[i]%10<lastorderval:
            lastorderval=S[i]%10
            lastorder=i
            

for i in range(5):
    if i==lastorder:
        goukei+=S[i]
       
    elif S[i]%10==0:
        goukei+=S[i]
        
    else:
        goukei+=S[i]+(10-S[i]%10)
       

print(goukei)

Solution (Python):
t=[int(input()) for _ in range(5)]
ans=0
b=[x%10 for x in t]
c=[x%10 for x in t if x%10>0]
if c==[]:
    print(sum(t))
else:
    for i in range(5):
        if b[i]>0:
            ans+=(t[i]//10+1)*10
        else:
            ans+=t[i]
    print(ans-10+min(c))

Solution (Python):

ans, lastMinus = 0, 0
for i in range(5):
    try:
        k = int(input())
    except EOFError:
        pass
    
    if k % 10 != 0:
        num = (k // 10 + 1) * 10
        if lastMinus < (num - k):
            lastMinus = num - k
    else:
        num = k
    ans += num

ans -= lastMinus    
print(ans)

Solution (Python):

import sys
import os
import itertools
from math import *

ctime = []
for i in range(5):
  ctime.append(int(input()))
  
max_diff = 10
max_index = 100
for i in range(5):
  diff_time = (ctime[i]) % 10
  if diff_time < max_diff and diff_time > 0:
    max_index = i
    max_diff = ctime[i] % 10

time = 0
for i in range(5):
  if i != max_index:
    if ctime[i] % 10 == 0:
      time = time + ctime[i]
    else:
      time = time + ((ctime[i] // 10)+1) * 10
  else:
    time = time + ctime[i]
    
print(time)

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

result = 0
result += a if a % 10 == 0 else a + 10 - a % 10
result += b if b % 10 == 0 else b + 10 - b % 10
result += c if c % 10 == 0 else c + 10 - c % 10
result += d if d % 10 == 0 else d + 10 - d % 10
result += e if e % 10 == 0 else e + 10 - e % 10


min_mod = 10 if a % 10 == 0 else a % 10
if b % 10 != 0 and b % 10 < min_mod:
  min_mod = b % 10
if c % 10 != 0 and c % 10 < min_mod:
  min_mod = c % 10
if d % 10 != 0 and d % 10 < min_mod:
  min_mod = d % 10
if e % 10 != 0 and e % 10 < min_mod:
  min_mod = e % 10

if min_mod != 10:
  result -= 10 - min_mod
  
print(result)

Solution (Python):
def __main__():
    orders = []
    for i in range(5):
        orders.append(int(input()))
    last = min(orders, key=(lambda x: (x-1)%10))
    orders.remove(last)
    print(sum(map((lambda x: (x+9)//10*10), orders)) + last)
if __name__ == "__main__":
    __main__()

Solution (Python):
from math import ceil

li = []

for i in range(5):
    tmp = int(input())
    li.append(tmp)

li_sorted = sorted(li, key=lambda digit: digit % 10)

last_flag = False

ans = 0
for i in li_sorted:
    if i % 10 == 0:
        ans += i
    elif last_flag is False:
        last_flag = True
        ans += i
    else:
        ans += i + 10 - (i % 10)

print(ans)

Solution (Python):
import sys

def main(inp):
    food=[int(next(inp).split()[0]) for _ in range(5)]
    
    ichi=[food[i]%10 for i in range(5)]
    for i in range(5):
        if(ichi[i]==0): ichi[i]=10
            
    lastfood=ichi.index(min(ichi))
    
    ans=0
    for i in range(5):
        if(i==lastfood or food[i]%10==0): ans+=food[i]
        else: ans+= (food[i]//10 +1)*10
            
    return ans
  
print(main(sys.stdin))

Solution (Python):
a = []
ans = 0
for i in range(5):
  po = int(input())
  a.append(po)

mindiv = 15
for i in range(5):
  div = a[i] % 10
  if div == 0:
    div = 10
  if div < mindiv:
    mindiv = div
    index = i
           
for i in range(5):
  if i != index:
    if a[i]%10 !=0:
      ans = ans + (int(a[i]/10)+1)*10
    else:
      ans = ans + a[i]
  else:
    ans = ans + a[index]
    
print(int(ans))

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

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

r = max(aa-a,bb-b,cc-c,dd-d,ee-e)
s = aa+bb+cc+dd+ee-r

print(s)

Solution (Python):
import math

li =[]
li2 = []
for i in range(5):
	li.append(int(input()))
	a = li[i]%10
	if a == 0:
		a = 10
	li2.append(a)
    



mi = li2.index(min(li2))

result=0
for i in range(len(li)):
	if i==mi:
		result = result+li[i]
	else:
		result = result+math.ceil(li[i]/10)*10
print(result)

Solution (Python):
rmax = 0
tsum = 0
for i in range(5):
    t = int(input())
    tsum += t
    if(t % 10 != 0):
        r = 10 - (t % 10)
        tsum += r
        if(r > rmax):
            rmax = r
print(tsum - rmax)

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

min_dish_num = 0
for i in range(1, 5):
    if (dishes[min_dish_num] % 10) == 0:
        min_dish_num = i
    else:
        temp = dishes[i]%10
        if (temp) < (dishes[min_dish_num]%10) and temp != 0:
            min_dish_num = i

cnt = 0
for i in range(5):
    if i == min_dish_num:
        continue
    
    dish = dishes[i]

    cnt += (dish // 10) * 10
    
    if (dish % 10) != 0:
        cnt += 10

cnt += dishes[min_dish_num]

print(cnt)

Solution (Python):
li = [int(input()) for i in range(5)]
li_amari = []
time = 0
for i in li:
    if (i % 10 == 0):
        li_amari.append(0)
    else:
        li_amari.append(10 - (int(i % 10)))

a = li_amari.index(max(li_amari))

max_li = li[a]

del li[a]
del li_amari[a]

for j in range(4):
    time += (li[j]+li_amari[j])

print(time + max_li)

Solution (Python):
import math
import itertools

def imagine_time(order):
    time = 0
    for o in order[:-1]:
        time += math.ceil(dishes[o] / 10 ) * 10
    time += dishes[order[-1]]
    return time

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
dishes = [A, B, C, D, E]

ans = 99999
orders = list(itertools.permutations([0, 1, 2, 3, 4]))
for order in orders:
    ans = min(ans, imagine_time(order))
print(ans)

Solution (Python):
import itertools

def hoge(lst):
    n = 0
    for x in list(lst[0:4]):
        n += x
        if n % 10 != 0:
            n = n + (10 - (n % 10))
    return n + lst[4]

lst = [int(input()) for _ in range(5)]
lst = list(itertools.permutations(lst))
ret = 100000000
for x in lst:
    ret = min(ret, hoge(x))

print(ret)

Solution (Python):
cooktimes = [int(input()) for i in range(5)]
intervals = [0 if x % 10 == 0 else 10 - (x % 10) for x in cooktimes]
alist = []
for i in range(5):
    alist.append(tuple([cooktimes[i], intervals[i]]))
alist.sort(key=lambda x: x[1])
ans = 0
for i in range(4):
    ans += alist[i][0] + alist[i][1]
ans += alist[4][0]
print(ans)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
num = [a,b,c,d,e]
def rou(num):
    return math.ceil(num/10) * 10
RR = list(map(rou, num))
def ama(num):
    t = num % 10
    if t == 0:
        return 10
    else:
        return t
tmp = list(map(ama, num))
ind = tmp.index(min(tmp))
RR.remove(RR[ind])
print(num[ind] + sum(RR))

Solution (Python):
li2 = []
c = 0
for i in range(5):
  a = int(input())
  li2.append((a-1)%10+1)
  c += (a-1)//10+1
li2.sort()        
print(c*10+li2[0]-10)

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

menu = sorted(menu, key = lambda x: x%10 if x%10 != 0 else 10, reverse = True)

time = 0
for i in range(4):
  time +=  menu[i] if menu[i]%10 == 0 else 10 * (menu[i] // 10 + 1)

time += menu[4]

print(time)

Solution (Python):
listA = [int(input()) for _ in range(5)]
listB = [(10 - (_ % 10)) % 10 for _ in listA]

idx = listB.index(max(listB))
time = 0

for i, data in enumerate(listA):
    if i == idx:
        continue
    else:
        if data % 10 == 0:
            time += data
        else:
            time += ((data // 10) + 1) * 10

time += listA[idx]
print(time)

Solution (Python):
a=[]
for i in range(5):
    a.append(int(input()))
b=set(map(lambda x: x%10,a))
if 0 in b:
    b.remove(0)
    if len(b) == 0:
        b.add(10)
print(sum(map(lambda x:(x/10+1)*10 if x%10 != 0 else (x/10)*10,a))+min(b)-10)

Solution (Python):
import itertools as it
l = []
for i in range(5):
    l.append(int(input()))
anss = []
def calcTime(ls):
    time = 0
    count = 0
    for i in ls:
        count += 1
        time += l[i]
        if count == 5:
            break
        if time % 10 != 0:
            time += 10 - (time % 10)
    anss.append(time)
perm = it.permutations(range(5),5)
lperm = list(perm)
for tup in lperm:
    calcTime(list(tup))
print(min(anss))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
import itertools
menu=[a,b,c,d,e]
menu_p = list(itertools.permutations(menu))

min = 10000000000
for list in menu_p:
    total = 0
    for i in range(len(list)):
        if i == len(list)-1 or list[i] % 10 == 0:
            total += list[i]
        else:
            total += list[i] + (10 - list[i]%10)
    if min > total:
        min = total
print(min)

Solution (Python):
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)
if a==10:
  a=0
if b==10:
  b=0
if c==10:
  c=0
if d==10:
  d=0
if e==10:
  e=0
SUM=max(a,b,c,d,e)
print(A+B+C+D+E+a+b+c+d+e-SUM)

Solution (Python):
a = [int(input()) for _ in range(5)]
b = [n for n in a if n % 10 == 0]  
c = [n for n in a if n % 10 > 0]  

res = sum(b)
if c:  
    r = min(n % 10 for n in c)
    res += sum((n // 10 + 1) * 10 for n in c) - 10 + r

print(res)

Solution (Python):
import numpy as np

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

list_ = np.array([a, b, c, d, e])

list_mod = (list_-1) % 10

min_factor = np.argmin(list_mod)
Total =  0

for i, var in enumerate(list_):
  if i == min_factor or var % 10 == 0:
    Total += var
  else:
    Total += var + 10 - (var % 10)
    
print(Total)

Solution (Python):
time = []
iti = 10
idx = -1
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        if y < iti:
            iti = y
            idx = i
    time.append(x)

sum = 0


for i in range(5):

    if i != idx and time[i] % 10 != 0:
        sum += time[i] + (10 - time[i]%10)
    else:
        sum += time[i]

print(sum)

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

aa = a % 10
bb = b % 10
cc = c % 10
dd = d % 10
ee = e % 10

cnt = 0

aaa = 10
bbb = 10
ccc = 10
ddd = 10
eee = 10
if aa != 0:
    cnt += 10
    aaa = aa
if bb != 0:
    cnt += 10
    bbb = bb
if cc != 0:
    cnt += 10
    ccc = cc
if dd != 0:
    cnt += 10
    ddd = dd
if ee != 0:
    cnt += 10
    eee = ee

if cnt > 0:
    cnt = cnt - 10
mmm = min([aaa, bbb, ccc, ddd, eee])
if mmm == 10:
    mmm = 0

print(a - aa + b - bb + c - cc + d - dd + e - ee + cnt + mmm)

Solution (Python):
A = [int(input()) for _ in range(5)]
a = 0
s = 0
for l in A:
  b = -(-l // 10) * 10
  s += b
  c = b - l
  if a < c:
    a = c
print(s-a)

Solution (Python):
arr=[]
for i in range(5):
	t=int(input())
	arr.append(t)
ans=0
arr2=[]
for i in range(5):
	if(arr[i]%10==0):
		ans+=arr[i]
	else:
		ans+=((arr[i]//10)+1)*10
		arr2.append(arr[i]%10)
if(len(arr2)>0):
	ans-=10
	ans+=min(arr2)
print(ans)

Solution (Python):
li = list()
for i in range(5):
  li.append(int(input()))

lili = list()
  
for i in li:
  num = list(map(int, str(i)))
  if num[-1] == 0:
    num[-1] = 10
  lili.append(num[-1])

index = lili.index(min(lili))
ans = 0
for i, l in enumerate(li):
  if i == index:
    ans += l
  else:
    ans += l
    ans += 10-lili[i]

print(ans)