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):
"""
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 = list(map(int, read().split()))

temp = 10
im = 0
for num, i in enumerate(DISH):
    if i % 10 < temp and i % 10 != 0:
        temp = i % 10
        im = num

ans = 0
for num, i in enumerate(DISH):
    if num != im:
        ans += ((i + 9) // 10) * 10
    else:
        ans += i
print(ans)

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)

import numpy as np

DISH = list(map(int, read().split()))

temp = 10
im = 0
for num, i in enumerate(DISH):
    if i % 10 < temp and i % 10 != 0:
        temp = i % 10
        im = num

ans = 0
for num, i in enumerate(DISH):
    if num != im:
        ans += ((i + 9) // 10) * 10
    else:
        ans += i
print(ans)

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

dif = 0
ans = 0
for i in l:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10 - i % 10)
        dif = max(dif, 10 - i % 10)
print(ans - dif)

Solution (Python):
import itertools

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

P = list(itertools.permutations([A, B, C,D,E]))
time = 0
mini = 10**3
for i in P:
    count = 0
    for j in i:
        time += j
        if (count ==4):
            break
        if j % 10 != 0:
            time += 10 - (time % 10)
        count += 1
    mini = min(mini, time)
    time = 0

print(mini)

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

A = (10-a%10)%10
B = (10-b%10)%10
C = (10-c%10)%10
D = (10-d%10)%10
E = (10-e%10)%10

gap =10 -  max(A,B,C,D,E)

ans = ceil(a/10)*10+ceil(b/10)*10+ceil(c/10)*10+ceil(d/10)*10+ceil(e/10)*10+gap-10
print(ans)

Solution (Python):

 
import math
import itertools
import sys
import copy
 






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

pmax = 0
sumA = 0
for i in range(5) :
  p = 0
  while A[i]%10 != 0 :
    A[i] += 1
    p += 1
  sumA += A[i]
  pmax = max(pmax, p)

print (sumA - pmax)

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

*d, = map(lambda x: 0 if x%10 == 0 else 10-x%10, menus)

ans = 0
for _m, _d in zip(menus, d):
    ans += _m+_d

print(ans-max(d))

Solution (Python):
def stupid(a):
    from itertools import permutations
    ret = float('inf')
    for p in permutations(a):
        time = 0
        for dish in p:
            time += (10 - (time % 10)) % 10
            time += dish
        ret = min(ret, time)
    return ret

def fast(a):
    temp = a[::]
    temp.sort(key=lambda x: (10 - (x % 10)) % 10)
    ret = 0
    for dish in temp:
        ret += (10 - (ret % 10)) % 10
        ret += dish
    return ret

def stress(n):
    from random import randint
    for _ in range(n):
        a = [randint(1, 123) for _ in range(5)]
        expected = stupid(a)
        got = fast(a)
        if got != expected:
            raise Exception('%s -> expected:%d, got:%d' % (' '.join(map(str, a)), expected, got))

test = False
if test:
    stress(1000)
else:
    a = [int(input()) for _ in range(5)]
    print(fast(a))

Solution (Python):
def stupid():
    from itertools import permutations

    ret = float('inf')
    for p in permutations(a):
        time = 0
        for dish in p:
            time += (10 - (time % 10)) % 10
            time += dish
        ret = min(ret, time)
    return ret

a = [int(input()) for _ in range(5)]
print(stupid())

Solution (Python):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = min([m % 10 for m in [a,b,c,d,e] if m % 10 != 0] + [10])
time = 10 * (math.ceil(a / 10) + math.ceil(b / 10)+ math.ceil(c / 10)+ math.ceil(d / 10)+ math.ceil(e / 10)) - (10 - sub)
print(int(time))

Solution (Python):
l = []
l1 = []
for i in range(5):
  a = int(input())
  l.append((a,a%10))
l.sort(key = lambda x: x[1])

count = 0
for i in range(5):
  if l[i][1] == 0:
    count += l[i][0]
    if i == 4:
      c = 5
  else:
    c = i
    break
for i in range(4,c-1,-1):
  
  if i == c:
    count += l[i][0]
  else:
    count += l[i][0] + 10-l[i][1]
print(count)

Solution (Python):
import math




def main():
    N = 5
    dishes = [0] * N
    m = 10 ** 9
    m_index = -1

    for i in range(N):
        dishes[i] = int(input())

    for i in range(len(dishes)):
        if m > dishes[i] % 10 and dishes[i] % 10 != 0:
            m = dishes[i] % 10
            m_index = i

    if m_index == -1:
        print(sum(dishes))
    else:
        print(sum([d // 10 * 10 + 10 if d % 10 != 0 else d for i, d in enumerate(dishes) if i != m_index]) + dishes[m_index])


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math
import numpy as np
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a = []
for _ in range(5):
    a.append(ni())
a = np.array(a)

m = np.min((a-1)%10+1)
d = (a - 1) // 10 + 1
print(sum(d)*10 + m - 10)

Solution (Python):
from decimal import *

dishes = []
for i in range(5):
    dishes.append(input())
    
idx = 0
min_ones_place = 9

for j in range(5):
    ones_place = int(dishes[j][-1])
    if ones_place != 0:
        if ones_place < min_ones_place:
            min_ones_place = ones_place
            idx = j
            
last_dish = int(dishes.pop(idx))

total_time = 0
for k in range(4):
    total_time += int(dishes[k])
    if total_time % 10 == 0:
        pass
    else :
        total_time = int(Decimal(str(total_time)).quantize(Decimal('1E1'), rounding=ROUND_UP))

total_time += last_dish
print(total_time)

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

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))

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

Solution (Python):
order = [int(input()) for _ in range(5)]
max_order = [ -(-i//10)*10-i  for i in order]
print(sum(order)+sum(max_order)-max(max_order))

Solution (Python):

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

ans = 0
tmp = [A, B, C, D, E]
Y = []
Z = []
for i in range(5):
    Y.append([tmp[i] % 10, tmp[i]])
Y.sort()

for i in range(5):
    if Y[i][0] != 0:
        Z.append(i)
if len(Z) != 0:
    for i in range(5):
        X = Y[i][1]
        
        while X % 10 != 0:
            X += 1
        ans += X
        
        
    G = Y[Z[0]][1]
    while G % 10 != 0:
        G += 1
    ans -= G
    ans += Y[Z[0]][1]
    
else:
    ans = sum(tmp)
print(ans)

Solution (Python):
import math

time = []
res = 0

for _ in range(5):
    time.append(int(input()))
for i in time:
    res += math.ceil(i/10) * 10
a = min([(i-1)%10 for i in time])
print(res-9+a)

Solution (Python):
I = ["{0:03d}".format(int(n)) for n in open(0).read().split()]
c = 0
min_z = 10
for i in I:
    x, y, z = map(int, i)
    if 0 < z < min_z:
        min_z = z
    if 0 < z:
        y +=1
    if 9 < y:
        x += 1
        y -= 10
    n = x * 100 + y * 10
    c += n

print(c+min_z-10)

Solution (Python):
import itertools

a_L = []

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

def hosei(x):
    """int:x"""
    x = -(x // -10)
    return x*10

a_L = list(itertools.permutations(a_L))

ans_L = []

for c in a_L:
    times = 0
    counter = 0
    for i in c:
        if counter != 4:
            times += hosei(i)
        else:
            
            times += i
        counter += 1
    ans_L.append(times)

print(min(ans_L))

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

smallest_ones_place = 10
last_dish = 0
for i in range(5):
    if l[i]%10 != 0 and l[i]%10 < smallest_ones_place:
        smallest_ones_place = l[i]%10
        last_dish = i

total_time = l.pop(last_dish)
for j in l:
    if j%10 == 0:
        total_time += j
    else:
        total_time += (j+10-j%10)

print(total_time)

Solution (Python):
A=[int(input()) for _ in range(5)]
B=[-(-a//10)*10-a for a 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())
X=[A,B,C,D,E]
Y=[]
for i in range(5):
  Y.append((((-1)*X[i])//10)*(-10))

ans=sum(Y)
for i in range(5):
  x=sum(Y)-Y[i]+X[i]
  ans=min(ans,x)
print(ans)

Solution (Python):
order = [int(input()) for _ in range(5)]
tmp=0
diff = 10
for i in order:
  if i%10 != 0:
    diff = min(i%10, diff)
    tmp+=((i//10)+1)*10
  else:
    tmp+=i
print(tmp+diff-10)

Solution (Python):
from math import floor, ceil
a = [int(input()) for i in range(5)]
c = sorted(a, key = lambda x: 10 if x % 10 == 0 else x % 10)
ans = c[0]
for i in c[1:]:
  ans += ceil(i/10) * 10
print(ans)

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

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):
def main():
	
	
	dish = []
	for i in range(5):
		dish.append(input())
	
	
	
	
	
	import itertools
	kumi = list(itertools.permutations(dish,5))
	
	time = 0
	time_ans = []
	for i in range(len(kumi)):
		
		time += int(kumi[i][0])
		
		while time % 10 != 0:
			time += 1
		time += int(kumi[i][1])
		
		while time % 10 != 0:
			time += 1
		time += int(kumi[i][2])
		
		while time % 10 != 0:
			time += 1
		time += int(kumi[i][3])
		
		while time % 10 != 0:
			time += 1
		time += int(kumi[i][4])
		
		
		time_ans.append(time)
		time = 0
	print(min(time_ans))


 
if __name__ == '__main__':
	main()

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

data_list = [A,B,C,D,E]
last_tmp = 10
last = 0
for data in data_list:
    data_str = str(data)
    if int(data_str[len(data_str)-1]) != 0:
        if last_tmp >= int(data_str[len(data_str)-1]):
            last = data
            last_tmp = int(data_str[len(data_str)-1])

if last != 0:
    data_list.remove(last)
ans = last
for data in data_list:
    ans += data
    data_str = str(data)
    if int(data_str[len(data_str)-1]) != 0:
        ans += 10-int(data_str[len(data_str)-1])

print(ans)

Solution (Python):
a=[]
b=[]
for i in range(5):
    x=int(input())
    a.append(x)
    if x%10!=0:
        b.append(10-x%10)
if a[0]%10==0 and a[1]%10==0 and a[2]%10==0 and a[3]%10==0 and a[4]%10==0:
    print(sum(a))
else:
    b.sort()
    print(sum(a)+sum(b)-max(b))

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

targetnum=999
minnum=10
for num,i in enumerate(arr):
    if int(str(i)[-1])<minnum and int(str(i)[-1])>0:
        minnum=int(str(i)[-1])
        targetnum=num

result=0
for num,i in enumerate(arr):
    if num==targetnum:
        result+=i
        
    else:
        result+=math.ceil(i/10)*10


print(result)

Solution (Python):



menu = list()
for _ in range(5):
    x = int(input())
    if x % 10 != 0:
        t = x % 10
    else:
        t = 10
    menu.append([t, x])

menu = sorted(menu, reverse = True)

total = 0
for e in menu[:-1]:
    if e[0] == 10:
        total += e[1]
    else:
        total += (e[1] + (10 - e[0]))
total += menu[-1][1]

print(total)

Solution (Python):
a = [int(input()) for _ in range(5)]
delta = []
time = 0
count = 0

for i in range(5):
    a10 = 0
    if str(a[i])[-1] != '0':
        a10 = (10 - int(str(a[i])[-1]))
        delta.append(a10)
        count += 0
    time += a[i] + a10

if count == 0:
    delta.append(0)

print(time-max(delta))

Solution (Python):
A = [int(input()) for _ in range(5)]
A.sort(key=lambda a: (a+9)%10)
print(10 * (sum(map(lambda a: a//10, A)) + sum(map(lambda a: int(a%10!=0), A[1:]))) + A[0]%10)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
q=min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)+1
s=((a+9)//10+(b+9)//10+(c+9)//10+(d+9)//10+(e+9)//10)*10-10+q
print(s)

Solution (Python):

T=[[0,0] for i in range(5)]


for i in range(5):
    temp=int(input())
    if temp%10==0:
        T[i]=[10,temp]
    else:
        T[i]=[temp%10,temp]

T.sort(reverse=True)

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

ans+=T[4][1]

print(ans)

Solution (Python):

T=[[0,0] for i in range(5)]


for i in range(5):
    temp=int(input())
    if temp%10==0:
        T[i]=[10,temp]
    else:
        T[i]=[temp%10,temp]

T.sort(reverse=True)

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

ans+=T[4][1]

print(ans)

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

lst1 = []
min1 = 9
num1 = 0

for i, l in enumerate(lst):
    lst1.append(math.ceil(l/10)*10)
    if min1 > l%10 and l%10!=0:
        min1 = l%10
        num1 = i
lst1[num1] = lst[num1]

print(sum(lst1))

Solution (Python):
l=[]
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
t=[]
for e in l:
    t.append(e%10)
s=0
i=0
while 0 in t:
    j=t.index(0)
    t[j]=-1
    s+=l[j]
    i+=1
while i<4:
    j=t.index(max(t))
    t[j]=-1
    s+=l[j]-l[j]%10+10
    i+=1
if i==4:
    j=t.index(max(t))
    s+=l[j]
print(s)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def x(i):
    return -(-i//10)*10
def y(i):
    return -i%10

print(x(a) + x(b) + x(c) + x(d) + x(e) - max([y(a), y(b), y(c), y(d), y(e)]))

Solution (Python):
just=[]
left=[]
for i in range(5):
  a=int(input())
  if a%10 == 0:
    just.append(a)
  else:
    left.append(a)
_sum = sum(just)    
_min=10
index=-1
for i in range(len(left)):
  i1=left[i]%10
  if _min > i1:
    _min = i1
    index = i
for i in range(len(left)):
  if i == index:
    _sum += left[i]
  else:
    b=left[i]%10
    _sum += left[i] + (10-b)
print(_sum)

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

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

m = 10
for i in [a, b, c, d, e]:
    if i%10 != 0 and i%10<m:
        m = i%10


m = 10 - m


total = 0
for i in [a, b, c, d, e]:
    if i % 10 != 0:
        total += (i//10)*10+10
    else:
        total += i
print(total-m)

Solution (Python):
lst = [int(input()) for i in range(5)]
tmp = 99
idx = 0
ans = 0

for i in range(5):
    if lst[i] % 10 != 0 and tmp > lst[i] % 10:
        tmp = lst[i] % 10
        idx = i

for i in range(5):
    if i != idx:
        if lst[i] % 10 != 0:
            lst[i] += (10 - lst[i] % 10)
        ans += lst[i]


ans += lst[idx]
print(ans)

Solution (Python):
from math import ceil

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

x = [a, b, c, d, e]
x1 = list(map(lambda x:x%10, x))
last_x = 10
last_i = -1
cnt = 0
for i in range(len(x1)):
    if x1[i]==0:
        cnt+=1
        continue
    if last_x > x1[i]:
        last_x = x1[i]
        last_i = i

if cnt==5:
    print(sum(x))
    exit(0)

tmp = x[:last_i] + x[last_i+1:]
ans = sum(list(map(lambda a:10*ceil(a/10), tmp)))+x[last_i]
print(ans)

Solution (Python):
def abc(n):

    if n%10 != 0:
        for i in range(1,14):
            if 0<10*i-n<10:
                return 10*i
    else:
        return n

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

lst1 = []
for i in range(5):
    lst1.append(abc(x[i]))

lst2 = []
for i in range(5):
    lst2.append(abc(x[i])-x[i])

print(sum(lst1)-max(lst2))

Solution (Python):
import itertools
costs = [int(input()) for _ in range(0, 5)]
ans = 1000000000000
for x in itertools.permutations([0, 1, 2, 3, 4]):
  c = 0
  for i in range(0, 5):
    c += costs[x[i]]
    if i != 4 and c % 10 != 0:
      c += 10 - c % 10
  ans = min(c, ans)
print(ans)

Solution (Python):
a=[int(input()) for i in range(5)]
ans = 0
d1 = 10
for i in range(5):
  ans += (a[i]+9)//10*10
  if a[i]%10:
    d1=min(d1,a[i]%10)
print(ans+d1-10)

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):
import math
n=[]
for i in range(5):
  n.append(int(input()))
l=[]
for i in range(5):
  l.append(10*(math.ceil(n[i]/10)))
samax=0
for i in range(5):
  ans=l[i]-n[i]
  samax=max(ans,samax)
print(sum(l)-samax)

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



A = [int(sys.stdin.buffer.readline()) for _ in range(5)]

ans = INF
for last_i in range(5):
    cnt = 0
    for i in range(5):
        if i == last_i:
            continue
        cnt += math.ceil(A[i] / 10) * 10
    cnt += A[last_i]
    ans = min(ans, cnt)

print(ans)

Solution (Python):

import math

def yes():
    print("Yes")
def no():
    print("No")












l = []
x = 2147483647
index = 0
for i in range(5):
   l.append( int(input()) )
   n = int(l[i]%10)
   if n>0 and n<x:
      x = n
      index = i

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

print(ans)

Solution (Python):
a = [int(input()) for _ in range(5)]
b = []
ans = 0
for i in range(5):
    if a[i] % 10 == 0:
        ans += a[i]
    else:
        b.append([a[i], a[i] % 10])
sorted_b = sorted(b, key=lambda x: x[1], reverse=True)

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

Solution (Python):


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

lis = [a,b,c,d,e]
mod = [a%10, b%10, c%10, d%10, e%10]

try:    
    hasu = min([i for i in mod if i%10 != 0])
    ishasu = True
except:
    hasu = 0
    ishasu = False

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


if (not ishasu):
    print(ans*10+hasu)
else:
    print(ans*10+hasu -10)

Solution (Python):
T = [int(input()) for _ in range(5)]
T_0 = [t for t in T if t % 10 == 0]
T_non_0 = [t for t in T if t % 10 != 0]
T_non_0.sort(key=lambda x: x % 10)

time = 0
time += sum(T_0)
head = 1
for t in T_non_0:
    if head:
        time += t
        head = 0
    else:
        time += -(-t // 10) * 10

print(time)

Solution (Python):
def examA():
    X = [I() for _ in range(5)]
    k = I()
    X.sort()
    ans = "Yay!"
    if X[-1]-X[0]>k:
        ans = ":("
    print(ans)
    return

def examB():
    X = [I() for _ in range(5)]
    ans = 0
    for i in range(5):
        ans += (X[i]+9)//10 *10
        X[i] = (X[i]-1)%10
    ans -= (9-min(X))
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()

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

import itertools

ans = 10 ** 9 + 7
for order in itertools.permutations(range(5)):
    ans_tmp = 0
    for i in range(5):
        if ans_tmp % 10 > 0:
            ans_tmp += (10 - (ans_tmp % 10))
        ans_tmp += X[order[i]]
    ans = min(ans, ans_tmp)

print(ans)

Solution (Python):
def solve():
    dishes = list(map(int, open(0).read().split()))
    
    last = 0
    dt_max = 0
    for i in range(5):
        if dishes[i] % 10 != 0 and dt_max <= 10 - (dishes[i] - dishes[i] // 10 * 10):
            dt_max = 10 - (dishes[i] - dishes[i] // 10 * 10)
            last = i
    
    ans = 0
    for i in range(5):
        if i != last:
            if dishes[i] % 10 != 0:
                ans += 10 * (dishes[i] // 10 + 1)
            else:
                ans += dishes[i]
        else:
            ans += dishes[i]
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
import math

l = [int(input()) for i in range(5)]
c = [l[i] % 10 for i in range(5)]
index = 0
minimum = 10
for i in range(5):
    if c[i] != 0 and c[i] < minimum:
        minimum = c[i]
        index = i
a = [10 * math.ceil(l[i] / 10) for i in range(5)]
ans = sum(a) - a[index] + l[index]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
li = [[0]*2 for _ in range(5)]
count = 0
total = 0
for i in range(5):
    li[i][0] = int(input())
    li[i][1] = li[i][0]%10
    if li[i][1] == 0:
        count += 1
li.sort(key=lambda x:x[1])
for i in range(count):
    total += li[0][0]
    li = li[1:]
if count != 5:
    for i in range(5-count-1):
        total += (li[-1][0]+10-li[-1][1])
        li = li[:-1]
    print(total+li[0][0])
else:
    print(total)

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

minute = 9
z = 0
for i in range(4):
    if minute > food[i] % 10 and food[i] % 10 != 0:
        minute = food[i] % 10
        z = i

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

print(ans)

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

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

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

print(ans)

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

count = 0
tmp = 10
tmp1 = 124
ABCDE = []
for i in [A,B,C,D,E]:
  if tmp >= i%10 and i%10 != 0:
    tmp = i%10
    tmp1 = i

for i in [A,B,C,D,E]:
  if tmp1 == i and count == 0:
    ABCDE.append(i)
    count = 1
  elif i%10 != 0:
    ABCDE.append(10-(i%10) + i)
  elif i%10 == 0:
    ABCDE.append(i)
print(sum(ABCDE))

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

*_menus, = map(lambda x: math.ceil(x/10)*10, menus)

diff = []
for i in range(len(menus)):
    diff.append(_menus[i] - menus[i])

print(sum(_menus) - max(diff))

Solution (Python):
lis=[]
for i in range(5):
    x=int(input())
    if x%10!=0:
        lis.append([x%10,x])
    else:
        lis.append([10,x])
lis1=sorted(lis,reverse=True)
t=0
for i in range(4):
    if lis1[i][0]!=0:
        t+=lis1[i][1]+10-lis1[i][0]
    else:
        t+=lis1[i][1]
print(t+lis1[4][1])

Solution (Python):
A = []
B = []
C = []
s = 10
for _ in range(5):
  A.append(int(input()))
for a in A:
  s = a%10
  if s != 0:
    B.append(a-s+10)
    C.append(s)
  else:
    B.append(a)
if len(C) == 0:
  print(sum(A))
else:
  b = sum(B)
  print(b-10 +min(C))

Solution (Python):
lst=[int(input()) for i in range(5)]
count=0
num=0
for u in lst:
    if u%10==0:
        count+=u
    else:
        v=u//10+1
        num=max(num,v*10-u)
        count+=v*10
print(count-num)

Solution (Python):

from functools import reduce

lst = [int(input()) for i in range(5)]
lst.sort(key=lambda x: 10 - (x % 10) if x % 10 > 0 else 0)
ans = 0
for i, v in enumerate(lst):
  ans += v + (10 - v % 10) if v % 10 > 0 and i != len(lst) - 1 else v

print(ans)

Solution (Python):
A=[int(input()) for i in range(5)]
from itertools import permutations, combinations,combinations_with_replacement,product
L = list(permutations(range(5), 5))
ans = sum(A)+100
for i in L:
  time = 0
  for j in i:
    if time%10 !=0:
      time += (10-time%10)
    time += A[j]
  ans = min(ans ,time)
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[(i,i%10) for i in [a,b,c,d,e] if i%10!=0]
y=[i for i in [a,b,c,d,e] if i%10==0]
x=sorted(x,key=lambda x:x[1])
ans = sum(y)
if len(x)==0:
  print(ans)
else:
  ans += sum((i[0]//10+1)*10 for i in x[1:])
  ans+=x[0][0]
  print(ans)

Solution (Python):
dishes = [int(input()) for _ in range(5)]
tuple_ = tuple(n for n in map(lambda num: num % 10, dishes) if n)
print(sum(map(lambda num: num + 10 * (num % 10 != 0) - (num % 10), dishes)) + min(tuple_ if tuple_ else (10,)) - 10)

Solution (Python):
a = [int(input()) for i in range(5)]
if all(n%10==0 for n in a):
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b)
else:
    A = min([j%10 for j in a if j%10 != 0])
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b-(10-A))

Solution (Python):
a=int(input())
p=a%10
b=int(input())
q=b%10
c=int(input())
r=c%10
d=int(input())
s=d%10
e=int(input())
t=e%10
l=[a,b,c,d,e]
m=[p,q,r,s,t]
ans=0
if set(m)==set([0]):
    minimum=10
else:
    minimum=min(list(set(m)-set([0])))
def func(n):
    if n%10==0:
        return n
    else:
        return (n//10)*10+10
for i in range(5):
    ans+=func(l[i])
ans=ans-10+minimum
print(ans)

Solution (Python):
a=[]
b=[]
for i in range(5):
    x=int(input())
    a.append(x)
    if x%10!=0:
        b.append(x%10)
ans=0
for i in range(5):
    if a[i]%10!=0:
        a[i]=(a[i]//10)*10+10
    ans+=a[i]
if b:
    print(ans-10+min(b))
else:
    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 = 0

Min = 10

for i in range(len(l)):
    s  = l[i] % 10 
    if ( 9>= s >=1 and Min > s):
        Min = s

for i in range(len(l)):   
    s  = l[i] % 10 

    if(s == Min):
        Min = 99
    elif(9>= s >=1):
        l[i] += 10 - s
    
print(sum(l))

Solution (Python):
import math

dishes = [int(input()) for i in range(5)]
up = [math.ceil(dish/10)*10 for dish in dishes]
loss = [x-y for x, y in zip(up, dishes)]
print(sum(up)-max(loss))

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1



A=[int(input()) for i in range(5)]
A.sort(key=lambda x:(x-1)%10,reverse=True)
ans=0
for i in range(4):
    ai=A[i]
    ans+=math.ceil(ai/10)*10
ans+=A[-1]
print(ans)

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

A.sort(key=lambda x: 10 if x % 10 == 0 else x % 10, reverse=True)
ans = 0
for a in A[:4]:
    ans += a+(-a%10)
ans += A[-1]

print(ans)

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

x =[]
j=[]
for i in l:
    t = i%10
    if t != 0:
        x.append(t)
        j.append(i+10-t)
    else:
        j.append(i)

if len(x) == 0:
    print(sum(j))
else:
    print(sum(j)-10+min(x))

Solution (Python):
ans = 0
b = 0
for i in range(5):
    a = int(input())
    ans += -(-a//10)*10
    b = max(b, (10-a%10)%10)
ans -= b
print(ans)

Solution (Python):
from math import ceil
mnu = []
idx = []
for _ in range(5):
    tim = input()
    mnu.append(int(tim))
    idx.append(10) if tim[-1] == "0" else idx.append(int(tim[-1]))

lst = idx.index(min(idx))
res = mnu[lst]
for i in range(5):
    if lst == i:
        continue
    res += (ceil(mnu[i]/10)*10)
print(res)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
k=[]
for i in l:
    m=10
    for j in range(14):
        if 10*j-i>=0:
            m=10*j-i
            break
    k.append(m)
print(sum(l)+sum(k)-max(k))

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

mi = [a%10,b%10,c%10,d%10,e%10]
mm = [i for i in mi if i != 0]
mm.sort()
sum = 0
for i in range(5):
	if p[i]%10 != 0:
		sum += (p[i]//10+1)*10
	else:
		sum += p[i]//10*10
if (mm):
	sum -= 10- mm[0]
print (sum)

Solution (Python):
x=[int(input()) for i in range(5)]
y=[x[i] for i in range(5) if x[i]%10 != 0]
if y==[]:
    print(sum(x))
else:
    print(sum([-(-1*x[i]//10)*10 for i in range(5)])-10+min([x[i]%10 for i in range(5) if x[i]%10 != 0 ]))