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:
zikan = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]
li2 = []

for x in li:
    if x % 10 != 0:
        li2.append(abs((x % 10) - 10))
    else:
        li2.append(0)
f = li[li2.index(max(li2))]
li.remove(f)
for y in li:
    if y % 10 == 0:
        zikan += y
    else:
        zikan += 10 * (y // 10 + 1)
zikan += f
print(zikan)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(input())
minn = 9
flag = 1
sumtime = 0
for i in range(5):
	if(minn > a[i]%10 & a[i]%10 > 0):
		minn = a[i]%10
		flag = 0
	elif(a[i]%10 == 9):
		flag = 0
	if(a[i]%10 == 0):
		sumtime += a[i]
	else:
		a[i] = a[i] + 10 - a[i]%10
		sumtime += a[i]
if(flag == 1):
	print(sumtime)
else:
	print(sumtime - 10 + minn)

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
input = sys.stdin.readline

times = []
for _ in range(5):
    x = int(input())
    times.append([x, ((x + 9) // 10 * 10) - x])

times.sort(key=lambda x : x[1])

ans = 0
for i in range(4):
    ans += times[i][0] + times[i][1]

ans += times[-1][0]

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
S = [int(input()) for _ in range(5)]
amari = [10 if s % 10 == 0 else s % 10 for s in S]
t = 0
for i in range(5):
    ind = np.argsort(amari)[::-1][i]
    #print(ind, np.sort(amari)[::-1][i])
    if i == 4 :
        t += S[ind]
    else :
        t += S[ind] + (10 - amari[ind])
print(t)

Submission status: Accepted

Solution code:
import math
import numpy as np

raw = np.array(
  [int(input()) for _ in range(5)])
rounded = np.array(
  [math.ceil(i/10)*10 for i in raw])
diff = rounded - raw
gap = diff.max()

print(rounded.sum() - gap)

Submission status: Accepted

Solution code:
dish = [int(input()) for _ in range(5)]
dishtime = [0]*5
for i,d in enumerate(dish):
  if int(d/10)*10 == d:
    dishtime[i] = d
  else:
    dishtime[i] = int(d/10)*10+10
mintime = [0]*5
for i in range(5):
  if dishtime[i] == dish[i]:
    mintime[i] = 10
  else:
    mintime[i] =  10+dish[i]-dishtime[i]
print(sum(dishtime)+min(mintime)-10)

Submission status: Accepted

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

def kuriage(n):
  mod10=n%10
  if mod10==0:
    return n
  else:
    return n+10-mod10

def kuriagesum(k,l,m,n,p):
  return kuriage(k)+kuriage(l)+kuriage(m)+kuriage(n)+p

S1=kuriagesum(a,b,c,d,e)
S2=kuriagesum(a,b,c,e,d)
S3=kuriagesum(a,b,d,e,c)
S4=kuriagesum(a,c,d,e,b)
S5=kuriagesum(b,c,d,e,a)
SS=[S1,S2,S3,S4,S5]
print(min(SS))

Submission status: Accepted

Solution code:
a = []

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


def ceil10(n):
    if n % 10 == 0:
        return n
    else:
        return ((n // 10) + 1) * 10


def min_1(a):
    a2 = list(filter(lambda a: a > 0, list(map(lambda e: e % 10, a))))

    if len(a2) == 0:
        return 10

    return min(a2)


ans = sum(map(ceil10, a)) - 10 + min_1(a)
print(ans)

Submission status: Accepted

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

lst_result = []
lst = [[A, A % 10], [B, B % 10], [C, C % 10], [D, D % 10], [E, E % 10]]
lst_a = []
for i in range(len(lst)):
  if lst[i][1] == 0:
    lst_result.append(lst[i][0])
  else:
    lst_a.append(lst[i])

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


for i in range(len(lst_a)):
  lst_result.append(lst_a[i][0])

answer = 0
for i in range(len(lst_result)):
  if i < 4:
    if lst_result[i] % 10 == 0:
      answer += lst_result[i]
    else:
      tmp = lst_result[i] // 10 + 1
      answer += tmp * 10
  else:
    answer += lst_result[i]
print(answer)

Submission status: Accepted

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

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

import math

times = [ 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 ]

digit1 = [a - a//10*10,
          b - b//10*10,
          c - c//10*10,
          d - d//10*10,
          e - e//10*10]

m = digit1[0]
tt = 0
idx = 0

for i in range(5):
    tt += times[i]
    if 0 < digit1[i] and digit1[i] < m:
        m = digit1[i]
        idx = i

print('{}'.format(tt - times[idx] + v[idx]))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from collections import deque

def solve(A: int, B: int, C: int, D: int, E: int):
    q = deque([])

    l = [A,B,C,D,E]
    for i in [0,9,8,7,6,5,4,3,2,1]:
        for j in l:
            if(j%10 == i):
                q.append(j)

    # print(q)
    ans = 0
    while len(q) > 0:
        x = q.popleft()
        if(x%10 == 0 or q == deque([])):
            ans += x
        else:
            ans += x+10-x%10
        # print(ans)
    print(ans)
    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:
plate = [int(input()) for i in range(5)]
amari=[]
for i in range(5):
    if plate[i]%10 == 0:
        amari.append(0)
    else:
        amari.append(10 - plate[i]%10)
ans = 0

def kiriage(n):
    if n%10 == 0:
        return n
    else:
        return n + (10 - n%10)

for i in range(5):
    ans += kiriage(plate[i])

ans -= max(amari)
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
Ac=(((a-1)//10)+1)*10
Bc=(((b-1)//10)+1)*10
Cc=(((c-1)//10)+1)*10
Dc=(((d-1)//10)+1)*10
Ec=(((e-1)//10)+1)*10
Af=(a-1)%10
Bf=(b-1)%10
Cf=(c-1)%10
Df=(d-1)%10
Ef=(e-1)%10

if min(Af,Bf,Cf,Df,Ef)==Af:
  print(a+Bc+Cc+Dc+Ec)
  
elif min(Af,Bf,Cf,Df,Ef)==Bf:
  print(Ac+b+Cc+Dc+Ec)
  
elif min(Af,Bf,Cf,Df,Ef)==Cf:
  print(Ac+Bc+c+Dc+Ec)  
  
elif min(Af,Bf,Cf,Df,Ef)==Df:
  print(Ac+Bc+Cc+d+Ec)
  
elif min(Af,Bf,Cf,Df,Ef)==Ef:
  print(Ac+Bc+Cc+Dc+e)

Submission status: Accepted

Solution code:
import sys
import itertools

def calc_time(ts):
  time = 0
  for t in ts[:-1]:
    time += t
    tmp = time % 10
    if tmp != 0:
      time += 10 - tmp
  return time + ts[-1]

times = [int(input()) for _ in range(5)]
results = [calc_time(ts) for ts in itertools.permutations(times, 5)]

print(min(results))

Submission status: Accepted

Solution code:
def rest(num):
    return num % 10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Foods = [A,B,C,D,E]
res = 0

poplist=[]
for idx in range(5):
    if Foods[idx]%10==0:
        res += Foods[idx]
        poplist.append(idx)
while len(poplist)>0:
    idx = max(poplist)
    Foods.pop(idx)
    poplist.pop(poplist.index(idx))

while len(Foods) > 0:
    idx = Foods.index(max(Foods, key=rest))
    if len(Foods)>1:
        res += (Foods[idx]//10)*10+10
    else:
        res += Foods[idx]
    Foods.pop(idx)



print(res)

Submission status: Accepted

Solution code:
dish = []
r    =[]
time = 0

for i in range(5):
	dish.append(int(input()))
#print("dish = " + str(dish))

for i in range(5):
	r.append((dish[i]-1)%10 + 1)
#print("r = " + str(r))

minr = min(r)
#print("minr = " + str(minr))

ind = r.index(min(r))
#print("ind = " + str(ind))

resdish = dish.pop(ind)
#print("resdish = " + str(resdish))
#print("dish = " + str(dish))
for i in range(4):
#	print(  ( (dish[i]-1)//10 )*10+10)
	time += ( (dish[i]-1)//10 )*10+10

time += + resdish
print(int(time))

Submission status: Accepted

Solution code:
import copy


def isNumsDouble(nums):
    for num in nums:
        if nums.count(num) > 1:
            return True
    return False


def main(input_nums):
    total_list = []
    for i_a, num_a in enumerate(input_nums):
        for i_b, num_b in enumerate(input_nums):
            for i_c, num_c in enumerate(input_nums):
                for i_d, num_d in enumerate(input_nums):
                    for i_e, num_e in enumerate(input_nums):
                        if isNumsDouble([i_a, i_b, i_c, i_d, i_e]):
                            continue
                        total = 0
                        for num in [num_a, num_b, num_c, num_d, num_e]:
                            rem = total % 10
                            if rem != 0:
                                total += 10 - rem
                            total += num
                        total_list.append(total)
    return min(total_list)


if __name__ == "__main__":
    input_nums = []
    for _ in range(5):
        input_nums.append(int(input()))
    print(main(input_nums))

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a_moji=str(a)
b_moji=str(b)
c_moji=str(c)
d_moji=str(d)
e_moji=str(e)

a1=int(a_moji[-1])
a1_moji=str(a1)
if a1==0:
    a1=10
a_kiriage=a+10-a1

b1=int(b_moji[-1])
b1_moji=str(b1)
if b1==0:
    b1=10
b_kiriage=b+10-b1

c1=int(c_moji[-1])
c1_moji=str(c1)
if c1==0:
    c1=10
c_kiriage=c+10-c1

d1=int(d_moji[-1])
d1_moji=str(d1)
if d1==0:
    d1=10
d_kiriage=d+10-d1

e1=int(e_moji[-1])
e1_moji=str(e1)
if e1==0:
    e1=10
e_kiriage=e+10-e1

k=10
if k>a1:
    k=a1
if k>b1:
    k=b1
if k>c1:
    k=c1
if k>d1:
    k=d1
if k>e1:
    k=e1
goke=a_kiriage+b_kiriage+c_kiriage+d_kiriage+e_kiriage+k-10
print(goke)

Submission status: Accepted

Solution code:
dishes = []
for i in range(5):
    dishes.append(int(input()))
time = 0
losstimes = []
for i in dishes:
    if not i%10 == 0:
        loss = 10-i%10
    else:
        loss = 0
    losstimes.append(loss)
losstimes.sort()
losstimes.pop(-1)
for i in range (5):
    if i < 4:
        time += losstimes[i]
    time += dishes[i]
print(time)

Submission status: Accepted

Solution code:
from math import ceil
time = 0
last = 10
for i in range(5):
    x = int(input())
    m = x % 10
    t = ceil(x/10) * 10
    last = m if m < last and m != 0 else last
    time += t
ans = time - 10 + last
print(ans)

Submission status: Accepted

Solution code:
d=[int(input()) for i in range(5)]
d2=[]
d_mod=[]
for j in d:
  if j%10 != 0:
    add=10-j%10
    j=j+10-j%10
  else:
    add=0
  d_mod.append(add)
  d2.append(j)
print(sum(d2)-max(d_mod))

Submission status: Accepted

Solution code:
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
if notdiv:
    for i in range(len(notdiv)):
        notdiv[i] %= 10
        notdiv[i] = 10 - notdiv[i]

    notdiv.sort()
    print(sum(lis) + plus - notdiv[-1])
else:
    print(sum(lis) + plus)

Submission status: Accepted

Solution code:
a=[]
for i in range(5):
  a.append(int(input()))
b=[]
for j in range(5):
  if a[j]%10==0:
    b.append(10)
  else:
    b.append(a[j]%10)
idx=b.index(min(b))
cnt=a[idx]
del a[idx]
for k in range(4):
  if a[k]%10==0:
    cnt+=a[k]
  else:
    cnt+=a[k]+10-(a[k]%10)
print(cnt)

Submission status: Accepted

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

order= []
for i in range(5):
    order.append(input())
    
min1 = 9
arg_min1 = 0
for i in range(5):
    #print(order[i][len(order[i])-1],len(order[i]),order[i])
    if int(order[i][-1]) < min1 and int(order[i][-1]) > 0:
        #print(int(order[i][-1]))
        min1 = int(order[i][-1])
        arg_min1= i

#print(arg_min1)
for i in range(5):
    order[i]= int(order[i])
        
order_min_sum = 0
for i in range(5):
    if arg_min1 == i:
        order_min_sum += int(order[i])
    else:
        while True:
            if int(order[i]) %10 == 0:
                break
            else:
                #print("are:{}".format(order[i]))
                order[i] = order[i] +1
        order_min_sum += order[i]
    #print("sum,{}".format(order_min_sum))
print(order_min_sum)

Submission status: Accepted

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

mod = 10
last =1
for s in range(5):
	tmp = i[s] % 10
	if tmp!=0:
		if mod > tmp:
			mod=tmp
			last=s
sum=0
for s in range(5):
  if(s!=last):
    tmp=i[s] // 10
    mod=i[s] % 10
    if mod >0:
      sum+=tmp + 1
    else:
      sum+=tmp
print(sum*10 +i[last])

Submission status: Accepted

Solution code:
num_m = 5
mins = [int(input()) for _ in range(num_m)]
ans = 0
for i in range(num_m - 1, -1, -1):
    if not mins[i] % 10:
        ans += mins[i]
        mins.pop(i)
mins = sorted(mins, key=lambda item: item % 10)
for m in mins[1:]:
    ans += (m // 10 + 1) * 10
if len(mins):
    ans += mins[0]

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
ans = 0
S = [0,0,0,0,0]
Ss = [0,0,0,0,0]
S[0] = int(input())
S[1] = int(input())
S[2] = int(input())
S[3] = int(input())
S[4] = int(input())

HJ = S[0] % 10
T = 0

for i in range(5):
    if HJ > S[i] % 10 and 0 != S[i] % 10:
         T = i
         HJ = S[i] % 10
         #print('testA')

for i in range(5):
    if S[i] % 10 != 0:
        Ss[i] = S[i] - (S[i] % 10) + 10
        #print('testB')
    else:
        Ss[i] = S[i]
        #print('testC')

Ss[T] = S[T]

ans = Ss[0]+Ss[1]+Ss[2]+Ss[3]+Ss[4]
print(ans)

Submission status: Accepted

Solution code:
def ten_baisu(n):
    while n % 10 != 0:
        n += 1
    return n


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

lst_2 = [i % 10 for i in lst]

num = 10
idx = 0
for i in range(5):
    if lst_2[i] < num and lst_2[i] != 0:
        num = lst_2[i]
        idx = i

ans = 0
for i in range(5):
    if i == idx:
        continue
    ans += ten_baisu(lst[i])

print(ans + lst[idx])

Submission status: Accepted

Solution code:
import math

dishes = []

for i in range(5):
    dishes.append([int(input()),None])

for el in dishes:
    el[1] = el[0] % 10 if el[0] % 10 > 0 else 10

dishes.sort(key=lambda x:x[1])

last_dish = dishes[0][0]

minute = 0

for j in range(1, len(dishes)):
    minute += math.ceil(dishes[j][0] / 10) * 10

minute += dishes[0][0]

print(minute)

Submission status: Accepted

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

total = 0
min_val =10
for it in dish:
    total += it
    tmp = it % 10
    
    if tmp == 0:
        continue
        
    if tmp<min_val:
        min_val = tmp
    total += (10-tmp)
print(total - 10 + min_val)

Submission status: Accepted

Solution code:
ans = 0
max_diff = 0
total_diff = 0

for _ in range(5):
    time = int(input())
    diff = 10-time%10
    diff = 0 if diff==10 else diff 
    total_diff += diff
    max_diff = max(max_diff,diff)
    ans += time
ans += total_diff-max_diff

print(ans)

Submission status: Accepted

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

li_div = [l%10 for l in li]

min_div = li[0] % 10
l_min_div = li[0]

for l in li:
  div = l % 10
  if div != 0 and div < min_div:
    min_div = div
    l_min_div = l
    
li.remove(l_min_div)

sum_time = 0
for l in li:
  x = l // 10
  if l % 10 != 0:
    sum_time += 10 * (x+1)
  else:
   	sum_time += 10 * x

print(sum_time + l_min_div)

Submission status: Accepted

Solution code:
import math


def main():
    h = [int(input()) for count in range(5)]
    total_time = 0
    while len(h) > 0:
        dlist = []
        for i in range(len(h)):
            time = h[i]
            del_time = abs((math.ceil(time / 10) * 10) - time)
            dlist.append(del_time)
        min_d = dlist.index(min(dlist))
        total_time += h[min_d]
        if len(h) > 1:
            total_time = math.ceil(total_time / 10) * 10
        h.pop(min_d)

    print(total_time)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys


atoe = []
for i in range(5):
    atoe.append(int(sys.stdin.readline()))

fastest_meal = 0
fastest_meal_num = 99
for i in range(5):
    temp = str(atoe[i])
    if int(temp[-1:]) > 0 and int(temp[-1:]) < fastest_meal:
        fastest_meal = int(temp[-1:])
        fastest_meal_num = i
    if i == 0:
        fastest_meal = int(temp[-1:])
        fastest_meal_num = i

total_time = 0
for i in range(5):
    if i == fastest_meal_num:
        continue
    temp = str(atoe[i])
    total_time += atoe[i]
    str_total_time = str(total_time)
    if int(temp[-1:]) > 0 and len(str_total_time) > 1:
        upper = int(str_total_time[:-1])
        upper += 1
        total_time = int(str(upper) + "0")
    elif int(temp[-1:]) > 0:
        total_time = 10

total_time += atoe[fastest_meal_num]

print(total_time)

Submission status: Accepted

Solution code:
import itertools as it

def get_ceil_10(target) :
    if (str(target)[-1] == "0") :
        return target
    
    return ((target // 10) + 1) * 10
    
     # return target + (5 - target % 5) % 5


# 5!は120なので全部試す
menu = {}
# A = int(input())
# B = int(input())
# C = int(input())
# D = int(input())
# E = int(input())
menu["A"]= int(input())
menu["B"] = int(input())
menu["C"] = int(input())
menu["D"] = int(input())
menu["E"] = int(input())

all_pattern  = list(it.permutations(["A","B","C","D","E"], 5))
# all_pattern  = [["A", "B","C", "E", "D"]]
min_time = 1000 # がんばっても600とかしかいかないはず
for pattern in all_pattern :
    # if (pattern[0] == ["A"] and pattern[1] == "B" and pattern[2] == "C" and pattern[3] == "E" and pattern[4] == "D") : 
    #     print("aaa")

    time = 0
    for action in pattern :
        time += menu[action]

        if (action != pattern[-1]) :
            # 最後は待たなくていい。
            # TODO ださい。。。

            # 時間ごと切り上げちゃってOK。
            time = get_ceil_10(time)  

    if (min_time > time) :
        min_time = time

print(min_time)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

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
l = [A,B,C,D,E]
ans = 0
for i in l:
    if i%10 == 0:
        ans += i
    else:
        ans += i-i%10+10
ans -= max((10-a)%10,(10-b)%10,(10-c)%10,(10-d)%10,(10-e)%10)
print(ans)

Submission status: Accepted

Solution code:
import scipy as sp

def mod10(x):
    return x%10
def kirisute(x):
    return x//10*10


l = []
total = 0

for i in range(5):
    l.append(int(input()))
    
for i in range(5):
    if l[4-i] % 10 == 0:
        total += l.pop(4-i)
if len(l) != 0:    
    lmd = list(map(mod10, l))
    lmd.sort()
    total += sum(map(kirisute, l))
    total += lmd.pop(0)
    total += 10*(len(l)-1-lmd.count(0))
print(total)

Submission status: Accepted

Solution code:
times = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0}
loss = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0}
times['a'] = int(input())
times['b'] = int(input())
times['c'] = int(input())
times['d'] = int(input())
times['e'] = int(input())

for key, time in times.items():
    a, b = divmod(time, 10)
    if b > 0:
        loss[key] = 10 - b
    else:
        loss[key] = 0

# print(times)
# print(loss)
# print(sorted(loss.items(), key=lambda x: x[1]))

ans = 0
idx = 1
for k, v in sorted(loss.items(), key=lambda x: x[1]):
    ans += times[k]
    if loss[k] > 0 and idx < 5:
        ans += v
    idx += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import math


def main():
    inp = [int(line)  for line in sys.stdin.readlines()]
    sorted_list = sorted(inp, key=lambda x: (x - 1)% 10)
    min = sorted_list.pop(0)
    sorted_list = [math.ceil(x * 0.1) * 10 for x in sorted_list]
    print(sum(sorted_list) + min)

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

Solution code:
import numpy as np

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
array = np.array([a, b, c, d, e])
rlist = [a % 10, b % 10, c % 10, d % 10, e % 10]
value = 0
for i in range(0, 4):
    tmpr = rlist[i] % 10
    if tmpr != 0 and 10 - tmpr > value:
        value = 10 - tmpr
tenList = [int(a / 10) * 10 + 10, int(b / 10) * 10 + 10, int(c / 10) * 10 + 10, int(d / 10) * 10 + 10, int(e / 10) * 10 + 10]
for i in range(0, 5):
    tmp = tenList[i]
    if rlist[i]  == 0:
        tenList[i] = tmp - 10
sumv = sum(tenList)
print(int(sumv - value))

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
ans = 9
n = 0
j = 0
for i in [i % 10 for i in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
m = l.pop(n)
r = 0
for i in l:
    r += math.ceil(i / 10) * 10
print(r + m)

Submission status: Accepted

Solution code:
import itertools

a=[int(input()) for j in range(5)]
#print(a)

x=list(itertools.permutations(a))
#print(x)

def cal(b,c):
  if b <= c:
    return c
  else:
    c+=10
    return cal(b,c)
  
a=x[0]  
time1=cal(a[0],0)
time2=cal(time1+a[1],0)
time3=cal(time2+a[2],0)
time4=cal(time3+a[3],0)
time5=time4+a[4]
#print(time5)
ans=100000000  
for i in range(len(x)):
  time1=cal(x[i][0],0)
  time2=cal(time1+x[i][1],0)
  time3=cal(time2+x[i][2],0)
  time4=cal(time3+x[i][3],0)
  time5=time4+x[i][4]

  if ans > time5:
    ans=time5
    
print(ans)

Submission status: Accepted

Solution code:
import math

l = []
l = []
l2 = []
a = []

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

for i in range(len(l)):
	a.append(math.ceil(l[i]/10)*10)

for i in range(len(l)):
	if l[i]%10 == 0 :
		l2.append(10)
	else:
		l2.append(l[i]%10)

a[l2.index(min(l2))] = l[l2.index(min(l2))]

print(sum(a))

Submission status: Accepted

Solution code:
A = dict()
B = [0 for i in range(5)]
for i in range(10):
    A[i] = []
for i in range(5):
    B[i] = int(input())
for i in range(5):
    A[B[i]% 10].append(B[i])
cur_time = 0
count = 0
if len(A[0]) > 0:
    for j in A[0]:
        count += 1
        cur_time += j
for i in range(9,0,-1):
    if len(A[i]) > 0:
        for j in A[i]:
            count += 1
            if count < 5:
                cur_time += j + (10-i)
            else:
                cur_time += j
print(cur_time)

Submission status: Accepted

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

order_1 = [(i-1)*0.1 - int((i-1)*0.1) for i in ryouri]
min_v = 999
min_id = 0
for i, v in enumerate(order_1):
    if v < min_v:
        min_v = v
        min_id = i

goukei = 0
for i, (price, order) in enumerate(zip(ryouri, order_1)):
    if i == min_id:
        goukei = goukei + price
    else:
        goukei = goukei + math.ceil(price*0.1)*10

print(goukei)

Submission status: Accepted

Solution code:
n = 5
list=[int(input()) for i in range(n)]
a = 0
d = [0,0,0,0,0]
c = 0
b = 0
j = 1
k = 0

for j in reversed(range(11)):
  for i in range(n):
    b = (list[i]%10)
    if b == 0:
        b = 10
    if b == j:
        d[k] = list[i]
        k = k + 1


for i in range(n):
    a = a + c
    c = 10 - (d[i]%10)
    if c == 10:
        c = 0
    a = a + list[i]


print(a)

Submission status: Accepted

Solution code:
import math

a = list(map(int, [input() for i in range(5)]))
b = [math.ceil(b/10)*10 for b in a]

c1 = b[0] + b[1] + b[2] + b[3] + a[4]
c2 = b[0] + b[1] + b[2] + a[3] + b[4]
c3 = b[0] + b[1] + a[2] + b[3] + b[4]
c4 = b[0] + a[1] + b[2] + b[3] + b[4]
c5 = a[0] + b[1] + b[2] + b[3] + b[4]

print(min([c1,c2,c3,c4,c5]))

Submission status: Accepted

Solution code:
from itertools import permutations

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

l = [A,B,C,D,E]
lll = []
for i in permutations(l):
    ll = []
    for j in i[:-1]:
        if not j % 10 == 0:
            j = j + 10 - (j % 10)
        ll += [j]
    ll += [i[-1]]
    lll += [sum(ll)]

print(sorted(lll)[0])

Submission status: Accepted

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

time = 0
non10li = []
for i in li:
    if i%10==0:
        time+=i
    else:
        non10li.append(i)
if len(non10li)!=0:
    minili = [i%10 for i in non10li]
    ind = non10li.pop(minili.index(min(minili)))
    for i in non10li:
        time+=(i//10)*10+10

    time+=ind
print(time)

Submission status: Accepted

Solution code:
items = list()
time = 0
for _ in range(5):
    menu = int(input())
    items.append((menu, 10-menu%10 if menu%10 != 0 else 0))

items = sorted(items, key=lambda x:x[1])
worst_item = items[-1]
items.pop()
items = sorted(items, key=lambda x: abs(x[1] - 5), reverse=True)
items.append(worst_item)

for i, (item, _) in enumerate(items):
    time += (item + 9) // 10 * 10 if i != len(items)-1 else item

print(time)

Submission status: Accepted

Solution code:
A_list = []
for i in range(5):
    A_list.append(input())
one_list = []
one_list.append(int(A_list[0][-1]))
one_list.append(int(A_list[1][-1]))
one_list.append(int(A_list[2][-1]))
one_list.append(int(A_list[3][-1]))
one_list.append(int(A_list[4][-1]))
min_num = max(one_list)
min_one_list_index = 1
for i in range(len(one_list)):
    if one_list[i] != 0 and min_num >= one_list[i]:
        min_num = one_list[i]
        min_one_list_index = i
A_list_min = A_list[min_one_list_index]
del A_list[min_one_list_index]


def ceil(src, range):
    if src % 10 == 0:
        return src
    else:
        return ((int)(src / range) + 1 ) * range


for i in range(len(A_list)):
    A_list[i] = ceil(int(A_list[i]), 10)
print(sum(A_list)+int(A_list_min))

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]
t = 0
ts = []

def chumon(ds, t):
    if len(ds) == 1:
        return ts.append(t + ds[0])
    for i in range(len(ds)):
        di = ds[i]
        n = ds[:]
        n.pop(i)
        if di % 10:
            chumon(n, t + di - (di % 10) + 10)
        else:
            chumon(n, t + di)

chumon(dishes, t)
print(min(ts))

Submission status: Accepted

Solution code:
v = []
rem = []

A = int(input())
v.append(A)
rem.append(A % 10)

B = int(input())
v.append(B)
rem.append(B % 10)

C = int(input())
v.append(C)
rem.append(C % 10)

D = int(input())
v.append(D)
rem.append(D % 10)

E = int(input())
v.append(E)
rem.append(E % 10)

ind = 0
m = 150
count = 0
for i in rem:
    if i != 0 and m > i:
        m = i
        ind = count
    count += 1

count = 0
ans = 0
for i in v:
    if count == ind:
        ans += i
    else:
        if i % 10 != 0:
            tmp = (int(i/10)+1)*10
            ans += tmp
        else:
            ans += i
    count += 1

print(ans)

Submission status: Accepted

Solution code:
data_list = []
for i in range(5):
    data = int(input())
    if data / 10 != data // 10:
        data_list.append(((((data // 10) * 10 + 10) - data), data))
    else:
        data_list.append((0, data))
data_list.sort(key=lambda tup: tup[0])
result = 0
for i in range(5):
    result += (data_list[i][0] + data_list[i][1])
print(result - data_list[4][0])

Submission status: Accepted

Solution code:
t = [int(input()) for _ in range(5)]
d = [c%10 for c in t]
for i in range(5):
    if d[i] == 0:
        d[i] = 10
#print(t,d)
min_d = min(d)
totalt = 0
f = True
for x,y in zip(t,d):
    if (y == min_d) and f:
        totalt += x
        f = False
    else:
        if y == 10:
            totalt += x
        else:
            totalt += ((x//10) + 1) * 10
print(totalt)

Submission status: Accepted

Solution code:
import math
a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
d = int(input().strip())
e = int(input().strip())
l = [a,b,c,d,e]
x = 0
ans = 0
for i in range (len(l)):
        ans = ans + math.ceil(l[i]/10)*10
        n = math.ceil(l[i]/10)*10 - l[i]
        if x < n:
                x = n
print(ans - x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#a,b,c = map(int,inpput().split(" "))
#n = int(input())
#print(a,b,c)
t=[]
for i in range(5):
    t.append(int(input()))
#n = int(input())
def dif(x):
    s = int(x/10)
    if s * 10 == x:
        return 0
    else:
        return (s+1)*10 -x

def comp(a,b):
    a1 = dif(a)
    b1 = dif(b)
    return a1 < b1
d = sorted(t, key=lambda x: dif(x))

sum = 0
for i in range(4):
    if int(d[i]/10)*10 ==d[i]:
        sum = sum+d[i]
    else:
        sum += (int(d[i]/10)+1)*10
print(sum + d[4])

Submission status: Accepted

Solution code:
import sys


def main():
    input = sys.stdin.readline
    ryori_list = [int(input()) for _ in range(5)]
    loss_list = [10 - (r % 10) for r in ryori_list if r % 10] or [0]
    print(sum(ryori_list) + sum(loss_list) - max(loss_list))


if __name__ == "__main__":
    main()