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=[]
b=[]
for _ in range(5):
    a.append(int(input()))
for i in  a:
    if i%10!=0:
        b.append(10-i%10)
if b:
             
    b.remove(max(b))
c=sum(b)
print(sum(a)+c)

Solution (Python):
meals=[]
for i in range(5):
    meals.append([i,int(input())])
for g in range(5):
    if meals[g][1]%10!=0:
        meals[g][0]=meals[g][1]%10
    else:
        meals[g][0]=10

meals.sort(reverse=True)

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

print(ans)

Solution (Python):
S=[]
total=0
q=10
for i in range(5):
    a=int(input())
    S.append(a)
for i in range(5):
    if S[i]%10==0:
        total+=S[i]
    else:
        total+=(S[i]//10+1)*10
        q=min(q,S[i]%10)
print(total-(10-q))

Solution (Python):
s = 0
rests = [None]*5

for i in range(5):
    t_num = int(input())
    s += t_num
    rests[i] = (10 - (t_num % 10)) % 10 

print(s + sum(rests)- max(rests))

Solution (Python):
from itertools import permutations as p
l = [int(input()) for _ in range(5)]

ans = 1000
for i in p(range(5)):
    v = 0
    for j,k in enumerate(i):
        if j!=4:
            if l[k]%10:
                v += (l[k] - l[k]%10 + 10)
            else:
                v += l[k]
        else:
            v += l[k]
    ans = min(ans, v)

print(ans)

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

def k (x):
            if x% 10 != 0:
                        return x-x%10+10
            else:
                        return x          




def m(y):
            if y%10 !=0:
                        return  y%10
            else:
                        return 10

a,b,c,d,e=map(k,[A,B,C,D,E])
a_list = [a,b,c,d,e]
sum_a_list = sum(a_list)

a_1,b_1,c_1,d_1,e_1=map(m,[A,B,C,D,E])
sum_a_list + min(a_1,b_1,c_1,d_1,e_1)

s=sum_a_list-10+min(a_1,b_1,c_1,d_1,e_1)
print(s)

Solution (Python):
S=[]
p=0;q=10
for i in range(5):
  a=int(input())
  S.append(a)
for i in range(5):
  if S[i]%10==0:
    p=p+S[i]
  else:
    p=p+(S[i]//10+1)*10
    q=min(q,S[i]%10)
print(p-(10-q))

Solution (Python):
import sys
import math

inputs = [int(row.split()[0]) for row in sys.stdin.readlines()]

remainder = []
for val in inputs:
    if val % 10 != 0:
        remainder.append(val % 10)
    else:
        remainder.append(9)
min_remainder_index = remainder.index(min(remainder))
last_order_time = inputs.pop(min_remainder_index)
    
order_time_sum = 0
for remaind_time in inputs:
    remind = remaind_time%10
    if remind!=0:
        current_time = remaind_time+ (10 - remaind_time%10)
    else:
        current_time = remaind_time
    order_time_sum += current_time
    
print(order_time_sum +last_order_time)

Solution (Python):
lis = [int(input()) for _ in range(5)]
fir = []
sur = []
for i in lis:
    if i % 10 == 0:
        fir.append(i)
        sur.append(0)
    else:
        fir.append(i + (10 - i%10))
        sur.append(10 - i % 10)
print(sum(fir)-max(sur))

Solution (Python):
x=[int(input()) for _ in range(5)]
rem=[]
for i in range(5):
    if x[i]%10 != 0:
        rem.append(10-x[i]%10)
    else:
        rem.append(0)
        
a=x[0] + rem[0]
b=x[1] + rem[1]
c=x[2] + rem[2]
d=x[3] + rem[3]
e=x[4] + rem[4]

print(a+b+c+d+e-max(rem[0],rem[1],rem[2],rem[3],rem[4]))

Solution (Python):
from itertools import permutations

lst=[int(input()) for i in range(5)]
ans=float('inf')
tmp=0

for l in list(permutations(lst)):
    for i in range(4):
        tmp+=l[i]
        if tmp%10!=0:
            k=((tmp//10)+1)*10
            tmp+=(k-tmp)
    tmp+=l[4]
    if tmp<=ans:
        ans=tmp
    tmp=0
print(ans)

Solution (Python):
n = [int(input()) for _ in range(5)]
min = 11
a = 0

if n.count(n[0]) == len(n):
    y = 0
    for i in range(len(n)-1):
        y += n[i] + (10 - n[i] % 10)
    y += n[-1]
    print(y)
    exit()


for i in range(len(n)):
    
    if not(n[i] % 10 == 0 or n[i] < 10):
        if min > n[i] % 10:
            min = n[i] % 10
            a = n[i]

for j in range(len(n)):
    
    if n[j] % 10 != 0:
        if n[j] != a:
            n[j] = n[j] + (10 - n[j] % 10)


print(sum(n))

Solution (Python):



import math
orders = sorted([int(input()) for _ in range(5)], key=lambda x: (x - 1) % 10)
last_order = orders.pop(0)
orders = [math.ceil(x / 10) * 10 for x in orders]
print(sum(orders) + last_order)

Solution (Python):

A = [int(input()) for _ in range(5)]
 
ceiled = [(x+9)//10*10 for x in A]
can_save = [y - x for x,y in zip(A,ceiled)]

answer = sum(ceiled) - max(can_save)
print(answer)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
time=0
menu=[A,B,C,D,E]
count=0
order=[]
kauri=[]
for i in range(5):
  if menu[i]%10==0:
      order.append(menu[i])
      count+=1
for h in range(9):
  for g in range(5):
    if menu[g]%10==9-h:
      kauri.append(menu[g])
      order.append(menu[g]+(h+1))
if  count!=5:
  order[4]=kauri[4-count]      
print(sum(order))

Solution (Python):
a=[int(input()) for i in range(5)]
p=[i%10 for i in a]
d=sorted(list(zip(p,a)))
q=-1
for x in d:
    if x[0]!=0:
        q=x[0]
        break
if q==-1:
    print(sum(a))
    exit(0)
s=[]
for x in d:
    if x[0]!=0:
        s.append((x[1]//10+1)*10)
    else:s.append(x[1])
print(sum(s)-10+q)

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

index = -1
min = 9
for i in range(5):
    if A[i]%10!= 0 and min>=A[i]%10:
        min =A[i]%10
        index =i

def func(n):
    if n%10 == 0:
        return n
    else:
        return ((n//10)+1)*10
sum = 0
for i in range(5):
    if i!=index:
        sum+=func(A[i])
    else:
        sum+=A[i]
print(sum)

Solution (Python):




def main():
    ABCDE = [int(input()) for _ in range(5)]
    X = [-(-x // 10) * 10 for x in ABCDE]
    print(sum(X) - max([x - a for a, x in zip(ABCDE, X)]))


if __name__ == "__main__":
    main()

Solution (Python):
import math
cooks = [int(input()) for _ in range(5)]
sorted_cooks = sorted(cooks, key=lambda x: int(str(x)[-1]))
ans = 0
last_order = False
for i in range(len(sorted_cooks)):
  if(last_order == False and int(str(sorted_cooks[i])[-1]) != 0 ):
    ans += sorted_cooks[i]
    last_order = True
  else:
    ans += math.ceil(sorted_cooks[i] / 10) * 10

print(ans)

Solution (Python):
a = list()
for i in range(5):
    a.append(int(input()))
x, y = 0,float("inf")
for i in range(5):
    p = int(str(a[i])[-1])
    if p == 0:
        pass
    elif p < y:
        x = i
        y = p
for i in range(5):
    if i == x:
        pass
    elif not str(a[i])[-1] == "0":
        a[i] = (a[i]//10+1)*10
print(sum(a))

Solution (Python):
s = []
ans = 0
for i in range(5):
    n = int(input())
    m = n % 10
    ans += n
    if m != 0:
        s.append(m)
s.sort()
for i in range(len(s)):
    if i != 0:
        c = 10 - s[i]
        ans += c
print(ans)

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

    ans = 0

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

    min_num = 10
    for i in num_list:
        if i % 10 < min_num and i % 10 != 0:
            min_num = i % 10
        if i % 10 == 0:
            ans += i
        else:
            ans += i + ( 10 - i % 10 )

    print(ans-10+min_num)

if __name__ == '__main__':
    main()

Solution (Python):
import math
price=[int(input()) for i in range(5)]
price.sort(key=lambda i:-i%10)
ans=0
for i in range(4):
  ans+=math.ceil(price[i]/10)*10
ans+=price[4]
print(ans)

Solution (Python):
l1 = [int(input()) for _ in range(5)]
l2 = [0] * 5
flag = 10
idx = -1

for i in range(5):
    l2[i] = l1[i] % 10
    if l2[i] != 0 and l2[i] < flag:
        flag = l2[i]
        idx = i
for j in range(5):
    if j == idx:
        continue
    while l1[j] % 10 != 0:
        l1[j] += 1
print(sum(l1))

Solution (Python):
a = [int(input()) for i in range(5)]
max = 0
for i in range(5):
    if a[i]%10!=0 and a[max]%10>a[i]%10:
        max = i
ans = 0
for i in range(5):
    if max==i:
        ans += a[i]
    else:
        ans += -(-a[i]//10)*10
print(ans)

Solution (Python):
d=[]

for i in range(5):
    s=int(input())
    if s%10 == 0:
        d.append((s,s,s%10))
    else:
        d.append((s,s+(10-s%10),10-s%10))

d.sort(key=lambda d:d[2])
result=0
result=sum(d[i][1] for i in range(len(d)-1)) + d[-1][0]

print(result)

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

lst2 = []

for x in lst:
    amari = x % 10
    if amari == 0:
        pass
    else:
        lst2.append(10 - amari)

if not lst2:
    pass
else:
    lst2.remove(max(lst2))
print(sum(lst)+sum(lst2))

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

a.sort(key=lambda x:-(((x%10)+9)%10))
ans = 0
for i in range(4):
    ans += ((a[i]+9)//10)*10
ans += a[-1]
print(ans)

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


def tanuki(dishes):
    sum_dishes = 0
    last_dish = 0
    last_tmp = 0
    for dish in dishes:
        tmp = 10 - int(dish[-1])
        dish = int(dish)
        if tmp == 10:
            sum_dishes += dish
        elif tmp > last_tmp:
            sum_dishes += last_dish + last_tmp
            last_dish = dish
            last_tmp = tmp
        else:
            sum_dishes += dish + tmp
    return sum_dishes + int(last_dish)


print(tanuki(dishes))

Solution (Python):
N = [int(input()) for _ in range(5)]
chk = [(10 - N[i] % 10) % 10 for i in range(5)]
print(sum(N) + sum(chk) - max(chk))

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

t = []
for i in range(5):
    d = m[i] % 10
    o = m[i] // 10 * 10
    if d != 0:
        o += 10
    else:
        d = 10
    t.append([d, o, m[i]])

t.sort()
ans = t[0][2]
for i in range(1, 5):
    ans += t[i][1]

print(ans)

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


def tanuki(dishes):
    if all([i[-1] == '0' for i in dishes]):
        return sum([int(i) for i in dishes])

    sum_dishes = 0
    last_dish = 0
    last_tmp = 0
    for idx, dish in enumerate(dishes):
        tmp = 10 - int(dish[-1])
        dish = int(dish)
        if tmp == 10:
            sum_dishes += dish
        elif tmp > last_tmp:
            sum_dishes += last_dish + last_tmp
            last_dish = dish
            last_tmp = tmp
            last_idx = idx
        else:
            sum_dishes += dish + tmp
    return sum_dishes + int(dishes[last_idx])


print(tanuki(dishes))

Solution (Python):
import itertools
def permutation_all(seq, choice):
    return list(itertools.permutations(seq, choice))

a = []
for i in range(5):
    a.append(int(input()))
p = permutation_all(a,5)
ans = 1000000000
for i in range(len(p)):
    point = p[i]
    tot = 0
    for j in range(5):
        if j != 4:
            tot += (point[j]+9)//10 * 10
        else:
            tot += point[j]
    ans = min(ans,tot)
print(ans)

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

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

t = []
for i in permutations(list(range(5))):
    c = 0
    for j in range(4):
        c += ceil(s[i[j]] / 10) * 10
    c += s[i[4]]
    t.append(c)

print(min(t))

Solution (Python):
lis = []
ans = 0
for i in range(5):
    a = int(input())
    amari = a%10
    if a%10 == 0:
        amari = 10
    lis.append([a, 10-amari])
lis = sorted(lis, key=lambda x:x[1])

for i in range(4):
    ans += lis[i][0] + lis[i][1]
    
ans += lis[4][0]
print(ans)

Solution (Python):
import itertools

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

min = 10**7
for order in order_list:
    sum = 0
    for i in range(4):
        sum += order[i]
        if sum % 10 > 0:
            sum += 10 - sum % 10
    sum += order[4]

    if sum < min:
        min = sum

print(min)

Solution (Python):
def checkDigit(a):
  while(a > 10):
    a %= 10
  return a
  
a = [int(input()) for i in range(5)]
calc = []
for i in range(5):
  tmp = checkDigit(a[i])
  if tmp != 0:
    calc.append(tmp)
calc.sort()

ans = sum(a)
for i in range(1, len(calc)):
  ans += 10 - calc[i]
print(ans)

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

div = 0
sum = 0
l = [a, b, c, d, e]

for i in range(len(l)):
    if(l[i] % 10 != 0):
        sum += (l[i]//10+1)*10
        if((l[i]//10+1)*10 - l[i] > div):
            div = (l[i]//10+1)*10 - l[i]
    else:
        sum += l[i]
        
print(sum-div)

Solution (Python):
import itertools

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



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

combination = list(itertools.permutations(dish))

ans = []
count = 0

for i in combination:
    time = 0
    for j in i:
        if count != 4:
            time = time + j
            if time % 10 != 0:
                while time % 10 != 0:
                    time = time + 1
            count = count+1
        elif count == 4:
            time = time + j
            count = 0
            ans.append(time)

print(min(ans))

Solution (Python):
import itertools

A = list(map(int, open(0).read().split()))
items = list(itertools.permutations(A))

ans = float('inf')

for item in items:
    t = 0
    for i in item[:-1]:
        t += (i if i%10==0 else (i//10+1)*10)
    t += item[-1]

    if t < ans:
        ans = t

print(ans)

Solution (Python):
import itertools

dish = []

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

perms = list(itertools.permutations(dish))

res = float('Inf')

for perm in perms:
    x = 0
    for i in range(len(perm)):
        x = x + perm[i]
        if i != len(perm) - 1:
            while x % 10 != 0:
                x = x + 1
    if x < res:
        res = x
        x = 0

print(res)

Solution (Python):

X = []
Y = []
for i in range(5):
    x = int(input())
    X.append(x)
    Y.append((10 - (x % 10)) % 10)

idx = Y.index(max(Y))
y = X.pop(idx)
Y.pop(idx)
print(sum(X) + sum(Y) + y)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
xs = [A, B, C, D, E]
xs.sort(key=lambda x: 10 if x % 10 == 0 else x % 10, reverse=True)
t = 0
for x in xs[:-1]:
    t += (x + 9) // 10 * 10
t += xs[-1]
print(t)

Solution (Python):
import numpy as np
l = np.array([int(input()) for _ in range(5)])
m = ((l+9)//10)*10
n = max(m-l)



print(sum(m)-n)

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

b=[(1+(d-1)//10)*10 for d in D]
c=sum(b)

ans=10**3

for i in range(n):
    ans=min(ans,c-b[i]+D[i])
print(ans)

Solution (Python):
from itertools import permutations
Minute=[int(input()) for _ in range(5)]

ans_l=set()
for M in permutations(Minute):
    res=0
    ans=0
    for i in range(5):
        res+=M[i]
        if i==4:
            break
        if res%10!=0:
            res=-(-res//10)*10
    ans_l.add(res)

print(min(ans_l))

Solution (Python):
m = 9
l = []
r = []
for i in range(5):
  a = int(input())
  if a % 10 != 0:
    m = 10 - a % 10
    b = a + m
    l.append(b)
    r.append(m)
  else:
    l.append(a)
    r.append(0)
r.sort()
print(sum(l) - r[-1])

Solution (Python):
import itertools
l = [0,1,2,3,4]
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]
ans =[]
time = 0
for k in itertools.permutations(l):
  time=0
  time += li[k[0]]
  for i in range(1,5):
    while time %10 !=0:
      time+=1
    time += li[k[i]]
  ans.append(time)
print(min(ans))

Solution (Python):
X = sorted([int(input()) for _ in range(5)], key=lambda x: x%10 if x%10==0 else 10-x%10)
ans = sum([((x+9)//10)*10 for x in X[:-1]])
print(ans + X[-1])

Solution (Python):
a = 0
max_dish = 0
sum_dish = 0
for _ in range(5):
    dish = int(input())
    x = dish % 10
    if x != 0:
        x = 10 - x
    a += x
    sum_dish += dish
    max_dish = max(x, max_dish)
print(sum_dish + a - max_dish)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a,b,c,d,e]
last = 10
ttl = 0
for i in range(5):
    if lst[i]%10 != 0:
        ttl += (lst[i]+(10-lst[i]%10))
    if lst[i]%10 == 0:
        ttl += lst[i]
    if 0 <(lst[i]%10) <= last:
        last = lst[i]%10
print(ttl-(10-last))

Solution (Python):
import sys
from math import ceil

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    L = [INT() for _ in range(5)]

    idx = 0
    for i in range(5):
        idx = i if (L[i]-1)%10 < (L[idx]-1)%10 else idx

    for i in range(5):
        if i != idx: L[i] = ceil(L[i]/10) * 10

    print(sum(L))


if __name__ == '__main__':
    main()

Solution (Python):
m=[]
cnt=0
for i in range(5):
    x=int(input())
    m.append(x)
m10=[i % 10 for i in m if i %10 >=1]
if m10:
    t=min(m10)
    for i in m:
        if i %10==0:
            cnt += i
        else:
            cnt += ((i//10)+1)*10
    print(cnt-10+t)
else:
    print(sum(m))

Solution (Python):
dish = [int(input()) for x in range(5)]
hitoketa = list(map(int, [str(x)[-1] for x in dish]))

last = 999
for i in hitoketa:
    if not i % 10 == 0:
        last = min(last, i)

if last != 999:
    last = dish[hitoketa.index(last)]
else:
    last = dish[0]

ans = last
skip = False

for i in dish:
    if i == last and not skip:
        skip = True
    elif i % 10 == 0:
        ans += i
    else:
        ans += (i // 10 + 1) * 10

print(ans)

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

def hun(n):
  if n % 10 == 0:
    return n//10*10
  else:
    return (n//10 + 1) * 10

a=10
ans=0
for x in cook:
  ans += hun(x)
  if x % 10 != 0:
    a = min(a, x % 10)

print(ans - 10 + a)

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):
nums = [int(input()) for _ in range(5)]
mods = [(10 - num % 10 if num % 10 != 0 else 0) for num in nums]
last = max(mods)
print(sum(nums) + sum(mods) - last)

Solution (Python):
lis = []
cnt = 0
for i in range(5):
    val = 0
    a = int(input())
    while a % 10 != 0:
        a += 1
        val += 1
    lis.append(a)
    if val > cnt:
        cnt = val

ans = sum(lis)
print(ans - cnt)

Solution (Python):
"""
最も時間ロスが大きい注文は最後に注文することで時間が節約できる
時間のロスは(10-(調理時間の1の位の値))で計算できる == 1の位が最小
最後の注文以外の注文時間は1の位繰り上げの値となる
最後の注文の切り上げ分を最終結果からマイナスしておく
"""

def ceil(a, b):
  return -(-a//b) * 10

A = [int(input()) for _ in range(5)]
ceiled = [ceil(a,10) for a in A]
loss = [x-y for x,y in zip(ceiled, A)]
print(sum(ceiled) - max(loss))

Solution (Python):
num = [int(input()) for _ in range(5)]
ceil = [10*(i//10) if i%10==0 else 10*(i//10+1) for i in num]
w = max(x - y for x,y in zip(ceil,num))
print(sum(ceil) - w)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

    ans = 0
    min_m = 10
    for m in menu:
        ans += (m + 9) // 10 * 10
        if m % 10 > 0:
            min_m = min(min_m, m % 10)
    if min_m > 0:
        ans += min_m - 10
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
a=[ int(input()) for i in range(5)]
b=[(a[i]-1)%10 for i in range(5)]
m=(10-((min(b)+1)%10))%10
def f(x):
  if x%10==0:
    return x
  else:
    return x-(x%10)+10
ans=-m
for i in range(5):
  ans+=f(a[i])
print(ans)

Solution (Python):

def age(x):
    if x%10==0:
        return x
    else:
        return x+10-x%10

r=[]
amari=[]
amari_new=[]
amari_min=10
ans=0
for i in range(5):
    d=int(input())
    amari.append(d%10)
    r.append(age(d))

for x in range(5):
    if x!=0 and amari_min>x:
        amari_min=x
ans+=sum(r)


for x in amari:
    if x!=0:
        amari_new.append(x)

if amari_new:
    amari_min=min(amari_new)
    ans-=10-amari_min

print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = []
li.append(a)
li.append(b)
li.append(c)
li.append(d)
li.append(e)

ans = []
sum_a = 0
for i in li:
  num = i % 10
  sum_a += i
  if num == 0:
    ans.append(0)
  else:
    ans.append(10-num)
num_a = sum_a + sum(ans) - max(ans)
print(str(num_a))

Solution (Python):
t=[int(input()) for _ in range(5)]
v=[10*(i//10) if i%10==0 else 10*(i//10+1) for i in t]
w=max(x-y for x,y in zip(v,t))
print(sum(v)-w)

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

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
count=0
lis=[[A,((A%10)-1)%10],[B,((B%10)-1)%10],[C,((C%10)-1)%10],[D,((D%10)-1)%10],[E,((E%10)-1)%10]]
lis.sort(key=lambda x:x[1], reverse=True)


for i in range(len(lis)):
    if not(i==len(lis)-1):
        count=count+lis[i][0]+(10-(lis[i][0])%10)%10
    else:
        count=count+lis[i][0]
print(count)

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a = [int(input()) for _ in range(5)]
max_i = 9
flag_0 = 0
ans = 0
for i in range(5):
    if a[i] % 10 != 0:
        flag_0 = 1
        max_i = min(max_i,a[i]%10)
        ans += (a[i]//10)*10 + 10
    else: ans += a[i]
if flag_0:
    ans -= 10 - max_i
print(ans)

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

amaris = sorted([ i % 10 for i in lst if i%10 != 0])
ans = sum(lst)

for amari in amaris[1:]:
  ans += (10-amari)
  
print(ans)

Solution (Python):
import sys
import math
import itertools

a=[]
min=10
ans=0

for i in range(5):	
	a.append(float(input()))
	if (min>a[i]%10)and(a[i]%10>0):
		min=int(a[i])%10
	a[i]=a[i]/10
	a[i]=math.ceil(a[i])
	a[i]=int(a[i])*10
	ans+=a[i]

ans=ans-10+min
print(ans)

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

L1 = [x for x in L if x%10 == 0]
L2 = [x for x in L if x%10 != 0]
L3 = [(x%10,x//10) for x in L2]

ans = sum(L1)
if len(L3)>0:
  L3.sort(reverse = True)
  for i in range(len(L3)-1):
    ans += (L3[i][1]+1)*10
  ans += L3[-1][1]*10+L3[-1][0]
print(ans)

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

l.sort()

ans = 0
flag = True
for l1, l2 in l:
  if l1 == 0:
    ans += l2
  elif flag:
    ans += l2
    flag = False
  else:
    ans += ((l2//10) + 1) * 10

print(ans)

Solution (Python):
import math

menus = [int(input()) for i in range(5)]
m = [math.ceil(k / 10) * 10 for k in menus]


re0 = menus[0] + m[1]+ m[2]+ m[3]+ m[4]
re1 = m[0] + menus[1]+ m[2]+ m[3]+ m[4]
re2 = m[0] + m[1]+ menus[2]+ m[3]+ m[4]
re3 = m[0] + m[1]+ m[2]+ menus[3]+ m[4]
re4 = m[0] + m[1]+ m[2]+ m[3]+ menus[4]
print(min(re0,re1,re2,re3,re4))

Solution (Python):
import numpy as np

N = []

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

f = []

for i in range(5):
    f.append([N[i]%10,i])

f.sort()
m = 0

for i in range(5):
    if f[i][0] > 0:
        m = f[i][1]
        break

ans = 0

for i in range(5):
    if i == m:
        ans += N[i]
    else:
        ans += int(10*np.ceil(N[i]/10))   
 
print(ans)

Solution (Python):
from math import ceil
menu1 = []
menu2 = []
for _ in range(5):
    m = int(input())
    if m % 10 == 0:
        menu1.append(m)
    else:
        menu2.append(m)
menu2 = sorted(menu2, key=lambda x: str(x)[-1])

ans = sum(menu1)
for i, m in enumerate(menu2):
    if i == 0:
        ans += m
        continue
    ans += ceil(m / 10) * 10
print(ans)

Solution (Python):
q = -1
r = 10
for i in range(5):
  k = int(input())
  q += (k-1)//10+1
  r = min(r-1,(k-1)%10)+1
print(q*10+r)

Solution (Python):
N=5
A=list(int(input()) for _ in range(N))

mi=9
index=0
for i in range(N):
    if A[i]%10!=0:
        if mi>A[i]%10:
            mi=A[i]%10
            index=i

ans=0    
for i in range(N):
    if i==index:
        ans+=A[i]
    else:
        ans+=(A[i]//10)*10
        if A[i]%10:
            ans+=10
print(ans)

Solution (Python):
import sys

*T, = map(int ,sys.stdin.read().split())

def main():
    res = 0
    e = 10
    for t in T:
        res += 10 * ((t + 10 - 1) // 10)
        e = min(e, (t - 1) % 10 + 1)

    res -= (10 - e)
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
import itertools
def ABC123B():
    T = [int(input()) for _ in range(5)]
    templist = itertools.permutations(T)
    mint = 644
    for l in templist:
        time = 0

        for t in l:
            if time % 10 !=0:
                time += 10 - time % 10
            time += t
        mint = min(mint, time)
    print(mint)


ABC123B()

Solution (Python):
min_d = None
total = 0
for _ in range(5):
    i = int(input())
    total += i // 10 * 10
    d = i % 10
    if d != 0:
        if min_d is None:
            min_d = d
        else:
            min_d = min(min_d, d)
        total += 10
if min_d is None:
    print(total)
else:
    print(total - (10 - min_d))

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

dish = [a,b,c,d,e]
result=0

mx=-1

for dd in dish:
    for i in range(0,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp > mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for dd in dish:
    result+=dd
    for i in range(1,10):
        if result % 10 == 0:
            break
        result+=1
        
print(result+buf)

Solution (Python):
tList = []
for i in range(5):
  tList.append(list(str(input())))

dList = []
for i in range(len(tList)):
  tmp = 10 - int(tList[i][-1])
  if tmp == 10:
    dList.append(0)
  else: 
    dList.append(tmp)

result = 0
for i in range(len(tList)):
  result += int(''.join(tList[i]))+dList[i]

print(result - sorted(dList,reverse = True)[0])

Solution (Python):
l = [input() for _ in [0] * 5]
keta =[]
for i in l:
    keta.append(i)

xxx = []
for j in keta:
    if int(j[-1]) != 0:
        xxx.append(int(j) + (10 - int(j[-1])))
    else:
        xxx.append(int(j))

yyy = []
for k in keta:
    yyy.append(int(k[-1]))

zzz = []
for m in yyy:
    if int(m) > 0:
        zzz.append(m)

if 0 < sum(zzz):
    p = min(zzz)
    print(sum(xxx) - (10 - p))
else:
    p = 0
    print(sum(xxx))

Solution (Python):
import math
t=[0]*5
s=[0]*5
ans=0
for i in range(5):
    t[i]=int(input())
    s[i]=math.ceil(t[i]/10)*10-t[i]
    ans+=math.ceil(t[i]/10)*10
print(ans-max(s))

Solution (Python):
X=[int(input()) for i in range(5)]
Y=[]
for x in X:
  Y.append(-(-x//10)*10-x)
print(sum(X)+sum(Y)-(max(Y)))

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

last = min((m[i] - 1) % 10 + 1 for i in range(5))
sum = sum(math.ceil(m[i] / 10) * 10 for i in range(5))

print(sum+last-10)

Solution (Python):
import math

time = [int(input()) for _ in range(5)]
ans = 0
min_ones = 10

for t in time:
    ans += math.ceil(t / 10) * 10
    ones = int(str(t)[-1])
    if ones < min_ones and ones > 0:
        min_ones = ones

if min_ones != 10:
    ans = ans - (10 - min_ones)

print(ans)

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):
from itertools import permutations


def main():
    result = 700
    cooking_time = []
    for _ in range(5):
        cooking_time.append(int(input()))
    for permutation in permutations(cooking_time, 5):
        tmp = 0
        for i in range(4):
            if not permutation[i] % 10 == 0:
                tmp += (permutation[i] // 10 + 1) * 10
            else:
                tmp += permutation[i]
        result = min(result, tmp + permutation[-1])
    print(result)


if __name__ == '__main__':
    main()

Solution (Python):
x = [int(input()) for i in range(5)]
ans = 0
gap = []
for i in x:
    y = -i//10 * -10
    ans += y
    gap.append(y-i)
ans = ans - max(gap)
print(ans)

Solution (Python):
from itertools import permutations
lst = [int(input()) for _ in range(5)]
lst_per = list(permutations(lst))
min_time = 643
for x in lst_per:
    ttl_time = 0
    for i in range(len(x)):
        if i != 4:
            ttl_time += x[i]
            if ttl_time % 10 != 0:
                ttl_time = (ttl_time // 10 + 1) * 10
        else:
            ttl_time += x[i]
    if ttl_time < min_time:
        min_time = ttl_time

print(min_time)

Solution (Python):
import math
x=[int(input()) for i in range(5)]
y=[i%10 for i in x]

ans=0
for i in range(5):
    ans+=math.ceil(x[i]/10)*10

check=10
for i in range(5):
    if y[i]!=0:
        check=min(check,y[i])
if check==10:
    print(ans)
else:
    print(ans-(10-check))

Solution (Python):
import itertools

x = [int(input()) for i in range(5)]
y = list(itertools.permutations(x))
t = 130 * 5
for z in y:
   c = [z[i] if i==4 or z[i]%10==0 else int(z[i]/10+1)*10 for i in range(5)]
   tt = sum(c)
   t = min(t, tt)
print(t)

Solution (Python):
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

DISH = [int(readline()) for _ in range(5)]
Ceiled = [(i + 9) // 10 * 10 for i in DISH]
div = [y - x for x, y in zip(DISH, Ceiled)]

print(sum(Ceiled)-max(div))