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

import itertools
import sys
import math
from functools import lru_cache





from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline













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

mm = 99999

kumi = list(itertools.permutations(ll))

for kk in kumi:
    sum = 0
    for s in kk:
        if sum % 10 != 0:
            sum += 10 - sum % 10
        sum += s
    mm = min(mm, sum)
print(mm)

Solution (Python):


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

ans = 0
max_tmp = 0
for i in ABCDE:
    tmp = i
    if i % 10 != 0:
        tmp = (i + 10) // 10 * 10
    ans += tmp
    max_tmp = max(max_tmp, (tmp - i))
ans -= max_tmp

print(ans)

Solution (Python):
data = [int(input()) for i in range(5)]
upped = list(map(lambda x: x if x % 10 == 0 else (x // 10 + 1) * 10, data.copy()))
wait = []
for s, t in zip(data, upped):
    wait.append(t - s)
print(sum(upped) - max(wait))

Solution (Python):
l = []

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

ans = float('inf')

def std_num(num):
  r = num % 10
  return num if r == 0 else num + (10 - r)

for i in range(5):
  total = 0

  for j in range(5):
    if i == j:
      total += l[j]
    else:
      total += std_num(l[j])

  ans = min(total,ans)

print(ans)

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

a = list(reversed(sorted(a, key=lambda x: 100 if x % 10 == 0 else x % 10)))


ans = 0
for i in range(5):
    ans += a[i]
    if ans % 10 != 0 and i != 4:
        ans += 10 - (ans % 10)


print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[]
for i in [a,b,c,d,e]:
    l.append([(10-i%10)%10,i])

l.sort()
ans=0

for i in range(5):
    if i<=3:
        ans+=l[i][0]+l[i][1]
    else:
        ans+=l[i][1]

print(ans)

Solution (Python):

import itertools

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


answer = 10000000000
for os in itertools.permutations([a, b, c, d, e]):
    t = 0
    m = 0
    for o in os:
        if m > 0:
            t += 10 - m
        t += o
        m = t % 10
    if t < answer:
        answer = t
        a = o

print(answer)

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

a.sort(key=lambda x:x%10)
if len(a)>0:
  ans-=(10-a[0]%10)

print(ans)

Solution (Python):
a, b, c, d, e = int(input()), int(input()), int(input()), int(input()), int(
    input())
cook = [a, b, c, d, e]
A = [10 - a % 10, 10 - b % 10, 10 - c % 10, 10 - d % 10, 10 - e % 10]
for i in range(5):
    if A[i] == 10:
        A[i] = 0

print(sum(cook) + sum(A) - max(A))

Solution (Python):
D = [int(input()) for _ in range(5)]
D.sort(key=lambda x: 10 - (x - 1) % 10)
ans = 0
for i in range(4):
    while(D[i] % 10 != 0):
        D[i] += 1
    ans += D[i]
ans += D[-1]
print(ans)

Solution (Python):

from sys import stdin
import math
import numpy as np

s_in = lambda: stdin.readline()[:-1]  
d_in = lambda: int(stdin.readline())  
ds_in = lambda: list(map(int, stdin.readline().split()))  


times = []
for _ in range(5):
    times.append(d_in())


min_val = 10
ans = 0
for i, t in enumerate(times):
    if t % 10 > 0 and t % 10 < min_val:
        min_val = t % 10
    ans += math.ceil(t / 10) * 10

if min_val == 10:
    print(ans)
else:
    print(ans - 10 + min_val)

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

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

r = list(map(lambda x:x % 10,l))
r = [x if x != 0 else 10 for x in r]

index = r.index(min(r))


ans = 0

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

print(ans)

Solution (Python):
import math
import sys

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

tmp=100
p=100
for i in range(5):
    if a[i]%10!=0 and a[i]%10<tmp:
        tmp=a[i]%10
        p=i


if p==100: print(sum(a))
else:
    ans=0
    for i in range(5):
        if i==p: ans+=a[p]
        else: ans+=math.ceil(a[i]/10)*10
    print(ans)

Solution (Python):



import itertools
import math

import sys

X = []
for _ in range(5):
    X.append(int(input()))

min_time = int(1e10)
for A in itertools.permutations(X, 5):
    time = 0
    for i, a in enumerate(A):
        if i == 4:
            time += a
        else:
            time += math.ceil(a / 10) * 10
        
    min_time = min(min_time, time)
    
print(min_time)

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

for k, i in enumerate(lst):
    if i % 10 == 0:
        index = k

rest = 9
for k, i in enumerate(lst):
    if 0 < i % 10 <= rest:
        rest = i % 10
        index = k

ans = 0
for k, i in enumerate(lst):
    if k == index:
        ans += i
    else:
        if i % 10 == 0:
            ans += i
        else:
            ans += i + (10 - (i % 10))
print(ans)

Solution (Python):
import math
menu = sorted([int(input()) for _ in range(5)])
ans = 0
rest = 10
for a in menu:
    ans += math.ceil(a/10) * 10
    rest = rest if a%10==0 else min(rest, a%10)

print(ans - 10 +  rest)

Solution (Python):
import itertools
def bit(n, m):
    bit_list = list(itertools.product([i for i in range(m)], repeat=n))
    return bit_list

l = [int(input()) for _ in range(5)]
bit = bit(5,5)
bit_n = []
for i in bit:
    if len(set(i)) == 5:
        bit_n.append(i)

res = float("inf")
for i in bit_n:
    time = 0
    for j in i:
        if time == 0:
            time += l[j]
        else:
            if time % 10 != 0:
                while time % 10 != 0:
                    time += 1
                time += l[j]
            else:
                time += l[j]
    if res > time:
        res = time

print(res)

Solution (Python):
amari = 10

li = []
for i in range(5):
    a = int(input())
    if a % 10 == 0:
        li.append(a)
    else:
        li.append((a // 10 + 1) * 10)
        if a % 10 < amari:
            amari = a % 10


print(sum(li)-10+amari)

Solution (Python):
def five_dishes(A: int, B: int, C: int, D: int, E: int)->int:
    dishes = sorted([A, B, C, D, E], key=lambda x: x % 10 if x % 10 else 10)

    def offset(d: int)->int:
        return 10 - d % 10 if d % 10 else 0
    return dishes[0] + sum(d + offset(d) for d in dishes[1:])


if __name__ == "__main__":
    inputs = [int(input()) for _ in range(5)]
    A, B, C, D, E = inputs
    ans = five_dishes(A, B, C, D, E)
    print(ans)

Solution (Python):
L = sorted([int(input()) for _ in range(5)], key=lambda x: - x % 10)
t = L[0]
for l in L[1:]:
    if t % 10 != 0:
        t += (10 - t % 10)
    t += l
print(t)

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

import numpy as np

def get_time(i):
    return int(np.ceil(i / 10) * 10)

total1 = get_time(a) + get_time(b) + get_time(c) + get_time(d) + e
total2 = a + get_time(b) + get_time(c) + get_time(d) + get_time(e)
total3 = get_time(a) + b + get_time(c) + get_time(d) + get_time(e)
total4 = get_time(a) + get_time(b) + c + get_time(d) + get_time(e)
total5 = get_time(a) + get_time(b) + get_time(c) + d + get_time(e)
print(min([total1, total2, total3, total4, total5]))

Solution (Python):
from itertools import permutations
*T, = map(int, open(0).read().split())
ans = 10**20
for p in permutations(T):
    r = 0
    for i, t in enumerate(p):
        if i < 4:
            r += (t+9)//10*10
        else:
            r += t
    ans = min(ans, r)
print(ans)

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

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

min=700
for dish in itertools.permutations(l, 5):
    index=1
    sum=dish[0]
    while index < len(dish):
        if sum%10==0:
            sum+=dish[index]
        else:
            sum = ((sum//10)+1)*10
            sum += dish[index]
        index+=1
    if sum < min:
        min = sum
print(min)

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

h = 0
time = 0
for i in a:
    b = i // 10
    c = i % 10
    if(c == 0): time += i
    else:
        time += (b+1)*10
        if(h < 10-c): h = 10-c

print(time-h)

Solution (Python):
import math

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

last = 0
remain = 10
foods = [a, b, c, d, e]
for i in range(len(foods)):
    r = foods[i] % 10
    if r == 0:
        r = 10
    if r < remain:
        remain = r
        last = i

time = 0
for i in range(len(foods)):
    if i == last:
        continue
    time += math.ceil(foods[i] / 10) * 10

time += foods[last]
print(time)

Solution (Python):
times = [int(input()) for i in range(5)]
def marume(i):
    return i-1-(i-1)%10+10 

a=0
for idx,t in enumerate(times):
  if idx == ([(t-1)%10for t in times]).index(min([(t-1)%10for t in times])):
    a += t
  else :
    a += marume(t)
    
print(a)

Solution (Python):
x = []
for i in range(5):
  a = int(input())
  x.append(a)
def kiriage(n):
  if n%10 == 0:
    return n
  else:
    return (n//10 + 1)*10
ans = 0
m = 0
for xi in x:
  kx = kiriage(xi)
  ans += kx
  if kx-xi > m:
    m = kx -xi
print(ans-m)

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

print(n - (10 - c))

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

min_r_t = 12
min_r_t_index = -1
for i, t in enumerate(ts):
    r_t = t % 10
    if r_t == 0:
        continue
    if r_t < min_r_t:
        min_r_t_index = i
        min_r_t = r_t

sum_t = 0
for i, t in enumerate(ts):
    if t % 10 == 0:
        sum_t += t
    elif i == min_r_t_index:
        sum_t += t
    else:
        sum_t += ((t // 10) + 1) * 10

print(sum_t)

Solution (Python):
time = []

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

cr = 0
mr = 0
ans = 0
for t in time:
    r = t % 10
    if r != 0:
        cr += 1
        if mr == 0:
            mr = r
        else:
            mr = min(mr, r)
    ans += (t-r)

if cr == 0:
    print(ans)
else:
    ans += (10*(cr-1)+mr)
    print(ans)

Solution (Python):


def start_process(length, num):

    print(ans)

def main():
    ans = 0
    data = [int(input()) for i in range(5)]
    min_data = 10
    for i in range(5):
        if 0 < data[i] % 10 < min_data:
            min_data = data[i] % 10

    for i in range(5):
        ans = ans + (data[i] // 10)
        if data[i] % 10 > 0:
            ans += 1
    
    
    print((ans - 1) * 10 + min_data)

def kari():
    a = list(map(int, input().split()))
    a, b = map(int, input().split())

if __name__ == '__main__':
    main()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
abcde = [a, b, c, d, e]
mini = (10, 0)
for i, x in enumerate(abcde):
  if x % 10 != 0 and mini[0] > x % 10:
    mini = (x % 10, i)
ans = 0
for i, x in enumerate(abcde):
  if mini[1] == i:
    ans += x
  else:
    if x % 10 == 0:
      ans += x
    else:
      ans += (x // 10 + 1) * 10
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]
M=[]
for i in X:
   M.append((10-i%10)%10)

ans=0

for i in X:
    ans+=(i+((10-i%10)%10))

print(ans-max(M))

Solution (Python):
import itertools

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


l = ['a', 'b', 'c', 'd', 'e']
res = 10 ** 9
for v in itertools.permutations(l):
    tmp = 0
    for i in v:
        if tmp%10 != 0:
            tmp += (10 - tmp%10)
            
        if i == 'a':
            tmp += a
        elif i == 'b':
            tmp += b
        elif i == 'c':
            tmp += c
        elif i == 'd':
            tmp += d
        else:
            tmp += e
            
    res = min(res, tmp)
    
print(res)

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

Solution (Python):
l=[]
t=0
for i in range(5):
  p=int(input())
  t+=p
  l.append(p%10)
l=sorted(l)
b=False
o=0
for i in l:
  if i!=0:
    if b==False:
      o=i
      b=True
    else:
      t+=10-i
  else:
    pass
print(t)

Solution (Python):

import sys
import itertools
import collections
import functools
import math
from queue import Queue

INF = float("inf")


def solve(A: int, B: int, C: int, D: int, E: int):
    ryouri = [A, B, C, D, E]
    a = [x % 10 for x in ryouri if x % 10 != 0]
    if len(a) == 0:
        print(sum([10*(math.ceil(x/10.0)) for x in ryouri]))
    else:
        print(sum([10*(math.ceil(x/10.0)) for x in ryouri]) - (10-min(a)))

    
    
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    E = int(next(tokens))  
    solve(A, B, C, D, E)


if __name__ == '__main__':
    main()

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

Solution (Python):
A = [int(input()) for _ in range(5)]
 
y = min([10] + [x%10 for x in A if x%10])
 
print(sum([10*(x//10 + bool(x%10)) for x in A]) -10 + y)

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

sum = math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10)
sum = sum*10

a = min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)+1

sum = sum - (10-a)
print(sum)

Solution (Python):
def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int,ss_raw()))


poss = []
for i in range(5):
    p = int_raw()
    poss.append(p)

def main(t,flags):
    if not (False in flags):
        return t
    ot = ((t+9)//10)*10
    mint = 10**10
    for i in range(5):
        if flags[i]==False:
            f = list(flags)
            f[i]=True
            mint = min(mint,main(ot+poss[i],f))
    return mint

print(main(0,[False]*5))

Solution (Python):
min_num = 10
num = 0
for i in range(5):
    a = int(input())
    if a % 10 == 0:
       num += a
    else:
        num += ((a//10) + 1) * 10
        min_num = min(min_num, a%10)


print(num+min_num-10)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ans=[a,b,c,d,e]
stack=0
m=0
for i in ans:
  stack+=(10-i%10)%10
  m=max(m,(10-i%10)%10)
print(sum(ans)+stack-m)

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

ans = 0

temp = 10

for a in A:
    if a % 10 == 0:
        ans += a
    else:
        ans += 10 * (a // 10 + 1)
    
    temp2 = a % 10
    if temp2 != 0 and temp2 < temp:
        temp = temp2

print(ans - (10 - temp))

Solution (Python):
dishes=[int(input()) for i in range(5)]
dishes_up=[((dish+9)//10)*10 for dish in dishes]
mod=[dish%10 if dish%10!=0 else 10 for dish in dishes]
v = min(mod) if min(mod)<10 else 10
print(sum(dishes_up) - (10-v))

Solution (Python):
import math
ABCDE = [int(input()) for _ in range(5)]
print(
    sum([10 * math.ceil(_ / 10)
         for _ in ABCDE]) + min([10] + [_ % 10 for _ in ABCDE if _ % 10]) - 10)

Solution (Python):

A = [0] * 5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

minidx = 0
minv = A[0] % 10

for i in range(1,5):
    if A[i] % 10 == 0: continue
    if A[i] % 10 < minv:
        minv = A[i] % 10
        minidx = i

ans = 0
for i in range(5):
    if i == minidx:
        ans = ans + A[minidx]
    else:
        ans = ans + (( A[i] + 9) // 10) * 10
print(ans)

Solution (Python):
from itertools import permutations

A = [int(input()) for _ in range(5)]
ans = 10**100
for A_perm in permutations(A, 5):
    t = 0
    for dish in A_perm:
        if t % 10 != 0:
            t += 10 - t % 10
        t += dish
    ans = min(ans, t)
print(ans)

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

b = (a[0]-1)%10

for i in range(5):
    if (a[i]-1)%10 < b:
        b=(a[i]-1)%10

b += 1

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

print(sum(a)+b-10)

Solution (Python):
import math
arr = [int(input()) for _ in range(5)]
minmod = 10
minidx = -1
time = []
for i, a in enumerate(arr):
  mod = a % 10
  mod = mod if mod > 0 else 10
  if mod < minmod:
    minmod = mod
    minidx = i
  time.append(math.ceil(a / 10) * 10)

ans = 0
for i in range(5):
  if i == minidx:
    ans += arr[i]
  else:
    ans += time[i]
print(ans)

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

mi = 0
for i in range(1, len(d)):
  if (d[mi] - 1) % 10 > (d[i] - 1) % 10:
    mi = i

Ans = d[mi]
for i in range(len(d)):
  if i == mi: continue
  if d[i] % 10 == 0:
    Ans += d[i]
  else:
    Ans += d[i] + 10 - (d[i] % 10)

print(Ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = []
if (a%10) != 0:
  li.append(a%10)
if (b%10) != 0:
  li.append(b%10)
if (c%10) != 0:
  li.append(c%10)
if (d%10) != 0:
  li.append(d%10)
if (e%10) != 0:
  li.append(e%10)
  
if li:
  min_ = min(li)
else:
  min_ = 10

count = -((-a)//10)-((-b)//10)-((-c)//10)-((-d)//10)-((-e)//10)
count = count*10
print(count-(10-min_))

Solution (Python):
l = [int(input()) for _ in range(5)]
a = [0]*5
for i in range(5):
    if 10 - l[i]%10 !=10:
        a[i] = 10 - l[i]%10
a.sort()
a.pop()
print(sum(l)+sum(a))

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

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
a.sort(reverse=True)

time = 0
max_wait = 0
for item in a:
    if item % 10 != 0:
        wait = 10 - (item % 10)
        item += wait
        max_wait = max(wait, max_wait)
    time += item

time -= max_wait
print(time)

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

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

    l = sorted(l, key=lambda x: (x-1)%10, reverse=True)
    

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


if __name__ == '__main__':
    main()

Solution (Python):
import math

def main(m):
    l = []
    k = 9
    get_index = 0
    for i in range(len(m)):
        t = m[i] % 10
        l.append(t)
        if t != 0 and t < k:
            get_index = i
            k = t

    wa = 0
    for i in range(len(m)):
        if i != get_index:
            wa += math.ceil(m[i] / 10) * 10
        else:
            wa += m[i]
    
    return '{}'.format(wa)

if __name__ == '__main__':
    try:
        m = []
        for i in range(5):
            m.append(int(input().strip()))
        print('{}'.format(main(m)))
    except EOFError:
        pass

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a, b, c, d, e]
new = []
mini = 10
for i in range(len(li)):
    if li[i] % 10 == 0:
        new.append(li[i])
    else:
        new.append(li[i] // 10 * 10 + 10)
        if mini > li[i] % 10:
            mini = li[i] % 10

print(sum(new)-(10-mini))

Solution (Python):
from itertools import permutations


def solve(a, b, c, d, e):
    m = 10000
    for p in permutations([a, b, c, d, e]):
        t = 0
        for i, o in enumerate(p):
            t += o
            if i == len(p) - 1:
                break
            while t % 10 != 0:
                t += 1
        m = min(t, m)
    return m

if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    print(solve(a, b, c, d, e))

Solution (Python):
abc = [int(input())+9 for x in range(5)]
print(sum([x//10 for x in abc])*10+min([x%10 for x in abc])-9)

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

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

b = [-(-x // 10) * 10 for x in a]

import numpy as np

aa = np.array(a)
bb = np.array(b)

c = max(bb - aa)

print(sum(bb) - c)

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

m = 10
for x in X:
    if x%10==0:
        t += x
    else:
        t += (x//10+1) * 10
        m = min(m, x%10)
t = t - 10 + m
print(t)

Solution (Python):
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
dish = [a, b, c, d, e]
tmp = 10
for i in range(len(dish)):
    s = dish[i] % 10
    if s < tmp and s != 0:
        tmp = s
sum = 0
for i in range(len(dish)):
    sum += math.ceil(dish[i]/10.0)*10

print(sum - 10 + tmp)

Solution (Python):
from itertools import permutations
import math
p=permutations(range(5))
l=[int(input()) for i in range(5)]
ans=10**10
for pi in p:
    res=0
    for i in range(5):
        if i==4:
            res+=l[pi[i]]
        else:
            res+=math.ceil(l[pi[i]]/10)*10
    ans=min(ans, res)
print(ans)

Solution (Python):
A = [0] * 5 
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

B = [0] * 5
for i in range(5):
	B[i] = ((A[i] - 1) // 10 + 1) * 10

print(sum(B) - max(b - a for a, b in zip(A, B)))

Solution (Python):
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g


di = []

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

su = []
for i in range(5):
    su.append(di[i]%10)

m = 100000
for i in range(5):
    if m > su[i] and su[i] != 0:
        m = su[i]

last = 0
for i in range(5):
    if su[i] == m :
        last = i

time = 0
for i in range(5):
    if i != last:
        time += ((di[i]//10))*10
        if di[i] % 10 != 0:
            time += 10
    else:
        time += di[i]

print(time)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, D: int, E: int):
    R = [A, B, C, D, E]
    mn = 10
    ret = 0
    count = 0
    for r in R:
        if r % 10 > 0 and r % 10 < mn:
            mn = r % 10
        if r % 10 == 0:
            count += 1
        ret += (r // 10) * 10
    ret += (5 - count) * 10
    ret -= 10 - mn
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    E = int(next(tokens))  
    solve(A, B, C, D, E)

if __name__ == '__main__':
    main()

Solution (Python):
import itertools
L = [int(input()) for i in range(5)]
L = list(itertools.permutations(L))
ans = float('inf')
for i in range(len(L)):
    menu = L[i]
    time = 0
    j = 0
    while j < 5:
        if time % 10 == 0:
            time += L[i][j]
            j += 1
        else:
            time += 1
    
    ans = min(ans,time)
print(ans)

Solution (Python):

A=[int(input()) for i in range(5)]
a=[]
for i in range(5):
    ain = A[i]%10
    if ain == 0:
        ain+=10
    a.append(ain)
MINA=min(a)
if MINA == 10:
    print(sum(A))
else:
    flag=0
    ans=0
    for i in range(5):
        if A[i]%10==MINA and flag == 0:
            flag=1
            ans+=A[i]
        else:
            if A[i]%10==0:
                ans+=A[i]
            else:
                ans+=(A[i]+10-A[i]%10)
    print(ans)

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

ri = 0
r = 0
for i in range(5):
    if not a[i]%10==0:
        if r < 10 - a[i]%10:
            ri = i
            r = 10 - a[i]%10
res = 0
for i in range(5):
    if not i == ri:
        if a[i]%10==0:
            res += a[i]
        else:
            res += a[i] + 10 - a[i]%10

res += a[ri]
print(res)

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

U = list(map(lambda x: int(math.ceil(x/10)*10) ,T))
D = [ U[i] - T[i] for i in range(5) ]

print(sum(U)-max(D))

Solution (Python):
times=[int(input()) for _ in range(5)]
amari=[i%10 + 10*(i%10==0) for i in times]
kiriage=[j//10+(j%10!=0) for j in times]
minamari=min(amari)
if minamari==10:
    print(sum(times))
else:
    print(10*(sum(kiriage))-10+minamari)

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


ans = float('inf')
for perm in permutations(X):
    tmp_ans = 0
    for p in perm:
        tmp_ans += p
        if p % 10 != 0:
            tmp_ans += (10 - p % 10)

    if perm[-1] % 10 != 0:
        tmp_ans -= (10 - perm[-1] % 10)
    ans = min(ans, tmp_ans)

print(ans)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

abcde = [ni() for _ in range(5)]
wait = []
ans = 0

for i in abcde:
    if i%10 == 0:
        ans += i
        wait.append(0)
    else:
        wait.append(10 - i%10)
        ans += 10 * (i//10 + 1)
    
wait.sort()
print(ans - wait[-1])

Solution (Python):

a = [0] * 5
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())

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

time = sum(b)

ans = float("inf")
for i in range(5):
    temp = time - b[i] + a[i]
    ans = min(temp,ans)

print(ans)

Solution (Python):
def solve():
    A=[0]*5
    for i in range(5):
        A[i]=int(input())
    B=[(a+9) // 10 * 10 for a in A]
    C=[((a+9) // 10 * 10) - a for a in A]
    return sum(B)-max(C)

print(solve())

Solution (Python):


ts = []
for _ in range(5):
    ts.append(int(input()))

mini = 0

for i in range(5):
    if ts[i] % 10 < ts[mini] % 10 and ts[i] % 10 != 0:
        mini = i

result = 0
for i in range(5):
    if i != mini:
        if ts[i] % 10 == 0:
            result += ts[i]
        else:
            result += (ts[i] // 10 + 1) * 10

result += ts[mini]

print(result)

Solution (Python):
x=[int(input()) for _ in range(5)]
res=0
mx,mi=10,-1
for i in range(5):
    if 0<x[i]%10<mx:
        mx=x[i]%10
        mi=i

if mx==10:
    print(sum(x))
else:
    res=0
    for i in range(5):
        if i!=mi:
            res+=(-(-x[i]//10)*10)
    res+=x[mi]
    print(res)

Solution (Python):
import sys

inputs = []
for _ in range(5):
    x = int(sys.stdin.readline())
    if x % 10 == 0:
        m = 0
    else:
        m = 10 - (x % 10)
    inputs.append((m, x))

inputs.sort()

ret = 0
for m, x in inputs[:-1]:
    ret += m + x
ret += inputs[-1][1]

print(ret)

Solution (Python):
l=[int(input()) for _ in range(5)]
m = 0
s = 0
for x in l:
  t = -(-x//10)*10
  m = max(m,t-x)
  s += t
print(s-m)

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

ans = 0
a = 10
for i in li:
    if i%10 < a and i%10 != 0:
        a = i%10

    if i%10 == 0:
        ans += i
    else:
        i = i//10
        i = (i+1)*10
        ans += i

print(ans+a-10)

Solution (Python):
L1=[int(input()) for _ in range(5)]
L2=[0]*5
for i in range(5):
    L2[i]=(10-L1[i])%10
    
L2.sort()

print(sum(L1)+sum(L2)-max(L2))

Solution (Python):
from itertools import permutations

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

ans = float('inf')
for perm in permutations(e):
    p = list(perm)
    t = 0
    for i in range(5):
        r = p[i] % 10
        if r == 0 or i == 4:
            t += p[i]
        else:
            t += p[i] + 10 - r
    ans = min(ans, t)
print(ans)

Solution (Python):

from itertools import product, permutations
from collections import defaultdict
def inpl(): return list(map(int, input().split()))

X = [0]*5
for i in range(5):
    X[i] = int(input())

ans = 10**9
for Y in permutations(X, r=5):
    tmp = 0
    for y in Y[:4]:
        tmp += y
        tmp = -(-tmp//10) * 10
    ans = min(ans, tmp + Y[-1])
print(ans)

Solution (Python):
lis = [int(input()) for i in range(5)]
ans = 0
num = 0
for nu in lis:
    if nu % 10:
        ans += 10-nu%10
        num = max(num,10-nu%10)
    ans += nu
print(ans-num)