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):
l = []
count = 0
maxi = 0
for i in range(5):
    x = int(input())
    if x % 10 != 0:
        maxi = max(maxi, 10-x % 10)
        count += 10-x % 10
    count += x
print(count - maxi)

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

    mod = list(map(lambda x: 10 - x % 10 if x % 10 > 0 else 0, menu))
    print(sum(menu)+sum(mod)-max(mod))


if __name__ == "__main__":
    main()

Solution (Python):
A = []
B = []

for i in range(5):
    x = int(input())
    if x % 10 == 0:
        a = x
        A.append(a)
    else:
        a = (x // 10 + 1) * 10
        A.append(a)
        
    b = a - x
    B.append(b)
    
print(sum(A) - max(B))

Solution (Python):
arr = [0]*5
for i in range(5):
    arr[i] = int(input())
time = 0
for ar in arr:
    time += (-(-ar//10))*10
amari = []
for i in arr:
    amari.append(i%10)
amari.sort()
while 0 in amari:
    amari.remove(0)
if amari == []:
    amari.append(10)
print(time - (10-amari[0]))

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

ans=10**9
temp=0

for j in li:
    temp = j
    li2 = copy.copy(li)
    li2.remove(j)
    for k in li2:
        if k % 10 != 0:
            temp += k + (10 - (k % 10))
        else:
            temp += k
    ans = min(ans, temp)

print(ans)

Solution (Python):


import numpy as np

def next_permutation(x):
    '''
    import numpy as np
    x = np.arange(3)+1
    while True:
        print(x)
        if next_permutation(x) == 0:
            break
    '''
    n = len(x)
    pos1 = -1
    for i in reversed(range(0, n-1)):
        if x[i] < x[i + 1]:
            pos1 = i
            break
    if pos1 == -1:
        return 0
    for i in reversed(range(pos1+1, n)):
        if x[pos1] < x[i]:
            pos2 = i
            break
    x[pos1], x[pos2] = x[pos2], x[pos1]
    for i in range(1, (n - 1 - pos1) // 2 + 1): 
        x[pos1 + i], x[n - i] = x[n - i], x[pos1 + i]
    return 1

t = [0] * 5
for i in range(5):
    t[i] = int(input())
t = sorted(t)
p = np.arange(len(t))
Min = np.inf
while True:
    time = t[p[4]]
    for i in range(4):
        time += np.ceil(t[p[i]] / 10)*10
    Min = min(Min, time)
    if next_permutation(p) == 0:
        break
print(int(Min))

Solution (Python):
l = []
count = 0
maxi = 0
for i in range(5):
  x = int(input())
  if x % 10 != 0:
    maxi = max(maxi,10-x%10)
    count += 10-x%10
  count += x
print(count - maxi)

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

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

min_time_mod = min(time_mod)
last = time_mod.index(min_time_mod)
ans = 0
for i in range(5):
    if i != last:
        ans += dish[i] + (10 - time_mod[i])
    elif i == last:
        ans += dish[i]
print(ans)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    

    
    

    a = [int(input()) for _ in range(5)]
    b, res = 0, 0
    for i in range(5):
        temp = ((a[i]-1)//10+1)*10
        res += temp
        b = max(b, temp-a[i])
    print(res-b)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    

    
    

    a = [int(input()) for _ in range(5)]
    res = 1000000
    for i in range(5):
        for j in range(5):
            if i == j:
                continue
            for k in range(5):
                if i == k or j == k:
                    continue
                for s in range(5):
                    if i == s or j == s or k == s:
                        continue
                    for t in range(5):
                        if i == t or j == t or k == t or s == t:
                            continue
                        res = min(res, ((a[i]-1)//10+1)*10+((a[j]-1)//10+1)*10+((a[k]-1)//10+1)*10+((a[s]-1)//10+1)*10+a[t])
    print(res)

if __name__ == '__main__':
    main()

Solution (Python):
import math

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



List = [A, B, C, D, E]
Time = []
Cost = []
answer = 0

for i in range(5):
    Time.append(List[i]%10)
    Cost.append(math.ceil(List[i]/10)*10)

for i in range(5):
    answer += Cost[i]

if Time.count(0)==5:
    print(answer)

else:
    Time = list(set(Time))
    if Time[0] == 0:
        Time.remove(0)

    answer = answer - (10-min(Time))

    print(answer)

Solution (Python):
import numpy as np

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

n = np.array(l)
n = 1000 - n
n %= 10

idx = np.argsort(n)
t = 0
for i in idx[:-1]:
    t += l[i]
    if(n[i] != 0):
        t = (t+10)-t%10
t += l[idx[-1]]
print(t)

Solution (Python):
n = [int(input()) for hoge in range(5)]
c = 0
t = 0
a = [10]
while t < 5:
  if n[t]%10 == 0:
    c += n[t]
  else:
    c += (n[t]//10 + 1)*10
    a.append(n[t]%10)
  t += 1
c -= (10-min(a))
print(c)

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

ans = 0
r = 0
for z in Z:
    time = (z+9) // 10 * 10
    r = max(r, time - z)
    ans += time

print(ans - r)

Solution (Python):
import math

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

ans = 0
r = 0
for z in Z:
    if z%10 != 0:
        r = max(10 - z%10, r)
    ans += math.ceil(z/10) * 10

print(ans - r)

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

Solution (Python):

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



machi = []
for i in range (5):
  if food[i]%10 == 0:
    time += food[i]
  else:
    time += food[i]+(10-(food[i]%10))
    machi.append(10-(food[i]%10)) 

if len(machi) == 0:
  print(time)
else:
  print(time-max(machi))

Solution (Python):
d_list = [int(input()) for _ in range(5)]
temp_list = sorted([((10 - d % 10) % 10, d) for d in d_list])
ans = 0
for d_mod, d in temp_list:
    ans += d + d_mod
ans -= d_mod
print(ans)

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

for i in foods:
  time += i
  mod = i % 10
  if mod != 0:
    time += 10 - mod
    if mod < minmod or minmod == 10:
      minmod = mod

print(time - 10 + minmod)

Solution (Python):
A=list([int(input()) for i in range(5)])
ans=0
cnt=0
B=[]
for i in range(5):
    if A[i]%10!=0:
        B.append(A[i]%10)
for i in range(5):
    if A[i]%10==0:
        ans+=A[i]
    else:
        ans+=(A[i]//10+1)*10
        if A[i]%10==min(B) and cnt==0:
            ans-=(10-A[i]%10)
            cnt+=1
print(ans)

Solution (Python):
l=list(int(input()) for _ in range(5))
s=list(10-i%10 for i in l)
for i in range(s.count(10)):
  s.remove(10)
if len(s)>0:
  s.remove(max(s))
print(sum(l)+sum(s))

Solution (Python):
foods=[int(input()) for i in range(5)]
time=0
tmp=[]

for i in range(5):
    mod=foods[i]%10
    if mod==0:
        time+=foods[i]
    else:
        tmp.append((mod, i))

l=sorted(tmp, reverse=True)

for i in range(len(l)):

    if i != len(l)-1:
        time+=(10-l[i][0])+foods[l[i][1]]
    else:
        time+=foods[l[i][1]]
        

print(time)

Solution (Python):
import math
l=[int(input()) for i in range(5)]
ans=min(l[0]+math.ceil(l[1]/10)*10+math.ceil(l[2]/10)*10+math.ceil(l[3]/10)*10+math.ceil(l[4]/10)*10,
math.ceil(l[0]/10)*10+l[1]+math.ceil(l[2]/10)*10+math.ceil(l[3]/10)*10+math.ceil(l[4]/10)*10,
math.ceil(l[0]/10)*10+math.ceil(l[1]/10)*10+l[2]+math.ceil(l[3]/10)*10+math.ceil(l[4]/10)*10,
math.ceil(l[0]/10)*10+math.ceil(l[1]/10)*10+math.ceil(l[2]/10)*10+l[3]+math.ceil(l[4]/10)*10,
math.ceil(l[0]/10)*10+math.ceil(l[1]/10)*10+math.ceil(l[2]/10)*10+math.ceil(l[3]/10)*10+l[4])
print(ans)

Solution (Python):
lis=[]
for i in range(5):
  lis.append(int(input()))
saitei=10
keep=0
for j in range(0,5):
  if 1<=lis[j]%10<saitei:
    saitei=lis[j]%10
    keep=j+1
res=0
for k in range(0,5):
  if lis[k]%10==0:
    res+=lis[k]
  else:
    res+=lis[k]+10-lis[k]%10

print([res,res-(10-lis[keep-1]%10)][bool(keep)])

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

mod_min = 10
idx = 0
for i in range(5):
    mod = times[i] % 10
    if mod == 0:
        continue
    else:
        if mod < mod_min:
            idx = i
            mod_min = mod

ans = 0
for i in range(5):
    if idx == i:
        ans += times[i]
    else:
        if times[i] % 10 == 0:
            ans += times[i]
        else:
            ans += (times[i] // 10) * 10 + 10
print(ans)

Solution (Python):
import math
list=[int(input()) for x in range(5)]
list.sort(key=lambda x:x%10)
count=0
for l in list:
  if l%10==0:
    count+=1
if count==5:
  print(sum(list))
else:
  a=list[count]
  del list[count]
  ans=[]
  for t in list:
    ans.append(math.ceil(t/10)*10)
  print(sum(ans)+a)

Solution (Python):
A=list(int(input()) for _ in range(5))
B=[]
C=[]
for i in A:
    if i%10!=0:
        B.append(i%10)
        C.append((i//10+1)*10)
    else:
        C.append(i)
if len(B)>0:
    c=10-min(B)
else:
    c=0
print(sum(C)-c)

Solution (Python):
l = [int(input()) for i in range(5)]
L = []
for i in l:
  if i%10==0:
    L.append(0)
  else:
    L.append(10-i%10)
print(sum(l)+sum(L)-max(L))

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

Solution (Python):
def five_dishes(li):

    ans = 0
    count = 10
    for i in li:
        ans += -(-i//10)*10
        if i%10 != 0:
            count = min(count, i%10)
    return ans-(10-count) if count != 10 else ans

def main():
    li = [int(input())for i in range(5)]
    print(five_dishes(li))

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=[input() for i in range(5)]
    sum=0
    for j in range(5):
        sum+=(int(l[j])//10)*10
    num=10
    for n in range(5):
        if int(l[n][-1])!=0 and int(l[n][-1]) < num:
            num=int(l[n][-1])
    sum-=10-num
    for s in range(5):
        if int(l[s])%10!=0:
            sum+=10
    print(sum)
resolve()

Solution (Python):


import math

t=[int(input()) for _ in range(5)]
r=[(i-1)%10+1 for i in t]
c=r.index(min(r))
ans=0
for i in range(5):
    if i==c:
        ans+=t[i]
    else:
        ans+=math.ceil(t[i]/10)*10
print(ans)

Solution (Python):

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

a.sort(key= lambda x: x%10)
ans = 0
cnt = 0
for i in range(5):
  if cnt == 0 and a[i] % 10 != 0:
    ans += a[i]
    cnt += 1
  else:
    ans += -(-a[i] // 10)*10

print(ans)

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

for x in parr:    
    if x%10 == 0:
        arr.append([0,x,x])
    else:
        arr.append([x%10, (x//10 + 1)*10,x])

arr.sort()

found = False
ans = 0
for cur in arr:
    r,v,o = cur
    if r == 0:
        ans += v
    else:
        if found:
            ans += v
        else:
            ans+= o
            found = True

print(ans)

Solution (Python):
dishes = [int(input()) for i in range(5)]
ceil_time = [-(-d//10)*10 for d in dishes]
diff = [c - d for c, d in zip(ceil_time, dishes)]
di = diff.index(max(diff))
print(sum(ceil_time) - diff[di])

Solution (Python):
import numpy as np
import sys

input = sys.stdin.readline


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


min_x = 9
flag = False
cnt = 0

y = []

see = False
for a in x:
    if a%10 != 0:
        y.append((a//10)*10+10)
        min_x = min(a%10,min_x)
        see = True
    else:
        y.append(a)

if see:print(sum(y)-(10-min_x))
else:print(sum(y))

Solution (Python):
dish = []
amari = []
for i in range(5):
  s = int(input())
  dish.append(s)
  if s % 10 != 0:
    a = 10 - s % 10
  else:
    a = 0
  amari.append(a)

final = amari.index(max(amari))
score = 0
for i in range(5):
  if i == final:
    score += dish[final]
  else:
    if dish[i] % 10 == 0:
      score += dish[i]
    else:
      score += (dish[i] // 10 + 1) * 10
      
print(score)

Solution (Python):
a = [int(input()) for _ in range(5)]
b = [9 - ((i - 1) % 10) for i in a]
print(sum(a) + sum(b) - max(b))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = 9 - ((a - 1) % 10)
g = 9 - ((b - 1) % 10)
h = 9 - ((c - 1) % 10)
i = 9 - ((d - 1) % 10)
j = 9 - ((e - 1) % 10)
print(a + b + c + d + e + f + g + h + i + j - max(f, g, h, i, j))

Solution (Python):
import math
a=[input() for i in range(5)]
b,c=10,0
for i in range(5):
    if 0<int(a[i][-1])<b:
        b=int(a[i][-1])
        d=i
for i in range(5):
    if b!=10:
        if i==d:
            c+=int(a[i])
        else:
            if int(a[i][-1])==0:
                c+=int(a[i])
            elif int(a[i])<=10:
                c+=10
            else:
                c+=(int(a[i][0:-1])+1)*10
    else:
        c+=int(a[i])
print(c)

Solution (Python):
import itertools

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

ans = 10000

for a in itertools.permutations(A):
    total = 0
    for t in a:
        while total % 10 != 0:
            total += 1
        total += t
    ans = min(ans, total)

print(ans)

Solution (Python):
import sys
import math
from collections import Counter
import itertools



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'


p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")



l=[II(),II(),II(),II(),II()]
l2=[l[i] if l[i]%10==0 else l[i]//10*10+10 for i in range(5)]
m = 0
for i in range(5):
    m=max(m,l2[i]-l[i])
print(sum(l2)-m)

Solution (Python):
import sys
import math
from collections import Counter
import itertools



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'


p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")



l=[II(),II(),II(),II(),II()]
t=643
P = itertools.permutations(l)
cnt=0
for p in P:
    cnt=0
    i=0
    for x in p:
        i+=1
        cnt+=x
        if cnt%10!=0 and i!=5:
            cnt=cnt+(10-(cnt%10))
    t=min(cnt,t)
print(t)

Solution (Python):


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

roundtime = []
difftime = []
for i in range(5):
    roundtime.append(((menu[i]+9)//10)*10)
    difftime.append(roundtime[i]-menu[i])

print(sum(roundtime)-max(difftime))

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time = 0
t1 = [a, b, c, d, e]
t2 = []

i = 0
while i <= 4:
    if t1[i]%10 != 0:
        tmp = 10-t1[i]%10
        t2.append([10 - t1[i]%10, i]) 
    else:
        t2.append([t1[i]%10, i]) 
    i += 1


t3 = sorted(t2)


for i in range(4):
    if t3[i][0] == 0:
        time += t1[t3[i][1]]
    else:
        time += t1[t3[i][1]] + t3[i][0]

time += t1[t3[-1][1]]

print(time)

Solution (Python):
import math
temp=[]
ans=0
list=[int(input()) for _ in range(5)]
for i in range(5):
    temp.append(10*math.ceil(list[i]/10)-list[i])
    ans += 10*math.ceil(list[i]/10)
print(ans-10*math.ceil(list[temp.index(max(temp))]/10)+list[temp.index(max(temp))])

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
plus = 0
while plus < a:
    plus += 10
ans += plus

plus = 0
while plus < b:
    plus += 10
ans += plus

plus = 0
while plus < c:
    plus += 10
ans += plus

plus = 0
while plus < d:
    plus += 10
ans += plus

plus = 0
while plus < e:
    plus += 10
ans += plus

minus = [int(str(a)[-1]), int(str(b)[-1]), int(str(c)[-1]), int(str(d)[-1]), int(str(e)[-1])]
minus.sort()
for i in minus:
    if i !=0:
        ans -= 10-i
        break
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
t = (a+9)//10*10+(b+9)//10*10+(c+9)//10*10+(d+9)//10*10+(e+9)//10*10
if a%10 == 0:
    aa = 10
else:
    aa = a%10
if b%10 == 0:
    bb = 10
else:
    bb = b%10
if c%10 == 0:
    cc = 10
else:
    cc = c%10
if d%10 == 0:
    dd = 10
else:
    dd = d%10
if e%10 == 0:
    ee = 10
else:
    ee = e%10
m = min(aa,min(bb,min(cc,min(dd,ee))))
print(t+m-10)

Solution (Python):
import math
A = [int(input()) for _ in range(5)]
B = 10
ans = 0
for i in range(5):
  if 0 < A[i] % 10 < B:
    B = A[i] % 10
    ans = -10+B
for j in A:
  ans += math.ceil(j/10)*10
print(ans)

Solution (Python):
foods = [int(input()) for i in range(5)]
kiriage = [-(-i//10)*10 for i in foods]
amari = [-(-i//10)*10-i for i in foods]
print(sum(kiriage) - max(amari))

Solution (Python):
foods = [int(input()) for i in range(5)]
amari = [i % 10 for i in foods]
kiriage = [-(-i//10) for i in foods]
min_amari = 10
for i in amari:
    if 1 <= i < min_amari:
        min_amari = i
print(sum(kiriage) * 10 - (10 - (10 if max(amari) == 0 else min_amari)))

Solution (Python):
from itertools import permutations
foods = [int(input()) for i in range(5)]
ans = 1230
for i in permutations(foods):
    tmp = 0
    for j in range(4):
        tmp += -(-i[j] // 10)
    tmp *= 10
    tmp += i[4]
    ans = min(ans, tmp)
print(ans)

Solution (Python):
S=[int(input()) for _ in range(5)]
T=[]
for i in range(5):
    T.append((10-S[i])%10)
print(sum(S)+sum(T)-max(T))

Solution (Python):
a = [int(input()) for _ in range(5)]
d = [[x, 10-x%10 if x%10!=0 else 0] for x in a]
d.sort(key=lambda x: x[1])
sumt=0
for i in range(5):
    sumt+=d[i][0]+d[i][1] if i<4 else d[i][0]
print(sumt)

Solution (Python):
res = 0
frac = 10
for i in range(5):
  a = int(input())
  if a % 10 != 0:
    frac = min(frac, a % 10)
  res += -(-a // 10) *10
print(res + frac - 10)

Solution (Python):
import math
lst = []
for i in range(5):
  lst.append(int(input()))
minu = 9
temp = 0
count = 0
for j in range(5):
  if int(str(lst[j])[-1]) < minu and int(str(lst[j])[-1]) > 0:
    minu = int(str(lst[j])[-1])
    temp = lst[j]
    count += 1
if count > 0:
  lst.remove(temp)
else:
  temp = lst[0]
  del lst[0]
time = 0
for k in range(4):
  kari = math.ceil(int(lst[k])/10)
  time += int(kari * 10)
time += temp
print(time)

Solution (Python):
l = list()
mod = list()

for a in range(0, 5):
    num = int(input())
    l.append(num)
    mod.append(num % 10)

sm = 0

for a in range(0, 5):
    if 0 in mod:
        indx = mod.index(0)
        mod.pop(indx)
        sm += l.pop(indx)
    else:
        indx = mod.index(max(mod))
        mod.pop(indx)
        sm += l.pop(indx)

    while 1:
        if a == 4:
            break
        if sm % 10 == 0:
            break
        else:
            sm += 1


print(sm)

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

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
    
if len(i) == 0:
  h = 0
else:
  h = max(i)
print(sum(aaa) + sum(i) - h)

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

d = 10
ans = 0
if A % 10 == 0:
    ans += A
else:
    ans += (A//10+1)*10
    d = min(A - A//10*10, d)

if B % 10 == 0:
    ans += B
else:
    ans += (B//10+1)*10
    d = min(B - B//10*10, d)

if C % 10 == 0:
    ans += C
else:
    ans += (C//10+1)*10
    d = min(C - C//10*10, d)

if D % 10 == 0:
    ans += D
else:
    ans += (D//10+1)*10
    d = min(D - D//10*10, d)
    
if E % 10 == 0:
    ans += E
else:
    ans += (E//10+1)*10
    d = min(E - E//10*10, d)

if d != 10:
    ans -= 10 - d
    
print(ans)

Solution (Python):
import itertools
s = [input() for i in range(5)]
listS = list(itertools.permutations(s))

Min = float("inf")
time = 0
for i in range(120):
    time = 0
    for j in range(5):
        time += int(listS[i][j])
        if(j != 4):
            while(time % 10 != 0):
                time += 1
    if(time < Min):
        Min = time

print(Min)

Solution (Python):
import itertools
l=[int(input()) for _ in range(5)]
l=list(itertools.permutations(l))
ans=[0]*120
for i in range(120):
  for k in range(4):
    ans[i]=ans[i]+((-1)*l[i][k]//10)*(-10)
  ans[i]+=l[i][4]
print(min(ans))

Solution (Python):
ret=0
m=10
for _ in range(5):
  y=int(input())
  ret+=(y+9)//10*10
  if y%10!=0:
    m=min(m,y%10)
print(ret-(10-m))

Solution (Python):
a=[int(input()) for i in range(5)]
b=10
c=0
for i in a:
    if str(i)[-1]!="0":
        b=min(b,int(str(i)[-1]))
        c+=10-int(str(i)[-1])
print(sum(a)-10+b+c)

Solution (Python):


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

ans = float('inf')
for i in range(5):
    t = dish[i]
    for j in range(5):
        if i == j:
            continue
        if dish[j] % 10 == 0:
            t += dish[j]
        else:
            t += 10 * (dish[j] // 10 + 1)
    ans = min(ans, t)
print(ans)

Solution (Python):
import math
ans = 0
lst = 10
for i in range(5):
    a = input()
    if int(a[-1]) != 0:
        lst = min(lst, int(a[-1]))
    ans += math.ceil(int(a) / 10) * 10

if lst == 10:
    print(ans)
else:
    print(ans - (10 - lst))

Solution (Python):
x=[int(input()) for _ in range(5)]
r=list(map(lambda a: a%10,x))
min = min(list(filter(lambda x: x>0, r))+[10])
ans=0
for i in range(5):
    ans+=-(-x[i]//10)*10
ans+= min-10
print(ans)

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

P = []
for i, v in enumerate(L):
    if (v % 10 == 0):
        P.append((0, i))
    else:
        P.append((10 - (v % 10), i))

P.sort()
count = 0
for i, v in enumerate(P):
    if (i == len(P) - 1):
        break
    if (v[0] == 0):
        count += L[v[1]]
    else:
        count += L[v[1]] + v[0]
print(count + L[P[-1][1]])

Solution (Python):

a = [int(input()) for _ in range(5)]
b = []
for i in range(len(a)):
    if a[i] % 10 == 0:
        b.append(0)
    else:
        b.append(10 - (a[i] % 10))
c = b.index(max(b))

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

    a = [int(input()) for _ in range(5)]
    res = 10000000
    for i in permutations(a, 5):
        b = 0
        for j in range(4):
            b += i[j]
            if b%10:
                b = (b//10+1)*10
        res = min(res, b+i[-1])
    print(res)

if __name__ == '__main__':
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

l = [INT() for _ in range(5)]
m = 0
n = [0]

for i in range(5):
	m += -(-l[i]//10)
	if l[i]%10 != 0:
		n.append(10-l[i]%10)

print(10*m - max(n))

Solution (Python):
def main():
    a = [int(input()) for _ in range(5)]
    a.sort(key=lambda x: x % 10)

    ans = 0
    picked = False  
    for x in a:
        if (not picked) and (x % 10 != 0):
            ans += x
            picked = True
        else:
            ans += (x + 9) // 10 * 10
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    from itertools import permutations
    a = [int(input()) for _ in range(5)]

    ans = -1
    for perm in permutations(a):
        it = iter(perm)
        t = next(it)
        for x in it:
            t += (x + 9) // 10 * 10
        if not (~ans) or t < ans:
            ans = t
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import math
menu = [int(input()) for i in range(5)]
time = [0]*5
last = 0
num = 0
for i in range(5):
    time[i] = math.ceil(menu[i]/10)*10
    if time[i]-menu[i]>=last:
        last = time[i]-menu[i]
        num = i
    else:
        continue
print(sum(time)-time[num]+menu[num])

Solution (Python):
A=[0]*5
B=0
A[0]=int(input())
A[1]=int(input())
A[2]=int(input())
A[3]=int(input())
A[4]=int(input())
count=0
for i in range(0,5):
    if A[i]%10==0:
        count+=A[i]
    else:
        if B==0:
            B=A[i]
        elif B%10>=A[i]%10:
            count+=((B+10)-(B%10))
            B=A[i]
        else:
            count+=((A[i]+10)-(A[i]%10))
print(count+B)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
aa=(a+9)//10*10
bb=(b+9)//10*10
cc=(c+9)//10*10
dd=(d+9)//10*10
ee=(e+9)//10*10
print(aa+bb+cc+dd+ee-max(aa-a,bb-b,cc-c,dd-d,ee-e))

Solution (Python):
ans = 0
def ceil(a, b):
   return a // b + (a % b > 0)
big = 0
for _ in range(5):
    a = int(input())
    ans += ceil(a, 10) * 10
    if a % 10 != 0:
        big = max(big, 10-(a%10))

print(ans-big)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a = [inp() for _ in range(5)]
mi = 10
ind = -1
for i,t in enumerate(a):
    tmp = int(str(t)[-1])
    if tmp < mi and tmp:
        mi = tmp
        ind = i
a[ind], a[4] = a[4], a[ind]
now = 0
for i in a:
    if now%10:
        now += 10-now%10
    now += i
print(now)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L = [INT() for i in range(5)]
A = []
for l in L:
    A.append(ceil(l * 0.1) * 10)


ans = INF
for i in range(5):
    tmp = 0
    for j in range(5):
        if i == j:
            tmp += L[j]
        else:
            tmp += A[j]
    ans = min(tmp, ans)
print(ans)