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:
menu = [int(input()) for _ in range(5)]
menu = sorted(menu,key = lambda x:x%10)
flag = True
ans=0

for v in menu:
    if flag and v%10!=0:
        ans+=v
        flag=False
    else:
        if flag:
            ans+=v
        else:
            ans+= v + 10-(v%10)
print(ans)

Submission status: Accepted

Solution code:
# 料理を最速で届くようにするには、最後に頼む料理に注目する
# 注文して届いた後から次の注文までのインターバルが
# 最も大きいものを最後に注文するべき

cook_time = [int(input()) for _ in range(5)]
interval_time = [0]*5

for i in range(len(cook_time)):
    interval_time[i] = (10 - (cook_time[i]%10))%10
    
print(sum(cook_time)+sum(interval_time)-max(interval_time))

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
a = list(map(lambda x:-(-x//10)*10,l))
b = list(map(lambda x:x%10 if x%10 else 10,l))
print(sum(a)-(10-min(b)))

Submission status: Accepted

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

B = [-((-A[i])%10) for i in range(5)]
C = [-((-A[i])//10) * 10 for i in range(5)]

#print(B, C)

print(sum(C) + min(B))

Submission status: Accepted

Solution code:
dishes = [int(input()) for _ in range(5)]
diffs = [-(-dish//10)*10 - dish for dish in dishes]
print(sum(dishes) + sum(diffs) - max(diffs))

Submission status: Accepted

Solution code:
import itertools


def func():
    index = list(range(5))
    p = list(itertools.permutations(index))

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

    mn = 1e1000

    for i in p:
        sum = 0
        for k in range(5):

            reminder = time[i[k]] % 10
            if reminder == 0:
                reminder = 10
            if k == 4:
                sum += time[i[k]]
            else:
                sum += time[i[k]] + (10 - reminder)
        mn = min(mn, sum)

    print(mn)


if __name__ == '__main__':
    func()

Submission status: Accepted

Solution code:
def func():
    time = []

    for i in range(5):
        t = int(input())
        remainder = t % 10
        if remainder == 0:
            remainder = 10
        tmp = [t, remainder]
        time.append(tmp)

    time = sorted(time, reverse=True, key=lambda x: x[1])

    sum = 0
    for i in range(5):
        if i == 4:
            sum += time[i][0]
        else:
            sum += time[i][0] + (10 - time[i][1])

    print(sum)


if __name__ == '__main__':
    func()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import math

A, B, C, D, E = int(input()), int(input()), int(input()), int(input()), int(input())
a = [A, B, C, D, E]
b = list(map(lambda x: (x - 1) % 10, a))
tmp = a[b.index(min(b))]
del a[b.index(min(b))]
c = list(map(lambda x: (math.ceil(x / 10) * 10), a))
print(sum(c) + tmp)

Submission status: Accepted

Solution code:
I = [int(input()) for _ in range(5)]
min_ = 10
cnt = 0
for ii in range(5):
    mod10 = I[ii] % 10
    cnt += I[ii] + (10 - mod10) if mod10 != 0 else I[ii]
    if min_ > mod10 and mod10 != 0: min_ = mod10

print (cnt - (10 - min_))

Submission status: Accepted

Solution code:
import math

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

total = 0
sub = 0
for i in L:
    if i % 10 == 0:
        total += i
    else:
        rest = 10 - (i % 10)
        if rest > sub:
            sub = rest
        total += math.ceil(i / 10) * 10

print(total - sub)

Submission status: Accepted

Solution code:
import math

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

uptime = [0 for _ in range(5)]
for i in range(5):
    uptime[i] = math.ceil(time[i]/10)*10 # 1の位切り上げ

sa = [0 for _ in range(5)]
for i in range(5):
    sa[i] = uptime[i] - time[i]

ans = sum(uptime) - max(sa)

print(ans)

Submission status: Accepted

Solution code:
ans = 0
m = 10
for i in range(5):
  food = int(input())
  if food % 10 == 0:
    ans += food
  else:
    k = food % 10
    ans += food + 10 - k
    m = min(m,k)
print(ans - 10 + m)

Submission status: Accepted

Solution code:
import math
total = 0
first_min = 10
for _ in range(5):
    time = int(input())
    total += math.ceil(time/10)*10
    if first_min > time%10 > 0:
        first_min = time%10
print(total-10+first_min)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from itertools import permutations
from math import ceil

def main():
    L = []
    [L.append(int(input())) for _ in range(5)]
    all_combinations = list(permutations(L))

    ans = float('inf')
    for i in range(len(all_combinations)):
        temp = 0
        for j in range(5):
            if j != 4:
                temp += all_combinations[i][j]
                temp = ceil(temp/10) *10
            if j == 4:
                temp += all_combinations[i][j]
        if temp < ans:
            ans = temp

    return ans

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
Z=[]
Y=[]
for i in range(5):
    a=int(input())
    if a% 10!=0:
        Z.append(10-a % 10+a)
        Y.append(a % 10)
    else:
        Z.append(a)
if len(Y)==0:
    H=10
else:
    H=min(Y)

print(sum(Z)-(10-H))

Submission status: Accepted

Solution code:
ans = 0
t_min = 10

for i in range(5):
    o = int(input())
    ans += o
    t = o % 10
    if t != 0:
        ans += 10 - t
        if t < t_min:
            t_min = t
ans -= 10 - t_min

print(ans)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
t = []
for i in range(5):
  c = (10-a[i])%10
  t.append(c)
print(sum(a) + sum(t) - max(t))

Submission status: Accepted

Solution code:
c=list(int(input()) for i in range(5))
amari=0
ma=0
for i in range(5):
    if c[i]%10!=0:
        amari+=10-(c[i]%10)
        if 10-(c[i]%10)>ma:
            ma=(10-(c[i]%10))           
time=sum(c)+(int(amari-ma))
print(int(time))

Submission status: Accepted

Solution code:
ds = []
total_time = 0
for i in range(5):
    d = int(input())
    if d % 10 == 0:
        total_time += d
    else:
        total_time += (d // 10 + 1) * 10
        ds.append(d % 10)
if len(ds) > 0:
    total_time = total_time - 10 + sorted(ds)[0]
print(total_time)

Submission status: Accepted

Solution code:
inputs=[int(input()) for _ in range(5)]

ans=0
ans=1000000000000000
for i in range(len(inputs)):
  tmp=0
  for j in range(len(inputs)):
    no=(i+j)%len(inputs)
    if j!=len(inputs)-1 and inputs[no]%10!=0:
      tmp+=inputs[no]+(10-inputs[no]%10)
    else:
      tmp+=inputs[no]
  if ans>tmp:
    ans=tmp
print(ans)

Submission status: Accepted

Solution code:
minv = 9
time = 0
count = 0
for i in range(5):
    p = int(input())
    if p%10 >0:
        minv = min(minv,p%10)
        q = (p//10)*10+10
        time += q
    else:
        time += p
        count+=1
time -= 10-minv
print(time+1 if count == 5 else time )

Submission status: Accepted

Solution code:
list = list(int(input()) for _ in range(5))
ans = 0
tag = 9
count = 0
for i in range(5):
  if list[i]%10==0:
    ans+=list[i]
    count+=1
  else:
    ans+=list[i]+(10-(list[i]%10))
    if tag>list[i]%10:
      tag = list[i]%10
print(ans if count==5 else ans-(10-tag))

Submission status: Accepted

Solution code:
lst = []
time = 0
for i in range(5):
    t = input()
    if int(t[-1]) == 0:
        lst.append([int(t), 9])
    else:
        lst.append([int(t), int(t[-1])])
l = sorted(lst, key = lambda lst:lst[1])
for i in range(5):
    if i == 0:
        time += l[i][0]
    else:
        time += l[i][0]//10 * 10
        if l[i][0]%10 != 0:
            time += 10
print(time)

Submission status: Accepted

Solution code:
sum_div = 0
M = []
for i in range(5):
    num = int(input())
    sum_div += num // 10
    mod = num % 10
    if mod != 0:
        M.append(mod)

if M:
    waiting = 10*(len(M)-1) + min(M)
else:
    waiting = 0
total = sum_div*10 + waiting
print(total)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a1=a%10
b1=b%10
c1=c%10
d1=d%10
e1=e%10
ar=[a1,b1,c1,d1,e1]
a2=a//10
b2=b//10
c2=c//10
d2=d//10
e2=e//10
k=10
s=0
minimini=-1
for i in ar:
    if i==0:
        continue
    minimini=min(i,k)
    if i<k:
        k=i
for i in ar:
    if i==0:
        continue
    if i==minimini:
        minimini-=1
        continue
    else:
        s+=10
print((a2+b2+c2+d2+e2)*10+minimini+1+s)

Submission status: Accepted

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

can_saves = [(10-x)%10 for x in A]
times = [(x+9)//10*10 for x in A]
print(sum(times) - max(can_saves))

Submission status: Accepted

Solution code:
A=[int(input()) for a in range(5)]
A.sort(key=lambda x:10-(x-1)%10)
ans=0
for i in range(4):
	if A[i]%10!=0:
		A[i]=(A[i]//10)*10+10
print(sum(A))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def tenmul (n):
    if n % 10 == 0:
        return n
    else:
        return n + 10 - n%10

a2 = tenmul(a)
b2 = tenmul(b)
c2 = tenmul(c)
d2 = tenmul(d)
e2 = tenmul(e)
list = [a,b,c,d,e]
list2 = [a2,b2,c2,d2,e2]

result = sum(list2)
for i in range(5):
    M = sum(list2)
    result = min(M-list2[i]+list[i],result)
print(result)

Submission status: Accepted

Solution code:
ds = [int(input()) for _ in range(5)]
ls = 10

for i in range(5):
    m = ds[i] % 10

    if ls > m > 0:
        ls = m

    if m > 0:
        ds[i] += 10 - m

res = sum(ds) - (10 - ls)
print(res)

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
r = [0] * 5
q = 0

for i in range(5):
    tr = t[i] % 10
    tq = t[i] // 10
    if tr == 0:
        r[i] = 10
        q += tq
    else:
        r[i] = tr
        q += tq + 1

if min(r) != 10:
    q -= 1
else:
    r = [0] * 5

print(q * 10 + min(r))

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
before = 9
index = 0

for i in range(5):
    if before > (a[i]+9)%10:
        before = (a[i]+9)%10
        index = i
for i in range(5):
    if i != index and a[i]%10 != 0:
        a[i] = (a[i]+10)//10*10

print(sum(a))

Submission status: Accepted

Solution code:
p = [int(input()) for _ in range(5)]
minr = 10
ans = 0
for x in p:
    if x % 10 == 0:
        ans += x // 10
    else:
        ans += x // 10 + 1
        minr = min(minr, x % 10)
print(ans * 10 - (10 - minr))

Submission status: Accepted

Solution code:
import itertools
from math import ceil
t = []
for i in range(5):
    t.append(int(input()))
ans = 10**9

for values in list(itertools.permutations(t)):
    tmp = 0
    for i, v in enumerate(values):
        if i == 4:
            tmp += v
        else:
            tmp += (ceil(v / 10) * 10)
    ans = min(ans, tmp)
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def main(): 

    a=[int(input()) for _ in range(5)]
    ans=10**5
    for i in range(5):
        tmp = a[i]
        for j in range(5):
            if i != j:
                if a[j]%10==0:
                    tmp += a[j]
                else:
                    tmp += (a[j]//10+1)*10
        ans=min(ans,tmp)
    print(ans)
    



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
L = [int(input()) for i in range(5)]
S = 0
answer = []
for i in range(5):
    S += math.ceil(L[i]/10) * 10
for i in range(5):
    answer.append(S - math.ceil(L[i]/10) * 10 + L[i])
print(min(answer))

Submission status: Accepted

Solution code:
from collections import deque
from math import ceil
L1 = [int(input()) for _ in range(5)]
L2 = list(map(lambda x: x % 10 if x % 10 != 0 else 10, L1))
L3 = list(map(lambda x: ceil(x/10)*10 if x % 10 != 0 else x, L1))
print (sum(L3) + min(L2) -10)

Submission status: Accepted

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

dish1 = [x for x in dish if x % 10 == 0]
dish2 = [x for x in dish if x % 10 != 0]
dish2 = sorted(dish2, key=lambda x: x % 10, reverse=True)

score = sum(dish1)
for i, d in enumerate(dish2):
    if i < len(dish2) - 1:
        score += d + (10 - d % 10)
    else:
        score += d

print(score)

Submission status: Accepted

Solution code:
f = [int(input()) for i in range(5)]
f.sort(key=lambda x: (x-1)%10)
t = f[0]
for v in f[1:]:
    t += (v+9)//10 * 10

print(t)

Submission status: Accepted

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

a = []
b = []
for i in range(5):
    a.append(((order_list[i]-1)//10+1)*10)
    b.append((order_list[i]-1)%10)

if min(b) != 9:
    ans = sum(a) + min(b) -9
else:
    ans = sum(a)
print(ans)

Submission status: Accepted

Solution code:
import itertools
a = [int(input()) for _ in range(5)]
mi = 10 ** 10
for i in itertools.permutations(a, 5):
    t = 0
    for j, v in enumerate(i):
        if j == 4:
            t += v
        else:
            t += ((v + 9) // 10 * 10)
    mi = min(t, mi)
print(mi)

Submission status: Accepted

Solution code:
import math

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

#全部繰り上げて足す。そこから末尾が一番小さい数と10の差の絶対値を引く。

time = 0
for i in range(5):
    time = time + 10*math.ceil(menu[i]/10)
    menu[i] = menu[i]%10

nonzeromenu = [i for i in menu if i != 0]
nonzeromenu.sort()

if nonzeromenu:
    print(time -10 +nonzeromenu[0])
else:
    print(time)

Submission status: Accepted

Solution code:
import math
def main():
    order = []
    for _ in range(5):
        order.append(int(input()))
    min_r = 10
    last = None
    for i in range(5):
        r = order[i] % 10
        if r != 0 and r < min_r:
            min_r = r
            last = i
    if last == None:
        return sum(order)
    time = 0
    for i in range(5):
        if i != last:
            time += math.ceil(order[i] / 10) * 10
        else:
            time += order[i]
    return time


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
s = [int(input()) for i in range(5)]
n = len(s)
a = []
ans = 0
for i in range(n):
  amari = s[i]%10
  num = 10-amari if amari!=0 else 0
  a += [[i,num]]
a.sort(lambda x:x[1])  
for j in range(n-1):
  ans += s[a[j][0]] + a[j][1]
ans += s[a[-1][0]]
print(ans)

Submission status: Accepted

Solution code:
input_li = [int(input()) for _ in range(5)]
rest_li = [_ % 10 for _ in input_li]
rest_li = [_ for _ in rest_li if _ != 0]

if len(rest_li) != 0:
    min_li = min(rest_li)
    del rest_li[rest_li.index(min_li)]
    total = 0

    for i in  rest_li:
        if i != 0:
            total += 10 - i

    print(sum(input_li) + total)

else:
    print(sum(input_li))

Submission status: Accepted

Solution code:
r=0
m=9
c=0
for i in range(5):
    t=int(input())
    h=int(str(t)[-1])
    if h==0:
        r+=t
        c+=1
    else:
        t=(t+10-1)//10*10
        r+=t
        m=min(m,h)
if c==5:
    print(r)
else:
    print(r-10+m)

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
ll = []
ans = -10
for i in range(5):
    if l[i] % 10 ==0:
        ans += l[i]
    else:
        ll.append(l[i]%10)
        ans += (l[i]//10 + 1)*10
if ll == []:
    ans += 10
else:
    ans += min(ll)
print(ans)

Submission status: Accepted

Solution code:
# B - Five Dishes(ABC123)
B=[]
C=[]
for i in range(5):
    S=int(input())
    if S%10==0:
        C.append(S)
    else:
        C.append(S+(10-S%10))
    if S%10!=0:
        B.append(S%10)
if B==[]:
    print(sum(C))
else:
    print(sum(C)-(10-min(B)))

Submission status: Accepted

Solution code:
myArray = list()
for n in range(5):
    myArray.append(int(input()))
Jouyo  = 9
jouyoi = 0

for i,j in enumerate(myArray):
    if 0 < j % 10 <= Jouyo:
        Jouyo = j % 10
        jouyoi = i
times = 0
for i,j in enumerate(myArray):
    if i != jouyoi:
        if j % 10 != 0:
            times += ((j // 10) + 1) * 10
        else:
            times += j
    else:
        times += j
print(times)

Submission status: Accepted

Solution code:
D_ = [int(input()) for i in range(5)]

min = 10
index = 0
for i in range(len(D_)):
    if D_[i]%10 > 0 and D_[i]%10 <= min:
        min = D_[i]%10
        index = i

for i in range(len(D_)):
    if D_[i]%10 > 0 and index != i:
        D_[i] = (D_[i]//10 )*10 + 10

print(sum(D_))

Submission status: Accepted

Solution code:
li=[input() for i in range(5)]
mi=10
for i in range(5):
    if int(li[i][-1])!=0:
        mi = min(mi, int(li[i][-1]))
ans = 0

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

Submission status: Accepted

Solution code:
ant = [int(input()) for _ in range(5)]

minidx = 0
minval = 124
i = 0
for a in ant:
    while 10 < a:
        a %= 10
        if a == 0:
            a = 10
    if a < minval:
        minidx = i
        minval = a
    i += 1

ans = 0
for i in range(5):
    if i == minidx:
        continue
    fact = 10
    while fact - ant[i] < 0:
        fact += 10
    ans += fact

ans += ant[minidx]
print(ans)

Submission status: Accepted

Solution code:
from math import ceil
ord = [int(input()) for _ in range(5)]
max_wait = 0
max_idx = 0
for i in range(5):
    cur = ceil(ord[i] / 10) * 10 - ord[i]
    if max_wait < cur:
        max_wait = cur
        max_idx = i
ans = 0
for i in range(5):
    if i != max_idx:
        ans += ceil(ord[i] / 10) * 10
ans += ord[max_idx]
print(ans)

Submission status: Accepted

Solution code:
N = 5

dish_list = []
d1_list = []

for i in range(N):
    tmp = int(input())
    dish_list.append(tmp)
    if tmp%10 == 0:
        d1_list.append(10)
    else:
        d1_list.append(tmp%10)

time = 0
for i in range(N):
    max_index = d1_list.index(max(d1_list))
    if i == 4:
        time += dish_list[max_index]
    else:
        time += (dish_list[max_index]//10) * 10
        if dish_list[max_index]%10 != 0:
            time += 10

    del dish_list[d1_list.index(max(d1_list))]
    del d1_list[d1_list.index(max(d1_list))]

print(time)

Submission status: Accepted

Solution code:
A = [-int(input()) for _ in range(5)]
m = max(A, key = lambda x: x%10)
print(-(m-m//10*10+sum([a//10*10 for a in A])))

Submission status: Accepted

Solution code:
total = 0
MIN = 9999
amari = False
for i in range(5):
    s = int(input())
    smod = int(s % 10)
    if smod == 0:
        total += s
    else:
        total += s - smod + 10
        MIN = min(MIN,smod)
        amari = True
if MIN == 9999:
    MIN = 0
elif amari:
    total -= 10
print(total + MIN)

Submission status: Accepted

Solution code:
seq = [int(input()) for i in range(5)]
t = 0
d = 9

for s in seq:
    t += s
    t = (t - 1) // 10 + 1
    t *= 10
    
    d = min(d, (s - 1) % 10) 
    
print(t + d - 9)

Submission status: Accepted

Solution code:
import itertools

seq = [int(input()) for i in range(5)]
ans = 10 ** 9

for ss in itertools.permutations(seq):
    t = 0
    for s in ss:
        t = (t - 1) // 10 + 1
        t *= 10
        t += s
    ans = min(ans, t)
    
print(ans)

Submission status: Accepted

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

o=[0 for _ in range(5)]
o1=[0 for _ in range(5)]
o[0]=a
o[1]=b
o[2]=c
o[3]=d
o[4]=e

m=max(o)
if not(m%10==0):
    while(m%10!=0):
        m+=1
for i in range(5):
    o1[i]=(m-o[i])%10
m1=max(o1)%10

for i in range(5):
    if not(o[i]%10==0):
        while(o[i]%10!=0):
            o[i]+=1
s=sum(o)

print(s-m1)

Submission status: Accepted

Solution code:
import numpy as np

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

ins = np.zeros(5)
ins[0] = a
ins[1] = b
ins[2] = c
ins[3] = d
ins[4] = e

ls = np.zeros(5)
ls[0] = a%10
ls[1] = b%10
ls[2] = c%10
ls[3] = d%10
ls[4] = e%10

count=0
for i in range(5):
    if ls[i]==0:
        count=count+1
x = np.argsort(ls)

ans = 0
for i in range(5):
    if ls[i]==0:
        ans = ans+ins[i]
    elif i==x[count]:
        ans = ans+ins[i]
    else:
        ans = ans + ((ins[i]//10)+1)*10
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


def solve():
    abcde = [int(input()) for _ in range(5)]
    if any([str(i)[-1] != "0" for i in abcde]):
        last = min([i for i in abcde if not str(i)[-1] == "0"], key=lambda x: abs(int(str(x)[-1])))
    else:
        last = min(abcde)
    hoge = sum([math.ceil(i / 10) * 10 for i in abcde]) - (math.ceil(last / 10) * 10)
    print(hoge + last)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
array = []
for i in range(5):
  array.append(int(input()))
  
ichi = list(map(lambda x: x%10,array))
ichi = list(map(lambda x: 10 if x==0 else x,ichi))

minichi = min(ichi)

sum = 0
for i in range(5):
  sum += ((array[i]+10-1)//10)*10

if minichi != 10:
  print(sum-10+minichi)
else:
  print(sum)

Submission status: Accepted

Solution code:
L = []
L2 = []
for _ in range(5):
    a = input()
    if a[-1] == "0":
        L.append(int(a))
    else:
        last = int(a[-1])
        L.append(int(a) + 10 - last)
        L2.append(last)
if not L2:
    print(sum(L))
else:
    print(sum(L) + min(L2) - 10)

Submission status: Accepted

Solution code:
def int_ceil(x):
  last=int(str(x)[-1])
  return([x+10-last,last])

dishes =[0]*5
min=10
for i in range(5):
  x=(int(input()))
  if x % 10 != 0:
    ceiled=int_ceil(x)
    if ceiled[1] < min:
      min=ceiled[1]
    dishes[i]=ceiled[0]
  else:
    dishes[i]=x
print(sum(dishes) - 10 + min)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
b = 0
c = []
for s in a:
    b = 10 - s % 10
    if b == 10:
        b = 0
    c.append(b)
d = zip(c,a)
e = sorted(d)
ans = 0
count = 0
for x,y in e:
    count += 1
    if count == 5:
        ans = ans + y
        break
    ans = ans + x + y

print(ans)

Submission status: Accepted

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

min_r = 10
min_dish = 0
for i in range(5):
    if dish[i] % 10 != 0 and min_r > dish[i] % 10:
        min_r = dish[i] % 10
        min_dish = i

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

print(ans)

Submission status: Accepted

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

min1 = 10
minval = 0 
for i in range(5):
    n = AList[i] % 10
    if n != 0 and min1 > n:
        min1 = n
        minval = AList[i]

sum1 = 0
if minval != 0:
    AList.remove(minval)
    sum1 = minval

for i in range(len(AList)):
    n = AList[ i ] + 9
    sum1 += (n // 10) * 10
print(sum1)

Submission status: Accepted

Solution code:
import itertools
import math
import sys
input = sys.stdin.readline
abcde = [int(input()) for _ in range(5)]

min_time = 2**24
for perm in itertools.permutations(abcde):
  time = 0
  for x in perm[0:-1]:
    time = math.ceil((time + x) / 10) * 10
  time += perm[-1]
  min_time = min(time, min_time)

print(min_time)

Submission status: Accepted

Solution code:
time=map(int,open(0).read().split())

def dist(n,th):
  amari=n%th
  if amari == 0:
    return amari
  else:
    return th-amari

arr=sorted([[dist(t,10),t] for t in time] ,key=lambda x: x[0])
print(sum([sum(x) for x in arr[:-1]])+arr[-1][1])

Submission status: Accepted

Solution code:
time=map(int,open(0).read().split())

arr=[]
for t in time:
  amari=t % 10
  if amari == 0:
    d=amari
  else:
    d=10-amari
  arr.append([d, t])

arr.sort(key=lambda x: x[0])

total=0
for x in arr[:-1]:
  total+=sum(x)
print(total+arr[-1][1])

Submission status: Accepted

Solution code:
import math
def resolve():
    a = list(int(input()) for _ in range(5))
    mint = 1000
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
        if a[i]%10 == 0: continue
        mint = min(mint,a[i]%10)
    if mint == 1000:
        print(ans)
    else:
        print(ans+mint-10)
resolve()

Submission status: Accepted

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

print(-(-a//10*10)-(-b//10*10)-(-c//10*10)-(-d//10*10)-(-e//10*10)-max((10-a)%10,(10-b)%10,(10-c)%10,(10-d)%10,(10-e)%10))

Submission status: Accepted

Solution code:
import math
import copy

# inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

a = 5
inputList=[]
for i in range(a):
    inputNum = input()
    inputList.append(inputNum)

inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

itemInfo = []
tmp = []

for i in range(a):
    tmp.append(int(math.floor(inputList[i]/10))*10)
    tmp.append(int(math.ceil(inputList[i]/10))*10)
    tmp.append(inputList[i]%10)
    itemInfo.append(copy.deepcopy(tmp))
    tmp.clear()

tmpList = sorted(itemInfo, key = lambda x:x[2])

flg = False
sum = 0
for i in range(len(tmpList)):
    if flg == False and tmpList[i][2] != 0:
        flg = True
        sum += tmpList[i][0] + tmpList[i][2]
    else:
        sum += tmpList[i][1]

print(sum)

Submission status: Accepted

Solution code:
t=0
s=10
for i in range(5):
    k=int(input())
    if k%10==0:
        t+=k
    else:
        t+=((k//10)+1)*10
        if k%10<s:
            s=k%10

if s!=10:
    print(t-10+s)
else:
    print(t)

Submission status: Accepted

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

#注文するべき順番は下一桁が０であるのが最強、１が最弱９は０にだけまける。下一桁を０にしたやつを足す
#これ順番はどうでもよい？
#要は注文時間の下一桁切り上げを足せってことですかね？
#最後の料理は０に切り上げる必要がないね
import math
a=10*(math.ceil(A/10))
b=10*(math.ceil(B/10))
c=10*(math.ceil(C/10))
d=10*(math.ceil(D/10))
e=10*(math.ceil(E/10))
Q=max(a-A,b-B,c-C,d-D,e-E)
if Q==a-A:
    print(b+c+d+e+A)
elif Q==b-B:
    print(a+c+d+e+B)
elif Q==c-C:
    print(a+b+d+e+C)
elif Q==d-D:
    print(a+b+c+e+D)
elif Q==e-E:
    print(a+b+c+d+E)

Submission status: Accepted

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

min = 10
for i in range(5):
    if min > A[i] % 10 and A[i] % 10 != 0:
        min = A[i] % 10
        tmp = i

ans = 0
for i in range(5):
    if A[i] % 10 == 0 or i == tmp:
        ans += A[i]
    else:
        ans += A[i] + (10 - A[i] % 10)

print(ans)

Submission status: Accepted

Solution code:
import math

minMod = 10
minModNum = 0
numList = []
for i in range(0, 5):
    numList.append(int(input()))
    if ((numList[i] % 10 != 0) & (numList[i] % 10 < minMod)):
        minMod = numList[i] % 10
        minModNum = i

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

Submission status: Accepted

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

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

order_list = []
for x in X:
    priority = x % 10
    if priority == 0:
        priority = 10
    order_list.append([x, priority])

order_list.sort(key=lambda order: order[1])

total_time = 0
for time, priority in order_list[1:]:
    plus10 = 0
    if time % 10 > 0:
        plus10 = 10
    actual_time = time//10*10 + plus10
    total_time += actual_time
    #print([time, priority], actual_time, total_time)

order = order_list.pop(0)
time = order[0]
total_time += time

print(total_time)

Submission status: Accepted

Solution code:
ll = [int(input()) for i in range(5)]

def calc_time(ll,idxlist):
	time = 0
	for _ in range(4):
		time += ll[idxlist[_]]
		while time % 10 != 0:
			time += 1
	time += ll[idxlist[4]]
	return time

time_min = 10**(3)
for i in range(5):
	for j in range(5):
		if i == j:
			continue
		for k in range(5):
			if j == k or i == k:
				continue
			for l in range(5):
				if k == l or j == l or i == l:
					continue
				for m in range(5):
					if l == m or k == m or j == m or i == m:
						continue
					time = calc_time(ll,[i,j,k,l,m])
					if time < time_min:
						time_min = time
print(time_min)

Submission status: Accepted

Solution code:
time_list=[int(input()) for _ in range(5)]
mod10_list=[]
for i in time_list:
  if i%10==0:
    mod10_list.append(10)
  else:
    mod10_list.append(i%10)
for i in range(5):

  if time_list[i]%10==0:
    pass
  else:
    time_list[i]=((time_list[i]//10)+1)*10
ans=sum(time_list)-10+min(mod10_list)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans = 0
r = 10
for i in range(5):
  a = int(input())
  if a%10 == 0:
    ans += a
  else:
    r = min(r,a%10)
    ans += (a//10)*10+10
ans += r-10
print(ans)

Submission status: Accepted

Solution code:
dishes = list(int(input()) for _ in range(5))

lost_time = [0]*5
for i in range(5):
    lost_time[i] = 9 - ((dishes[i] - 1) % 10)

print(sum(dishes)+sum(lost_time)-max(lost_time))

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
b = [-(-i//10)*10-i for i in a]

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