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):
from itertools import permutations

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
T = [A, B, C, D, E]

res = 10 ** 9
for s in permutations(range(5), 5):
    cnt = T[s[0]]
    for i in s[1:]:
        if cnt % 10 != 0:
            cnt += 10 - cnt % 10
        cnt += T[i]
    res = min(res, cnt)

print(res)

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

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

sub = [(10 - i%10)%10 for i in m]

x = sub.index(max(sub))

ans = 0

for i in range(5):
    if i == x:
        ans += m[i]
    else:
        ans += m[i] + (10 - m[i]%10)%10

print(ans)

Solution (Python):
l = [int(input()) for _ in range(5)]
t = max(map(lambda x: (10-x%10)%10, l))
print(sum(map(lambda x: (x+9)//10*10, l))-t)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, D: int, E: int):
    def func(n):
        return 0 if n % 10 == 0  else 10 - n % 10
    F = [A, B, C, D, E]
    G = list(map(func, F))
    H = [f+g for f, g in zip(F, G)]
    return sum(H) - max(G)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    E = int(next(tokens))  
    print(solve(A, B, C, D, E))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
X = [int(input()) for _ in range(5)]
m = 10
mi = 10
rX = []
for i, x in enumerate(X):
    y = int(str(x)[-1])
    if y != 0 and y < m:
        m = y
        mi = i
    if len(str(x)) == 1:
        rX.append(10)
    else:
        z = int(''.join(str(x)[:-1]))
        if y == 0:
            rX.append(z * 10)
        else:
            rX.append((z + 1) * 10)
if m == 10:
    print(sum(rX))
else:
    print(sum([x if i != mi else X[mi] for i, x in enumerate(rX)]))

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
ans=[]
mm=0
for i in l:
    k=(10-i%10)%10
    ans.append(k)
print(sum(l)+sum(ans)-max(ans))

Solution (Python):


import sys
import math





















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    L = [ii() for _ in range(5)]
    diff = [math.ceil(elm / 10) * 10 - elm for elm in L]
    max_ind = 0
    maximum = -1
    for i, elm in enumerate(diff):
        if elm > maximum:
            max_ind, maximum = i, elm
    
    ans = 0
    for i in range(5):
        if i != max_ind:
            ans += math.ceil(L[i] / 10) * 10
        else:
            ans += L[i]
    print(ans)



if __name__ == "__main__":
    main()

Solution (Python):
l=[0]*5
for i in range(5):
    l[i]=input()

odr=[]
ans=0
for x in l:
    if int(x)%10==0:
        ans+=int(x)
    else:
        odr.append(x)
odr=sorted(odr,key=lambda x:x[-1],reverse=True)

for i in range(len(odr)):
    if i==len(odr)-1:
        ans+=int(odr[i])
    else:
        ans += int(odr[i]) + (10-int(odr[i])%10)
print(ans)

Solution (Python):
t = []
ans = 0
for i in range(5):
    a = int(input())
    if a%10 == 0:
        ans += a
        t.append(0)
    
    else:
        x = 10-a%10
        ans += a + x
        t.append(x)
    
ans -= max(t)
print(ans)

Solution (Python):
time=[]
ans=0
for i in range(5):
    A=int(input())
    a=10-A%10
    ans+=A+a%10
    time.append(a%10)
time.sort()
ans-=time[-1]
print(ans)

Solution (Python):
import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))


ans = 1e6
for i in range(len(time_list)):
    tmp = 0
    for j in range(len(time_list)):
        if i == j:
            tmp += time_list[i]
            continue
        tmp += math.ceil(time_list[j] / 10) * 10
    ans = min(tmp, ans)

print(ans)

Solution (Python):
time=[]
ans=0
for i in range(5):
    A=int(input())
    a=10-A%10
    ans+=A+a%10
    time.append(a%10)
time.sort()
ans-=time[-1]
print(ans)

Solution (Python):
foods=[]

for _ in range(5):
    foods.append(int(input()))

from itertools import permutations

l = [0,1,2,3,4]

p = permutations(l,5)

time=pow(10,9)
for v in p:
    order = v

    tmp_time=0

    for i in range(5):

        tmp_time+=foods[order[i]]

        if tmp_time%10!=0 and i<4:

            tmp_time = ((tmp_time//10)+1) * 10

    
    time= min(time,tmp_time)

print(time)

Solution (Python):






import sys
input = sys.stdin.readline

import math
import bisect
from collections import deque
from fractions import gcd
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


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


def bit_count(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count





l = inputILs(5)

SUM = sum(-(-i//10)*10 for i in l)
R = [i%10 for i in l]

if max(R) == 0:
  print(SUM)
else:
  R.sort()
  print(SUM-10+R[bisect.bisect(R,0)])

Solution (Python):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
def main():
    lis=[I(),I(),I(),I(),I()]
    dig1=[i%10 if i%10!=0 else 10 for i in lis]
    sum=0
    while len(lis)!=0:
        nex=0
        ind=0
        for i in range(len(lis)):
            if dig1[i]>nex:
                nex=dig1[i]
                ind=i
        
        
        if len(lis)!=1:
            sum+=lis.pop(ind)+(10-nex)%10
            dig1.pop(ind)
        else:
            sum+=lis.pop()
    
    print(sum)
    

if __name__ == '__main__':
    main()

Solution (Python):
import math
a = []
mini = 9
flag = False
for i in range(5):
    x = int(input())
    if x%10==0:
        a.append(x)
    else:
        flag = True
        if x%10<mini :
            mini = x%10
        a.append(math.ceil(x/10)*10)

if flag:
    print(sum(a)-(10-mini))
else:
    print(sum(a))

Solution (Python):
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nuko = 10

n = []
for i in range(5):
    n.append(iin())
    if (n[i]%10 < nuko)and(n[i]%10 != 0):
        nuko = n[i]%10
    n[i] = math.ceil(n[i]/10)*10
print(sum(n)-10+nuko)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def time(x):
    return (x+9)//10*10
def last(x):
    return time(x)-x
sum_time=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_time-max(last(a),last(b),last(c),last(d),last(e))
print(ans)

Solution (Python):
import numpy as np
A, B, C, D, E = [int(input()) for i in range(5)]

x = np.array([A, B, C, D, E])
ans = int((np.ceil((x / 10)) * 10).sum())
x = x %10

if x.sum()==0:
    tmp = 0
else:
    tmp = 10 - x[np.where(x>0)].min()

ans = ans - tmp

print(ans)

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    ans = 0
    ex = []
    for _ in range(5):
        t = int(input())
        e = 10 - t%10
        if e != 10:
          ex.append(e)
        ans += t
    ex.sort()
    ans += sum(ex[:-1])

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

import sys


def solve(A: int, B: int, C: int, D: int, E: int):
    m = [A, B, C, D, E]
    print(sum(-(-mi // 10) * 10 for mi in m) - max(-mi % 10 for mi in m))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    E = int(next(tokens))  
    solve(A, B, C, D, E)


if __name__ == '__main__':
    main()

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a1=(a-1)%10
b1=(b-1)%10
c1=(c-1)%10
d1=(d-1)%10
e1=(e-1)%10
ans=-((a//-10)+(b//-10)+(c//-10)+(d//-10)+(e//-10))*10
ans=ans-10+min(a1,b1,c1,d1,e1)+1
print(ans)

Solution (Python):
ABCDE = [int(input()) for _ in range(5)]
w_time = []
for i in ABCDE:
    r = i % 10
    if r != 0:
        r = 10 - r
    w_time.append(r)
    
w_max = max(w_time)

ans = sum(ABCDE) + sum(w_time) - w_max

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]


A1 = int(str(A)[-1])
B1 = int(str(B)[-1])
C1 = int(str(C)[-1])
D1 = int(str(D)[-1])
E1 = int(str(E)[-1])

flag=0
ls1 = [A1,B1,C1,D1,E1]
if ls1 == [0,0,0,0,0]:
    flag=1
j=0
for i in ls1:
    if i==0:
        ls1[j]=9
    j+=1

j=0
last = min(ls1)
for i in  ls1:
    
    if i == last:
        las = j  
    j+=1

k=0
for i in ls:
    for j in range(1,14):
        if i <= j*10:
            ls[k] = j*10
            break
    k+=1

ls[las] -= (10 - last)

if flag==0:
    print(sum(ls))
else:
    print(sum([A,B,C,D,E]))

Solution (Python):
abcde = [int(input()) for _ in range(5)]
mn = 124
id = 0
for i in range(5):
    if abcde[i] % 10 != 0 and abcde[i] % 10 <= mn:
        mn = abcde[i] % 10
        id = i
ans = 0
for i in range(5):
    if i == id:
        ans += abcde[i]
    elif abcde[i] % 10 == 0:
        ans += abcde[i]
    else:
        ans += (abcde[i]//10+1)*10
print(ans)

Solution (Python):
a, b, c, d, e = (int(input()) for _ in range(5))
L = [a, b, c, d, e]
last = 10
for i in range(5):
    C = L[i] % 10
    if C != 0:
        if C < last:
            last = C
    L[i] = ((L[i] + 9) // 10) * 10
print(sum(L) + last - 10)

Solution (Python):
def resolve():
    import math
    a = [int(input()) for _ in range(5)]
    a = sorted(a, key=lambda x: 10 - (x % 10) if x % 10 != 0 else 0)
    count = sum([math.ceil(i/10) * 10 for i in a[:-1]])
    count += a[-1]
    print(count)

resolve()

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


A = []
for i in range(5):
    a = int(input())
    b = (a-1) % 10
    A.append((a, b))

A.sort(key=itemgetter(1))

ans = A[0][0]
for i in range(1, 5):
    tmp = ceil(A[i][0]/10)*10
    ans += tmp
    

print(ans)

Solution (Python):
def hoge(n):
    tmp = str(n)
    tmp2 = len(tmp)
    tmp = int(tmp)
    for i in range(tmp2-1):
        tmp = tmp % 10
    if(tmp == 0):
        tmp = 11
    return tmp

a = []
for i in range(5):
    tmp = int(input())
    a.append(tmp)
b = []
for i in range(len(a)):
    b.append(hoge(a[i]))
min_index = b.index(min(b))


sum = 0
for i in range(len(a)):
    if i == min_index:
        sum += a[i]
    else:
        if b[i] == 11:
            sum += a[i]
        else:
            sum += a[i] + (10 - b[i])

print(sum)

Solution (Python):
def s(n):
    c=0
    while n%10!=0:
        n+=1
        c+=1
    return c

l=[int(input()) for i in range(5)]
n=[]
for i in range(5):
    n.append(s(l[i]))
suml=sum(l)
sumd=sum(n)
maxn=max(n)
print(suml+sumd-maxn)

Solution (Python):
t = [int(input()) for i in range(5)]
import itertools
p = list(itertools.permutations(t))
ans = float('inf')
for d in p:
    time = d[0]
    for i in d[1:]:
        time = -(-time//10)*10
        time += i
    ans = min(ans,time)
print(ans)

Solution (Python):
inp = [int(input()) for _ in range(5)]
rem = [p % 10 if p % 10 != 0 else 10 for p in inp]
idx = rem.index(min(rem))
min_rem = inp[idx]
res = 0
inp.remove(min_rem)
for a in inp:
    if a % 10 == 0:
        res += a
    else:
        res += a + (10 - a % 10)

print(res + min_rem)

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

m = 0
res = 0
for x in a:
    if x%10 != 0:
        t = 10 - x%10
    else:
        t = 0
    res += x+t

    m = max(m,t)


print(res-m)

Solution (Python):
A=input()
B=input()
C=input()
D=input()
E=input()
import math
l_total=[A,B,C,D,E]
l=[A[-1],B[-1],C[-1],D[-1],E[-1]]
l=list(map(int,l))
n_l= list(range(1,10))
n_l.append(0)
min_n=0
for i in n_l:
    if i in l:
        min_n=i
        break
min_n=l.index(min_n)
ans=int(l_total[min_n])
l_total.pop(min_n)
for i in range(4):
    ans += math.ceil(int(l_total[i]) / 10) * 10
print(ans)

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))


def resolve():
    A=[int(input()) for i in range(5)]
    A.sort(key=lambda x:(x-1)%10)
    
    ans=A[0]
    for n in range(1,5):
        a=A[n]
        if a%10==0:
            ans+=a
        else:ans+=(1+a//10)*10
    print(ans)
        

resolve()

Solution (Python):
import itertools

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

cnt=[]

for i in range(5):
    cnt.append(0)

for i in range(len(cuisine)):
    while float(cuisine[i]/10).is_integer()==False:
        cuisine[i] += 1
        cnt[i] +=1


ALL = list(itertools.permutations(range(5)))

result=[]

for i in range(len(ALL)):
    
    sum=0
    last =0
    
    for j in range(5):
        
        index =ALL[i][j]
        
        sum += cuisine[index]
        last = index
        
    result.append(sum-cnt[last])
    
    
result.sort()


print(result[0])

Solution (Python):
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a10=(a%10)
if a%10==0:
    a10=a10+10
b10=(b%10)
if b%10==0:
    b10=b10+10
c10=(c%10)
if c%10==0:
    c10=c10+10
d10=(d%10)
if d%10==0:
    d10=d10+10
e10=(e%10)
if e%10==0:
    e10=e10+10
sum=min(a10,b10,c10,d10,e10)
print((math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10))*10-(10-sum))

Solution (Python):
import sys
from math import ceil
from itertools import permutations
def input(): return sys.stdin.readline().strip()

def main():
    T = [int(input()) for _ in range(5)]
    ans = 10**10
    for way in list(permutations(T, 5)):
        time = 0
        for i in range(4):
            time += ceil(way[i] / 10) * 10
        time += way[-1]
        
        ans = min(ans, time)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

input = sys.stdin.readline


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

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

    ans = float("inf")
    for i in range(5):
        X = order[:]
        X[0], X[i] = X[i], X[0]
        X, Y = X[0], X[1:]

        total = 0
        for y in Y:
            q, r, = divmod(y, 10)
            t = 10 * q
            t += 10 if r > 0 else 0
            total += t
        total += X
        if total < ans:
            ans = total

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
etime=[]
for i in range(5):
  etime.append(int(input()))
  
atime=[int(((i-1)//10+1)*10) for i in etime]
A=sum(atime)
c=[]
for k in range(5):
  c.append(A-atime[k]+etime[k])
  
print(min(c))

Solution (Python):
a = [0]*(5)
for l in range(5):
    a[l] = str(input())
ls = [a[0],a[1],a[2],a[3],a[4]]
new = [0]*(5)
s = 0
for i in range(5):
    new[i] = int(a[i][-1])
for p in ls:
    if int(p) % 10 ==0:
        s += int(p)
    else:
        s += ((int(p)//10) + 1) *10
if sum(new) !=0:
    ans = min([e for e in new if e !=0])
    print(s-10+ans)
else:
    print(s)

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

Solution (Python):
x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
tmp = str(x[0])
tmp = int(tmp[-1])
ans = 0


def a(b):
    c = str(b)
    if c[-1] == "0":
        return b
    else:
        return b - int(c[-1]) + 10


for i in x:
    ans += a(i)
    d = str(i)
    if int(d[-1]) != 0:
        tmp = min(tmp, int(d[-1]))

if tmp == 0:
    print(ans)
else:
    print(ans - (10 - tmp))

Solution (Python):
f = []

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

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

Solution (Python):
f = []

for i in range (5):
  f.append(int(input()))
  
time = 0

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

Solution (Python):
from itertools import permutations
import math

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

items_list = list(permutations(items))
time = float('inf')



for i in range(len(items_list)):
    tmp = 0
    for j in range(4):
        tmp += math.ceil(items_list[i][j] / 10) *10
    
    tmp += items_list[i][4]
    time = min(time, tmp)

print(time)

Solution (Python):
menu = [int(input()) for _ in range(5)]
last = 10**18
last_menu = 0
num = -1
for i in range(len(menu)):
  if menu[i]%10 != 0:
    last = min(last, menu[i]%10)
  if last == menu[i]%10:
    num = i
if num >= 0:
  last_menu = menu.pop(num)

time = 0
for j in range(len(menu)):
  if menu[j]%10 == 0:
    time += menu[j]
  else:
    time += menu[j] + (10 - menu[j]%10)
time += last_menu

print(time)

Solution (Python):
import itertools
ss = [int(input()) for i in range(5)]
mm = list(itertools.permutations(ss))
ans = 0
anss = 10**9
for sc in mm:
    ans = 0
    for i in range(len(sc)):
        if i == 4:
            ans += sc[i]
        else:
            ans += -(-sc[i]//10)*10
    anss = min(anss , ans)
print(anss)

Solution (Python):
D = list(reversed(sorted([int(input()) for _ in range(5)])))
max_rest = 0
max_rest_idx = 0
time = 0
for i in range(5):
    if D[i]%10 == 0:
        continue
    if max_rest <= (10 - D[i]%10):
        max_rest = (10 - D[i]%10)
        max_rest_idx = i
for i in range(5):
    if i == max_rest_idx:
        continue
    if D[i]%10 == 0:
        time += D[i]
    else:
        time += (D[i] + (10 - D[i]%10))
time = time + D[max_rest_idx]
print(time)

Solution (Python):
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())
L=[a,b,c,d,e]

a1=int(a[-1])
b1=int(b[-1])
c1=int(c[-1])
d1=int(d[-1])
e1=int(e[-1])
l1=[a1,b1,c1,d1,e1]

ans=0
flag=0
m=0
for i in range(5):
  if l1[i]==0:
    ans+=int(L[i])
  else:
    flag=1
    s=10-l1[i]
    ans+=int(L[i])+s
    if m<s:
      m=s
if flag==1:
  ans-=m
print(ans)

Solution (Python):
import itertools

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

candidates = []
for check in itertools.permutations(t):
  t = 0
  for i in range(4):
    t+= -((-check[i])//10)*10
  t+=check[-1]
  candidates.append(t)

print(min(candidates))

Solution (Python):
l = []
for i in range(5):
    inp = int(input())
    mod = inp % 10
    if mod != 0:
        mod = 10 - mod
    l.append([mod, inp])
l.sort()
ans = 0
for i in range(4):
    ans += l[i][0] + l[i][1]
ans += l[4][1]
print(ans)

Solution (Python):
import math
minutes=[int(input())for i in range(5)]
m=[math.ceil(minutes[k]/10)*10 for k in range(5)]
last =min((minutes[j]-1)%10 for j in range(5))
last+=1
print(m[0]+m[1]+m[2]+m[3]+m[4]+last-10)

Solution (Python):
import math

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

v = int((math.ceil(A)+math.ceil(B)+math.ceil(C)+math.ceil(D)+E) * 10)
w = int((math.ceil(A)+math.ceil(B)+math.ceil(C)+math.ceil(E)+D) * 10)
x = int((math.ceil(A)+math.ceil(B)+math.ceil(E)+math.ceil(D)+C) * 10)
y = int((math.ceil(A)+math.ceil(E)+math.ceil(C)+math.ceil(D)+B) * 10)
z = int((math.ceil(E)+math.ceil(B)+math.ceil(C)+math.ceil(D)+A) * 10)

print(min(v, w, x, y, z))

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return (math.ceil(N / 10)) * 10


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

    ABCDE = itertools.permutations([ii() for _ in range(5)])

    ret = MAX
    for a, b, c, d, e in ABCDE:
        ret = min(ret, f(a) + f(b) + f(c) + f(d) + e)
    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
import itertools

l = [int(input()) for i in range(5)]
l2 = list(itertools.permutations(l))
min = float("INF")
for i in range(120):
    ans = 0
    for j in range(4):
        if l2[i][j] % 10 == 0:
            ans += l2[i][j]
        else:
            ans += (l2[i][j] // 10 + 1) * 10
    ans += l2[i][4]
    if min > ans:
        min = ans
print(min)

Solution (Python):
l1=[]
l2=[]
for i in range(5):
    s=int(input())
    if s%10==0:
        l1.append(s)
    else:
        l2.append(s)
min_1=9
tot=sum(l1)
for i in range(len(l2)):
    tot+=10*(l2[i]//10 +1)
    if min_1>l2[i]%10:
        min_1=l2[i]%10

if len(l1)!=5:
    ans=tot-10+min_1
else:
    ans=tot
print(ans)

Solution (Python):
time_list = [int(input()) for i in range(5)]
ans = 0
min_rem = 10
for time in time_list:
    if time % 10 == 0:
        ans += time
    else:
        ans += (time // 10 + 1) * 10
        if min_rem > time % 10:
            min_rem = time % 10
if min_rem == 10:
    print(ans)
else:
    print(ans - (10 - min_rem))

Solution (Python):
import itertools
import math

antena = []
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))

mod = []
idx = 0
for i in range(len(antena)):
    mod.append(antena[i] % 10)
    if(mod[i] == 0):
        mod[i]=10

idx = mod.index(min(mod))
sum = 0
for i in range(len(antena)):
    if i != idx:
        sum += math.ceil(antena[i]/10) * 10
print(sum + antena[idx])

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
b = []
for i in a:
    if i%10:
        b.append(i)
c = min(b,key = lambda x:x%10) if len(b) else 0
ans = 0
for i in a:
    ans += i+(10-i%10) if i%10 else i
print(ans-(10-c%10) if len(b) else ans)

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
b = []
for i in a:
    if i%10:
        b.append(i)
c = min(b,key = lambda x:x%10) if len(b) else 0
ans = 0
for i in a:
    if i%10:
        ans += i+(10-i%10)
    else:
        ans += i
print(ans-(10-c%10) if len(b) else ans)

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

cnt1=0
cnt2=10

for i in range(5):
	if 0<A[i]-(A[i]//10)*10<cnt2:
		cnt1=i
		cnt2=A[i]-(A[i]//10)*10

res=A[cnt1]
		
for i in range(5):
	if i!=cnt1:
		res+=((A[i]+9)//10)*10

print(res)

Solution (Python):
from itertools import permutations

D = [int(input()) for _ in range(5)]
ans = 650

for d in list(permutations(D)):
  sum = 0
  for i in range(5):
    sum += d[i]
    if (i < 4):
      if d[i] % 10 > 0:
        sum += 10 - (d[i] % 10)
      else:
        sum += 0
  if sum < ans:    
    ans = sum

print(ans)

Solution (Python):
import math
number_list = [input() for _ in range(5)]
last_digit = [int(n[-1]) if int(n[-1]) != 0 else 1000 for n in number_list]
min_last_digit_index = last_digit.index(min(last_digit))
print(sum([int(n) if i == min_last_digit_index else math.ceil(int(n) / 10) * 10
           for i, n in enumerate(number_list)]))

Solution (Python):
import numpy as np

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

l = np.array(list(map(int, [a[-1], b[-1], c[-1], d[-1], e[-1]])))

idx = np.argmin(np.where(l == 0, 10, l))

times = list(map(int, [a, b, c, d, e]))

ans = 0
for i, t in enumerate(times):
  if i == idx:
    ans += t
  else:
    ans += np.ceil(t/10) * 10

print(int(ans))

Solution (Python):
import itertools

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

ans = float('inf')
for v in itertools.permutations(range(5), 5):
  result = 0
  for i in range(4):
    if dishes[v[i]] % 10 == 0:
      result += dishes[v[i]]
    else:
      result += (dishes[v[i]]//10)*10 + 10
  result += dishes[v[4]]
  ans = min(ans, result)

print(ans)

Solution (Python):
import itertools

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

p = itertools.permutations([0, 1, 2, 3, 4])

min_time = 10e9
for orders in p:
    current_time = 0
    for idx, order in enumerate(orders):
        t = times[order]
        current_time += t
        if idx < 4 and current_time % 10 != 0:
            current_time += 10 - current_time % 10

    min_time = min(min_time, current_time)

print(min_time)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
inp_list = [a,b,c,d,e]
ans = 1000
inp_sum = 0
for i in range(5):
    inp_sum += math.ceil((inp_list[i])/10)*10


for i in range(5):
    ans = min(ans,(inp_sum - math.ceil((inp_list[i])/10)*10) + inp_list[i])
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
minrem = 10
minnum = 0
tens = 0
impts = [a,b,c,d,e]
for i in impts:
  if i%10>0:
    if min(minrem,i%10)==i%10:
      minrem = i%10
      minnum = i
  else:
    tens+=1
if tens==5:
  print(a+b+c+d+e)
else:  
  print((a//10+b//10+c//10+d//10+e//10)*10+(5-tens-1)*10-minnum//10*10+minnum)

Solution (Python):
a = []
for i in range(5):
    a.append(input())
ans = 0
a.sort(key = lambda x: x[-1])
flag = True
for s in a:
    if s[-1] == '0' and flag:
        ans += int(s)
    elif flag:
        ans += int(s)
        flag = False
    else:
        x = int(s[-1])
        ans += int(s) + 10 -x
print(ans)