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):
dishes = []
for _ in range(5):
  dishes.append(int(input()))
  
times = []
for _ in range(5):
  n = dishes.pop(0)
  time = n
  for dish in dishes:
    time += ((dish + 9) // 10) * 10
  times.append(time)
  dishes.append(n)
  
print(min(times))

Solution (Python):
def get_last(num):
    str_num = str(num)
    last_num = str_num[-1]
    if int(last_num) == 0:
        return 10
    else:
        return int(last_num)

def gauss_10(num):
    if get_last(num) == 10:
        return num
    else:
        return num + (10-get_last(num))

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


list_last = [get_last(i) for i in list]
last_index = list_last.index(min(list_last))

total = 0
for i, minutes in enumerate(list):
    if i == last_index:
        total += minutes
    else:
        total += gauss_10(minutes)
print(total)

Solution (Python):

import  math
from itertools import permutations

min_t = 100000
X = [int(input()) for i in range(5)]
for x in list(permutations(X)):
    t = 0
    for i in range(4):
        t += x[i]
        t = math.ceil(t/10)*10
    t += x[4]
    if t < min_t:
        min_t = t
print(min_t)

Solution (Python):
import itertools

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

res = 1 << 28
for ss in itertools.permutations(s):
    tmp = 0
    tmp += (ss[0] + 9) // 10 * 10
    tmp += (ss[1] + 9) // 10 * 10
    tmp += (ss[2] + 9) // 10 * 10
    tmp += (ss[3] + 9) // 10 * 10
    tmp += ss[4]
    res = min(res, tmp)

print(res)

Solution (Python):
a = []
for i in range(5):
    b = input()
    c = b[-1] if b[-1] != "0" else "9"
    d = (int(b) + 10 - 1) // 10 * 10
    a.append([b, c, d])
a = sorted(a, key=lambda x: x[1])
e = 0
for i in range(5):
    if i == 0:
        e += int(a[i][0])
    else:
        e += a[i][2]
print(e)

Solution (Python):

def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


times = get_nums(5)

min_quot = 10
target_idx = 5
for i, time in enumerate(times):
    quot = time % 10
    if quot > 0 and quot < min_quot:
        min_quot = quot
        target_idx = i

total = 0
for i, time in enumerate(times):
    if target_idx == i:
        total += time
        continue

    if time % 10 == 0:
        total += time
    else:
        total += int((time // 10 + 1) * 10)

print(total)

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

min_time = 999999
for i in range(5):
    time_sum = 0
    for j in range(5):
        if j == i:
            time_sum += dish[j]
        else:
            time_sum += dish[j] + ((10 - (dish[j] % 10)) % 10)
    if min_time > time_sum:
        min_time = time_sum

print(min_time)

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

d_arr.sort(key=lambda x:(10-(x%10))%10)
print(sum([((x-1)//10+1)*10 for x in d_arr[:4]])+d_arr[4])

Solution (Python):
t = []
T = []
d = []
index_cnt = 0
ma = 0
for i in range(5):
    temp = input()
    t.append(int(temp))
    if t[i] % 10 != 0:
        Ti = t[i] + (10 - t[i] % 10)
    else:
        Ti = t[i]
    T.append(Ti)
    di = 10 - t[i] % 10
    if di == 10:
        d.append(0)
    else:
        d.append(di)
    if d[i] > ma:
        ma = d[i]
        index_cnt = i
total = 0
for i in range(5):
    if i == index_cnt:
        total += t[i]
    else:
        total += T[i]
print(total)

Solution (Python):


a = 10

arr = []

for i in range(5):
    num = int(input())
    if num % 10 != 0:
        a = min(a, num % 10)
        num -= num % 10
        num += 10
    arr.append(num)

ans = sum(arr)
if a != 10:
    ans -= (10-a)

print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  l=[I() for _ in range(5)]

  mn=inf
  for c in itertools.permutations(l,5):
    t=0
    for x in c:
      if t%10==0:
        t+=x
      else:
        t+=10-(t%10)
        t+=x

    mn=min(mn,t)

  return mn


print(main())

Solution (Python):
N = [int(input()) for i in range(5)] 
list_sho = []
list_amari = []

for i in range(len(N)):
  list_sho.append(N[i]//10)
  list_amari.append(N[i]%10)
  
min1 = list_amari.index(min(list_amari))
sum1 = 0

for i in range(len(N)):
  if N[i] % 10 == 0:
    sum1 += N[i]
  else:
    sum1 += ((N[i]//10) + 1) * 10

if N[min1]%10 == 0:
  while min(list_amari) == 0:
    list_amari.remove(0)
    if len(list_amari) == 0:
      break
  if len(list_amari) == 0:
    sum1 =  sum1
  else:
    sum1 =  sum1 - 10 +  min(list_amari)
  print(sum1)
else:
  sum1 = sum1 - 10 +  N[min1]%10
  print(sum1)

Solution (Python):
import math
 
T = list(map(int, (input() for _ in range(5))))
T2 = [math.ceil(t / 10) * 10 for t in T]
m = max(t2 - t for t, t2 in zip(T, T2))
print(sum(T2) - m)

Solution (Python):
A=[int(input()) for _ in range(5)]
cook=[]
for i in range(5):
  a=(10-A[i])%10
  cook.append(a)


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

Solution (Python):
A=[int(input()) for _ in range(5)]
cook=[]
for i in range(5):
  a=(10-A[i])%10
  cook.append(a)

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

Solution (Python):
import itertools

A = [0, 0, 0, 0, 0]
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
A = tuple(A)

time = 0
time_min = 100000000

list = list(itertools.permutations(A))

for l in list:
    count = 0
    time = 0
    while True:
        if count == 4:
            time = time + l[count]
            break
        if (l[count] % 10) != 0:
            time = time + l[count] + (10 - (l[count] % 10))
            count = count + 1
        else:
            time = time + l[count]
            count = count + 1
    if time < time_min:
        time_min = time

print(time_min)

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

Solution (Python):
"""


 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())


 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  


a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654


char_list = list("abcd") 
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    t = list(map(int,sys.stdin.readlines()))
    m = 0
    res = 0
    for e in t:
        if e%10 !=0:
            k = 10 - e%10
        else:
            k = 0
        res += e+k

        m = max(m,k)

    print(res-m)

Solution (Python):
import itertools

def q47(a, b, c, d, e):
    f = [a, b, c, d, e]
    min = 0
    for i in itertools.permutations(f):
        t = 0
        for j in i:
            if t % 10 == 0:
                t += j
            else:
                t += 10 - t % 10
                t += j
        if min == 0:
            min = t
        elif t < min:
            min = t
    return min
        
            
    
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

print(q47(A, B, C, D, E))

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


def ret(perm):
    now = 0
    for i in range(4):
        now += perm[i]
        now = ceil(now / 10) * 10
    now += perm[-1]
    return now


X = [int(input()) for _ in range(5)]
perms = permutations(X)
ans = 1e100
for perm in perms:
    ans = min(ans, ret(perm))
print(ans)

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

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

def round_up_count(n):
    if n%10 != 0:
        return 10 - n%10
    else:
        return 0

orders = []

max_rc = 0
last_order_index = 0
last_order_time = 0

for i in range(5):
    order = int(input())
    orders.append(order)
    last_order_time += round_up(order)
    rc = round_up_count(order)
    if max_rc <= rc:
        last_order_index = i
        max_rc = rc

print(last_order_time - round_up_count(orders[last_order_index]))

Solution (Python):
def ru(n):
  if n % 10 ==0:
    return n
  else:
    return ((n//10)+1)*10
li1=[int(input()) for i in range(5)]
li2=[ru(li1[i]) for i in range(5)]
sub= [x - y for (x, y) in zip(li2, li1)]
print(sum(li2)-max(sub))

Solution (Python):
time=[]
back=0
for i in range(5):
    A=int(input())
    if A%10==0:
        pass
    else:
        back=max(back,10-A%10)
        A=(A//10)*10 +10

    time.append(A)

print(sum(time)-back)

Solution (Python):
import numpy as np 
x =[]
for i in range(5):
    x.append(int(input()))
x = np.array(x)
y = x.copy()
z = x%10
y[y%10 !=0] = y[y%10 !=0] + 10 - y[y%10 !=0]%10
if all(x%10==0):
    minz = 0
    print(sum(y))
else:
    minz = min(z[z%10!=0])
    print(sum(y)-10+minz)

Solution (Python):
def ceil(x):
    k = x % 10
    if k == 0:
        return x
    else:
        return x + (10 - k)
d = []
for i in range(5):
    d.append(int(input()))
d_min = []
min = 124
sum = 0
index = -1
for i in range(5):
    d_min.append((d[i]) % 10)
for i in range(5):
    if d_min[i] != 0:
        if min > d_min[i]:
            min = d_min[i]
            index = i
if index == -1:
    index = 0
for i in range(5):
    if i != index:
        sum = sum + ceil(d[i])
sum += d[index]
print(sum)

Solution (Python):

a=[]
last=0
lasttime=0
ans=0
for _ in range(5):
    a.append(int(input()))
for i in range(5):
    if a[i]%10!=0 and lasttime<10-a[i]%10:
        lasttime=10-a[i]%10
        last=i
for j in range(0,last):
    if a[j]%10==0:
        ans=ans+a[j]
    else:
        ans=ans+(a[j]//10+1)*10
for j in range(last+1,5):
    if a[j]%10==0:
        ans=ans+a[j]
    else:
        ans=ans+(a[j]//10+1)*10
ans=ans+a[last]
print(ans)

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

cnt = 0
temp = 9

for ai in a:
    cnt += (ai // 10 + int((ai % 10) != 0))*10
    temp = min((ai - 1) % 10, temp)

print(cnt+temp+1-10)

Solution (Python):
nums = [int(input()) for _ in range(5)]
l = list(map(int,filter(lambda x:x !="0",[str(n)[-1] for n in nums])))
r = [(n+9) // 10 for n in nums]
print(sum(r)*10-(10-min(l))) if len(l) != 0 else print(sum(r)*10)

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

x = 10
time = 0
for i in range(5):
	if x >= s[i]%10 > 0:
		x = s[i]%10
	time += -(-s[i]//10)*10

print(time-10+x)

Solution (Python):



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

minr = 10
minf = 0
for f in food:
    if f % 10 != 0 :
        if f % 10 < minr :
            minr = f % 10
            minf = f
if minf == 0:
    minf = food[0]
        

food.remove(minf)
food.append(minf)

sumf = 0
i = 0
for f in food:
    if i == 4:
        sumf += f
    elif f % 10 != 0:
        sumf += int(f/10) * 10 + 10
    else:
        sumf += f
    i+=1
print(sumf)

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

min = 10

dish = [a,b,c,d,e]
total = 0
for i in dish:
    if i % 10 != 0 and i % 10 < min:
        min = i % 10
    total -= (- i // 10) * 10

total += min - 10

print(total)

Solution (Python):

import sys

dishesList = [int(input()) for i in range(5)]
min = 100000
targetIndex=9999

for i,v in enumerate(dishesList):
    last = v%10
    if last !=0 and last < min:
        min = last
        targetIndex=i

newList = []
for i,v in enumerate(dishesList):

    if i==targetIndex:
        newList.append(v)
        continue

    last = v%10
    if last==0:
        diff=abs(10-last)
        add=v+diff
        newList.append(v)
    else:
        diff=10 - last
        add=v+diff
        newList.append(add)

ans=0

for i in newList:
    ans += i

print(ans)

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

sa = 10
count = 0
for i in li:
    count += (10 * (i // 10) )
    if i % 10 != 0:
        count+= 10
        if i % 10 < sa:
            sa = i % 10

if sa == 10:
    print(count)
else:
    print(count - 10 + sa)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def ten(n):
    if n % 10 == 0:
        return n // 10
    else:
        return n // 10 + 1
def per(n):
    if n % 10 == 0:
        return 0
    else:
        return 10 - n % 10
print((ten(a) + ten(b) + ten(c) + ten(d) + ten(e))*10 - max(per(a),per(b),per(c),per(d),per(e)))

Solution (Python):
a = [int(input()) for i in range(5)]
b = [a[i]%10 for i in range(5)]
bl = sorted(b)
bb = 0
for i in bl:
  if i > 0:
    bb = i
    break

t = 0
for i in range(5):
  if i != b.index(bb):
    t += a[i]
    if t%10!=0:
      t +=(10-t%10)
t+=a[b.index(bb)]
print(t)

Solution (Python):
input = open(0).read
A = [int(i) for i in input().split()]
L = []

for a in A:
    if 0 < a % 10:
        tmp = 10 - a % 10
        L.append(tmp)

L.sort(reverse=True)
print(sum(A) + sum(L[1:]))

Solution (Python):
def main():

    """ convenient functions
    
    
    
    
    
    """

    """convenient decorator
    
    
        
        
        
        
        
        
        
        
        
        
    """
    
    
    import sys
    sys.setrecursionlimit(10**7)
    from itertools import accumulate, combinations, permutations, product 
    
    from math import factorial, ceil, floor, sqrt
    def factorize(n):
        """return the factors of the Arg and count of each factor
        
        Args:
            n (long): number to be resolved into factors
        
        Returns:
            list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
        """
        fct = []  
        b, e = 2, 0  
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def combinations_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        
        if n < 0 or r < 0:
            raise Exception('combinations_count(n, r) not defined when n or r is negative')
        if n - r < r: r = n - r
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result
    def combinations_with_replacement_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        if n < 0 or r < 0:
            raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
        elif n == 0:
            return 1
        else:
            return combinations_count(n + r - 1, r)
    from bisect import bisect_left, bisect_right
    from collections import deque, Counter, defaultdict 
    from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest 
    from copy import deepcopy, copy 
    import operator
    from operator import itemgetter
    
    
    from functools import reduce, lru_cache
    def chmin(x, y):
        """change minimum
        if x > y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current minimum value
            y (long): potential minimum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x > y:
            x = y
            return (x, True)
        else:
            return (x, False)
    def chmax(x, y):
        """change maximum
        if x < y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current maximum value
            y (long): potential maximum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x < y:
            x = y
            return (x, True)
        else:
            return (x, False)

    from fractions import gcd 
    def gcds(numbers):
        return reduce(gcd, numbers)
    def lcm(x, y):
        return (x * y) // gcd(x, y)
    def lcms(numbers):
        return reduce(lcm, numbers, 1)

    
    
    INF = 10 ** 18
    MOD = 10 ** 9 + 7
    modpow = lambda a, n, p = MOD: pow(a, n, p) 
    def modinv(a, p = MOD):
        
        
        return modpow(a, p-2, p)
    def modinv_list(n, p = MOD):
        if n <= 1:
            return [0,1][:n+1]
        else:
            inv_t = [0,1]
            for i in range(2, n+1):
                inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
            return inv_t
    def modfactorial_list(n, p = MOD):
        if n == 0:
            return [1]
        else:
            l = [0] * (n+1)
            tmp = 1
            for i in range(1, n+1):
                tmp = tmp * i % p
                l[i] = tmp
            return l
    def modcomb(n, k, fac_list = [], p = MOD):
        
        
        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        if len(fac_list) <= n:
            a = factorial(n) % p
            b = factorial(k) % p
            c = factorial(n-k) % p
        else:
            a = fac_list[n]
            b = fac_list[k]
            c = fac_list[n-k]
        return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
    def modadd(a, b, p = MOD):
        return (a + b) % MOD
    def modsub(a, b, p = MOD):
        return (a - b) % p
    def modmul(a, b, p = MOD):
        return ((a % p) * (b % p)) % p
    def moddiv(a, b, p = MOD):
        return modmul(a, modpow(b, p-2, p))

    """ initialize variables and set inputs
    
        
        
    
        
        
        
        
        
    
        
        
        
        
    
        
        
    """

    
    r = lambda: sys.stdin.readline().strip()
    r_int = lambda: int(r())
    R = lambda: list(map(int, r().split()))
    Rmap = lambda: map(int, r().split())
    Rfloat = lambda: list(map(float, r().split()))
    Rtuple = lambda: tuple(map(int, r().split()))

    """ how to treat input
    
    
    
    
    
    
    
    """

    if __name__ != '__main__':
        
        sys.stdin = open('sample.txt')

    
    

    tmp = 0
    sumup = 0
    memo = 10
    for i in range(5):
        tmp = int(r())
        if tmp % 10 != 0:
            sumup += tmp - (tmp % 10) + 10
            memo = min(memo, tmp % 10)
        else:
            sumup += tmp
    if memo == 10:
        print(sumup)
    else:
        print(sumup+memo-10)
    
    
    

    """memo: how to use defaultdict of list
    
    Dic = defaultdict(list)
    
    Dic[x].append(y)
    
    for k, v in Dic.items():
    """

if __name__ == '__main__':
    main()

Solution (Python):
from math import ceil
ds = [int(input()) for i in range(5)]
t = sum(10 * ceil(x / 10) for x in ds)
rs = [x % 10 for x in ds if x % 10 != 0]
r = (min(rs) - 10) if rs else 0
print(t + r)

Solution (Python):
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def change_color(t):
    if t == '0':
        return '1'
    return '0'


def solve(inputs):
    [A] = string_to_int(inputs[0])
    [B] = string_to_int(inputs[1])
    [C] = string_to_int(inputs[2])
    [D] = string_to_int(inputs[3])
    [E] = string_to_int(inputs[4])
    foods = [A, B, C, D, E]
    time = 0

    while len(foods) > 0:
        optimal_f = -1
        optimal_i = -1
        for i, f in enumerate(foods):
            futility = (time + f) % 10
            if futility == 0:
                optimal_i = i
                break
            if futility > optimal_f or optimal_f == -1:
                optimal_f = futility
                optimal_i = i
        time += foods[optimal_i]
        foods.pop(optimal_i)
        if len(foods) != 0 and time % 10 != 0:
            time += 10 - (time % 10)
    return time


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(5))
    print(ret)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
 
l = [a, b, c, d, e]
s = []
 
for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))
if len(s) > 0:
    s.sort()
    del s[-1]
 
ans = sum(l) + sum(s)
print(ans)

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


def f(n):
    return (10 - (n % 10)) % 10


ans = a + b + c + d + e
ans += f(a) + f(b) + f(c) + f(d) + f(e)
ans -= max(f(a), f(b), f(c), f(d), f(e))

print(ans)

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

sum = int(0)
min = int(10)
for i in range(5):
    x = a[i]%10
    sum += a[i]//10*10
    if min>x and x!=0:
            min = x
    if x!= 0:        
            sum += 10

print(sum + min-10)

Solution (Python):
a = []
for i in range(5):
    b = int(input())
    a.append([(b+9) % 10, b])
a = sorted(a, reverse=True)
c = 0
for i in range(4):
    c += (a[i][1] + 9) // 10 * 10
print(c + a[4][1])

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

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

for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))
if len(s) > 0:
    s.sort()
    del s[-1]

ans = sum(l) + sum(s)
print(ans)

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

    min_mod = 10
    elapsed_time = 0
    for x in [A, B, C, D, E]:
        mod = x % 10
        if 0 < mod < min_mod:
            min_mod = mod
        time = x if x % 10 == 0 else (x // 10 + 1) * 10
        elapsed_time += time

    elapsed_time = elapsed_time - (10 - min_mod)
    print(elapsed_time)

if __name__ == '__main__':
    main()

Solution (Python):
def smaller(x, y):
	if x < y:
		return x
	return y

lst = []
for i in range(0, 5):
	lst.append(int(input()))
min = 5000000000000000
for i in range(0, 5):
	first = lst[i]
	lst1 = lst[:i]
	if i != 4:
		lst1 = lst1 + lst[i+1:]
	time1 = first - first % 10
	if first % 10 != 0:
		time1 += 10
	for j in range(0, 4):
		second = lst1[j]
		lst2 = lst1[:j]
		if j != 3:
			lst2 = lst2 + lst1[j+1:]
		time2 = time1 + second - second % 10
		if second % 10 != 0:
			time2 += 10
		for k in range(0, 3):
			third = lst2[k]
			lst3 = lst2[:k]
			if k != 2:
				lst3 = lst3 + lst2[k+1:]
			time3 = time2 + third - third % 10
			if third % 10 != 0:
				time3 += 10
			for p in range(0, 2):
				fourth = lst3[p]
				time4 = time3 + fourth - fourth % 10
				if fourth % 10 != 0:
					time4 += 10
				fifth = lst3[(p+1)%2]
				time5 = time4 + fifth
				min = smaller(min, time5)
print(min)

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

time = [[a, a%10], [b, b%10], [c, c%10], [d, d%10], [e, e%10]]
ans = 0

for i in range(5):
	if time[i][1] == 0:
		time[i][1] = 10
		
time = sorted(time, key = lambda x:x[1], reverse = True)

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

Solution (Python):
time = [0]*5
time_ = [0]*5
for i in range(5):
    time[i] = int(input())
    time_[i] = time[i] % 10
    if time_[i] == 0:
        time_[i] = 10

idx = time_.index(min(time_))
ans = 0
for i in range(5):
    if i == idx:
        ans += time[i]
    else:
        if 1 <= time_[i] and time_[i] <= 9:
            ans += ((time[i]//10)+1)*10
        else:
            ans += time[i]

print(ans)

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

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  if dish%10 == 0:
    ans += dish
  else:
    ans += dish + 10 - dish%10
  if dish%10 < min_digits and dish%10 !=0:
    digits_idx = idx
    min_digits = dish%10
if min_digits == 10:
  print(ans)
else:
  ans -= (10 - min_digits)
  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]
S = [10]
for l in L:
    if l % 10 != 0:
        S.append(l % 10)
min_s = min(S)

s = 0
flag = True
for l in L:
    if flag and min_s == l % 10:
        s += l
        flag = False
    elif 0 == l % 10:
        s += l
    else:
        s += 10 * (l // 10) + 10
print(s)

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):
import sys
input = sys.stdin.readline

l1=[]
l2=[]
for _ in range(5):
    m = int(input())
    if m % 10 == 0:
        l1.append(m)
    else:
        l2.append([m, int(str(m)[-1])])

l2 = sorted(l2, key=lambda x: x[1], reverse=True)
ans = sum(l1)
for i in range(len(l2)):
    if i+1 != len(l2):
        ans += l2[i][0]+10-l2[i][1]
    else:
        ans += l2[i][0]

print(ans)

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

l1=[]
l2=[]
for _ in range(5):
    m = int(input())
    if m % 10 == 0:
        l1.append(m)
    else:
        l2.append([m, int(str(m)[-1])])

l2 = sorted(l2, key=lambda x: x[1], reverse=True)
ans = sum(l1)
for i in range(len(l2)):
    if i+1 != len(l2):
        ans += l2[i][0]+10-l2[i][1]
    else:
        ans += l2[i][0]

print(ans)

Solution (Python):
import math

a = [int(input()) for _ in range(5)]
print(min([sum(map(lambda x: (math.ceil(x/10)*10), a)) - (math.ceil(a[i]/10)*10) + a[i] for i in range(5)]))

Solution (Python):
def ru(n):
  if n % 10 ==0:
    return n
  else:
    return ((n//10)+1)*10
li1=[int(input()) for i in range(5)]
li2=[ru(li1[i]) for i in range(5)]
sub= [x - y for (x, y) in zip(li2, li1)]
print(sum(li2)-max(sub))

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

A=[]
N=5
for i in range(N):
    A.append(int(input()))
B=[roof10(A[n]) for n in range(N)]
x=max([B[n]-A[n] for n in range(N)])
print(sum(B)-x)

Solution (Python):
def more(n):
    n=int(n)
    c=n%10
    if c==0:
        b=n
    else:
        a=n//10
        b=(a+1)*10
    return b
info=[]
for i in range(5):
    a=int(input())
    info.append([a,more(a),more(a)-a])

info2=sorted(info,key=lambda x:x[2])

print(info2[4][0]+sum(info2[i][1] for i in range(4)))

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

    max_wait = 0
    sum_wait = 0
    for d in t:
        wait = (10 - d % 10) % 10
        if max_wait < wait:
            max_wait = wait
        sum_wait += d + wait
    print(sum_wait - max_wait)


main()

Solution (Python):
import math
t=[]
for _ in range(5):
  x=int(input())
  t.append(x)
tt=[]
for i in t:
  tt.append(math.ceil(i*0.1))
sa=[]
for i in range(5):
  sa.append(tt[i]*10-t[i])
print(sum(tt)*10-max(sa))

Solution (Python):


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

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

order_time = (sum([(dish - 1) // 10 + 1 for dish in dishes])) * 10
final_dish = min([(dish - 1) % 10 + 1 for dish in dishes]) - 10

ans = order_time + final_dish
print(ans)

Solution (Python):
a = [int(input()) for _ in range(5)]
b = [i%10 for i in a if i%10 !=0]
if len(b)==0:
  b=0
else:
  b= 10 - min(b)
print(sum([((i + 9)//10 *10) for  i in a]) - b)

Solution (Python):
l = [int(input()) for x in range(5)]
l_kiriage = []

for i in l:
    while i%10!=0:
        i += 1
    l_kiriage.append(i)

l_sa = [l_kiriage[x]-l[x] for x in range(5)]

print(sum(l_kiriage) - max(l_sa))