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:
ls = [int(input()) for i in range(5)]

na = []
for n in ls:
  if n%10 == 0:
  	na.append(n//10)
nb = []
rb = []
for n in ls:
  if n%10 != 0:
    nb.append(n//10 + 1)
    rb.append(n%10)
#print(na,nb)

if len(rb) == 0:
  print(sum(na)*10 + sum(nb)*10)
else:
  minr = max(min(rb), 0)
  print(sum(na)*10 + sum(nb)*10 -10 + minr)

Submission status: Accepted

Solution code:
from math import ceil
time = [int(input()) for i in range(5)]
mod = []
for t in time:
    if t % 10 == 0: mod.append(10)
    else: mod.append(t % 10)

total = 0
for i in range(5):
    total += 10 * ceil(time[i]/10)
total -= (10 - min(mod))
print(total)

Submission status: Accepted

Solution code:
lis = [int(input()) for _ in range(5)]
times = [(l + 9) // 10 * 10 for l in lis]
loss = [(10 - l % 10) % 10 for l in lis]
print(sum(times) - max(loss))

Submission status: Accepted

Solution code:
from sys import stdin
import math

order = {'0': 0, '9': 1, '8': 2, '7': 3, '6': 4, '5': 5, '4': 6, '3': 7, '2': 8, '1': 9}
r = 0
foods = sorted([stdin.readline().rstrip() for _ in range(5)], key=lambda food: order[food[-1]])

for i, food in enumerate(foods):
    if food[-1] == '0' or i == 4:
        r += int(food)
    else:
        r += 10 * (math.floor(int(food) / 10) + 1)

print(r)

Submission status: Accepted

Solution code:
x = [int(input()) for i in range(5)]
mintime = 100000
for i in range(5):
    for j in range(5):
        for p in range(5):
            for q in range(5):
                for w in range(5):
                    time = 0
                    if i != j and i != p and i != q and i != w and j != p and j != q and j != w and p != q and p != w and q != w:
                        time += x[i]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[j]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[p]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[q]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[w]
                        if time < mintime:
                            mintime = time
print(mintime)

Submission status: Accepted

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

mi = 9
ar = a % 10
if ar > 0 and ar < mi:
  mi = ar
br = b % 10
if br > 0 and br < mi:
  mi = br
cr = c % 10
if cr > 0 and cr < mi:
  mi = cr
dr = d % 10
if dr > 0 and dr < mi:
  mi = dr
er = e % 10
if er > 0 and er < mi:
  mi = er

li = [a,b,c,d,e]
su = 0
fl = 0
for i in li:
  if i%10==mi and fl == 0:
#    print("{} += {}".format(su,i))
    su = su + i
    fl = 1
  else:
#    print("{} += {}".format(su,i//10*10+10))
    if i%10 == 0:
      su = su+i
    else:
      su = su + i//10*10+10
print(su)

Submission status: Accepted

Solution code:
import math

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


def main():
    M = [A, B, C, D, E]
    L = [int(math.ceil(m / 10) * 10) for m in M]

    x = min([(m-1) % 10 for m in M]) + 1

    print(sum(L) - 10 + x)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
l=[input() for i in range(5)]
a=[0, 0, 0, 0, "9"]

for i in range(5):
  if int(a[4][-1]) >= int(l[i][-1]) and not(int(l[i][-1]) == 0):
      a[4] = l[i]

if a[4] is "9":
  a[4] = l[0]

l.remove(a[4])
l = [int(i) for i in l]
l.sort()
for j in range(4):
  while(not(int(l[j]) % 10 is 0)):
    l[j]+=1
  a[j] = int(l[j])
  
a[4] = int(a[4])
print(sum(a))

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
l = [n % 10 if not (n % 10 == 0) else 100 for n in L]
i = l.index(min(l))
I = 10 - (L[i] % 10) + L[i] if not(L[i] % 10 == 0) else L[i]
SUM = sum([n + 10 - (n % 10) if not (n % 10 == 0) else n for n in L])
# print(i, I, SUM)
ans = SUM - I + L[i]
print(ans)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
r = 10
last = 0
for i in range(5):
    if a[i] % 10 != 0 and a[i] % 10 < r:
        last = i
        r = int(a[i] % 10)


b = [int((a[i] + 9) / 10) * 10 for i in range(5)] 
time = 0
for i in range(5):
    if i != last:
        time = time + b[i]
    
time = time + a[last]
print(time)

Submission status: Accepted

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

T_sub = []
cnt = 0
for i in range(10, 131, 10):
    while T[cnt] <= i:
        T_sub.append(i - T[cnt])
        cnt += 1
        if cnt == 5:
            break
    if cnt == 5:
        break

max_index = T_sub.index(max(T_sub))

new_T = []
for i in range(5):
    if i == max_index:
        pass
    else:
        new_T.append(T[i])
new_T.append(T[max_index])

time = 0
for i in range(5):
    time += new_T[i]
    if i == 4:
        print(time)
        exit()
    else:
        while time % 10 != 0:
            time += 1

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
# 料理の時間
# ABC 丼
A = int(input())
# ARC カレー
B = int(input())
# AGC パスタ
C = int(input())
# APC ラーメン
D = int(input())
# ATC ハンバーグ
E = int(input())

# 10で割り切れるかを判断させる
order_list         = [A, B, C, D, E]
ordered_order_list = []
counter = 0

# 10で割り切れるものを先に、10で割った余りが最大のものを最後にする
for i, order in enumerate(order_list):
#  print("------------------")
#  print(str(i))
#  print(str(order))
#  print(ordered_order_list)
    
    
  # 最初のものはまずリストに挿入
  if i == 0:
#    print('最初のもの')
    ordered_order_list.append(order)
    if order % 10 ==0:
       counter += 1
    continue

#  # 10で割り切れるものしかないときは最後に挿入
#  if(len(ordered_order_list) == counter):
#    ordered_order_list.append(order)
#    continue

  # 10で割り切れるときは最初に挿入
  if order % 10 == 0:
    ordered_order_list.insert(0, order)
    counter += 1
  # そうでない場合は最後尾と1の位同士を比較し、1の位が小さいほうを最後尾にする
  else:
#    print('そうでないもの')
    order_units_digit        = order % 10
#    print(str(order_units_digit))
    target_order             = ordered_order_list[len(ordered_order_list) -1]
    target_order_units_digit = target_order % 10
#    print(str(target_order_units_digit))
    if(target_order_units_digit > order_units_digit):
      ordered_order_list.append(order)
    else:
      ordered_order_list.insert(len(ordered_order_list) -1, order)
       
answer = 0
#print(ordered_order_list)
for l, ordered_order in enumerate(ordered_order_list):
  if l == len(ordered_order_list) - 1:
    answer += ordered_order
    continue
  if(l<counter):
    answer += ordered_order
  else:
    answer += (int(ordered_order/10) + 1) * 10

# 出力
print(str(answer))

Submission status: Accepted

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


time = 0

for j in range(5):
    if a[j][0]%10 == 0:
      a[j][1] = 0
    else:
      a[j][1] = 10-(a[j][0]%10)

for k in range(5):
    a.sort(key=lambda x:x[0])
    a.sort(key=lambda x:x[1])


for l in range(4):
  if a[l][1] == 0:
    time += a[l][0]
  else:
    time += (a[l][0]+(10-(a[l][0]%10)))
time += a[4][0]
print(time)

Submission status: Accepted

Solution code:
import math

all_list = [int(input()) for _ in range(5)]
tmp = 0
for i in all_list:
    j = math.ceil(i/10)*10
    tmp_i = j - i
    if tmp < tmp_i:
        tmp = tmp_i
for i, num in enumerate(all_list):
    all_list[i] = math.ceil(num/10)*10
result = sum(all_list)
result -= tmp
print(result)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a >= 100:
    a1 = a % 10
else:
    a2 = a - 100
    a1 = a2 % 10
if b >= 100:
    b1 = b % 10
else:
    b2 = b - 100
    b1 = b2 % 10
if c >= 100:
    c1 = c % 10
else:
    c2 = c - 100
    c1 = c2 % 10
if d >= 100:
    d1 = d % 10
else:
    d2 = d - 100
    d1 = d2 % 10
if e >= 100:
    e1 = e % 10
else:
    e2 = e - 100
    e1 = e2 % 10
if a1 == 0:
    a1 = 9
if b1 == 0:
    b1 = 9
if c1 == 0:
    c1 = 9
if d1 == 0:
    a1 = 9
if e1 == 0:
    e1 = 9
lis = [a1,b1,c1,d1,e1]
if a1 == min(lis) :
    answer = math.ceil(b / 10) * 10 + math.ceil(c/ 10) * 10 + math.ceil(e/ 10)* 10+ math.ceil(d/ 10) * 10 + a
if b1 == min(lis):
    answer = math.ceil(a/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + b
if c1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(a/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + c
if d1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(a/ 10)* 10 + d
if e1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(a/ 10)* 10 + math.ceil(d/ 10)* 10 + e
print(answer)

Submission status: Accepted

Solution code:
from itertools import permutations
lis = [int(input()) for _ in range(5)]
ans = 1e9
for li in permutations(lis):
    cnt = 0
    for i in range(5):
        if cnt % 10 != 0:
            cnt += 10 - (cnt % 10)
        cnt += li[i]
    ans = min(ans, cnt)
print(ans)

Submission status: Accepted

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

b = [[i, i%10] for i in a]

b.sort(key=lambda x:x[1])
s=0
flag = 0
for i in range(5):
    if b[i][1] == 0:
        s += b[i][0]
    else:
        if flag == 0:
            s += b[i][0]
            flag = 1
        else :
            s += (b[i][0]+10)//10*10
print(s)

Submission status: Accepted

Solution code:
array = [int(input()) for i in range(5)]
array2 = [] # 繰り上げの値
array3 = []#一の位

for i in array:
  array2.append(((i//10 + 1) *10) if i%10 != 0 else i//10 * 10)
  array3.append(i%10 if i%10 != 0 else 10)

print(sum(array2)-(10-min(array3)))

Submission status: Accepted

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

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()

if int(menu[4])==0:
    iti=0
    marume=0
else:
    while menu[0]=="0":
        menu.remove("0")
    iti=int(menu[0])
    marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
                
print(iti + marume +time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sum = 0
amari_min = 10
for i in range(5):
    tmp = int(input())
    amari = tmp % 10
    if amari == 0:
        a = tmp / 10
    else:
        a = int(tmp / 10) + 1
    sum += a
    if amari != 0:
        if amari_min > amari:
            amari_min = amari

sum *= 10
print(int(sum - 10 + amari_min))

Submission status: Accepted

Solution code:
num_list = []
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
minutes = 0
dist_10 = 0
min_dist_10 = 0
min_list_num = 0
for _ in range(5):
    minutes += min_dist_10
    min_dist_10 = 10
    for i in range(len(num_list)):
        num = num_list[i] + minutes
        dist_10 = 10-int((str(num)[-1:]))
        if (str(num)[-1:]) == "0":
            min_dist_10 = 0
            min_list_num = i
            break
        if min_dist_10 > dist_10:
            min_dist_10 = dist_10
            min_list_num = i
    minutes += int(num_list.pop(min_list_num))
print(minutes)

Submission status: Accepted

Solution code:
import numpy as np

# 整数の入力
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

time = np.array([a, b, c, d, e])
time_10 = np.ceil(time / 10) * 10
xx0, xx1 = np.meshgrid(time,time_10)

time_set = (1 - np.eye(xx1.shape[0])) * xx1 + np.eye(xx0.shape[0]) * xx0

print(int(np.min(time_set.sum(axis=0))))

Submission status: Accepted

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

num = [[a,0],[b,1],[c,2],[d,3],[e,4]]
index = 0
f = 10
for n,i in num:
    if n%10==0:
        continue
    if f > n%10:
        index = i
        f = n%10

sm = 0
for n,i in num:
    if index == i:
        sm += num[i][0]
    elif n%10==0:
        sm += num[i][0]
    else:
        sm += num[i][0] + (10 - num[i][0]%10)
print(sm)

Submission status: Accepted

Solution code:
import math

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

f = [a,b,c,d,e]
n = [math.ceil((i/10))*10 for i in f]
m = [math.ceil((i/10))*10-i for i in f]
s = sum(n)-max(m)
print(s)

Submission status: Accepted

Solution code:

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

def dfs(time,depth,list):
	if(depth == 5):
		time_t.append(time)
	time += (10 - time%10)%10
	for ind,l in enumerate(list):
		new_list = list[0:ind]+list[ind+1:len(list)]
		dfs(time+a[l],depth+1,new_list)

dfs(0,0,[0,1,2,3,4])
print(min(time_t))

Submission status: Accepted

Solution code:
import math
import itertools
X = [int(input()) for i in range(5)]
T = []
for x in list(itertools.permutations(X)):
    t = 0
    for i in x:
        t = math.ceil(t  / 10) * 10 + i
    T.append(t)
print(min(T))

Submission status: Accepted

Solution code:
import numpy as np
T = np.array([int(input()) for i in range(5)])

T_0 = T[np.mod(T, 10) == 0]
T_o = T[np.mod(T, 10) != 0]

T_c = T_o + 10 - np.mod(T_o, 10)
T_s = np.sort(np.mod(T_o, 10))
if T_0.size == 5:
    print(np.sum(T_0))
else:
    print(np.sum(T_c) - 10 + np.sum(T_0) + T_s[0])

Submission status: Accepted

Solution code:

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

min=t[0]
length=len(t)
for i in range(length):
    if min%10>t[i]%10 and t[i]%10!=0:
        min=t[i]
t.remove(min)
t.append(min)
ans=0
for _ in range(length-1):
    if t[_]%10!=0:
        ans+=t[_]+10-t[_]%10
    else:
        ans+=t[_]
print(ans+t[length-1])

Submission status: Accepted

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

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

a = 10 - A % 10
b = 10 - B % 10
c = 10 - C % 10
d = 10 - D % 10
e = 10 - E % 10

def func(x):
    if x == 10 :
        x = 0
    return x

a = func(a)
b = func(b)
c = func(c)
d = func(d)
e = func(e)
    
    
get = [a,b,c,d,e]

z = 0
k = 0 # 指摘するlist。こいつを最後に持っていく。
for i in  range(5):
    if z < get[i]:
        z = get[i]
        k = i
        
A_ = A + a
B_ = B + b
C_ = C + c
D_ = D + d
E_ = E + e

pocket_ = [A_, B_, C_, D_, E_]

print(sum(pocket_) - pocket_[k] + pocket[k])

Submission status: Accepted

Solution code:

time = []
last = 0
amari = 10
flg = True
sum = 0

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

for i in range(5):
    temp = time[i]%10
    if temp > 0 and temp < amari:
        amari = temp
        last = time[i]

for i in range(5):
    if time[i] == last and flg == True:
        sum += last
        flg = False
    else:
        sum += time[i]
        if time[i]%10 != 0:
            sum += 10-(time[i]%10)
print(sum)

Submission status: Accepted

Solution code:
import sys
import itertools
import math

"""
B - Five Dishes
https://atcoder.jp/contests/abc123/tasks/abc123_b
"""


def order(order_list):
    t1 = math.ceil(order_list[0] / 10) * 10
    t2 = t1 + math.ceil(order_list[1] / 10) * 10
    t3 = t2 + math.ceil(order_list[2] / 10) * 10
    t4 = t3 + math.ceil(order_list[3] / 10) * 10
    t5 = t4 + order_list[4]
    return t5


if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    all_order = sorted([a, b, c, d, e])

    all_cases = list(itertools.permutations(all_order))

    min_time = sys.maxsize

    for e in all_cases:
        time = order(e)
        if time < min_time:
            min_time = time

    print(min_time)

Submission status: Accepted

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

MaxTime = 0
for t in T:
	MaxTime += ((t + 9) // 10) * 10

MaxDiffTime = 10
for t in T:
	if t % 10 != 0:
		MaxDiffTime = min(MaxDiffTime, t % 10)

print(max(0, MaxTime - (10 - MaxDiffTime)))

Submission status: Accepted

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

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

# print(a)
sum_time = 0
b = {}

for i in range(5):
    t = a[i] % 10
    if t == 0:
        b[i] = 10
    else:
        b[i] = a[i] % 10

# print(b)

sort_dict = sorted(b.items(), key=lambda x:x[1], reverse=True)
# print(sort_dict)

for i in range(4):
    d = sort_dict[i]
    index = d[0]
    sub = 10 - d[1]
    sum_time += a[d[0]] + sub

d = sort_dict[4]
index = d[0]
sum_time += a[d[0]]

print(sum_time)

Submission status: Accepted

Solution code:
array=[int(input()) for i in range(5)]
array2=[array[i]%10 for i in range(5)]
n=10
sum=0
for i in range(5): 
    if array2[i]<n and array2[i]!=0: n=array2[i]
    if array2[i]!=0: sum += int(array[i]/10)+1
    else: sum += int(array[i]/10)
if n!=10: print(sum*10-(10-n))
else: print(sum*10)

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
sum = 0
amari = [0, 0, 0, 0, 0]

for i in range(5):
    sum += -(-t[i] // 10) * 10
#    print(-(-t[i] // 10) * 10)
    amari[i] = t[i] % 10
    if amari[i] == 0:
        amari[i] = 10

# print(sum)
# print(t)
# print(min(amari))

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

Submission status: Accepted

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

N=math.ceil(a/10)*10+math.ceil(b/10)*10+math.ceil(c/10)*10+math.ceil(d/10)*10+math.ceil(e/10)*10
X=[a%10,b%10,c%10,d%10,e%10]
n=0
while(n!=5):
  if X[n]==0:
    X[n]=10
  n+=1

else:
  print(N-(10-min(X)))

Submission status: Accepted

Solution code:
#b
import math

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

result = 0
mod_res = 10
for x in [a, b, c, d, e]:
    if 0 < x % 10 < mod_res:
        mod_res = x % 10
flag = True
for x in [a, b, c, d, e]:
    if x % 10 == mod_res and flag:
        result += x
        flag = False
    else:
        result += math.ceil(x / 10) * 10
        
print(result)

Submission status: Accepted

Solution code:
import math
a,b,c,d,e=[int(input()) for i in range(5)]
x=[]
y=[]
def ceil(src, range):
  return ((int)(src / range) + 1 ) * range
for s in [a,b,c,d,e]:
  if s%10 != 0:
    x.append(s%10)
    t=min(x)
  if s<10:
    y.append(10)
  elif s%10==0:
    y.append(s)
  else:
    y.append(ceil(s,10))
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
  print(a+b+c+d+e)
else:
  ans = sum(y)
  ans= ans-10+t
  print(ans)

Submission status: Accepted

Solution code:
n=[]
for _ in range(5):n+=[int(input())]
n.sort(key=lambda m:(m-1)%10)
for i in range(1,5):n[i]=(n[i]//10+(n[i]%10>0))*10
print(sum(n))

Submission status: Accepted

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

mono = [A,B,C,D,E]
amari = [A%10,B%10,C%10,D%10,E%10]
minamari = 9
jun = []
for i in range(5):
    if amari[i]==0:
        jun.insert(0,mono[i])
    elif amari[i]<minamari:
        jun.append(mono[i])
        minamari = amari[i]
    else:
        jun.insert(0,mono[i])
        
for i in range(4):
    if jun[i]%10>0:
        jun[i]=(jun[i]//10)*10+10

output = sum(jun)
print(int(output))

Submission status: Accepted

Solution code:
import numpy as np
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10
 
aa = A // 10
bb = B // 10
cc = C // 10
dd = D // 10
ee = E // 10
 
r = np.array([a, b, c, d, e])
k = (r > 0).sum()
if k > 0:
  l = r[r != 0].min()
  print((aa + bb + cc + dd + ee) * 10 + 10*(k-1) + l)
else:
  print(A + B + C + D + E)

Submission status: Accepted

Solution code:
A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0
#print(B)
for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)

Submission status: Accepted

Solution code:

data = [input() for i in range(5)]
num_data = list(map(int, sorted([i for i in data if i[-1] != '0'],key=lambda x:x[-1],reverse=True)))

zero_data = list(map(int, [i for i in data if i[-1] == '0']))
res = 0
for i in range(len(num_data)):
    if i == len(num_data)-1:
        res += num_data[i]
    elif num_data[i] < 10:
        res += 10
    elif num_data[i] - 100 < 0:
        info = str(num_data[i])[0]
        res +=(int(info)+1) * 10
    else:
        info = str(num_data[i])[1]
        res += num_data[i] + ((int(info) + 1) * 10) - int(str(num_data[i])[-1]) -(int(info) * 10)
print(res + sum(zero_data))

Submission status: Accepted

Solution code:
import math
def main():
    a = []
    for _ in range(5):
        b = int(input())
        a.append([b % 10, b])
    
    a.sort()
    result = 0
    f = 1
    for i in a:
        if i[0] != 0:
            if f:
                result += i[1]
                f = 0
            else:
                result += (i[1]//10 + 1) * 10

        else:
            result += i[1]
    
    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

bk = [x[i]%10 for i in range(5)]
new_bk = [(e if e !=0 else 9) for e in bk]
bmin = min(new_bk)
last_index=new_bk.index(bmin)
last = x.pop(last_index)
intbk=[math.ceil(e/10)*10 for e in x]
print(sum(intbk)+last)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while 10 in li :
   li.remove(max(li))
if len(li)>0 :
   li.remove(max(li))
print(s+sum(li))

Submission status: Accepted

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

l = [A,B,C,D,E]
l = sorted(l)
# print(l)
ans = 0
tl = []
for v in l:
    temp = v % 10
    while temp > 10:
        temp = v % 10
    if temp == 0:
        temp = 100
    tl.append(temp)
# print(tl)
tt = []
for i in range(5):
    tt.append([l[i], tl[i]])

# print(tt)
tt.sort(key=lambda x:x[0])
tt.sort(key=lambda x:x[1],reverse=True)

# print(tt)
a = tl.index(min(tl))
# print(a)
# print(l)
l = [x[0] for x in tt]
# print(l)
for i,v in enumerate(l):
    if i != len(l) - 1:
        temp = v % 10
        if temp != 0:
            temp = 10 - temp + v
        else:
            temp = v
        ans = ans + temp
    else:
        ans = ans + v
    # print(ans)

print(ans)

Submission status: Accepted

Solution code:
import math

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

# 1の位が０を除く最も小さい数の注文は一番最後
# それ以外は、切り上げていく。4つの注文は順不同で、1の位を切り上げてスタート

array = [a, b, c, d, e]
# print(array)

# print(array[0])

skip = int()
last = 9
for i in range(5):
    if array[i] % 10 == 0:
        # print(array[i])
        #array_begin = array[i]
        # print(array[i])
        pass
    else:
        # print(array[i])
        if array[i] % 10 <= last:
            # print(array[i])
            last = array[i] % 10
            skip = i
        else:
            pass
# print(last)
# print(skip)
counter = 0
for i in range(5):
    if i == skip:
        pass
    else:
        counter += 10*math.ceil(array[i] / 10)

counter = counter + array[skip]

print(counter)

Submission status: Accepted

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

num_first =[]

for str1 in num_list:
  number=10-int(str1[-1])
  if number==10:
    number=0
  num_first.append(number)

index=num_first.index(max(num_first))
sum=0
for i in range(5):
    sum=sum+int(num_list[i])+num_first[i]
    if i == index:
      sum=sum-num_first[i]
    
    
print(sum)

Submission status: Accepted

Solution code:
import math
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
t = []
b = []
u = []
for i in a:
	if(i%10 == 0):
		b.append(i)
	else:
		t.append(i)
		u.append(i%10)
if(sum(u) != 0):
	min_t = u.index(min(u))
	ss = t.pop(min_t)
	u.pop(min_t)

	for i in range(len(t)): 
		u[i] = 10 - u[i]
		t[i] = t[i] + u[i]
	print(sum(b) + sum(t) + ss)

else:
	print(sum(b))

Submission status: Accepted

Solution code:
import math

menu = [int(input()) for _ in range(5)]
num = [0, 1, 2, 3, 4]

min = float('inf')

def plus(a, b):
    c = a + b
    if (c % 10 != 0):
        c += 10 - c % 10
    return c

for index1 in num:
    for index2 in set(num) - set([index1]):
        for index3 in set(num) - set([index1, index2]):
            for index4 in set(num) - set([index1, index2, index3]):
                index5 = list((set(num) - set([index1, index2, index3, index4])))[0]
                sum = 0
                sum = plus(sum, menu[index1])
                sum = plus(sum, menu[index2])            
                sum = plus(sum, menu[index3])            
                sum = plus(sum, menu[index4])            
                sum = sum + menu[index5]
                if (sum < min):
                    min = sum

print(min)

Submission status: Accepted

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

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

moda = a % 10
modb = b % 10
modc = c % 10
modd = d % 10
mode = e % 10

mod_list = [moda, modb, modc, modd, mode]

min = 124
flag = -1
for cnt, i in enumerate(mod_list):
    if i != 0 and i < min:
        min = i
        flag = cnt

cnt = 0
for i in range(0, 5):
    if i == flag:
        cnt = cnt + input_list[i]
    elif mod_list[i] == 0:
        cnt = cnt + input_list[i]
    else:
        cnt = cnt + input_list[i] + (10 - mod_list[i])

print(cnt)

Submission status: Accepted

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

dishes=[a,b,c,d,e]
mod_dishes=[]
time_dishes=[]
for i in dishes:
    if i%10 != 0:
        mod_dishes.append(i%10)
        time_dishes.append(i+(10-i%10))
    else:
        mod_dishes.append(10)
        time_dishes.append(i)                   
                          
x=10
for i in mod_dishes:
    if i < x:
        x = i

y = 10-x
z=0
for i in time_dishes:
    z = z + i

z = z - y
print(z)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
t = [a, b, c, d, e]
times = []
amari_not_zero = []
for i in range(len(t)):
    amari = t[i] % 10
    if amari == 0:
        times.append([t[i], amari])
    else :
        amari_not_zero.append([t[i], amari])
anz = sorted(amari_not_zero, key=lambda x: x[1], reverse=True)
for i in range(len(anz)):
    times.append(anz[i])

finish_time = 0
buf = 0
for i in range(len(times)):
    if i == len(times) - 1:
        finish_time += times[i][0]
    else :
        for j in range(14):
            buf2 = buf - times[i][0]
            if (not buf2 < 0) and buf2 <= 10:
                finish_time += buf
                break
            buf += 10
    buf = 0
print(finish_time)

Submission status: Accepted

Solution code:
dishes = sorted([int(input()) for _ in range(5)], key=lambda x:int(str(x)[-1]))

for dish in dishes:
    if int(str(dish)[-1]) == 0:
        new_dishes = dishes[1:]
        new_dishes.append(dish)
        dishes = new_dishes
    else:
        pass

time = 0
for i, dish in enumerate(dishes):
    if i == 0:
        time += dish
    else:
        if dish % 10 != 0:
            rest = 10 - (dish % 10)
        else:
            rest = 0
        time += dish + rest

print(time)

Submission status: Accepted

Solution code:
import numpy as np
import itertools
data = [int(input()) for _ in range(5)]
minimum = 10**15
for orders in itertools.permutations(data):
    current_time = 0
    next_arrival = 0
    for i in range(5):
        next_arrival = current_time + orders[i]
        current_time = np.ceil(next_arrival/10).astype(int) *10

    minimum = min(minimum,next_arrival)
print(minimum)