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.



Sample input:
29
20
7
35
120


Sample output:
215

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    solve(A, B, C, D, E)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

#1の位
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:
    #print(i)
    if i == last:
        las = j  #最後に注文するやつのindex
    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)
#print(ls)
if flag==0:
    print(sum(ls))
else:
    print(sum([A,B,C,D,E]))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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))
# print(A)
ans = A[0][0]
for i in range(1, 5):
    tmp = ceil(A[i][0]/10)*10
    ans += tmp
    # print(tmp)

print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
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))
#%%code

def resolve():
    A=[int(input()) for i in range(5)]
    A.sort(key=lambda x:(x-1)%10)
    #print(A)
    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)
        
#%%submit!    
resolve()

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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]
        #if ans > time: print("way={}, time={}".format(way, time))
        ans = min(ans, time)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
l1=[]#1の位が0
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
#print(tot,min_1)
if len(l1)!=5:
    ans=tot-10+min_1
else:
    ans=tot
print(ans)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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
#print(inp_sum)

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# ABC123B(t):

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): # i = 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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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
#print(time_mod)
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)

Submission status: Accepted

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

    #inf = 10**17
    #mod = 10**9 + 7

    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()

Submission status: Accepted

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

    #inf = 10**17
    #mod = 10**9 + 7

    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()

Submission status: Accepted

Solution code:
import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [list(map(int, input().split())) for i in range(N)]
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

#1keta toru 10 watte amari dasu
#amari wo dasu
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)