Problem:
 Score: 200 points    Problem Statement  The restaurant AtCoder serves the following five dishes:   ABC Don (rice bowl): takes A minutes to serve.  ARC Curry: takes B minutes to serve.  AGC Pasta: takes C minutes to serve.  APC Ramen: takes D minutes to serve.  ATC Hanbagu (hamburger patty): takes E minutes to serve.   Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.  This restaurant has the following rules on orders:   An order can only be placed at a time that is a multiple of 10 (time 0 , 10 , 20 , ... ).  Only one dish can be ordered at a time.  No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.   E869120 arrives at this restaurant at time 0 . He will order all five dishes. Find the earliest possible time for the last dish to be delivered. Here, he can order the dishes in any order he likes, and he can place an order already at time 0 .      Constraints   A, B, C, D and E are integers between 1 and 123 (inclusive).         Input  Input is given from Standard Input in the following format:  A  B  C  D  E       Output  Print the earliest possible time for the last dish to be delivered, as an integer.        Sample Input 1 29
20
7
35
120      Sample Output 1 215  If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:   Order ABC Don at time 0 , which will be delivered at time 29 .  Order ARC Curry at time 30 , which will be delivered at time 50 .  Order AGC Pasta at time 50 , which will be delivered at time 57 .  Order ATC Hanbagu at time 60 , which will be delivered at time 180 .  Order APC Ramen at time 180 , which will be delivered at time 215 .   There is no way to order the dishes in which the last dish will be delivered earlier than this.       Sample Input 2 101
86
119
108
57      Sample Output 2 481  If we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:   Order AGC Pasta at time 0 , which will be delivered at time 119 .  Order ARC Curry at time 120 , which will be delivered at time 206 .  Order ATC Hanbagu at time 210 , which will be delivered at time 267 .  Order APC Ramen at time 270 , which will be delivered at time 378 .  Order ABC Don at time 380 , which will be delivered at time 481 .   There is no way to order the dishes in which the last dish will be delivered earlier than this.       Sample Input 3 123
123
123
123
123      Sample Output 3 643  This is the largest valid case.

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

if a%10==0:
  p=10
else:
  p=a%10
  a=a-p+10
  
if b%10==0:
  q=10
else:
  q=b%10
  b=b-q+10
  
if c%10==0:
  r=10
else:
  r=c%10
  c=c-r+10
  
if d%10==0:
  s=10
else:
  s=d%10
  d=d-s+10
  
if e%10==0:
  t=10
else:
  t=e%10
  e=e-t+10
  
x=a+b+c+d+e
y=min(p,q,r,s,t)
print(x+y-10)

Solution (Python):
M = [int(input()) for _ in range(5)]
m = []
T = 0
for i in range(5):
    if M[i] % 10 == 0:
        T += M[i]
    else:
        T += M[i]
        T += 10 - M[i] % 10
        m.append(M[i] % 10)
print(T - (10 - (10 if not m else min(m))))

Solution (Python):
import sys

def main():
    sinputl = sys.stdin.readline

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

    input.sort(key=lambda x: (x - 1) % 10)

    time = input.pop(0)

    for x in input:
        time += (x + 9) // 10 * 10

    print(time)

if __name__ == "__main__":
    main()

Solution (Python):
mr = 0
sm = 0
for i in range(5):
    nm = int(input())
    r = (10 - nm % 10) % 10
    sm += nm + r
    mr = max(r, mr)
print(sm - mr)

Solution (Python):
import math

sm = 0
dishes = []
for i in range(5):
    nm = int(input())
    if nm % 10 == 0:
        sm += nm
        continue
    dishes.append(nm)
last = min(dishes, key=(lambda x: x % 10), default=0)
discovered = False
for e in dishes:
    if e == last and not discovered:
        discovered = True
        continue
    sm += math.ceil(e / 10.0) * 10

print(sm + last)

Solution (Python):
A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]

print(sum(B)-max(diff))

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

Solution (Python):

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


list_2 = []
for i in range(5):
    list_2.append(list[i]%10)





list_3 = []

for i in range(5):
    list_3.append(((list[i]+ 9)//10)*10)



ans = 10
for i in range(5):
    if 0<list_2[i]<ans:
        ans = list_2[i]
print(sum(list_3)-(10-ans))

Solution (Python):
A = [int(input()) for _ in range(5)]
ans = 0
I = [i for i, a in enumerate(A) if a % 10 == 0]
for i in reversed(I):
    ans += A.pop(i)
if len(A) == 0:
    print(ans)
    exit()
A.sort(key=lambda a: a % 10)
ans += A.pop(0)
for i in range(len(A)):
    A[i] += 10 - (A[i] % 10)
ans += sum(A)
print(ans)

Solution (Python):



import sys

input = sys.stdin.readline

def main():
    M = [int(input()) for _ in range(5)]
    t = 0
    print(min([rec(0, i, M[:]) for i in range(len(M))]))

def rec(total, i, M):
    if len(M) == 1:
        total += M[i]
        return total
    else:
        if M[i] % 10 != 0:
            total += int(M[i] / 10) * 10 + 10
        else:
            total += M[i]
        del M[i]
    return min([rec(total, i, M[:]) for i in range(len(M))])

main()

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

ans = 0
tmp = []

for i in range(len(L)):
    if(L[i]%10 == 0):
        ans += L[i]
    else:
        ans += L[i] + (10 - L[i]%10)
        tmp.append(L[i]%10)

if(len(tmp) > 0):
    ans -= 10 - min(tmp)

print(ans)

Solution (Python):
dic=[]

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

sub=[]
t=0

for line in dic:
    t+=line
    sub.append((10-line%10)%10)

t+=sum(sub)-max(sub)
print(t)

Solution (Python):
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)

a = [int(input()) for _ in range(5)]
b = []
last_order = 0

for i in range(5):
	b.append(-(-a[i] // 10) * 10)
	if (a[i] % 10 < a[last_order] % 10) and (a[i] % 10 != 0):
		last_order = i

print(sum(b) - b[last_order] + a[last_order])

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

for i in range(5):
    if time[i] % 10 == 0:
        result += time[i]
    else:
        result += ((time[i] // 10)+1)*10
        a.append(time[i] % 10)
print(result - (10 - min(a)))

Solution (Python):
import math

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

def roundUp(x):
    '''
    Takes integer x.
    Returns x rounded up to the next multiple of 10
    '''

    while x%10 != 0:
        x = x + 1
    return x

arounded = (a-1)%10
brounded = (b-1)%10
crounded = (c-1)%10
drounded = (d-1)%10
erounded = (e-1)%10
if min(arounded, brounded, crounded, drounded, erounded) == arounded:
    print(roundUp(b) + roundUp(c) + roundUp(d) + roundUp(e) + a)
elif min(arounded, brounded, crounded, drounded, erounded) == brounded:
    print(roundUp(a) + roundUp(c) + roundUp(d) + roundUp(e) + b)
elif min(arounded, brounded, crounded, drounded, erounded) == crounded:
    print(roundUp(b) + roundUp(a) + roundUp(d) + roundUp(e) + c)
elif min(arounded, brounded, crounded, drounded, erounded) == drounded:
    print(roundUp(b) + roundUp(c) + roundUp(a) + roundUp(e) + d)
else:
    print(roundUp(b) + roundUp(c) + roundUp(d) + roundUp(a) + e)

Solution (Python):
from itertools import permutations

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

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

perm_times = list(permutations(cook_time))

result_time = 10**9

for perm_time in perm_times:
    total_time = 0
    cnt = 0
    for time in perm_time:
        cnt += 1
        if time % 10 != 0 and cnt != 5:
            total_time += time + 10 - time % 10
        else:
            total_time += time
        
    if result_time > total_time:
        result_time = total_time
        
    
    
print(result_time)

Solution (Python):
diff = 1000
total = 0

for i in range(5) :
    time = int(input())
    if time % 10 > 0 :
        diff = min(diff,time % 10)
    total += int((time + 9) / 10) * 10

if diff == 1000 :
    print(total)
else :
    print(total - 10 + diff)

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

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

Solution (Python):

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

min_i = 0
min_rest = 10
times = []
for i, x in enumerate(l):
    rest = x%10
    if rest > 0:
        times.append((x//10)*10+10)
        if rest < min_rest:
            min_i = i
            min_rest = rest
    else:
        times.append(x)

print(sum(times[:min_i])+sum(times[min_i+1:])+l[min_i])

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
mozi = [a, b, c, d, e]
rup = [round(mozi[i], -1) if mozi[i] % 10 == 0 else
       round(mozi[i] + 5, -1)
       for i in range(len(mozi))]

amari = [mozi[i] % 10 if mozi[i] % 10 != 0 else
         10 for i in range(len(mozi))]

m_r_a = list(zip(mozi, rup, amari))
sorta_m_r_a =(sorted(m_r_a, key=lambda x:x[2], reverse=True))

dishes_4sum = 0
for i in range(4):
    dishes_4sum += sorta_m_r_a[i][1]
dishes_5sum = dishes_4sum + sorta_m_r_a[4][0]

print(dishes_5sum)

Solution (Python):
l=[int(input()) for i in range(5)]
def A(i):
    return 10-(i-1)%10
l.sort(key=A)
t=0
for i in range(4):
    if l[i]%10==0:
        t+=l[i]
    else:
        t+=l[i]//10*10+10
print(t+l[4])

Solution (Python):
li = []
count = 0

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

    amari = list(map(lambda x: x % 10, li))
    sho = list(map(lambda x: x // 10, li))

for j in range(5):
    if amari[j] != 0:
        sho[j] = (sho[j]+1)*10
    else:
        sho[j] = sho[j]*10
        count += 1
        amari[j] += 123

if count == 5:
    print(sum(sho))
else:
    print(sum(sho) - 10 + min(amari))

Solution (Python):
ans = 0
Ri = 0 
Rm = 0 

for _ in range(5):
	I = int(input())

	
	if I%10 != 0:
		Ri = 10 - I%10

	
	ans += 10 * ((I + 9)//10) 

	
	if Ri > Rm:
		Rm = Ri 


ans = ans - Rm


print(ans)

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

li = [A,B,C,D,E]
li_nonzero=[]



for x in li:
    if x % 10 != 0:
        li_nonzero.append(x)

if len(li_nonzero) == 0:
    last_menu = li[4]
    li.remove(li[4])
else:
    z = li_nonzero[0]%10
    for y in li_nonzero:
        if y % 10 <= z:
            z = y%10
            last_menu = y
            
    li.remove(last_menu)

if len(li) < 4:
    while(len(li)==4):
        li.append(last_menu)
sum_time = 0
for menu in li:
    if menu % 10 != 0:
        sum_time = sum_time +( (menu//10)*10+10)
    else:
        sum_time = sum_time +( (menu//10)*10+0)
        
    
print(sum_time+last_menu)

Solution (Python):
times = []
min_unit_place = 9
min_unit_index = None

for i in range(5):
  time_i = input()
  times.append(int(time_i))
  unit_place = int(time_i[-1])
  if unit_place > 0 and min_unit_place >= unit_place:
    min_unit_place = unit_place
    min_unit_index = i
  
answer = 0
for i, t in enumerate(times):
  if i == min_unit_index or t%10 == 0:
    answer += t
  else:
    answer = answer + t + (10-t%10)

print(answer)

Solution (Python):
order = []
amari = []
show = []
sum = 0
for i in range(5):
  order.append(int(input()))
  s = order[i] % 10
  if(s == 0):
    s = 10
  t = order[i] - s + 10
  amari.append(s)
  sum += t
ans = sum - 10 + min(amari)
print(ans)

Solution (Python):

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

m = 0
res = 0

for x in A:
    if x%10 == 0:
        t = 0
    else:
        t = 10 - x%10
    res += x+t
    
    m = max(m,t)
    
print(res-m)

Solution (Python):
Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

if len(Time) > 0:
  ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)

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

all_list = [A, B, C, D, E]
amari = [A%10, B%10, C%10, D%10, E%10]
amari = [ 10 if i == 0 else i for i in amari]
min_index = amari.index(min(amari))
amari = [ 0 if i == 10 else i for i in amari]
goukei = 0
for i, one in enumerate(all_list):
    if i != min_index:
        if one%10 > 0:
            goukei += one + (10-one%10)
        else:
            goukei += one
goukei += all_list[min_index]
print(goukei)

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

total = 0
n = 0
mod10 = [i%10 for i in time]
mod10_l = []
for i in mod10:
    if i > 0:
        mod10_l.append(i)
for i,j in zip(mod10, time):
    if i == 0:
        total += j
    elif n == 0 and i == min(mod10_l):
        total += j
        n += 1
    else:
        total += j + 10-i
print(total)

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

ans = 0
x = 10

for i in range(5):
    if menu[i] % 10 == 0:
        ans += menu[i]
    else:
        x = min(x, menu[i] % 10)
        ans += (menu[i] // 10 + 1)*10

ans -= 10-x

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
All = [A, B, C, D, E]
_All = [A, B, C, D, E]
late = 10
late_menu = 0
total = 0
for menu in All:
    if menu % 10 == 0:
        total += menu
        _All.remove(menu)
if len(_All)>=1:
    for menu1 in _All:
        if menu1 % 10 <= late:
            late = menu1 % 10
            late_menu = menu1
    _All.remove(late_menu)
for x in _All:
    if x <= 10:
        x = 10
        total += x
    else:
        x = (x // 10 +1) * 10
        total += x
total = total + late_menu
print(total)

Solution (Python):
import math
from functools import reduce
from operator import add
from operator import sub


def round_up(x, y):

    if x % 10 == 0:
        return x
    else:
        roundup = int((x / y) + 1) * y
        return roundup



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

cook_time_round = list(map(lambda x: round_up(x, 10), cook_time))

cook_time_difference = list([sub(x, y) for x, y in zip(cook_time_round, cook_time)])

total_time = reduce(add, cook_time_round)

print(total_time - reduce(max, cook_time_difference))

Solution (Python):
dish = [int(input()) for i in range(5)]
reeltime = sorted([10 - (x%10) if x%10 != 0 else (x%10) for x in dish])
print(sum(dish)+sum(reeltime[:-1]))

Solution (Python):
dish = [int(input()) for i in range(5)]
reeltime = [10 - (x%10) if x%10 != 0 else (x%10) for x in dish]
a, b = 0, 0
for i, j in zip(dish, sorted(reeltime)):
    a += i
    b += 1
    if b != len(dish):
        a += j
print(a)

Solution (Python):
a = [int(input()) for _ in range(5)]
def ceil(x):
  if x % 10 != 0:
    return 10 * ((x // 10) + 1)
  else:
    return x
sum = 0
min = 10
for i in range(5):
  sum = sum + ceil(a[i])
  if a[i] % 10 != 0 and a[i] % 10 < min:
    min = a[i] % 10
print(sum - 10 + min)

Solution (Python):
a=list(map(int, [input() for i in range(5)]))
b=map(lambda x:(10-(x%10))%10, a)
ans=0
for i in range(5):
    ans+=a[i]
    if (a[i]%10)!=0:
        ans+=10-(a[i]%10)
print(ans-max(b))

Solution (Python):
import sys
import os


time=0
tmax=10
for i in range(5):
    a=int(input())
    if a%10==0:
        time +=a
    else:
        time += a-a%10+10
        tmax=min(tmax,a%10)
    
print(time+tmax-10)

Solution (Python):
Times =[int(input())for i in range(5)]
def realtime(n):
    return (-(-n//10))*10

def amari(n):
    if n%10 == 0:
        return 10
    else:
        return n%10

Realtimes = list(map(realtime,Times))
amaris = list(map(amari,Times))
finalist = amaris.index(min(amaris))

ans = sum(Realtimes) + Times[finalist] - Realtimes[finalist]
print(ans)

Solution (Python):

import math

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

time = 0
mini = 10
for x in n:
    rest = x%10
    if rest != 0:
        mini = min(rest, mini)
    while x%10 != 0:
        x = math.ceil(x/10)*10
    time += x
print(time-10+mini)

Solution (Python):


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

time = 0
mini = 10
for x in n:
    rest = x%10
    if rest != 0:
        mini = min(rest, mini)
    while x%10 != 0:
        x += 1
    time += x
print(time-10+mini)

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

Solution (Python):
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dat = [a,b,c,d,e]
dattime = map
tindex = 0
tnum = 10

for i in range(5):
    t = dat[i] % 10
    t = 10 if t == 0 else t
    if tnum > t:
        tindex = i
        tnum = t

sum = 0

for i in range(5):
    if i != tindex:
        sum += int( math.ceil(dat[i] / 10) * 10 )
    else:
        sum += dat[i]
print(sum)

Solution (Python):
a = []
low = 10
ans = 0
for i in range(5):
    a.append(int(input()))
    if a[i] % 10 != 0:
        low = min(low, a[i]%10)
    while (a[i] % 10 != 0):
        a[i] += 1
    ans += a[i]

if low != 10:
    print(ans - 10 + low)
else:
    print(ans)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



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


def main():
    v = []
    for _ in range(5):
        v.append(int(input()))
    v.sort()

    ans = INF
    for p in permutations(v):
        t = 0
        for x in p:
            if t % 10 != 0:
                t += 10 - (t % 10)
            t += x

        ans = min(ans, t)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    a = [int(input()) for i in range(5)]
    a.sort(key=lambda x: x%10 if x%10 != 0 else 10, reverse=True)
    ans = 0
    for aa in a[:4]:
        if aa%10 != 0:
            ans += aa+(10-aa%10)
        else:
            ans += aa
    ans += a[4]
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
lis = [int(input()) for _ in range(5)]
lis = sorted(lis,key=lambda x:(10-(x%10))%10,reverse=True)
lis = [(j+9)//10*10 if i != 0 else j for i,j in enumerate(lis)]
print(sum(lis))

Solution (Python):
i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]

if not i2:
    min = i[len(i)-1]

else:
    min = i2[len(i2)-1]

for x in i:
    if 0 < x % 10 < min % 10:
        min = x
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))

Solution (Python):
order_time = [0, 0, 0, 0, 0]
order = len(order_time)
time = 0
last_order = 9
count_change = 0

for i in range(0, order):
    order_time[i] = int(input())
    if (order_time[i] % 10 != 0) and (order_time[i] % 10 <= last_order % 10):
        last_order = order_time[i]
        count_change += 1

for i in range(0, order):
    if order_time[i] % 10 != 0:
        time += order_time[i] // 10 * 10 + 10
    else:
        time += order_time[i]

if count_change == 0:
    last_order = 0
else:
    time -= last_order // 10 * 10 + 10
    time += last_order

print(time)

Solution (Python):
def addTime(x):
  return (x + 9) // 10 * 10

def diff(x):
  return addTime(x) - x

def main():
  a = [int(input()) for i in range(5)]
  ans = 0
  for i in a:
    ans = ans + addTime(i)
  
  diffList = []
  for i in a:
    diffList.append(diff(i))

  ans = ans - max(diffList)
  print(ans)

main()

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
list = [A, B, C, D, E]
  
minimam = 10
sum = 0
  
for i in list:
  if i%10 < minimam and i%10 != 0:
    minimam = i%10
  sum += ((i+9)//10)*10

print(sum-10+minimam)

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

def make_ten(i):
    ans = 0
    while i % 10 != 0:
        i += 1
        ans += 1
    return [i,ans]

anslist = []
diflist = []
for i in range(5):
    anslist.append(make_ten(A[i])[0])
    diflist.append(make_ten(A[i])[1])

print(sum(anslist)-max(diflist))

Solution (Python):
i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]

if not i2:
    min = i[len(i)-1]

else:
    min = i2[len(i2)-1]

count = 0
for x in i:
    if 0 < x % 10 < min % 10:
        min = x
        count += 1
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))

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

sub = []
t = 0

for line in l:
    t += line
    sub.append((10 - line % 10) % 10)

t += sum(sub) - max(sub)
print(t)

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

s = 0
sabun = []

s += a
sabun.append((10 - a % 10) % 10)
s += b
sabun.append((10 - b % 10) % 10)
s += c
sabun.append((10 - c % 10) % 10)
s += d
sabun.append((10 - d % 10) % 10)
s += e
sabun.append((10 - e % 10) % 10)

s += sum(sabun) - max(sabun)
print(s)

Solution (Python):
import math

list = []
for i in range(5):
    list.append(int(input()))
sum = 0
zeroList = [list[i] for i in range(len(list)) if list[i]%10 == 0]
otherList = [list[i] for i in range(len(list)) if not list[i]%10 == 0]
def func(x):
    return x % 10
otherList.sort(key=func)
for i in range(len(zeroList)):
    sum += zeroList[i]
for i in (otherList[1:]):
    sum += math.ceil(i/10)*10
if not len(otherList) == 0:
    sum += otherList[0]
print(sum)

Solution (Python):
a = [0 for _ in range(5)]
b = [0 for _ in range(5)]

for i in range(5):
    d = int(input())
    a[i] = d // 10
    if d % 10 != 0:
        a[i] += 1
    b[i] = (d-1) % 10

print((sum(a) - 1) * 10 + min(b) + 1)

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

sum = 0
counter = 0

list = [[A,A%10], [B,B%10], [C,C%10], [D,D%10], [E,E%10]]
list = sorted(list, key=lambda x:x[1])
for i in range(4):
    if list[i][1] == 0:
        sum += list[i][0]
        counter += 1
for i in range(len(list)-1,counter,-1):
    if list[i][0] % 10 != 0:
        sum += 10*(list[i][0] // 10 + 1)
    else:
        sum += list[i][0] 
sum += list[counter][0]
print(sum)

Solution (Python):


Dishes_list = [0] * 5
total_list = [0] * 5
one_rank = 10
total_time = 0

for i in range(0, 5):
    Dishes_list[i] = input()

for i in range(0, 5):
    a = int(Dishes_list[i])
    syo = a // 10
    amari = a % 10
    a = syo * 10
    if amari > 0:
        a += 10
    if (amari < one_rank) and (amari != 0):
        one_rank = amari
    total_list[i] = str(a)

for i in range(0, 5):
    total_time += int(total_list[i])

if one_rank != 0:
    total_time -= 10
    total_time += one_rank

print(total_time)

Solution (Python):
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

li = []
for i in range(5):
    li.append(II())

sum_ = 0
li_mod = []
for i in li:
    if i%10 == 0:
        sum_ += i
    else:
        sum_ += ((i//10)+1)*10
        li_mod.append(10-i%10)
if li_mod:
    sum_ -= max(li_mod)

print(sum_)

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

l=0
for i in range(5):
  if r[l]%10>r[i]%10 and r[i]%10!=0:
    l=i
ans=0
for i in range(5):
  if l==i:
    ans+=r[i]
  else:
    ans+=(r[i]+9)//10*10

print(ans)

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

print(s)

Solution (Python):
a = [0 for _ in range(5)]

idx = 0
tmp = 9
for i in range(5):
    a[i] = int(input())
    if a[i] % 10 == 0:
        continue
    elif a[i] % 10 < tmp:
        idx = i
        tmp = a[i] % 10
        

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

print(ans)

Solution (Python):
m = 10
f = 0
for _ in range(5):
    k = int(input())
    if k%10==0:
        f += k//10
    else:
        f += k//10+1
        if k%10<m:
            m = k%10
print(10*(f-1)+m)

Solution (Python):
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
if not cnt_l:
    cnt_l.append(0)
print(t - max(cnt_l))

Solution (Python):
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a//10
a2=a%10
if a2==0:
    a1-=1
    a2=10
b1=b//10
b2=b%10
if b2==0:
    b1-=1
    b2=10
c1=c//10
c2=c%10
if c2==0:
    c1-=1
    c2=10
d1=d//10
d2=d%10
if d2==0:
    d1-=1
    d2=10
n=e//10
m=e%10
if m==0:
    n-=1
    m=10
min1=min(a2,b2,c2,d2,m)
ans=(a1+b1+c1+d1+n+4)*10+min1
print(ans)

Solution (Python):
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a//10
a2=a%10
if a2==0:
    a1-=1
    a2=10
b1=b//10
b2=b%10
if b2==0:
    b1-=1
    b2=10
c1=c//10
c2=c%10
if c2==0:
    c1-=1
    c2=10
d1=d//10
d2=d%10
if d2==0:
    d1-=1
    d2=10
n=e//10
m=e%10
if m==0:
    n-=1
    m=10
min1=min(a2,b2,c2,d2,m)
if a2==10 or b2==10 or c2==10 or d2==10 or m==10:
    ans=(a1+b1+c1+d1+n+4)*10+min1
else:
    ans=(a1+b1+c1+d1+n+4)*10+min1
print(ans)

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

min = 9
num = 0
for i in range(len(A)):
    if min > A[i]%10 and A[i] % 10 != 0:
      min = A[i]%10
      num = i
      
ans = 0
for i in range(5):
  if i != num:
    ans = ans + int((A[i]+9)/10) * 10
ans = ans + A[num]

print(ans)

Solution (Python):
t=0
for i in sorted(map(int,list(open(0))),key=lambda x:-x%10-(x%10<1)):t+=i+(10-t)%10
print(t)

Solution (Python):
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

order = [int(input()) for _ in range(5)]
ans = 0
last = INF
for i in range(5):
    ans += ((order[i]-1)//10+1) * 10
    last = min(last,(order[i]-1)%10+1)

print(ans-10+last)

Solution (Python):
menu = [int(input()) for ii in range(0,5)]
remainder=[0]*len(menu)

for ii in range(0,len(menu)):
    remainder[ii] =abs(10-menu[ii] % 10)
    if remainder[ii] == 10:
        remainder[ii]=0

final_menu_index = remainder.index(max(remainder))

print(sum(menu)+sum(remainder)-remainder[final_menu_index])

Solution (Python):
A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]

print(sum(B)-max(diff))

Solution (Python):


def sub():
    items = [int(input()) for _ in range(5)]
    ms = [e % 10 for e in items]

    minIdx = None
    minMod = 11
    for i, m in enumerate(ms):
        if m == 0:
            continue
        if m < minMod:
            minMod = m
            minIdx = i
    if minIdx is None:
        print(sum(items))
        return
    others = items[:minIdx] + items[minIdx+1:]
    cum = 0
    for a in others:
        m = a % 10
        if m == 0:
            cum = cum + a
        else:
            cum = cum + a + (10 - m)
    cum = cum + items[minIdx]
    print(cum)

sub()

Solution (Python):
t=0
for i in sorted([int(input())for i in' '*5],key=lambda x:-x%10-(x%10<1)):t+=i+(10-t)%10
print(t)

Solution (Python):
t=0
for i in sorted([int(input())for i in' '*5],key=lambda x:-x%10-(x%10<1)):t+=i+(10-t%10)%10
print(t)

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

time = []
min = 10

for dish in dishes:
    if dish % 10 == 0:
        time.append(dish)
    else:
        time.append((dish // 10 + 1)* 10)
        if min > dish % 10:
            min = dish % 10

print(sum(time) - (10 - min))

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

result = 0

hasuu = [item % 10 for item in [A, B, C, D, E] if item % 10 != 0]

for item in [A, B, C, D, E]:
  if item % 10 == 0:
    result += item 
  else:
    result += (item // 10 + 1) * 10
    
if hasuu != []:
  result = int(result - 10 + min(hasuu))

print(result)

Solution (Python):
N=5
s= list(int(input()) for i in range(N))

ans=0
min=10
for a in s:
  if a%10==0:
    ans+=a
  else:
    ans+=a+(10-(a%10))
    if min>a%10:
      min=a%10
    
print(ans+min-10)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a,b,c,d,e]
g = 0
sm = f[0]%10
for i in f:
    if i %10 == 0:
        g = g+ i
    else:
        g = g + 10*(i//10)+10
        if i%10 < sm:
            sm = i%10
if sm == 0:
    print(g)
else:
    print(sm+g-10)

Solution (Python):
l=[int(input()) for i in range(5)]
L=[(l[i]-1)//10+1 for i in range(5)]
l_1=[(l[i]-1)%10+1 for i in range(5)]
print(10*sum(L)+min(l_1)-10)

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

ans = 0
min_val = 99
flag = False

for i in range(5):
  if l[i][-1] == "0":
    ans += int(l[i])
  else:
    if int(l[i][-1]) <= int(str(min_val)[-1]):
      if flag:
        ans += (-(-int(min_val)//10))*10
      flag = True
      min_val = l[i]
    else:
      ans += (-(-int(l[i])//10))*10
if flag:
  ans += int(min_val)
print(ans)

Solution (Python):
import math
elements = [int(x) for i in range(5) for x in input().split()]
sum = 0
elements = sorted(elements,key=lambda x: x%10 if(x%10==0) else 10-x%10)
for i in range(len(elements)):

    if(elements[i]%10 == 0 or i == 4):
        sum+= elements[i]
    else:
        sum+= elements[i] + 10 - elements[i]%10
print(sum)