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

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    a = []
    for i in range(5):
        a.append(I())

    ans = inf
    for arr in itertools.permutations(range(5)):
        t = 0
        for j, i in enumerate(arr):
            t += a[i]
            if t % 10 != 0 and j < 4:
                t = (t // 10 + 1) * 10
        ans = min(ans, t)
    print(ans)

main()

Solution (Python):
import math
a=[]
first=[]
for i in range(5):
    temp=str(input())
    a.append(temp)
    first.append(int(temp[-1]))
nin=0
nva=9

for i in range(5):
    if first[i]!=0 and first[i]<nva:
        nin=i
        nva=first[i]

ans=0
for i in range(5):
    if i!=nin:
        temmp=int(a[i])
        temmp=math.ceil((temmp-0.5)/10)*10
        ans+=temmp
    else:
        ans+=int(a[i])
print(ans)

Solution (Python):

import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)
dl = [0]
s = np.ceil(n/10)*10

if max(n%10)==0:
    print(int(np.sum(s)))
    exit()
m = [e for e in n%10 if e not in dl]
print(int(np.sum(s)-(10-min(m))))

Solution (Python):
import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
z = []
x = []
y = [A, B, C, D, E]
for i in range(5):
    a = math.ceil(y[i] / 10)
    a *= 10
    x.append(a)
for i in range(5):
    c = x[i] - y[i]
    z.append(c)
k = max(z)
print(sum(x) - k)

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

X = [I() for i in range(5)]
Y = [x % 10 for x in X if x % 10 != 0]
ans = sum(10*((x-1)//10+1) for x in X)

if len(Y) == 0:
    print(ans)
else:
    print(ans-10+min(Y))

Solution (Python):

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

import math

suma = sum(math.ceil(aa/10)*10 for aa in a)
ans=10**10
for i in range(5):
    ans = min(ans,a[i] + suma - math.ceil(a[i]/10)*10 )
print(ans)

Solution (Python):
List = []
for i in range (5):
  List.append(int(input()))
res = 10
n = 0
calc = 0
RES = 0
for i in range(5):
  n = List[i]%10
  RES += List[i]
  if n == 0:
    pass
  else:
    res = min(n,res)
    calc += 10-n
RES = RES + calc -10 + res
print(RES)

Solution (Python):
l,s = [],0
for _ in range(5):
    l.append(int(input()))
if len(set(l))==1:
    if l[0]%10 != 0:
        s = (10-(l[0]%10))*4
    print(sum(l) + s)
else:
    a = list(i%10 for i in l)
    b = list(10-i if i%10 else 0 for i in a)
    p = b.index(max(b))
    ans = 0
    for i in range(5):
        if l[i] != l[p]:
            ans += l[i]
            ans += b[i]
    print(ans+l[p])

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

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

def roundup(n):
    return int(math.ceil(n /10)) * 10
def get_digit(number):
    return number % 10   
s = 0
m = []
li = [A, B, C, D, E]
for i in range(len(li)):
    if get_digit(li[i]) >= 1:
        m.append(get_digit(li[i]))
f = False
m.sort()        
for l in range(len(li)):
    if len(m) > 0:
        if m[0] == get_digit(li[l]) and f == False:
            s += li[l]
            f = True
        else:
            s += roundup(li[l])
            
    else:
        s =sum(li)
print(s)

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

ans = 10**9
for v in itertools.permutations([a,b,c,d,e],5):
    time = 0
    for i in range(4):
        time += v[i]
        amari = time % 10
        if amari != 0:
            time += 10 - amari
    time += v[4]
    ans = min(ans,time)

print(ans)

Solution (Python):
dish = [int(input()) for i in range(5)]
s = sum(dish)
l = []
l_d =[]

for i in range(5):
    if dish[i]%10 != 0:
        l.append(dish[i]%10)

for i in l:
    l_d.append(-(i-10))

print(s+sum(sorted(l_d)[:-1]))

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

x=10
for i in a:
  if i>0:
    x=min(x,i)
if x ==10:
  x = 0
y = a.index(x)
l = dish.pop(y)

time = [(i//10+1)*10  if i%10 != 0 else i for i in dish]

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

Solution (Python):
n = [int(input()) for i in range(5)]
m = min(n, key=lambda x: (x + 9) % 10)
n.remove(m)
print(sum([(i+9)//10 * 10 for i in n]) + m)

Solution (Python):
import math

lst = []
min_1 = "129"
for i in range(5):
    s = input()
    lst.append(s)
    if s[-1] != "0" and s[-1] <= min_1[-1]:
        min_1 = s
if min_1 == "129": min_1 = lst[0]        
lst.remove(min_1)
a = list(map(lambda x:math.ceil(int(x)/10)*10,lst))
print(sum(a) + int(min_1))

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

lst1 = []
lst2 = []
for i in range(5):
    if T[i]%10 == 0:
        lst1.append([0,T[i]])
    else:
        lst2.append([T[i]%10,T[i]])

lst2 = sorted(lst2, reverse=True)
lst = lst1 + lst2

ans = 0
for i in range(5):
    ans += lst[i][1]
    if lst[i][0] == 0:
        pass
    else:
        ans += 10 - lst[i][0]

if lst[i][0] == 0:
    pass
else:
    ans -= 10 - lst[i][0]

print(ans)

Solution (Python):
n = [int(input()) for i in range(5)]
m = min(n, key=lambda x: (x + 9) % 10)
n.remove(m)
print(sum([(i+9)//10 * 10 for i in n]) + m)

Solution (Python):
def main():
  num = [int(input()) for i in range(5)]
  min_num=num[0]%10
  last_index=0
  ans=0
  for i in range(1,len(num)):
    if( num[i]%10 < min_num and num[i]%10!=0) or min_num==0 :
      min_num=num[i]%10
      last_index=i
  
  for i in range(0,len(num)):
    if i==last_index or num[i]%10==0:
      ans+=num[i]
    else:
      ans+=((int(num[i]/10)+1)*10)
  print(ans)

main()

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

Solution (Python):
from itertools import permutations

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

ans = []
for orders in permutations(Order):
    
    tmp = 0
    cnt = 1
    for order in orders:
        tmp += order
        if cnt == 5:
            ans.append(tmp)
        for _ in range(11):
            if tmp % 10 == 0:
                break
            tmp += 1
        cnt += 1

print(min(ans))

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

for n in range(5):
  S = 0
  A = [A[4]]+A[:4]
  for a in A[:4]:
    S += -(-a//10)*10
  ans = min(ans,S+A[4])
  
print(ans)

Solution (Python):
from itertools import permutations
import math
menu=5
ABCDE=[int(input()) for i in range(menu)]
orders=list(permutations(ABCDE,menu))
minimum=sum(math.ceil(time/10)*10 for time in ABCDE)
for order in orders:
    total=order[0]
    for i in range(1,menu):
        total+=math.ceil(order[i]/10)*10
    minimum=min(minimum,total)
print(minimum)

Solution (Python):
from itertools import permutations
import math
menu=5
times=[int(input()) for i in range(menu)]
orders=list(permutations(times,menu))
minimum=sum(math.ceil(time/10)*10 for time in times)
for order in orders:
    total=order[0]
    for i in range(1,menu):
        total+=math.ceil(order[i]/10)*10
    minimum=min(minimum,total)
print(minimum)

Solution (Python):
*A, = map(int, open(0).read().split())
B = [(10-a%10)%10 for a in A]
print(sum(A) + sum(B) - max(B))

Solution (Python):
import math

menu = [int(input()) for i in range(5)]
remain = [l % 10 for l in menu]

if sum(remain) == 0:
    print(sum(menu))
else:
    cost = [math.ceil(l / 10) for l in menu]
    for i in range(5):
        if remain[i] == 0:
            remain[i] = 10
    print(10 * sum(cost) - 10 + remain[remain.index(min(remain))])

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
N = [A, B, C, D, E]
loss = []
for i in range(5):
  if N[i]%10 == 0:
    loss.append(10)
  else:
    loss.append(N[i]%10)
Wait = (N[loss.index(min(loss))]) 
N.remove(Wait)
for i in range(4):
  if N[i]%10 == 0:
    Wait += N[i]
  else:
    Wait += ((N[i]//10+1)*10)
print(Wait)

Solution (Python):
import numpy as np
X = []
for i in range(5):
  tmp = int(input())
  X.append(tmp)

X_remain = np.zeros(5)
for i in range(5):
  if X[i] % 10 == 0:
    X_remain[i] = 0
  else:
    X_remain[i] = 10 -(X[i] % 10)


ans = 0
count = 0
for i in range(10):
  for j in range(5):
    if X_remain[j] == i:
      if count < 4:
        ans += X[j] + X_remain[j]
        count += 1
      else:
        ans += X[j]
print(int(ans))

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

ans = 0
ans += T[0]
for i in range(1,5):
  ans += T[i]
  if T[i] % 10 != 0:
    ans += 10 - T[i] % 10
print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a = [int(input()) for _ in range(5)]
    b = [(x + 9) // 10 * 10 for x in a]

    ans = INF
    for i in range(5):
        ans = min(ans,sum(b) - b[i] + a[i])

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
short = 10
ans = 0
for i in range(5):
    n = int(input())
    if short > n%10 and n%10 > 0:
        short = n%10
    ans += (n//10)*10
    if n%10 > 0:
        ans += 10
ans -= 10 if short > 0 else 0
print(ans+short)

Solution (Python):
from itertools import permutations
def main():
    a=[int(input()) for _ in range(5)]
    ans=[]
    for x in permutations(a):
        t = 0
        for y in x:
            if t % 10 != 0:
                t = (t//10 + 1) * 10
            t += y
        ans.append(t)
    print(min(ans))
            
    
if __name__ == "__main__":
    main()

Solution (Python):
import sys
import itertools
from decimal import Decimal, ROUND_CEILING
array = [ int(input()) for I in range(5) ]
for I in array:
    if not ( 1 <= I <= 123 ):
        sys.exit()

min = (123 * 5) + (10 * 5)
for J in list(itertools.permutations(array)):
    time = 0
    for K in J[0:-1]:
        time += K
        time = Decimal(time).quantize(Decimal('1E1'), rounding=ROUND_CEILING)
    time += J[-1]
    if min > time: min = time
print(min)

Solution (Python):

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
last = 9
time = 0
cou = 0
check = 0

l = [A,B,C,D,E]
for i in l:
    if i%10 !=0 :
        if last%10 >= i%10:
            last = i
            check +=1
if check !=0:
    l.remove(last)
    l.append(last)
for i in range(5):
    time += l[i]
    if i == 4:
        break
    while time%10 != 0:
        time += 1
        
    
print(time)

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
num = min((A-1)%10,(B-1)%10,(C-1)%10,(D-1)%10,(E-1)%10)
print((-(-A//10)*10)+(-(-B//10)*10)+(-(-C//10)*10)+(-(-D//10)*10)+(-(-E//10)*10)+num-9)

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

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

def main():
    dishes = [int(input()) for _ in range(5)]
    ans = float('inf')
    for dish in itertools.permutations(dishes, 5):
        time = 0
        for i in range(5):
            time += dish[i]
            if time%10 != 0 and i < 4:
                time += 10 - time%10
        ans = min(ans, time)
    print(ans)
            
if __name__ == '__main__':
    main()

Solution (Python):
import math

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

d_align = [math.ceil(d / 10) * 10 for d in ds]
d_mirgin = [math.ceil(d / 10) * 10 - d for d in ds]
print(sum(d_align) - max(d_mirgin))

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

fcn = []   
for f in fn:
  if f%10 != 0:
    fcn.append([f,f%10-10])
  else :
    fcn.append([f,0])

fcn.sort(key=lambda x: x[1],reverse=True)    

sum = 0
for i in range(len(fcn)):
  if i != len(fcn)-1:
    sum += fcn[i][0] - fcn[i][1]
  else :
    sum += fcn[i][0]
  
print(sum)

Solution (Python):
l = []
min_s = 10
check = 0

for i in range(5):
    a = int(input())
    l.append(a)
    s = int(str(a)[-1])

    if s == 0:
        s = 10
    if s < min_s:
        min_s = s
        check = i

ans = 0
for i in range(len(l)):
    if i == check:
        ans += l[i]
    else:
        if int(str(l[i])[-1]) != 0:
            ans += l[i] + (10-int(str(l[i])[-1]))
        else:
            ans += l[i]

print (ans)

Solution (Python):
import math
a = [int(input()) for _ in range(5)]
ans = 0
min0 = 10
for i in a:
    if i%10 != 0:
        i = str(i)
        ans += int(i)+10-int(i[-1])
        min0 = min(int(i[-1]), min0)
    else:
        ans += i
print(ans-10+min0)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

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

ma = 0
s = 0
for i in li:
    tmp = ((i + (10 - 1)) // 10) * 10
    s += tmp
    ma = max(ma, abs(i - tmp))

print(s - ma)

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

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

ans = 10 ** 10
def order(t, mr):
  global ans
  if len(mr) == 0:
    ans = min(ans, t)
    return
  
  if t % 10 != 0:
    t = t - (t % 10) + 10
  for i in range(len(mr)):
    nextt =  t + mr[i]
    nextmr = copy.deepcopy(mr)
    del nextmr[i]
    order(nextt, nextmr)
order(0, m)
print(ans)

Solution (Python):
X = []
n = 0
idx = 0
for i in range(5):
    x = int(input())
    X.append(x)
    m = (10 - x % 10) % 10
    if n < m:
        n = m
        idx = i
res = 0
for i in range(5):
    if i != idx:
        res += (10 - X[i] % 10) % 10 + X[i]
print(res + X[idx])

Solution (Python):
time=[int(input()) for _ in range(5)]
loss=[(10-(x%10))%10 for x in time]
loss.sort()
loss.pop(-1)

print(sum(time)+sum(loss))

Solution (Python):
lst = [input() for i in range(5)]
d = [int(num) for num in lst]
lst_one = [int(list(i)[-1]) for i in lst]
if lst_one.count(0) == len(lst_one):
  print(sum(d))
else:
  if lst_one.count(0) == 0:
    idx = lst_one.index(min(lst_one))
  else:
    no_zero = [i for i in lst_one if i != 0]
    m = min(no_zero)
    idx = lst_one.index(m)

  x = d[idx]
  del d[idx]

  for i in range(len(d)):
    if d[i] % 10 != 0:
      d[i] = 10*(int((d[i]/10))+1)
    else:
      continue
  print(sum(d) + x)

Solution (Python):
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
M=max(a,b,c,d,e)
print(A+a+B+b+C+c+D+d+E+e-M)

Solution (Python):
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
M=max(a,b,c,d,e)
print(A+a+B+b+C+c+D+d+E+e-M)

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]





N = [ii() for _ in range(5)]

sa = 0
ans = 0
for num in N:
    if not num % 10:
        ans += num
    else:
        add = (num // 10 + 1) * 10
        ans += add
        sa = max(sa, add - num)

print(ans - sa)

Solution (Python):
import math

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

time = 0
last = 0
for i in range(5):
    time += math.ceil(l[i] / 10) * 10
    if l[i] % 10 == 0:
        continue
    else:
        last = max(last, 10 - (l[i] % 10))

print(time - last)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A%10
b=B%10
c=C%10
d=D%10
e=E%10
result=0
if a==0:
    result+=A
else:
    result+=(A+10-a)
if b==0:
    result+=B
else:
    result+=(B+10-b)
if c==0:
    result+=C
else:
    result+=(C+10-c)
if d==0:
    result+=D
else:
    result+=(D+10-d)
if e==0:
    result+=E
else:
    result+=(E+10-e)
if a==b==c==d==e==0:
    print(result)
else:
    l=set([a,b,c,d,e])
    l.discard(0)
    print(result-(10-min(l)))

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

Solution (Python):

(*t, ) = map(int, open(0).read().split())
print(sum(-(-i // 10)*10 for i in t) + min(-(-i % 10) for i in t))

Solution (Python):
import math
m = [int(input()) for _ in range(5)]
ans = 0
b = 0
for i in m:
  ans+=math.ceil(i/10)*10
  if i%10!=0:
    b = max(b, 10-i%10)
print(ans-b)

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

li = [ri() for _ in range(5)]
lis = [math.ceil(i/10)*10 for i in li]
ans = inf
for i in range(5):
  ans = min(sum(lis[:i])+li[i]+sum(lis[i+1:]), ans)
print(ans)

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

s = 0
t = 125
for i in range(5):
  if abcde[i]%10 != 0:
    if int(str(abcde[i])[-1]) < t:
      s = i
      t = int(str(abcde[i])[-1])

ans = 0
for i in range(5):
  if s == i: continue
  if abcde[i] % 10 == 0: ans += abcde[i]
  else:
    while abcde[i]%10 != 0:
      abcde[i] += 1
    ans += abcde[i]
print(ans+abcde[s])

Solution (Python):
Time = [int(input()) for X in range(0,5)]
Loss = [(10-X%10)%10 for X in Time]
print(sum(Time)+sum(sorted(Loss)[:4]))

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

import math

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

def get_ceiled_num(num):
    ret = math.ceil(num/10)*10
    return ret














ceiled_a2e = [get_ceiled_num(i) for i in a2e]

tot = sum(ceiled_a2e)

ans = tot

for i,j in zip(a2e, ceiled_a2e):
    tmp = tot-(j-i)
    ans = min(ans, tmp)
    
print(ans)

Solution (Python):
time = [int(input()) for _ in range(5)]
dif = 0
dif_max = 0
for i in time:
    tmp = abs(10-int(str(i)[-1]))
    tmp = 0 if tmp == 10 else tmp
    dif += tmp
    dif_max = max(dif_max,tmp)

print(sum(time)+dif-dif_max)

Solution (Python):

import itertools
import math
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
List=[A,B,C,D,E]
ans=10000000
for i in itertools.permutations(List, 5):
    AList=list(i)
    R=0
    for i in range(5):
        if str(AList[i])[-1]!=0 and i!=4:
            R+=math.ceil((AList[i])/10)*10
        else:
            R+=AList[i]
    ans=min(ans,R)
    
    
print(ans)

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

m = 10
ans = 0
for i in (a, b, c, d, e):
    q, mod = divmod(i, 10)
    if mod == 0:
        ans += i
    else:
        m = min(m, mod)
        ans += (q + 1) * 10
print(ans - 10 + m)

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

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

b = list(map(f, time))

ans = sum(time) + sum(b) - max(b)
print(ans)

Solution (Python):
a = list(int(input()) for _ in range(5))
b = list(map(lambda x: (10-x%10)%10, a))

ans = sum(a)+sum(b)-max(b)
print(ans)

Solution (Python):
import math
A = [int(input()) for _ in range(5)]
ad = 0
rm = 0
for i in range(5):
    ad += math.ceil(A[i]/10)*10
    rm = max(math.ceil(A[i]/10)*10 - A[i],rm)
print(ad-rm)

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

ma = 0
for i in range(1,5):
  if m[i][-1] == '0':
    continue
  if int(m[ma][-1]) > int(m[i][-1]):
    ma = i
c = 0
for i in range(5):
  tmp = int(m[i])
  if i != ma and tmp % 10 !=0:
    tmp = tmp // 10 * 10 + 10
  c += tmp
print(c)

Solution (Python):
p=[int(input()) for i in range(5)]
q=[10*(0--i//10) for i in p]
res=10**6
for i in range(5):
    res =min(res,sum(q)-q[i]+p[i])
print(res)

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)]
ans=sum(ceiled)-max(can_save)
print(ans)

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

flg = -1
for i in range(1,10):
    if flg != -1:
        break
    for j in range(5):
        if abcde[j][-1]==str(i):
            flg = j
            break
total = 0
for i in range(5):
    if flg==i:
        total += int(abcde[i])
    else:
        total += math.ceil(int(abcde[i])/10)*10
print(total)

Solution (Python):
from math import ceil

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

x = min((a - 1) % 10, (b - 1) % 10, (c - 1) % 10, (d - 1) % 10, (e - 1) % 10) + 1
ans = ceil(a / 10) * 10 + ceil(b / 10) * 10 + ceil(c / 10) * 10 + ceil(d / 10) * 10 + ceil(e / 10) * 10
ans -= (10 - x)
print(ans)

Solution (Python):
from sys import stdin
from itertools import permutations
def main():
    
    readline=stdin.readline
    li=[int(readline()) for _ in range(5)]

    ans=float("inf")
    for i in permutations(li):
        tmp=0
        for j in range(5):
            if j!=4:
                if i[j]%10==0:
                    tmp+=i[j]
                else:
                    tmp+=i[j]+10-i[j]%10
            else:
                tmp+=i[j]

        ans=min(ans,tmp)

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    li=[int(readline()) for _ in range(5)]

    res=10
    res_i=0
    for i in range(5):
        if li[i]%10==0:
            pass
        else:
            if li[i]%10<res:
                res=li[i]%10
                res_i=i

    ans=0
    for i in range(5):
        if i!=res_i:
            if li[i]%10==0:
                ans+=li[i]
            else:
                ans+=li[i]+10-li[i]%10

        else:
            ans+=li[i]

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):
import math
def roundup(x):
    return int(math.ceil(x/10))*10


def main():
    import math
    inlis = []
    roundlis = []
    gapdic = {}
    cnt = 0
    for i in range(5):
        a = int(input())
        inlis.append(a)
        roundlis.append(roundup(a))
        gap = roundup(a) - a
        gapdic[i] = gap
    
    gapdic= sorted(gapdic.items(), key = lambda x:x[1])
    num = 1
    ans = 0
    for tup in gapdic:
        if num != len(inlis):
            ans += roundlis[tup[0]]
            
        else:
            ans += inlis[tup[0]]
        num += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
T = [int(input()) for _ in range(5)]
U = [T[i] for i in range(5)]

for i in range(5):
    if T[i] % 10 == 0:
        T[i] = 10
    else:
        T[i] %= 10
    U[i] += (10-T[i])

ans = sum(U)

T.sort()
ans -= (10-T[0])

print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
orders = sorted([a, b, c, d, e], key=lambda x: 10 if x % 10 == 0 else x % 10, reverse=True)
total = 0
for o in orders[:-1]:
    total += ((o + 9) // 10) * 10
total += orders[-1]
print(total)

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

temp = 10
index = 0
for i,dish in zip(range(len(dishes_time)),dishes_time):
    if temp > int(str(dish)[-1]) and int(str(dish)[-1])!=0:
        temp = int(str(dish)[-1])
        index = i

for i in range(len(dishes_time)):
    if index != i:
        if dishes_time[i]%10!=0:
            dishes_time[i] = (dishes_time[i]//10)*10 + 10
print(sum(dishes_time))

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

temp = 10
index = 0
for i,dish in zip(range(len(dishes_time)),dishes_time):
    if temp > int(str(dish)[-1]) and int(str(dish)[-1])!=0:
        temp = int(str(dish)[-1])
        index = i

for i in range(len(dishes_time)):
    if index != i:
        if dishes_time[i]%10!=0:
            dishes_time[i] = (dishes_time[i]//10)*10 + 10
print(sum(dishes_time))

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

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

mintime = 9
minindex = 4
for i, m in enumerate(menu):
    if m % 10 == 0:
        continue

    if m % 10 < mintime:
        minindex = i
        mintime = m % 10

ans = menu[minindex]
for i, m in enumerate(menu):
    if i == minindex:
        continue
    if m % 10 != 0:
        m += 10 - m % 10
    ans += m

print(ans)

Solution (Python):
A = [int(input()) for n in range(5)]
B = [(a+9)//10*10 for a in A]
C = sum(B)
print(min([C-B[n]+A[n] for n in range(5)]))

Solution (Python):
import math
X = [int(input()) for _ in range(5)]
t = 0
m = 100
for x in X:
  t += (math.ceil(x/10))*10
  if x%10 != 0:
    m = min(m, x%10)
print(t+m-10 if m!=100 else t)

Solution (Python):
from itertools import permutations

def f(a,g):
    return ((a+(g-1))//g)*g

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

P=[A,B,C,D,E]
Q=permutations(P)

M=10**100
for (v,w,x,y,z) in Q:
    M=min(M,f(v,10)+f(w,10)+f(x,10)+f(y,10)+z)
print(M)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = []
ans.append(((b-1)//10+1+(c-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+a)
ans.append(((a-1)//10+1+(c-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+b)
ans.append(((a-1)//10+1+(b-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+c)
ans.append(((a-1)//10+1+(b-1)//10+1+(c-1)//10+1+(e-1)//10+1)*10+d)
ans.append(((a-1)//10+1+(b-1)//10+1+(c-1)//10+1+(d-1)//10+1)*10+e)
print(min(ans))

Solution (Python):
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [[a%10,a//10*10+10,a],[b%10,b//10*10+10,b],[c%10,c//10*10+10,c],[d%10,d//10*10+10,d],[e%10,e//10*10+10,e]]
s.sort()
for i in range(5):
    if s[0][0] == 0:
        s[0][1]-=10
        s.append(s.pop(0))
    else:
        break
s = np.array(s)
ans = s[0][2] + sum(s[1:,1])
print(ans)

Solution (Python):
l = [int(input()) for _ in range(5)]
m = [(x+9)//10*10 for x in l]
d = [x - y for (x, y) in zip(m, l)]
print(sum(m)-max(d))

Solution (Python):
l = [int(input()) for _ in range(5)]
m = [(x+9)//10*10 for x in l]
s = sum(m)
print(min([s-m[i]+l[i] for i in range(5)]))

Solution (Python):
import math

l = [int(input()) for _ in range(5)]
m = [math.ceil(l[i]/10)*10 for i in range(5)]
s = sum(m)
ans = [s-m[i]+l[i] for i in range(5)]
print(min(ans))

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

from itertools import permutations

def ceil_base10(x):
    q,r = divmod(x, 10)
    return 10*(q + min(r, 1))

ans=10**12
for A,B,C,D,E in permutations([a,b,c,d,e], 5):
    s = sum([ceil_base10(x) for x in [A,B,C,D]]) + E
    ans = min(ans, s)

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
a =[]
for i in range(5):
    x = int(input())
    x2 =x %10
    x3 =x
    
    x /= 10 
    if not x.is_integer():
        x=int(x)*10 +10
    else:
        x =int(x)*10
    if x2 ==0:
        x2 =10
    a.append((x2,x,x3))
a.sort(reverse=True)
ans =0
for i in range(4):
    ans +=a[i][1]
ans +=a[4][2]
print(ans)

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

A = list(map(int, input().split()))

res = 0
mi = 10

for a in A:
    x, y = divmod(a, 10)
    if not y:
        res += x
    else:
        res += x + 1
        mi = min(mi, y)
print(res * 10 + mi - 10)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X=[A%10,B%10,C%10,D%10,E%10]
minimum=100
for i in range(5):
  if X[i]!=0:
    minimum=min(minimum,X[i])
Y=[A,B,C,D,E]
if minimum==100:
  minimum=0
last=X.index(minimum)
time=0
import math
for i in range(5):
  if i!=last:
    time =time+10*math.ceil(Y[i]/10)
if X==[0,0,0,0,0]:
  print(sum(Y))
else:
  print(time+Y[last])