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):
X = [input() for _ in range(5)]
endzero = 0
elesnum = []
for x in X:
  if x[-1] == "0":
    endzero += int(x)
  else:
    elesnum.append(x)
if elesnum:
  elesnum.sort(key = lambda x: x[-1])
  min_ = int(elesnum[0])
  for e in elesnum[1:]:
    endzero += (int(e)//10+1)*10
  print(endzero+min_)
else:
  print(endzero)

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

dish_list = [a, b, c, d, e]
min_val = 100
idx = 0
for i, x in enumerate(dish_list):
    if x%10 == 0:
        continue
    val = x % 10
    if val < min_val:
        min_val = val
        idx = i

ans = 0
for i, dish in enumerate(dish_list):
    if i == idx:
        continue

    wait_order =  10 - dish_list[i]%10 if dish_list[i]%10 != 0 else 0

    ans += dish_list[i] + wait_order

print(ans + dish_list[idx])

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

a1 = a % 10
b1 = b % 10
c1 = c % 10
d1 = d % 10
e1 = e % 10

if a1 == 0:
  a1 = 10
if b1 == 0:
  b1 = 10
if c1 == 0:
  c1 = 10
if d1 == 0:
  d1 = 10
if e1 == 0:
  e1 = 10

a2 = a - a1 + 10
b2 = b - b1 + 10
c2 = c - c1 + 10
d2 = d - d1 + 10
e2 = e - e1 + 10

ans = a2 + b2 + c2 + d2 + e2 - 10 + min(a1, b1, c1, d1, e1)

print(ans)

Solution (Python):
time_list=[]
rest_time_list=[]
rest_time=0
rest_mene=0
for i in range(5):
    time = int(input())
    time_list.append(time)
    iti=str(time)[-1]
    if int(iti)!=0:
        rest_time_list.append(10-int(iti))
        if rest_time<10-int(iti):
            rest_time=10-int(iti)
            rest_mene=i
    else:
        rest_time_list.append(0)
print(sum(time_list)+sum(rest_time_list)-rest_time)

Solution (Python):
x = [int(input()) for i in range(5)]
a = [0]
res = 0
for i in range(5):
    if x[i]%10!=0:
        a.append(10-x[i]%10)
b = max(a)
c = sum(a)-b
print(sum(x)+c)

Solution (Python):
a = list()
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
sum = 0
min = 10
for i in range(0, 5):
	if a[i] % 10 == 0:
		a[i] = a[i] - 10
	else:
		if a[i] % 10 < min:
			min = a[i] % 10
	a[i] = a[i] - a[i] % 10
	sum = sum + a[i]
sum = sum + min + 40
print(sum)

Solution (Python):


def main():
    time = []
    time_zero = []
    for i in range(5):
        temp = int(input())
        if temp%10 == 0:
            time_zero.append(temp)
        else:
            time.append([temp,temp%10])
    sort_list = sorted(time, key=lambda x:x[1],reverse=True)

    
    ans = 0
    
    for i in time_zero:
        ans += i    
    for i in sort_list:
        if ans > 0 and ans%10 > 0:
            ans +=  (10 - ans%10)
        ans += i[0]
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math


def solve(lines):
    lines = [int(x) for x in lines]

    rem = [l % 10 if l % 10 != 0 else 10 for l in lines]
    rem_min = min(rem)
    idx = None
    for i, l in enumerate(rem):
        if l == rem_min:
            idx = i

    last = lines.pop(idx)

    lines = [math.ceil(l / 10) * 10 for l in lines]
    result = sum(lines) + last
    print(result)


if __name__ == '__main__':
    lines = sys.stdin.read()
    lines = lines.strip().split('\n')
    solve(lines)

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

dec = 0
m = 10
for a in A:
    dec += a // 10
    if a % 10 > 0:
        dec += 1
        m = min(m, a % 10)
print(10 * (dec - 1) + m)

Solution (Python):
from sys import stdin
import itertools


foods = [int(input()) for i in range(5)]
orders = list(itertools.permutations(range(5)))
mintime = 1111111111
ordertime = 0
nowtime = 0
for i in orders:
    ordertime = 0
    l = list(i)
    
    ordertime += foods[l[0]]
    for j in range(1, 5):
        
        if ordertime%10 == 0:
            ordertime+= foods[l[j]]
        else:
            while ordertime%10 !=0:
                ordertime += 1
            ordertime+=foods[l[j]]
    if mintime > ordertime:
        mintime = ordertime

print(mintime)

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

at = -(-a//10)*10
bt = -(-b//10)*10
ct = -(-c//10)*10
dt = -(-d//10)*10
et = -(-e//10)*10

aa = a % 10
ba = b % 10
ca = c % 10
da = d % 10
ea = e % 10

array = (aa, ba, ca, da, ea)
minn = aa
for i in array:
    if (i != 0 and minn > i):
        minn = i
test = array.index(minn)

if (test == 0):
    time = a + bt + ct + dt + et
elif (test == 1):
    time = at + b + ct + dt + et
elif (test == 2):
    time = at + bt + c + dt + et
elif (test == 3):
    time = at + bt + ct + d + et
elif (test == 4):
    time = at + bt + ct + dt + e

print(time)

Solution (Python):
T = []
for i in range(5):
  t = int(input())
  T.append([t % 10, t])
T.sort()
ans = 0
flag = 0
for i in range(5):
  if T[i][0] == 0:
    ans += T[i][1]
  else:
    if flag == 0:
      ans += T[i][1]
      flag =1
    else:
      ans += ((T[i][1] // 10) + 1) * 10
print(ans)

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

last = min([10 if x % 10 == 0 else x % 10 for x in i])
s = 0
for x in i:
    if x % 10 == 0:
        s += x
    else:
        s += (int(x / 10) + 1) * 10
s = s + last - 10
print(str(s))

Solution (Python):

d=sorted([int(input()) for i in range(5)],key=lambda x:(x-1)%10)
m=0
for i in range(1,5):
    d[i]=d[i] if d[i]%10==0 else int((d[i]+10)//10*10)
print(sum(d))

Solution (Python):
import itertools
import math

A = []
for i in range(5):
    A.append(float(input()))

B = list(itertools.permutations(A))
M = 500 * 5
for i in range(120):
    c = 0
    for j in range(4):
        c += math.ceil(B[i][j]/10) * 10
    c += B[i][4]
    M = min(M, c)
print(int(M))

Solution (Python):
import math
import sys

def main():
    a = []
    s = 0
    for _ in range(5):
        n = int(input())
        a.append(n)
        s += math.ceil(n/10)*10
    ans = sys.maxsize
    for n in a:
        ans = min(ans,s - math.ceil(n/10)*10 + n)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math

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

last = F[0]
for i in F:
    if i % 10 < last % 10 and i % 10 != 0:
        last = i
ans = 0
for i in F:
    ans = ans + math.ceil(i/10)*10

ans = ans - math.ceil(last/10)*10 + last

print(ans)

Solution (Python):

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

count=0
if A%10!=0:
    A1=A-A%10+10
else:
    A1=A
if B%10!=0:
    B1=B-B%10+10
else:
    B1=B
if C%10!=0:
    C1=C-C%10+10
else:
    C1=C
if D%10!=0:
    D1=D-D%10+10
else:
    D1=D
if E%10!=0:
    E1=E-E%10+10
else:
    E1=E


total=[]

total+=[A1+B1+C1+D1+E]
total+=[A1+B1+C1+E1+D]
total+=[A1+B1+D1+E1+C]
total+=[A1+C1+D1+E1+B]
total+=[B1+C1+D1+E1+A]


print(min(total))

Solution (Python):
import math
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
oreder_time = np.array([a,b,c,d,e])
next_oreder_time = np.ceil(oreder_time/10)*10

print(int(np.sum(next_oreder_time)-np.max(next_oreder_time-oreder_time)))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def f(x):
  return -(-x // 10) * 10
def g(x):
  return (x-1) % 10 + 1
ans = sum(f(i) for i in [a,b,c,d,e])
mi = min(g(i) for i in [a,b,c,d,e])
ans += mi - 10
print(ans)

Solution (Python):
a = [int(input()) for i in range(5)]
mod = []
for d in a:
    mod.append(d %10)
for i in range(5):
    for j in range(13):
        if j*10< a[i] <=( j+1)*10:
            a[i] = (j+1) *10

m = 10
for i in mod:
    if i != 0 and i <=m:
        m = i

print((sum(a) - (10 - m)))

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

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

sum = 0

f = 0
for i in range(1,10):
    if f == 0:
        for j in list:
            if j%10 == i:
                sum += j
                list.remove(j)
                f = 1
                break
        
for i in list:
    if i % 10 == 0:
        sum += i
    else:
        sum += i + 10 - (i % 10)

print(sum)

Solution (Python):
l=[]
for i in range(5):
    l.append(int(input()))
tl=[]
for i in range(5):
    tl.append(l[i]%10)
nl=[]
for i in range(5):
    if l[i]%10==0:
        nl.append(l[i])
    else:
        nl.append((l[i]//10+1)*10)
ctr=0
a=tl[:]
a.sort()
for i in range(5):
    if a[i]>0:
        ctr=a[i]
        break
if a==[0,0,0,0,0]:
    print(sum(nl))
else:
    print(sum(nl)-10+ctr)

Solution (Python):
L=[]
L2=[]
for i in range(5):
    I=int(input())
    L.append(I)
    L2.append(I%10)

result=0
for i in L:
    result+=i
    if result%10==0:
        continue
    for j in range(10):
        result+=1
        if result%10==0:
            break

if max(L2)==0:
    print(sum(L))
else:
    if min(L2)==0:
        for t in sorted(L2):
            if t==0:
                pass
            else:
                mn=t
                break
    else:
        mn=min(L2)

    print(result-(10-mn))

Solution (Python):
L = [int(input()) for i in range(5)]
A = [[] for i in range(10)]
ans = 0
for i in range(len(L)) :
    A[L[i] % 10].append(L[i])
cnt = 0
ans = 0
ans += sum(A[0])
cnt += len(A[0])
A.pop(0)
A = list(reversed(A))
for i in range(len(A)) :
    for j in range(len(A[i])) :
        ans += A[i][j]
        if cnt != 4 :
            ans += 10 - (A[i][j] % 10)
            cnt += 1
print(ans)

Solution (Python):
li = []

a = 10

for i in range(5):
    x = input()
    if int(x[-1]) == 0:
        li.append(int(x))
    else:
        if int(x[-1]) < a:
            a = int(x[-1])
        x = x[:-1] + "0"
        x = int(x) + 10
        li.append(x)

if a == 10:
    a = 0

if a:
    print(sum(li) - 10 + a)
else:
    print(sum(li))

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

l = [a,b,c,d,e]
if len([i for i in l if i != 0]) == 0:
    m = 10
    
else:
    m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10 -10
print(ans)

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

def cost(min):
    if min % 10 == 0:
        return min
    else:
        return min - (min % 10) + 10

def min_extra(t, now):
    e = t % 10
    if e == 0:
        return now
    if e < now:
        return e
    else:
        return now

extra = A % 10
extra = min_extra(B, extra)
extra = min_extra(C, extra)
extra = min_extra(D, extra)
extra = min_extra(E, extra)

sum = cost(A)
sum += cost(B)
sum += cost(C)
sum += cost(D)
sum += cost(E)
if extra != 0:
    sum -= (10 - extra)

print(sum)

Solution (Python):
import math

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

last_order_index = None
last_order_time = 10
for i, cooking_time in enumerate(cooking_times):
    ones_place = int(str(cooking_time)[-1])
    if last_order_time > ones_place != 0:
        last_order_time = ones_place
        last_order_index = i

time = 0
for i, cooking_time in enumerate(cooking_times):
    if i == last_order_index:
        time += cooking_time
    else:
        time += int(math.ceil(cooking_time / 10) * 10)

print(time)

Solution (Python):
a = [0] * 5
a_kuriage = [0] * 5
min_waste = 10
for i in range(5):
    a[i] = int(input())
    if a[i] % 10 != 0:
        a_kuriage[i] = a[i] + 10 - a[i] % 10
        if a[i] % 10 < min_waste:
            min_waste = a[i] % 10
    else:
        a_kuriage[i] = a[i]

print(sum(a_kuriage) - 10 + min_waste)

Solution (Python):
"""
python3 main.py < input.txt
"""
import math
a=float(input())
b=float(input())
c=float(input())
d=float(input())
e=float(input())
l=[a, b, c, d, e]
l.sort(key=lambda x: (x+9)%10)
t=0
for x in l[1:]:
    t += math.ceil(x/10)*10
print(int(t+l[0]))

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

b = 0
d = 0
C = []
for i in range(5):
    if A[i]%10 != 0:
        C.append(10-(A[i]%10))
        if b < 10-(A[i]%10):
            b = 10-(A[i]%10)
            d = i

ans = sum(A)+sum(C)-b



print(ans)

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

for x in lis:
    if x%10 == 0:
        ans_fla_lis.append(0)
    else:
        ans_fla_lis.append(10-(x%10))
axo = ans_fla_lis.pop(ans_fla_lis.index(max(ans_fla_lis)))
print(sum(lis) + sum(ans_fla_lis))

Solution (Python):
min_ = 10
ans = 0

for _ in range(5):
    t = int(input())
    a = t // 10
    b = t % 10
    if b == 0:
        ans += a * 10
    else:
        ans += (a + 1) * 10
        min_ = min(min_, b)

print(ans - 10 + min_)

Solution (Python):
func = lambda x: x if x != 0 else 10 

ct_list = [int(input()) for _ in range(5)]
ct_surp = [func(ct%10) for ct in ct_list]

argmin = sorted(list(enumerate(ct_surp)),key=lambda x:x[1])[0][0]

total_time = 0

for i,ct in enumerate(ct_list):
  if i == argmin:
    continue
  total_time += ct + (10-ct_surp[i]) if ct_surp[i] < 10 else ct

total_time += ct_list[argmin]

print(total_time)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
mod_list = []
for i in l:
  mod_list.append((i-1)%10)
last = l.pop(mod_list.index(min(mod_list)))
s = 0
for i in l:
  s += ((i-1)//10 + 1) * 10
s += last
print(s)

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

l = [a,b,c,d,e]
cost = [(10 - (i%10))%10 for i in l]
time = []
idx = cost.index(max(cost))
for i in range(len(l)):
    if i == idx:
        time.append(l[i])
    else:
        time.append(l[i]+cost[i])
print(sum(time))

Solution (Python):
costs = []
for i in range(5):
    costs.append(int(input()))
    
waits = []
for cost in costs:
    waits.append((10 - (cost % 10))%10)

time = 0
for i in range(5):
    time += (costs[i] + waits[i])

print(time - max(waits))

Solution (Python):

times = []

tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    

if len(tmp) == 0:
    tmp = [0]

yobun = min(tmp)
if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)

Solution (Python):
L= list(map(int,[input() for i in range(5)]))
res = 10
res2 = 0
M = []
ans = 0
for i in range(5):
    if L[i] % 10 != 0:
        M.append(10 - L[i] % 10)
        if res > L[i] % 10:
            res = L[i] % 10
            res2 = 10 - L[i] % 10
    else:
         M.append(0)
for i in range(5):
    ans += L[i]+M[i]

ans -= res2
print(ans)

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

K=0
V=0
for z in A:
  j = math.ceil(float(z) / 10) * 10
  V += j
  if K <= j - z:
    K = j - z
print(V - K)

Solution (Python):
x = []
for _ in range(5):
    x.append(int(input()))
t = 0
wt = []
for a in x:
    t += a
    m = a % 10
    if m > 0:
      wt.append(10-m)
if len(wt) > 1:
    wt.sort()
    wt.pop()
    for x in wt:
        t += x
print(t)

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

if A == 0:
    A = 10
if B == 0:
    B = 10
if C == 0:
    C = 10
if D == 0:
    D = 10
if E ==0:
    E = 10

MIN = min(A,B,C,D,E)

Af = (a - A) + 10
Bf = (b - B) + 10
Cf = (c - C) + 10
Df = (d - D) + 10
Ef = (e - E) + 10

if A == MIN:
    print( Bf + Cf + Df + Ef + a)
elif B == MIN:
    print(Af + Cf + Df + Ef + b)
elif C == MIN:
    print(Af + Bf + Df + Ef + c)
elif D == MIN:
    print(Af + Bf + Cf + Ef + d)
else:
    print(Af + Bf + Cf + Df + e)

Solution (Python):
m = 0
s = 0
for i in range(5):
    t = int(input())
    if t % 10 != 0:
        m = max(10 - (t % 10), m)
        t = ((t // 10) + 1) * 10
    s += t

print(s - m)

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

m = 0
for i, d in enumerate(data):
    a = 10 - d % 10
    if a == 10:
        a = 0
    m = max(a, m)
    data[i] = d + a
    
print(sum(data) - m)

Solution (Python):
import math

array = []
for i in range(5):
    array.append(int(input()))
res = 0
round_array = []
for j in array:
    round_array.append(math.ceil(j /10) * 10)
tmp = 0
for k, l in zip(array, round_array):
    if abs(tmp) < abs(k - l):
        tmp = k - l
res = sum(round_array)
print(res + tmp)

Solution (Python):
def kiriage(n):
    if n%10==0:
        return n
    else: return n-(n%10)+10

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

least = 100
dish = [A, B, C, D, E]
kiri = []
ans = 1000
for i in dish:
    kiri.append(kiriage(i))
for i in range(5):
    time = sum(kiri) - kiri[i] + dish[i]
    ans = min(ans, time)

print(ans)

Solution (Python):
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=a // 10
t=b // 10
u=c // 10
v=d // 10
w=e // 10

if A == 0:
	A = A + 10
else:
	a = (s + 1) * 10

if B == 0:
	B = B + 10
else:
	b = (t + 1) * 10

if C == 0:
	C = C + 10
else:
	c = (u + 1) * 10

if D == 0:
	D = D + 10
else:
	d = (v + 1) * 10

if E == 0:
	E = E + 10
else:
	e = (w + 1) * 10

m = min([A,B,C,D,E])

if m == 10:
	X = a+b+c+d+e
elif m == A:
	X = b+c+d+e+(s*10+A)
elif m == B:
	X = a+c+d+e+(t*10+B)
elif m == C:
	X = a+b+d+e+(u*10+C)
elif m == D:
	X = a+b+c+e+(v*10+D)
else:
	X = a+b+c+d+(w*10+E)

print(X)

Solution (Python):
import sys
input = sys.stdin.readline

l = []
s = []

for i in range(5):
    l.append(int(input()))
    if l[-1] % 10 > 0:
        s.append( (l[-1] // 10 + 1) * 10 )
    else:
        s.append(l[-1])
        
idx = 0
min_ = 10
for i in range(5):
    x = l[i] % 10
    if min_ > x and x != 0:
        min_ = x
        idx = i

print(sum(s)-s[idx]+l[idx])

Solution (Python):
a=[];b=[]
for i in range(5):
    a1 = int(input())
    a.append(a1)
    b.append(a1%10)
sum = 0
for i in range(5):
    if a[i]%10 ==0:
        sum += a[i]
    else:
        sum += a[i] +10 -a[i]%10
c = [i for i in b if not i ==0 ]
if c == []:
    print(sum)
else:
    print(sum-10+min(c))

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

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

time = 0

for i in ae:
    if i % 10 == 0:
        time += i

ae = [i for i in ae if i % 10 != 0]

if ae:
    idx = 0
    for i in ae:
        time += i
        time += 10 - (i % 10)

    one = []
    for i in ae:
        i = [j for j in str(i)]
        one.append(int(i[-1]))

    print(time-10+min(one))

else:
    print(time)

Solution (Python):
dishes = []
for _ in range(5):
    x = int(input())
    dishes.append(x)
        
min_d = dishes[0]
other_dishes = []
for d in dishes[1:]:
    if min_d % 10 > d % 10 and d % 10 != 0:
        other_dishes.append(min_d)
        min_d = d
    else:
        other_dishes.append(d)

ans = 0
for d in other_dishes:
    if d % 10 == 0:
        ans += d
    else:
        ans += (d // 10) * 10
        ans += 10

ans += min_d
print(ans)

Solution (Python):
num = []
m = 10
for _ in range(5) :
    n = int(input())
    if n % 10 == 0 :
        num.append(n)
        continue
    num.append(n + 10 - (n % 10))
    m = min(m, n % 10)

print(sum(num) - 10 + m)

Solution (Python):
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


T = read_col(5, 1)[0]



ans = 0

for t in T:
    if t % 10 == 0:
        ans += t
    else:
        ans += (t // 10 + 1) * 10



tmp = [x % 10 for x in T if x % 10 != 0]

if tmp == []:
    ans += 10
else:
    ans += min(tmp)

print(ans-10)

Solution (Python):
ans=chk=0
d=[]
for i in range(5):
    x=int(input())
    if x%10:
        d.append((x%10,x))
    else:
        ans+=x
d.sort(reverse=True)
for i in d:
    ans+=((i[1]+10)//10)*10
if len(d): ans-=10-d[-1][1]%10

print(ans)

Solution (Python):
import math 

all_list = []

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

  all_list.append(a)
  
last_list = [x % 10 for x in all_list if x % 10 > 0]
last_list2 = [x for x in all_list if x % 10 > 0]

if len(last_list) > 0:
  last_x = last_list2[last_list.index(min(last_list))]
  all_list.remove(last_x)
else:
  last_x = 0

sum_list = [math.ceil(x / 10) * 10 for x in all_list]

m = sum(sum_list) + last_x
print(m)

Solution (Python):
A, B, C, D, E = [int(input()) for _ in range(5)]

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

time_dig = [-(-food // 10) for food in menu]
time_mod_10 = [_ % 10 for _ in menu if _ % 10 != 0]
time_mod_10.append(10)

print((sum(time_dig) - 1) * 10 + min(time_mod_10))

Solution (Python):
l=[int(input()) for i in range(5)]
t=0
mx=10
for i in l:
    if i%10!=0 and i%10<mx:
        mx=i%10
    if i%10==0:
        t+=i
    else:
        t+=int(i/10.0)*10+10


print(t-10+mx)

Solution (Python):
n = 5
l = [int(input()) for _ in range(n)]
ans = sum(l)
times = []
for i in l:
    num = i - (int(i / 10) * 10)
    times.append((10 - num) % 10)

times.sort()
for i in range(n - 1):
    ans += times[i]
print(ans)

Solution (Python):

a = []
b = []
for i in range(5):
    ai = int(input())
    a.append([ai,ai%10])
    if ai%10 == 0:
        a[i][1]=10

a.sort(key=lambda x: x[1])

time = 0
for i in range(1,5):
    time += (a[i][0]//10)*10
    if a[i][0]%10 != 0:
        time += 10

time += a[0][0]
print(time)

Solution (Python):
dis = [int(input()) for i in range(5)]
n,c = 10,11
for i,k in enumerate(dis):
  if c>(k%10) and k%10>=1:
    c = (k%10)
    n = i
for i,k in enumerate(dis):
  if i == n:
    continue
  else:
    if k%10==0:
      continue
    else:
      dis[i]=int(k/10)*10+10
ans = 0
for i in dis:
  ans+=i
print(ans)

Solution (Python):
def kiriage(n):
    while n %10  !=0:
        n+=1
    return n

def myfinal(A):
    r= 10
    r2 = 0
    for i in range(5):
        if A[i] % 10 < r and A[i] % 10 != 0:
            r = A[i] %10
            r2= i
    return r2

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

f = myfinal(A)
ans = A[f]
for i in range(0,5):
    if i != f:
        ans += kiriage(A[i])
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
list=[a,b,c,d,e]
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(list))
    exit()
min=100
for i in range(len(list)):
    if list[i]%10!=0 and list[i]%10<min:
        memo=list[i]
        min=list[i]%10
flag=0
for k in range(len(list)):
    if list[k]==memo and flag==0:
        flag=1
    else:
        while list[k]%10!=0:
            list[k]+=1
print(sum(list))

Solution (Python):
def ii2ss(n):
    ss = []
    for i in range(n):
        ss.append(input())
    return ss

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

import math
def main(ss):
    nn = ss2nn(ss)
    total = 0
    mod = 0
    for n in nn:
        n2 = math.ceil(n/10)*10
        total += n2
        m = n % 10
        if m != 0:
            if mod == 0:
                mod = m
            elif m < mod:
                mod = m
    if mod != 0:
        total -= 10 - mod
    return total
ss = ii2ss(5)
print(main(ss))

Solution (Python):
import copy
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = [a, b, c, d, e]

def dfs(ordered, remain, tim):
    if len(remain) == 0:
        
        return tim

    tims = []
    for r in remain:
        o = copy.copy(ordered)
        o.append(r)
        r2 = copy.copy(remain)
        r2.remove(r)
        t3 = (10 - tim % 10)
        t4 = 0 if t3 == 10 else t3
        tim2 = tim + t4  + r
        
        tims.append(dfs(o, r2, tim2))
    return min(tims)

print(dfs([], A, 0))

Solution (Python):
dish = [0]*5
for i in range(5):
  dish[i] = int(input())
dish = [i for i in dish if i%10==0] + sorted([i for i in dish if i%10!=0], key=lambda x: -x%10)
sum_ = 0
for d in dish[:-1]:
  sum_ += d
  if sum_%10!=0:
    sum_ -= (sum_%10)
    sum_ += 10
print(sum_+dish[-1])

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a%10==0:
  A = 0
else:
  A=10-a%10
if b%10==0:
  B=0
else:
  B = 10-b%10
if c%10==0:
  C=0
else:
  C = 10-c%10
if d%10==0:
  D=0
else:
  D = 10-d%10
if e%10==0:
  E=0
else:
  E = 10-e%10
listA = [A,B,C,D,E]
listA.sort()
f = a+b+c+d+e+listA[0]+listA[1]+listA[2]+listA[3]
print(f)

Solution (Python):
import itertools
import math

dishes = list(map(int, [input() for _ in range(5)]))
p_list = list(itertools.permutations(dishes))

min_total_time = 1000000000
for p in p_list:
    next_time = 0
    for idx, dish in enumerate(p):
        if idx <= 3:
            next_time = math.ceil((next_time + dish) / 10) * 10
        else:
            next_time += dish
    min_total_time = min(min_total_time, next_time)

print(min_total_time)

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

alhoge = [0 if x % 10 == 0 else (10 - (x % 10)) for x in al]

alsorted = sorted(al, key=lambda x: 0 if x % 10 == 0 else (10 - (x % 10)))


ans = 0
for i in range(len(alsorted)):
    if i == len(alsorted) - 1:
        ans += alsorted[i]
    else:
        ans += alsorted[i] if alsorted[i] % 10 == 0 else alsorted[i] + (10 - alsorted[i] % 10)

print(ans)

Solution (Python):
import numpy as np

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

f=[a,b,c,d,e]
f2=[]
for i in range(5):
    res=0
    for j in range(5):
      if i==j:
        res+=f[j]
      else:
        res+=int(np.ceil(f[j]/10)*10)
    f2.append(res)
print(min(f2))

Solution (Python):
m = 10**5
w = []

for i in range(0, 5):
    w.append(int(input()))

def s(c):
    
    global m
    global w
    r = 0
    for i in range(0, 5):
        r += w[c[i]]
        if r % 10 > 0 and i < 4:
            r = (r // 10 + 1) * 10
    if r < m:
        m = r

def t(c, r):
    if len(c) == 5:
        s(c)
    else:
        for i in r:
            nr = r[:]
            nr.remove(i)
            t(c + [i], nr)

t([], [0, 1, 2, 3, 4])
print(m)

Solution (Python):
ABCDE = []
ABCDEamari = []
for i in range(5):
    ABCDE.append(int(input()))
    ABCDEamari.append(ABCDE[i]%10)
answer = 0
for i in range(5):
    if ABCDEamari[i] == 0:
        answer += ABCDE[i]
    else:
        answer += (ABCDE[i]//10)*10 + 10

min = 10

for i in range(5):
    if min > ABCDEamari[i] and ABCDEamari[i] != 0:
        min = ABCDEamari[i]
    

answer -= (10-min)%10

print(answer)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
list1 = [a, b, c, d, e]
result = 0
last = 10
for i in range(0, 5):
    tmp = math.floor(list1[i] / 10) * 10
    if last > list1[i] - tmp and list1[i]-tmp != 0:
        last = list1[i]-tmp
    result += math.ceil(list1[i]/10)*10

print("{}".format(result-(10-last)))

Solution (Python):
menu=[]
menu.append(int(input()))
menu.append(int(input()))
menu.append(int(input()))
menu.append(int(input()))
menu.append(int(input()))

ans=0
for i in range(5):
  ans+=max((((menu[i]-1)//10)+1)*10,10)

tmp=[]
for i in range(5):
  s=str(menu[i])
  tmp.append(int(s[-1]))
tmp.sort()

hiku=0
for i in range(5):
  if not tmp[i]==0:
    hiku=tmp[i]
    break
    
if not hiku==0:
  ans = ans-(10-hiku)
  
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[a,b,c,d,e]
y=[]
z=[]
ans=0
for i in range(5):
    z.append(x[i]//10)
    if x[i]%10==0:
        y.append(10)
        z[0]-=1
    else:
        y.append(x[i]%10)
    
for i in range(5):
    ans+=z[i]

ans+=4
ans*=10
ans+=min(y)

print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
p=10
ix=0
for i in range(len(l)):
  x=l[i]
  q=x%10
  if q!=0 and q<p:
    p=q
    ix=i
r=l[ix]
l.remove(r)
s=0
for x in l:
  s+=x
  if x%10!=0:
    s+=10-(x%10)
print(s+r)

Solution (Python):
time = 0
a = int(input())
b= int(input())
c = int(input())
d = int(input())
e = int(input())
lis = [a,b,c,d,e]
for num in lis:
    time += num
amarilis = []
for item in lis:
    if item % 10 == 0:
        amarilis.append(0)
    else:
        amarilis.append(10 -(item % 10))


amarilis.sort()

del amarilis[4]

for nu in amarilis:
    time += nu
print(time)

Solution (Python):
import math
A = []
for i in range(5):
  A.append(int(input()))
A.sort(key=lambda x:10 if (x % 10) == 0 else x % 10,reverse=True)
ans = 0
for i in range(4):
  ans += math.ceil(A[i] / 10) * 10
print(ans + A[4])