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:
dishes=[]
mindiv=10

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

for j in range(len(dishes)):
  k= dishes[j]
  if(k%10 ==0 ):
    continue
  if(k%10 <mindiv):
    mindiv= k%10
  if(k%10 <=5 ):
    k += 5
  dishes[j]= round(k,-1)
  
# print(dishes)
# print(mindiv)
print(sum(dishes)-(10-mindiv))

Submission status: Accepted

Solution code:
import numpy as np

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

menu = [int(a), int(b), int(c), int(d), int(e)]

menu_ = [int(a[-1]), int(b[-1]), int(c[-1]), int(d[-1]), int(e[-1])]
menu_index = [i for i, x in enumerate(menu_) if x == 0]

menu_ = np.array(menu_)
sort_menu = np.argsort(-menu_)
if len(menu_index) == 0:
    menu_index = sort_menu 
else:
    for i in sort_menu[:-len(menu_index)]:
        menu_index.append(i)

sum = 0
for i, j in enumerate(menu_index):
    sum = sum + menu[j]
    if i == len(menu_index) -1:
        break
    if not sum % 10 == 0:
        sum = sum + (10 - sum % 10)

print(sum)

Submission status: Accepted

Solution code:
# input
listB = []
while True:
    try:
        listB.append(int(raw_input()))
    except:
        break;

A = listB[0]
B = listB[1]
C = listB[2]
D = listB[3]
E = listB[4]

totalCookingTime = A+B+C+D+E

A_lossTime = 10 - (A % 10 if A % 10 != 0 else 10)
B_lossTime = 10 - (B % 10 if B % 10 != 0 else 10)
C_lossTime = 10 - (C % 10 if C % 10 != 0 else 10)
D_lossTime = 10 - (D % 10 if D % 10 != 0 else 10)
E_lossTime = 10 - (E % 10 if E % 10 != 0 else 10)

maxLossTime = max(A_lossTime,B_lossTime,C_lossTime,D_lossTime,E_lossTime)

print(totalCookingTime + A_lossTime + B_lossTime + C_lossTime + D_lossTime +
      E_lossTime - maxLossTime)

Submission status: Accepted

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

min_value=10
min_index=0
for i, data in enumerate(input_data):
    temp = data%10
    if temp < min_value and temp!=0:
        min_value = temp
        min_index = i

sum_value=0
for i, data in enumerate(input_data):
    if i != min_index:
        if data%10 != 0:
            sum_value += (int(data/10)+1) *10
        else:
            sum_value += data
    else:
        sum_value += data
print(sum_value)

Submission status: Accepted

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

import math

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

s = 0
for f in li:
    s += (f//10)*10 + 10*(int(bool(f%10)))

li2 = []
for f in li:
    if f%10 != 0:
        li2.append(f%10)
if len(li2) == 0:
    li2.append(10)
print(s + min(li2) - 10)

Submission status: Accepted

Solution code:
import itertools


result = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time = 0

# item
for i in itertools.permutations([a,b,c,d,e], r=5):
    result = 0
    result = result  +  i[0]
    if result %10 != 0:
        result = result + (10-i[0]%10)
    result = result  +  i[1]
    if result %10 != 0:
        result = result + (10-i[1]%10)
    result = result  +  i[2]
    if result %10 != 0:
        result = result + (10-i[2]%10)
    result = result  +  i[3]
    if result %10 != 0:
        result = result + (10-i[3]%10)
    result = result  +  i[4] 
# order
    if time == 0:
        time = result
    elif time > result:
        time= result

# result
print(time)

Submission status: Accepted

Solution code:
t_a = int(input())
t_b = int(input())
t_c = int(input())
t_d = int(input())
t_e = int(input())

Time = 0

time_list = [t_a, t_b, t_c, t_d, t_e]

i = 1
tmp = 10

for time in time_list:
    if time % 10 == 0:
        a = 3
    elif(time % 10 < tmp):
        tmp = time % 10
        min_key = i

    i=i+1
j=1

try:
    if min_key:
        for t in time_list:
            if j != min_key:
                if t % 10 == 0:
                    Time = Time + t
                else:
                    Time = Time + t + (10 - (t % 10))
            j = j+ 1

        Time = Time + time_list[min_key-1]

        print(Time)



#min_keyがない場合すべて0なのでそのまま足す
except:
    Time = sum(time_list)
    print(Time)

Submission status: Accepted

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

last = 9
if a % 10 != 0:
  last = a
if (b % 10 != 0 and last % 10 > b % 10):
  last = b
if (c % 10 != 0 and last % 10 > c % 10):
  last = c
if (d % 10 != 0 and last % 10 > d % 10):
  last = d
if (e % 10 != 0 and last % 10 > e % 10):
  last = e
if (a % 10 == 0 and b % 10 == 0 and c % 10 == 0 and d % 10 == 0 and e % 10 == 0):
  last = a
  
print(-(-a // 10) * 10 - (-b // 10) * 10 -(-c // 10) * 10 - (-d // 10) * 10 -(-e // 10) * 10 + last + (-last // 10) * 10)

Submission status: Accepted

Solution code:
ts = [int(raw_input()) for i in range(5)]

def up(i):
    one = int(str(i)[-1])
    if one == 0:
        return i
    else:
        return i + (10 - one)

t = sum([up(i) for i in ts])
ones = [int(str(s)[-1]) for s in ts]
while True:
    try:
        ones.remove(0)
    except:
        break
if not len(ones) == 0:
	m = min(ones)
	print int(t-(10-m))
else:
  	print int(t)

Submission status: Accepted

Solution code:
inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
if inp3 != []:

    last = inp3[0]
    inp2.remove(last)
else:
    last = 0

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
res = r + last
print(res)

Submission status: Accepted

Solution code:
import math
time_list=[]

for _ in range(5):
    time_list.append(int(input()))
# print(1, time_list)

time_list2=[]
for x in time_list:
    m = x % 10
    if m!=0:
        time_list2.append(x+(10-m))
    else:
        time_list2.append(x)
# print("2", time_list2)

mod_list = []
for x in time_list:
    m = x % 10
    if m!=0:
        mod_list.append(m)
    else:
        mod_list.append(10)
min_ = min(mod_list)
# print(mod_list)



print(sum(time_list2)-(10-min_))

Submission status: Accepted

Solution code:
A = input()
B = input()
C = input()
D = input()
E = input()
ABC = [A,B,C,D,E]
sort_abc = []
time = 0
m = 9
for abc in ABC:
    if m < int(abc[-1]) or abc[-1] == '0':
        sort_abc.insert(0,abc)
    else:
        m = int(abc[-1])
        sort_abc.append(abc)
sort_abc = list(map(int,sort_abc))
for i in range(5):
    abc = sort_abc[i]
    if i == 4:
        time += abc
    else:
        if abc%10 == 0:
            time += abc
        elif abc%10 != 0 and abc >= 10:
            time += abc + (10-abc%10)
        else:
            time += 10       
print(time)

Submission status: Accepted

Solution code:
l,s = [],[]
for i in range(5):
    num = int(input())
    l.append(num)
    if num%10!=0:
        s.append(num%10)

res = 0

for i in l:
    if i%10!=0:
        res += (i+10)//10*10
    else:
        res += i
else:
    if len(s) != 0:
        tmp = min(s)
    else:
        tmp = 10
    print(res-(10-tmp))

Submission status: Accepted

Solution code:
import math

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

minimum_last_order_cycle = None
for cycle in cycles:
    if minimum_last_order_cycle is None and cycle % 10 > 0:
        minimum_last_order_cycle = cycle
    elif minimum_last_order_cycle is not None and cycle % 10 < minimum_last_order_cycle % 10 and cycle % 10 > 0:
        minimum_last_order_cycle = cycle

if minimum_last_order_cycle is None:
    minimum_last_order_cycle = cycles[0]

cycles.remove(minimum_last_order_cycle)

time = 0
for cycle in cycles:
    time += math.ceil(cycle / 10) * 10

time += minimum_last_order_cycle

print(time)

Submission status: Accepted

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

a_s=a/10
a_a=a%10

b_s=b/10
b_a=b%10

c_s=c/10
c_a=c%10

d_s=d/10
d_a=d%10

e_s=e/10
e_a=e%10

A=[]
A.append(a_a)
A.append(b_a)
A.append(c_a)
A.append(d_a)
A.append(e_a)
ans+=(a_s + b_s + c_s + d_s + e_s)*10
A.sort()
for i in range(5):
    if A[i]!=0:
        ans += A[i]
        ans += (5-(i+1))*10
        break

print(ans)

Submission status: Accepted

Solution code:
import math

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



ans = 0
for i in [a, b, c, d, e]:
    ans += int(math.ceil(i/10)*10)

    
li = [int(str(a)[-1]), int(str(b)[-1]), int(str(c)[-1]), int(str(d)[-1]), int(str(e)[-1])]

if li == [0, 0, 0, 0, 0]:
    ans = ans + min(li)
    print(ans)
    
else:
    for j in li:
        if j==0:
            li.remove(0)
    ans = ans + min(li) - 10
    print(ans)

Submission status: Accepted

Solution code:
e,*a=sorted(eval('int(input()),'*5),key=lambda x:(x%10-1)%10);print(e-sum(-i//10*10for i in a))

Submission status: Accepted

Solution code:
a = [0,0,0,0,0]

a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())

ans = 10000000

def is_unique(seq):
   return len(seq) == len(set(seq))

for o in range(5):
	for p in range(5):
		if is_unique([o,p]):
			for q in range(5):
				if is_unique([o,p,q]):
					for r in range(5):
						if is_unique([o,p,q,r]):
							for s in range(5):
								if is_unique([o,p,q,r,s]):
									tmp = int(a[o]/10)*10+int(a[p]/10)*10+int(a[q]/10)*10+int(a[r]/10)*10+int(a[s])
									tmp += (bool(a[o]%10)+bool(a[p]%10)+bool(a[q]%10)+bool(a[r]%10))*10
									ans = min(tmp, ans)

print(ans)

Submission status: Accepted

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

def times2(dish):
    if 0<=dish & dish<=10:
        return 10-dish
    elif 11<=dish & dish<=20:
        return 20-dish
    elif 21<=dish & dish<=30:
        return 30-dish
    elif 31<=dish & dish<=40:
        return 40-dish
    elif 41<=dish & dish<=50:
        return 50-dish
    elif 51<=dish & dish<=60:
        return 60-dish
    elif 61<=dish & dish<=70:
        return 70-dish
    elif 71<=dish & dish<=80:
        return 80-dish
    elif 81<=dish & dish<=90:
        return 90-dish
    elif 91<=dish & dish<=100:
        return 100-dish
    elif 101<=dish & dish<=110:
        return 110-dish
    elif 111<=dish & dish<=120:
        return 120-dish
    elif 121<=dish & dish<=130:
        return 130-dish



    if int(dish/10)==0:
        return 0-dish
    elif int(dish/10)==1:
        return 10-dish
    elif int(dish/10)==2:
        return 20-dish
    elif int(dish/10)==3:
        return 30-dish
    elif int(dish/10)==4:
        return 40-dish
    elif int(dish/10)==5:
        return 50-dish
    elif int(dish/10)==6:
        return 60-dish
    elif int(dish/10)==7:
        return 70-dish
    elif int(dish/10)==8:
        return 80-dish
    elif int(dish/10)==9:
        return 90-dish
    elif int(dish/10)==10:
        return 100-dish
    elif int(dish/10)==11:
        return 110-dish
    elif int(dish/10)==12:
        return 120-dish
    else:
        pass

a_=times2(a)
b_=times2(b)
c_=times2(c)
d_=times2(d)
e_=times2(e)
s=[a_,b_,c_,d_,e_]
# print(s)
data=sorted(range(len(s)), key=lambda k: s[k])

ans=s[data[0]]+s[data[1]]+s[data[2]]+s[data[3]]+a+b+c+d+e
print(ans)

Submission status: Accepted

Solution code:
def main():
    time = [0] * 5
    re = []
    for i in range(5):
        time[i] = int(input())
        if time[i] % 10 != 0:
            re.append(time[i] % 10)

    ans = sum(time)
    if len(re) > 1:
        re.sort()
        for r in re[1:]:
            ans += 10 - r % 10

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = []
b = 0
c = 10
d = 0
e = []
for i in range(5):
    a.append(int(input()))
for i in range(5):
    d += a[i]
for i in range(5):
    b = 20
    c = 10
    while(b > 10 or b < 0):
        b = c - a[i]
        c += 10
    e.append(b)
e = sorted(e)
for i in range(4):
    d += e[i]
print(d)

Submission status: Accepted

Solution code:
import math
a, b, c, d, e = [int(input()) for _ in range(5)]
li = [a, b, c, d, e]
ls = []
for l in li:
    ls.append(math.ceil(l/10)*10)


def amari(x): return (x-1) % 10+1


li = list(map(amari, li))
min = min(li)

sum = sum(ls)

print(sum + min - 10)

Submission status: Accepted

Solution code:
from sys import stdin

def ten(x):
    return 10 - x

lst = []
for i in range(5):
    a = int(stdin.readline().rstrip())
    lst.append(a)

minv = 9
flag = False
for x in lst:
    s = str(x)
    tmp = int(s[-1])
    if tmp <= minv and tmp != 0:
        flag = True
        minv = tmp

sum = 0

for x in lst:
    s = str(x)
    tmp = int(s[-1])
    if tmp >= 1:
        tmp2 = ten(tmp)
        sum = sum + x + tmp2
    else:
        sum = sum + x

if minv != 0 and flag:
    sum = sum - (ten(minv))

print(sum)

Submission status: Accepted

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


t =0
s = 0
for m in a:
    t += int(m/10) * 10
    if m%10 != 0:
        t = t + 10
    if 10 - (m%10) > s and m%10 !=0:
        s = 10 - (m%10)

print(t - s)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
b = [g%10 for g in a]
kkk = 9
h = 0
for i in range(len(a)):
    g = a[i] % 10
    if g > 0 and g < kkk:
        kkk = g
        h = i
l = a[h]
a.pop(h)
a.append(l)
total = 0
for i in a:
    if total % 10 != 0:
        total += 10 - (total % 10)
    total += i

print(total)

Submission status: Accepted

Solution code:
line= [int(input()) for i in range(5)]
line_sec=[]
k=0
s=0
k_before=0
num_before=0
num=0
m=0
m_before=0
for i in range(5):
    # k_before = k
    # num_before=num
    # num=i
    m_before=m
    m=i
    k=line[i]%10
    if k>0:
        s=line[i]-k+10
    else:
        s=line[i]
    line_sec.append(s)
    # if k!=0 and k_before<k:
    #     k=k_before
    #     num=num_before
    num_before=num
    num=line_sec[i]-line[i]
    if num_before>num:
        num=num_before
        m=m_before

ans = (line_sec[0]+line_sec[1]+line_sec[2]+line_sec[3]+line_sec[4])-line_sec[m]+line[m]
print(ans)
# print('l',line)
# print('l_sec',line_sec)
# print(num)
# print(k)

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]
l_a = [A%10,B%10,C%10,D%10,E%10]
dif = 9
for j in l_a:
    if j == 0:
        pass
    else:
        if j <= dif:
            dif = j
ans = 0
for i in l:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10 - i % 10)
if A%10==0 and B%10==0 and C%10==0 and D%10==0 and E%10==0:
    print(ans)
else:
    a = ans - (10 - dif)
    print(a)

Submission status: Accepted

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

def mykey(x):
    x=x%10
    if x<0:
        x=-x
    if x==0:
        x=10
    return -int(x)

b=sorted(a,key=mykey)
    
for i in range(4):
    if (b[i]%10)>0:
        b[i]=int(b[i]/10)+1
        b[i]=b[i]*10
g=0    
for i in range(5):
    g+=b[i]
print(g)

Submission status: Accepted

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

div=list(map(lambda x: x%10, arr))
index=0
min_v=9
for i, v in enumerate(div):
    if v!=0 and v < min_v:
        index = i
        min_v = v

del div[index]

interval = sum(list(map(lambda x: 10-x if x!=0 else 0, div)))
print(sum(arr)+interval)

Submission status: Accepted

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

fl = False
idx = 0
ch = 10
for j in range(5):
  if li[j] % 10 != 0 and li[j] % 10 < ch:
    ch = li[j] % 10
    idx = j
    fl = True
#print('fl',fl)
#print('idx',idx)

if fl == False:
  print(sum(li))
  exit()

ans = 0
ln = 0
#print(li)
if fl == True:
  ln = li[idx]
  li.remove(li[idx])
  #print(li)
  for k in range(len(li)):
    c = math.ceil(li[k]/10)*10
    #print(c)
    ans += c
#print('ln',ln)
print(ans+ln)

Submission status: Accepted

Solution code:
ts = []
ts_mod = []
for i in range(5):
    ts.append(int(input()))
    ts_mod.append(ts[i] % 10)


def find_index(ts, ts_mod):
    if all([x == 0 for x in ts_mod]):
        return 0
    else:
        result = 10
        for i in range(len(ts_mod)):
            if ts_mod[i] == 0:
                pass
            else:
                if result > ts_mod[i]:
                    result = ts_mod[i]
        return ts_mod.index(result)

min_ind = find_index(ts, ts_mod)

last_ts = ts[min_ind]

del ts_mod[min_ind]
del ts[min_ind]


result = 0
for i in range(len(ts_mod)):
    if ts[i] % 10 == 0:
        result += ts[i]
    else:
        result += ts[i] + ( 10 - ts[i] % 10 )
        
result += last_ts
print(result)

Submission status: Accepted

Solution code:
import itertools

def calc_time(current_time):

    if current_time % 10 == 0:
        return current_time
    else:
        fraction = current_time % 10
        current_time += 10 -fraction
        return current_time


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

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

permutation_list = list(itertools.permutations(time_list))

current_time = 0
results = []

for times in permutation_list:
    for index, time in enumerate(times):
        current_time += time
        if index < 4:
            current_time = calc_time(current_time)
    results.append(current_time)
    current_time = 0
print(min(results))

Submission status: Accepted

Solution code:
import sys
menu = []
for i in range(5):
  menu.append(int(input()))
maxtmp = 0
for i in range(5):
  tmp = 10 - (menu[i] % 10) if menu[i] % 10 else 0
  menu[i] += tmp
  if (maxtmp < tmp):
    maxtmp = tmp
print(sum(menu) - maxtmp)

Submission status: Accepted

Solution code:
import math

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

mods = [i % 10 for i in times]
index = 0
mod = 10
all_time = 0

if sum(mods) == 0:
    for time in times:
        all_time += time
else:
    for i in range(5):
        if mods[i] <= mod and mods[i] != 0:
            index = i
            mod = mods[i]
    all_time = 0
    for i in range(5):
        if i == index:
            all_time += times[i]
        else:
            all_time += math.ceil(times[i]/10.0) * 10

print(all_time)

Submission status: Accepted

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

def ceil(v):
    """1桁目を強制切り上げ"""
    if v%10==0:
        return v
    else:
        return v - v%10 + 10

#最大値
min_time = sum(ceil(a) for a in dish)

import itertools

for a,b,c,d,e in list(itertools.permutations(dish)):
    time = ceil(a)
    time = ceil(time+b)
    time = ceil(time+c)
    time = ceil(time+d)
    time += e
    if time < min_time:
        min_time=time
print(min_time)

Submission status: Accepted

Solution code:
aryTime = []
aryModTime = []
allTime = 0
for i in range(5):
  aryTime.append(int(input()))
  aryModTime.append(aryTime[i] % 10)
  allTime += (int(aryTime[i] / 10) * 10)
  #print(str(aryTime[i]) + "," + str(allTime))
  
flgMinCheck = False
aryModTime.sort()
for j in range(len(aryModTime)):
  if aryModTime[j] == 0:
    pass
  elif aryModTime[j] > 0 and flgMinCheck == False:
    allTime += aryModTime[j]
    flgMinCheck = True
  else:
    allTime += 10
  #print(str(aryModTime[j]) + "," + str(allTime))


print(allTime)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a, b, c, d, e]

l1 = [i % 10 for i in li]
min_idx = -1
for i in range(len(l1)):
    if min_idx == -1 or l1[i] != 0 and l1[i] < l1[min_idx]:
        min_idx = i
last = li.pop(min_idx)

output = 0
for x in li:
    if x % 10 != 0:
        x = x - (x % 10) + 10
    output += x
print(output + last)

Submission status: Accepted

Solution code:
from  itertools import permutations
wait_time = [int(input()) for i in range(5)]
wait_time_p = list(permutations(wait_time))
min_total=643
for time_list in wait_time_p:
    total = 0
    for i in range(len(time_list)):
        total += time_list[i]
        if i == 4:
          break
        mod10 = total % 10
        if mod10 != 0:
            total += (10 - mod10)
    if total <= min_total:
        min_total = total
print(min_total)

Submission status: Accepted

Solution code:
A = []
B = []
for i in range(5):
    x = input()
    if int(x[-1]) != 0:
        A.append(10 - int(x[-1]))
    B.append(int(x))

if A == []:
    print(sum(A) + sum(B))
else:
    print(sum(A) + sum(B) - max(A))

Submission status: Accepted

Solution code:
# coding: utf-8

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

min_loss = 10
min_dish = dishes[0]
cooking_time = []
for d in dishes:
    loss = 0 if d % 10 == 0 else d % 10
    if loss != 0 and min_loss > loss:
        min_loss = loss
        min_dish = d
dishes.remove(min_dish)
for d in dishes:
    loss = 0 if d % 10 == 0 else 10 - d % 10
    cooking_time.append(d + loss)
print(sum(cooking_time) + min_dish)

Submission status: Accepted

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

time = 0
minMod = 10
for i in range(5):
    mod = a[i] % 10
    if(mod == 0):
        time += a[i]
    else:
        time += (1 + a[i] // 10) * 10
        if (mod < minMod):
            minMod = mod

print(time-10+minMod)

Submission status: Accepted

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

last = 10

idx = 0

for i in range(5):
    if c[i] % 10 ==  0:
        continue
    else:
        if last > c[i] % 10:
            last = c[i] % 10
            idx = i
    
ans = 0


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


print(ans)

Submission status: Accepted

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

from math import ceil
times = []
times.append(int(input()))
times.append(int(input()))
times.append(int(input()))
times.append(int(input()))
times.append(int(input()))


just_times = [time for time in times if time%10==0]
other_times = [time for time in times if time%10!=0]
other_times = sorted(other_times, key=lambda time: time%10)

answers = []
if len(other_times) >= 1:
    answers += [other_times[0]]
if len(other_times) > 1:
    answers += [(ceil(time/10))*10 for time in other_times[1:]]
answers += just_times
print(sum(answers))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
l = []

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

ll = []
min = 10
index = 0
lll = []
for i in range(5):
    ll.append(int(l[i]*0.1)*10)
    ll[i] = l[i]-ll[i]
    if ll[i] > 0:
        lll.append(l[i]-ll[i]+10)
        if min > ll[i]:
            min = ll[i]
            index = i
    else:
        lll.append(l[i])
    
sum = 0
for i in range(5):
    if i != index:
        sum = sum + lll[i]
    else:
        sum = sum + l[i]

print(sum)

Submission status: Accepted

Solution code:
cT = [] * 5 
kiriage = [] * 5 
shimo1 = [] * 5 
import math
for i in range(5):
    cT.append(int(input()))
for i in range(5):
    kiriage.append(math.floor((cT[i] + 10 - 1)/10) * 10)
for i in range(5):
    shimo1.append(cT[i] % 10)
timeCount = 0
minshimo1 = 10
for i in range(5):
    if shimo1[i] == 0:
        timeCount += cT[i]
    else:
        timeCount += kiriage[i]
        if shimo1[i] < minshimo1:
            minshimo1 = shimo1[i]
if minshimo1 != 10:
    timeCount -= (10 - minshimo1)
print(timeCount)

Submission status: Accepted

Solution code:
timelist = []

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

min_order = 10**9
for a in range(5):
    for b in range(5):
        if a == b:
            continue
        for c in range(5):
            if a == c or b == c:
                continue
            for d in range(5):
                if a == d or b == d or c == d:
                    continue
                for e in range(5):
                    if a == e or b == e or c == e or d == e:
                        continue
                    m = timelist[a]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[b]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[c]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[d]
                    mul = 10 - m%10 if m%10>0 else 0
                    m += mul + timelist[e]
                    min_order = min(min_order, m)
print(min_order)

Submission status: Accepted

Solution code:
s = []
for i in range(5):
    s.append(int(input()))
s1 = [str(e)[-1] for e in s]
s2 = [int(e) if e != '0' else 10 for e in s1]
time_min = s2.index(min(s2))
s_min = s.pop(time_min)
s3 = [-(-e//10)*10 for e in s]
result = sum(s3) + s_min
print(result)

Submission status: Accepted

Solution code:
ans = 0
l = [10]
for i in range(5):
    x = int(input())
    ans += x
    if x%10!=0:
        ans += 10-x%10
    if x%10 != 0:
        l.append(x%10)
l.sort()
ans -= 10-l[0]
print(ans)

Submission status: Accepted

Solution code:
t=[]
for i in range(5):
    time=int(input())
    amari=10-time%10
    amari=0 if amari==10 else amari
    t.append((amari,time))

t.sort()
ans=0
for i in range(5):
    if i<4:
        ttt=t[i][0]+t[i][1]
    else:
        ttt=t[i][1]
    ans+=ttt
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a % 10 == 0:
  aa = 0 
else:
  aa = 10 - a % 10
  
if b % 10 == 0:
  bb = 0 
else:
  bb = 10 - b % 10

if c % 10 == 0:
  cc = 0 
else:
  cc = 10 - c % 10
  
if d % 10 == 0:
  dd = 0 
else:
  dd = 10 - d % 10
  
if e % 10 == 0:
  ee = 0 
else:
  ee = 10 - e % 10
l1 = [[a,aa],[b,bb],[c,cc],[d,dd],[e,ee]]
l2 = sorted(l1, key=lambda x:x[1])
time = 0
for i in range(4):
  time += l2[i][0] + l2[i][1]
time += l2[4][0]
print(time)

Submission status: Accepted

Solution code:
arr = []
arr.append(input())
arr.append(input())
arr.append(input())
arr.append(input())
arr.append(input())

min = 0

count = 0

num = 0
num_val = 9
for i in range(5):
    if int(arr[i]) % 10 < num_val and int(arr[i]) % 10 != 0:
        num = i
        num_val = int(arr[i]) % 10


list = []

for i in range(5):
    if i != num:
        list.append(arr[i])
list.append(arr[num])


for i in range(5):
    count += int(list[i])
    if i == 4:
        pass
    else:
        if int(list[i]) % 10 == 0:
            pass
        else:
            count += 10 - (int(list[i])%10)

print(count)

Submission status: Accepted

Solution code:
from sys import stdin

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

cnt = 0
index = 0

max_i = 0
max_d = 0

for i in range(5):
    if (10 - (data[i] % 10)) % 10 > max_d:
        max_i = i
        max_d = (10 - (data[i] % 10)) % 10

data[max_i], data[4] = data[4], data[max_i]

while True:
    if cnt % 10 == 0:
        cnt += data[index]
        if index == 4:
            break
        index += 1
    else:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
from math import ceil
minutes = [int(input()) for _ in range(5)]

arr = [(x, x%10) for x in minutes if x%10 != 0]
if arr:
    x = min(arr, key=lambda x: x[1])
    minutes.remove(x[0])
    print(sum([ceil(x/10)*10 for x in minutes])+x[0])
else:
    print(sum(minutes))

Submission status: Accepted

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

dishes.sort(key=lambda x: x % 10)

flag = True
sum_dish = 0

for dish in dishes:
    if dish % 10 == 0:
        sum_dish += dish
    elif flag:
        sum_dish += dish
        flag = False
    else:
        sum_dish += dish + (10 - dish % 10)

print(sum_dish)

Submission status: Accepted

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

l = []
ans = 0
for t in [a,b,c,d,e]:
  if t%10 == 0:
    ans += t
  else:
    l.append(t)

if len(l) < 1:
  print(ans)
elif len(l) == 1:
  print(ans + l[0])
else:
  l = sorted(l, key=lambda x: x%10, reverse=True)

  def tyumon(t, ans):
    ans += t
    if ans % 10 == 0:
      return ans
    else:
      return (ans//10 + 1)*10

  for i in range(len(l)-1):
    ans = tyumon(l[i], ans)
  print(ans + l[-1])

Submission status: Accepted

Solution code:
import math

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

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)

flag = 0
for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m
        flag = 1

if flag ==0:
    index = 0

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)

Submission status: Accepted

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

s1 = a+b+c+d+e
st = []
st += [(10-a)%10,(10-b)%10,(10-c)%10,(10-d)%10,(10-e)%10]
s2 = sum(st) - max(st)
print(s1+s2)