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:
import math

dish = [ int(input()) for i in range(5) ]
sum = sum([ math.ceil(d/10)*10 for d in dish])
mdish = 10

for d in dish:
    if d%10 != 0:
        mdish = min(d%10, mdish)

print(sum + mdish - 10)

Submission status: Accepted

Solution code:
 
import itertools
#import time

#t1 = time.time()

num = [int(input()) for _ in range(5)]
#num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

N = []

for i in list(itertools.permutations(range(5))):
    c = 0
    n = 0
#    print(i)
    for j in i:
        c += 1
 #       print(j)
        if c == 5:
            n += num[j]
#            print(n)
        else:
            if num[j]%10 == 0: n+=num[j]
            else:n += num[j] - (num[j] % 10) + 10
 #           print(n)
    N.append(n)

print(int(min(N)))

#t2 = time.time()

#print(t2-t1)

Submission status: Accepted

Solution code:
time = [int(input()) for i in range(5)]
ten_time = 0
smallest_mod = 10
for i in range(5):
    div,mod = divmod(time[i],10)
    if 0 < mod < smallest_mod:
        smallest_mod = mod
    if mod != 0:
        ten_time += div + 1
    else:ten_time += div
print(ten_time * 10 - 10 + smallest_mod)

Submission status: Accepted

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

last_order_candidate_value = _list[0]
minimum_mod_10 = 9
for i in range(len(_list)):
    minutes_mod_10 = _list[i] % 10
    if minutes_mod_10 != 0 and minimum_mod_10 > minutes_mod_10:
        minimum_mod_10 = minutes_mod_10
        last_order_candidate_value = _list[i]

_list.remove(last_order_candidate_value)

elaps = 0
for i in range(len(_list)):
    elaps = elaps + _list[i]
    if (elaps%10 != 0):
        elaps = elaps + (10 - elaps%10)
elaps = elaps + last_order_candidate_value

print(elaps)

Submission status: Accepted

Solution code:
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

a = inn()
b = inn()
c = inn()
d = inn()
e = inn()
t  = [a,b,c,d,e]
p = [ x//10 for x in t ]
r = [ x%10 for x in t ]
if max(r) == 0:
    rest = 0
else:
    rnz = [ x for x in r if x != 0 ]
    rmn = min(rnz)
    rest = 10 * (len(rnz)-1) + rmn

print(10*sum(p) + rest)

Submission status: Accepted

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

v = np.array(v)

s = [(i-1)%10 for i in v]

v = v[np.argsort(s)][::-1]

res = v[-1]
for i in range(len(v)-1):
    res += ((v[i]+9) // 10 * 10)

print(res)

Submission status: Accepted

Solution code:
a2, b, c, d, e= [int(input()) for i in range(5)]
a=[a2,b,c,d,e]
sum = 0;
res = 0; 
temp = 0;
num = 0;
for i in range(5):
  if(a[i]%10==0):
    sum+=a[i]
  else:
    temp = (int(a[i]/10) +1)*10-a[i];
    #print(temp)
    if temp>res:
      sum = sum + res 
      res =temp
      sum+=a[i]
     # print(sum)
    else:
      sum = sum+a[i]+temp
      #print(sum)
print(int(sum))

Submission status: Accepted

Solution code:
list1=[int(input()) for i in range(5)]
d=0
t=0
for n in list1:
  m=((n-1)//10+1)*10
  t=t+m
  if m-n>d:
    d=m-n
  else:
    d=d
print(t-d)

Submission status: Accepted

Solution code:
import math

a = [int(input()) for i in range(5)]
b = [x%10 if x%10!=0 else 10 for x in a]
c = [math.ceil(x/10)*10 for x in a]
d = 10 if any(b) else 0
print(sum(c)-d+min(b))

Submission status: Accepted

Solution code:
import math

Five_Dishes1 = []
Five_Dishes2 = []
for i in range(5):
    time = input()
    time_last = time[-1]
    Five_Dishes1.append(time)
    Five_Dishes2.append(time_last)
    
Five_Dishes_int = [int(n) for n in Five_Dishes1]
Five_Dishes2 = [x if x is not '0' else 'a' for x in Five_Dishes2]
Five_Dishes_last2 = sorted(Five_Dishes2)

last_dish = Five_Dishes2.index(min(Five_Dishes2))
res_time = 0
n = 0
while n < 5:
    if Five_Dishes_int[n] % 10 == 0:
        res_time += Five_Dishes_int[n]
    elif Five_Dishes_int[n] % 10 != 0 and n == last_dish:
        res_time += Five_Dishes_int[n]
    else:
        res_time += math.ceil(Five_Dishes_int[n] / 10 ) * 10    
    n += 1    
        
print(res_time)

Submission status: Accepted

Solution code:
menu = []
for i in range(0, 5):
	menu.append(int(raw_input()))

queue = [[0, menu]]
min = 1000
while queue != []:
	now = queue.pop(0)
	if now[1] == []:
		if now[0] < min: min = now[0]
	else:
		for i in range(0, len(now[1])):
			newmenu = []
			for j in range(0, len(now[1])):
				if i != j: newmenu.append(now[1][j])
			t = now[0]
			if t % 10 != 0:
				t = (t / 10 + 1) * 10
			t += now[1][i]
			queue.append([t, newmenu])

print min

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yay!")
    else:print(":(")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
#n = ip()                                     #入力整数1つ
#n,q= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#b = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
a=[ip() for i in range(5)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
ms = [a[i]%10 for i in range(5)]
for i in range(5):
    if ms[i]==0:ms[i]+=10
p = ms.index(min(ms))
b = []
for i in range(5):
    if i==p:
        b.append(a[i])
    elif a[i]%10:
        b.append(a[i]//10*10+10)
    else: b.append(a[i])
print(sum(b))

Submission status: Accepted

Solution code:
a=[]
for i in range(5):
  a.append(int(input()))
a.sort(key=lambda x:(x-1)%10)
b=0
for i in range(5):
  if i==0:
    b+=a[i]
  else:
    c=(a[i]-1)//10+1
    b+=c*10
print(b)

Submission status: Accepted

Solution code:
import sys
import math

matlist = [0] * 5
for i in range(5):
    matlist[i] = int(sys.stdin.readline())

mn = 11
idx = 0
for i in range(5):
    tmp = matlist[i] % 10
    if tmp == 0:
        tmp = 10
    if mn > tmp:
        idx = i
        mn = tmp

ans = 0
for i in range(5):
    if i != idx:
        ans += math.ceil(matlist[i]/10)*10
    else:
        ans += matlist[i]

print(int(ans))

Submission status: Accepted

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

menu = [a,b,c,d,e]
mlt = [0]*5
mod = [0]*5
for i in range(5):
    mlt[i] = menu[i] // 10
    mod[i] = menu[i] % 10
    if mod[i] == 0:
        mod[i] = 10

ans = 0
t = 0
for i in range(5):
    if mod[i] == min(mod) and t == 0:
        t = 1
        ans += menu[i]
    elif mod[i] == 10:
        ans += mlt[i]*10
    else:
        ans += (mlt[i]+1)*10


print(ans)

Submission status: Accepted

Solution code:
import itertools
list = [int(input()) for _ in range(5)]
temp = 0
ans = 10**9

for v in itertools.permutations(list):
    temp = 0
    for i,j in enumerate(v):
        if i != 4:
            if j % 10 == 0:
                temp += j
            else:
                temp += (j//10+1)*10
        else:
            temp += j
    ans = min(ans,temp)

print(ans)

Submission status: Accepted

Solution code:
import sys
List = [int(input()) for i in range(5)]
s = 0
flag = True
for i in range(1, 10):
    if flag:
        for j in range(5):
            if List[j] % 10 == i:
                s += List.pop(j)
                flag = False
                break

for i in range(len(List)):
    s += (-(-List[i] // 10))*10
print(s)

Submission status: Accepted

Solution code:

def up(num):
    if num%10 ==0:
        return num
    else:
        return (num//10+1)*10 

arr = []
mod = []

for i in range(5):
    arr.append(int(input()))
    m = 10 if arr[i]%10==0 else  arr[i]%10
    mod.append(m)

index = mod.index(min(mod))
last = arr.pop(index)
sum = sum(map(up,arr))+last
print(sum)

Submission status: Accepted

Solution code:
a = list(map(int,[input() for i in range(5)]))
b = 10
c = 0
for i in a:
	if i % 10 > 0:
		c += i + 10 - i % 10
		if b > i % 10:
			b = i % 10
	else:
		c += i
print(c-10+b)

Submission status: Accepted

Solution code:
import math


res = 0
d_min = 10
for i in range(5):
    dish = int(input())
    if dish % 10 == 0:
        res += dish
    else:
        res += math.ceil(dish / 10) * 10
        if dish % 10 < d_min:
            d_min = dish % 10
res -= 10 - d_min
print(res)

Submission status: Accepted

Solution code:
A=[int(input()) for i in range(5)]
B=[10 if A[i]%10==0 else A[i]%10 for i in range(5)]
k=B.index(min(B))
C=[(A[i]-0.001)//10*10+10 for i in range(5)]
print(int(sum(C)-C[k]+A[k]))

Submission status: Accepted

Solution code:
#-*- coding: utf-8 -*-
#入力
A = int(raw_input())
B = int(raw_input())
C = int(raw_input())
D = int(raw_input())
E = int(raw_input())

#リスト化
list = [A, B, C, D, E]

#10で割ったあまり,一番小さい数字を取得
list10 = map(lambda x: -(-x // 10), list)
#print(list10)
list20 = map(lambda x: x * 10, list10)
#print(list20)
list30 = [x - y for (x, y) in zip(list20, list)]
#print(list30)

lmaxindex = list30.index(max(list30))
#print(lmaxindex)
max = list[lmaxindex]
#print(max)

#リストから一番小さいのを削除する
list.pop(lmaxindex)

list2 = map(lambda x: -(-x // 10), list)
list3 = map(lambda x: x * 10, list2)
list3.append(max)
#print(list3)
print(sum(list3))

Submission status: Accepted

Solution code:
import numpy as np
# 入力処理
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# 最後に注文する品を決める関数
def get_last_dish_index(order_list):
    """
    process: 10で割ったときの剰りが最も小さい要素のindexを求める
             (ただし、剰りが0の場合を除く)
    ===========
    input: int[]
    output: int
    """
    rem_list = list()
    for order in order_list:
        if order % 10 == 0:
            rem_list.append(0)
        else:
            rem_list.append(10 - order % 10)
    # print(rem_list)
    last_dish_index = rem_list.index(max(rem_list))
    return last_dish_index

order_list = [a, b, c, d, e]
ldi = get_last_dish_index(order_list)
last_order = order_list.pop(ldi)

time = 0
for order in order_list:
    if order % 10 == 0:
        time += order
    else:
        time += order + (10 - order % 10)

print(time+last_order)

Submission status: Accepted

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

queue = [(i,) for i in range(5)]
mintime = 1000
while(len(queue)):
    q = queue.pop(0)
    if(len(q)==5):
        time = 0
        for i in q:
            if(time%10 == 0):
                time += times[i]
            else:
                time += 10 - time%10 + times[i]
        mintime = min(mintime, time)
    for i in range(5):
        if not i in q:
            queue.append(q + (i,))

print(mintime)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
List = list(map(int,[input() for i in range(5)]))

a = lambda x:-(-x//10) * 10
b = lambda x:x % 10 if x % 10 !=0 else 10

aa = list(map(b, List))

a2 = aa.index(min(aa))
a3 = List.pop(a2)

print(sum(list(map(a,List)))+a3)

Submission status: Accepted

Solution code:
ABCDE = list(map(int,[input() for i in range(5)]))
waiting = [(10-a)%10 for a in ABCDE]
waiting.sort()
waiting.pop()
print(sum(waiting)+sum(ABCDE))

Submission status: Accepted

Solution code:
*li, = map(int, open(0).read().split())
new = []
mini = 10
for i in range(len(li)):
    if li[i] % 10 == 0:
        new.append(li[i])
    else:
        new.append(li[i] // 10 * 10 + 10)
        if mini > li[i] % 10:
            mini = li[i] % 10
# print(new)
print(sum(new)-(10-mini))

Submission status: Accepted

Solution code:
ds = [int(input()) for _ in range(5)]
def f(x):
  	return (x+9)//10*10
def g(x):
  	return 10-x%10 if x%10 else 0
print(sum(map(f,ds))-max(map(g,ds)))

Submission status: Accepted

Solution code:
num = [int(input()) for _ in range(5)]
num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

c = []
for i, j  in enumerate(num):
    n = j
    for k,l in enumerate(num2):
        if  k == i:
            continue
        else:
            n += l
    c.append(n)

print(int(min(c)))

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-
import itertools
import math

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

ans = 10000000000

for order in itertools.permutations(ryori):
    t = sum([math.ceil(order[i]/10) * 10 for i in range(4)])
    t += order[4]
    ans = min(ans, t)

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import sys


def solve(A: int, B: int, C: int, D: int, E: int):
    p = [A,B,C,D,E]
    list = []
    for d in p:
        diff = 10 - d % 10
        if diff == 10:
            diff = 0
        list.append((diff,d))
    list.sort()
    sum = 0
    for i in range(4):
        sum += list[i][0] + list[i][1]

    print(sum + list[4][1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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=sorted([int(input()) for _ in range(5)])
B=[(i+9)//10*10 for i in A]
C=[]
for i in range(5) :
    C.append(int(B[i])-int(A[i]))
print(sum(B)-max(C))

Submission status: Accepted

Solution code:
dish=[int(input()) for i in range(5)]
print(sum([(dish[i]-1)//10+1 for i in range(5)])*10-9+min([(dish[i]-1)%10 for i in range(5)]))

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=0
amari=[a%10,b%10,c%10,d%10,e%10]
nokori=list((10-amari[i])%10 for i in range(5))
maxi=max(nokori)
dish=[a,b,c,d,e]
for i in range(5):
  if dish[i]%10==0:
    s=s+dish[i]
  else:
    s=s+dish[i]+10-dish[i]%10
if maxi==0:
  print(s)
else:
  print(s-maxi)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Apr  8 15:07:25 2019

@author: adachi-lab
"""

Y = 0
T = []
TT = []
TTT = []
TTTT = []
for i in range(5):
    input_code = int(input())
    T.append(input_code)
    
for q in range(5):
    TT.append(T[q]%10)
    
    if T[q]%10 == 0:
        TTT.append(T[q])
        
    else:
        TTT.append(((T[q]//10)*10)+10)
        
if min(TT) == 0:
    C = TT.count(0)
    for f in range(C):
        W1 = TT.index(min(TT))
        TT[W1] = 9
    
    W = TT.index(min(TT))
    TTT[W] = T[W]
    
else:
    W = TT.index(min(TT))
    TTT[W] = T[W]

for w in range(len(TTT)):
    Y += TTT[w]
    
print(Y)

Submission status: Accepted

Solution code:
from sys import exit
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
A = [0]*5
last = 129

for _ in range(5):
    A[_] = int(input())
    if(A[_]%10 != 0 and last%10 >= A[_]%10):
        last = A[_]
ans = 0
once = False
for a in A:
    if(a == last and not once):
        once = True
        continue
    if(a%10 != 0 ):
        a+=10 - a%10
    ans+=a
if(last == 129):
    print(ans)
else:
    print(ans+last)
# S = str(input())
# L = len(S)
# T = str(input())
# exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

order = []

for _ in range(5):
    menu = int(input())
    if menu%10 != 0:
        lossTime = 10 - menu % 10
    else:
        lossTime = 0
    order.append((lossTime, menu))
    
order.sort()

time = 0

for i in order:
    time += i[0] + i[1]
    
print(time - order[-1][0])

Submission status: Accepted

Solution code:
from operator import itemgetter
Dishes = [[0 for n in range(2)] for m in range(5)]
result = 0
most_loss = 0

for i in range(5):
    k = input()
    loss = 0  if int(k) % 10 == 0 else 10 - (int(k) % 10)
    Dishes[i][0] = int(k)
    Dishes[i][1] = loss
    if most_loss < loss:
        most_loss = loss
    result = int(k) + loss + result
    
result = result - most_loss
    
print(result)

Submission status: Accepted

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

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

last_food = []

for i in food:
	sub = i % 10
	sub_last_food = 10 - sub
	
	if sub_last_food == 10:
		x = 0
	else:
		x = sub_last_food
		
	last_food.append(x)
	
	
ans = max(last_food)


ans1 = last_food.index(ans)


for i in range(5):
	ans2 = food[i] + last_food[i]
	ans3 = ans3 + ans2
	

ans4 = ans3  - last_food[ans1]

print(ans4)

Submission status: Accepted

Solution code:
#abc123b

l,ll,m=[],[],[]
for i in xrange(5):
 l.append(int(raw_input()))
for i in xrange(5):
 m.append(l[i]%10)
s=130
idx=0
for i in xrange(5):
 if m[i]!=0:
  if m[i]<s:
   idx=i
   s=m[i]
for i in xrange(5):
 ll.append((l[i]+9)//10*10)
print sum(ll)-ll[idx]+l[idx]

Submission status: Accepted

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

temp = -1
s = 10
for i in range(5):
    x = a[i]
    if x % 10 == 0:
        b.append(x)
    else:
        b.append(x - (x % 10) + 10)
        if x % 10 < s:
            s = x % 10
            temp = i

if s == 10:
    print(sum(a))
else:
    print(sum(b) - b[temp] + a[temp])

Submission status: Accepted

Solution code:
A, B, C, D, E = [input() for _ in range(5)]
L = [A, B, C, D, E]
ans = 0
tmp = []
for l in L:
  if l[-1] != "0":
    tmp.append(l)
  else:
    ans += int(l)
if tmp:
  tmp.sort(key = lambda x: x[-1] if x[-1] != "0" else "")
  ans += int(tmp[0])
  for t in tmp[1:]:
    ans += (int(t)//10+1)*10
print(ans)

Submission status: Accepted

Solution code:
cook=[0]*5
omit=[0]*5

for i in range(5):
    cook[i]=int(input())
    omit[i]=cook[i]%10
    if omit[i]==0:
        omit[i]=10

loss=omit.index(min(omit))
time=cook[loss]
del cook[loss]
del omit[loss]

for i in range(4):
    cook[i]=cook[i]+10-omit[i]
    time=time+cook[i]

print(time)

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]
m = [i%10 for i in l if i%10!=0 ]
if len(m) == 0:
  sub = 0
else:
  sub = 10 - min(m)
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
from math import ceil
times = [int(input()) for i in range(5)]

# timesの各要素を10で割った余りをキーとしてソート
# ただし、余り0は最後に持ってきたいので各要素に-1してから余りを出している
times = sorted(times, key=lambda time: (time-1)%10)

# 端数が一番小さい時間以外は10の倍数に揃えて、最後に一番端数が小さい時間を足す
times= [(ceil(time/10))*10 for time in times[1:]] + [times[0]]
print(sum(times))

Submission status: Accepted

Solution code:
import sys

args = [int(input()) for i in range(5)]
#args = [29,20,7,35,120]
smallest = 10
i = 0
sum = 0
arg_num = 0

for tmp in args[:4]:
    if tmp % 10 < smallest:
        if tmp % 10 != 0:
            smallest = tmp % 10
            arg_num = i
    i+=1

#print("smallest:" + str(arg_num))

for i in range(5):
    if i != arg_num:
        if args[i] % 10 != 0:
            args[i] = args[i] + (10 - args[i] % 10)
    #print("args[" + str(i) + "]:" + str(args[i]))
    sum += args[i]

print(sum)

Submission status: Accepted

Solution code:
def kiriage(a):
  if a%10 == 0:
    return a
  else:
    return (a//10+1)*10
  
times = [int(input()) for i in range(5)]

age_times = sum([kiriage(i) for i in times])
lastdish = max([(10-j%10)%10 for j in times])

print(age_times - lastdish)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
ans = 0
x = 0
for i in a:
    ans += i
    if i % 10 != 0:
        ans += 10 - ans % 10
        x = max(x, 10 - i % 10)
if x != 0:
    ans -= x
print(ans)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    A = [II() for _ in range(5)]

    res = sum(A)
    loss = []
    for a in A:
        loss.append((10 - int(str(a)[-1])) % 10)

    loss.sort()

    return res + sum(loss[:-1])


print(main())

Submission status: Accepted

Solution code:
from sys import exit

time = [int(input()), int(input()), int(input()), int(input()), int(input())]

total = 0
loss = []

for t in time:
    total += t
    if t % 10 != 0:
        loss.append(10 - t % 10)

if loss:
    total += sum(loss) - max(loss)

print(total)

Submission status: Accepted

Solution code:
input_val = [int(input()) for i in range(5)]
min_val = 10
min_index = 0
sum_time = 0
for i in range(0,5):
    str_num = str(input_val[i])
    if(int(str_num[len(str_num)-1]) < min_val) and (int(str_num[len(str_num)-1]) != 0):
        min_val = int(str_num[len(str_num)-1])
        min_index = i

for i in range(0,5):
    str_num = str(input_val[i])
    if(i==min_index):
        continue
    elif(int(str_num[len(str_num)-1])>0):
        sum_time += 10 - int(str_num[len(str_num)-1])

print(sum_time + sum(input_val))

Submission status: Accepted

Solution code:
#!/usr/bin/python

def main():
    dishes = []
    for _ in range(5):
        dishes.append(int(input()))
    _sum = sum([maxtime(d) for d in dishes])
    _sum -= max([remtime(x) for x in dishes])
    print(_sum)
    
def maxtime(num):
    return (num + 9) // 10 * 10

def remtime(num):
    return maxtime(num) - num


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

a=[0]*5
b=[10]*5
for i in range(5):
    a[i]=int(input().strip())
    r=a[i]%10
    if r!=0:
        b[i]=r
x=b.index(min(b))
num=0
for i in range(5):
    if i!=x:
        num+=math.ceil(a[i]/10)*10
num+=a[x]
print(num)

Submission status: Accepted

Solution code:
x = [int(input()) for i in range(5)]
y = [0,0,0,0,0]
last = 0
i = 0
while i < 5:
    if 0 < x[i]%10 < x[last]%10:
        last = i
    if x[i]%10 != 0:
        y[i] = x[i]//10*10+ 10
    else:
        y[i] = x[i]//10*10
    i += 1

z = 0
for i in range(5):
    if i != last:
        z += y[i]
    else:
        z += x[i]

print(z)

Submission status: Accepted

Solution code:
import numpy as np
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X = np.asarray([A,B,C,D,E])
X_div = X%10
X_sort = np.sort(X_div)
min=0
for i in range(5):
	if X_sort[i]!=0:
		min=X_sort[i]
		break
if min==0:
	min=10
X=10*((X-1)//10)+10

sum=0
for i in range(5):
	sum+=X[i]
print(sum-10+min)

Submission status: Accepted

Solution code:
import math

list = []
indent = 0
memory = 9
for i in range(5):
  list.append(int(input()))
  if memory > list[i] % 10 and list[i] % 10 > 0:
    indent = i
    memory = list[i] % 10

count = 0
for i in range(5):
  if i == indent:
    count += list[i]
  else:
    count += 10 * math.ceil(list[i]/10)

print(count)

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import math
import itertools as itr


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

l_p = list(itr.permutations(l))
ans = 643
for l in l_p:
  ret = 0
  for t in l[:-1]:
    ret += math.ceil(t/10)*10
  ret += l[-1]
  ans = min(ret, ans)

print(ans)

Submission status: Accepted

Solution code:
time = 0
order_list = []

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

#余りを利用して、9~0で表現し、大きい順にソートしている
order_list = sorted(order_list, key=lambda x: ((x-1)%10), reverse=True)

for i in order_list[0:-1]:
        if i % 10 == 0:
                time += i
        else:
                time += (int(i/10)+1)*10

print(time+order_list[-1])

Submission status: Accepted

Solution code:
li = [int(input()) for _ in range(5)]
time = 0
min1 = 10
for i in range(5):
    a = li[i]
    if a % 10 != 0:
        time += (int(a/10) + 1) * 10
        if a % 10 < min1 :
            min1 = a % 10
    else:
        time += a
print(time - 10 + min1)

Submission status: Accepted

Solution code:
import math

"""
A = []
min_1 = 9
min_index = 0
for i in range(5):
    a = int(input())
    A.append(a)
    if (a%10 == 0):
        continue
    if (a%10 <= min_1):
        min_1 = a%10
        min_index = i

t = A.pop(min_index)
for a in A:
    if a%10 == 0:
        t += a
    else:
        t += ((a//10)+1)*10
print(t)
"""
def ten(a):
    return (a+9) // 10 * 10
def ichi(a):
    return ten(a) - a

A = []
for i in range(5):
    a = int(input())
    A.append(a)
B = [ten(a) for a in A]
C = [ichi(a) for a in A]
print(sum(B) - max(C))

Submission status: Accepted

Solution code:
import math


def find(lst):
    lst2 = []
    for li in lst:
        x = li % 10
        if x == 0:
            lst2.append(10)
        else:
            lst2.append(x)

    min_ = lst2[0]
    min_i = 0
    for i in range(len(lst2)):
        if lst2[i] < min_:
            min_ = lst2[i]
            min_i = i
    return min_i


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

min_i = find(F)

ans = 0
for i, fi in enumerate(F):
    if i == min_i:
        continue
    # ans += math.ceil(fi)
    ans += (math.ceil(fi / 10)) * 10

ans += F[min_i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    ans = 0
    mx = 0
    for _ in range(5):
        x = int(input())
        tmp = -(-x//10) * 10
        mx = max(tmp-x, mx)
        ans += tmp
    ans -= mx
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
time = 0
order_list = []

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

for i in range(4):
    next_order = order_list[i+1] % 10 if order_list[i+1] % 10 != 0 else 10
    if order_list[i] % 10 < next_order:
        buff = order_list[i]
        order_list[i] = order_list[i+1]
        order_list[i+1] = buff

for i in range(5):
    wait = 10 - order_list[i] % 10
    if wait == 10 or i == 4:
        wait = 0
    time += order_list[i] + wait

print(time)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
r_min = 10
r_idx = -1
res = 0
for i in range(len(a)):
  r_ = a[i] % 10
  res += (a[i] // 10) * 10 + int(r_ > 0) * 10
  if r_ == 0:
    r_ = 10
  if r_ < r_min:
    r_min = r_
    r_idx = i

if r_min < 10:
  res -= 10 - r_min
print(res)

Submission status: Accepted

Solution code:
import math

times = [input() for _ in range(5)]
mini = times[0]
for i, _ in enumerate(times):
    if i >= 4:
        break
    if int(_[-1]) != 0 and int(_[-1]) < int(mini[-1]):
        mini = _

times.remove(mini)

sums = sum([int(math.ceil(int(_)/10)*10) for _ in times])
sums += int(mini)
print(sums)

Submission status: Accepted

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

for i in range(5):
    extra.append(times[i] % 10)

ans = 0

for time in times:
    ans += time // 10 * 10
    if time % 10 != 0:
        ans += 10

loss = [10 - e if e != 0 else 0 for e in extra]
ans -= max(loss)
print(ans)

Submission status: Accepted

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

from itertools import permutations
ans = 643

def kiriage(i):
    if i % 10 == 0:
        return i
    else:
        juu = i // 10
        return (juu + 1) * 10

for *ts, t5 in permutations(time, 5):
    time_took = 0
    for t in ts:
        time_took += kiriage(t)
    time_took += t5
    ans = min(ans, time_took)

print(ans)

Submission status: Accepted

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

ans = 0
min_wait = 99
for t in needs:
    wait = t % 10
    if wait == 0:
        ans += t
    else:
        min_wait = min(min_wait, t % 10)
        ans += (t // 10 + 1) * 10
if min_wait != 99:
    ans = ans - 10 + min_wait

print(ans)

Submission status: Accepted

Solution code:
import math

def main():
    ABCDE = [int(input()) for _ in range(5)]
    d = [(k, 10 - (k % 10) if k % 10 != 0 else 0,) for k in ABCDE]
    d.sort(key=lambda x:x[1])
    abced = [k[0] for k in d]
    result = 0
    for i in abced[:-1]:
        if i % 10 == 0:
            result += i
        else:
            result += 10 * math.ceil(i / 10)
    result += abced[-1]
    print(result)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

moda = [a[i] % 10 for i in range(5)]
for num, i in enumerate(moda):
    if i == 0:
        moda[num] = 10
# print(moda)
print(sum(a)-sum(moda)+40+min(moda))