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:
li = list()
li2 = list()
for _ in range(5):
    tmp = int(input())
    if(tmp % 10 == 0):
        li2.append(tmp)
    else:
        li.append(tmp)
li.sort(key=lambda x: x % 10, reverse=True)
li2.sort()
ans = sum(li2)
if(len(li)!=0):
    for i in range(len(li)-1):
        ans = ans + ((li[i] // 10 + 1) * 10)
    ans += li[-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t = []
for i in range(5):
  t.append(int(input()))
total = 0
#add the x%10==0s first
#let the last one be x%10 is minimum but not 0
#How am I suppose to compare infinite numbers in pyhton like in c?

last = 256

for x in t:
  if x%10 ==0:
    total+=x
    t.pop(t.index(x))
  elif last>200 or x%10<last%10:
    last = x
if last < 200:
  t.pop(t.index(last))
  t.append(last)
for i in range(len(t)):
  temp = total
  if i==0:
    total+=t[i]
  else:
    if t[i-1]%10 == 0:
      total += t[i]
    else:
      total += t[i] + (10 - t[i-1]%10)
print(total)

Submission status: Accepted

Solution code:
X = [int(input()) for _ in range(5)]
Y = [-(-a//10)*10 for a in X]
Z = [Y[i]-X[i] for i in range(5)]
print(sum(Y) - max(Z))

Submission status: Accepted

Solution code:
x=[]
y=[]
count=10
a=0
for i in range(5):
    x.append(int(input()))
for k in range(5):
    y.append(x[k])
for j in range(5):
    y[j]=y[j]%10
#print(y)
for m in range(5):
    if y[m]!=0:
        if count>y[m]:
            count=y[m]
            a=m
#print(a)
for w in range(5):
    if y[w]==0 or w==a:
        continue
    x[w]+=10-y[w]
print(sum(x))

Submission status: Accepted

Solution code:
from math import ceil
wg = [int(input()) for _ in range(5)]
wg.sort(key=lambda x: -x % 10)
wait = 0
for w in wg[:-1]:
    wait += ceil(w / 10) * 10
print(wait + wg[-1])

Submission status: Accepted

Solution code:
def main():
    array = [int(input()) for _ in range(5)]

    min_ones_place = 10
    for i in range(5):
        ones_place = array[i]%10
        temp = 10 - ones_place
        if temp ==10:
            continue
        array[i] += temp
        min_ones_place = min(min_ones_place, ones_place)
    print(sum(array)-(10-min_ones_place))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#coding: utf-8
A = []
B = []
for i in range(5):
    A.append(int(input()))
    B.append((10 - A[-1] % 10)%10)
B.sort()
print(sum(A) + sum(B[:-1]))

Submission status: Accepted

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

time = 0
result = 0

for food in foods:
  if food % 10 == 0:
    result += food
  else:
    result += (food // 10 + 1) * 10
    if (10 - (food % 10)) > time:
      time = 10 - food % 10

print(result - time)

Submission status: Accepted

Solution code:
from itertools import permutations
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

min_time = float('inf')
for combo in permutations([a,b,c,d,e], r=5):
    t = 0
    for val in combo:
        if t % 10 != 0:
            t = ((t // 10)+1)*10
        t+=val
    if t < min_time:
        min_time = t
print(min_time)

Submission status: Accepted

Solution code:
from sys import stdin

li = [int(stdin.readline().rstrip()) for _ in range(5)]
lin = []

for i in range(5):
    amari = li[i]%10
    if amari == 0:
        amari = 10
    lin.append(amari)

sai = lin.index(min(lin))
point = 0
for i in range(5):
    if i == sai:
        point += li[i]
    else:
        if lin[i] == 10:
            point += li[i]
        else:
            point += li[i] + (10-lin[i])
print(point)

Submission status: Accepted

Solution code:
import numpy as np
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

time_array = np.array([A, B, C, D, E])
ten_array = np.ceil(time_array / 10)

tentimes_array = ten_array * 10
sum_time = int(sum(tentimes_array)) 
dif_array = tentimes_array - time_array
max_dif = int(max(dif_array))

print(sum_time - max_dif)

Submission status: Accepted

Solution code:
import math
t = []
for i in range(5):
  t.append(int(input()))
ct = [math.ceil(x/10)*10 for x in t]
fraction = [x%10 for x in t]
fraction = list(filter(lambda x: x > 0, fraction))
if len(fraction) > 0:
  min_fraction = min(fraction)
else:
  min_fraction = 10
print(sum(ct) - 10 + min_fraction)

Submission status: Accepted

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

ans = float('inf')

for i in range(5):
	cur = 0
	for j in range(5):
		if i == j: continue
		cur += A[j]
		cur = (cur + 9) // 10 * 10
	cur += A[i]
	
	ans = min(ans, cur)

print(ans)

Submission status: Accepted

Solution code:
import math
list_str = []
list1 = []
for i in range(5):
	a = input()
	list_str.append(list(a))
	list1.append(int(a))


abs_max = 10
count = 0
for i in range(5):
	if int(list_str[i][-1]) != 0 and int(list_str[i][-1]) < abs_max:
		abs_max = int(list_str[i][-1])
for i in range(5):
	count += math.ceil(list1[i]/10)

if abs_max == 10:
	print(int(count*10))
else:
	print(int(count*10)-10+abs_max)

Submission status: Accepted

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

for i in range(5):
    if time[i] % 10 == 0:
        time[i] = 0
    else:
        time[i] = abs((time[i] % 10) - 10)

time_m = max(time)
print(a + b + c + d + e + sum(time) - time_m)

Submission status: Accepted

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

def main():
    A = []
    for _ in range(5):
        A.append(int(input()))



    ans = 0
    mi = float("inf")

    for a in A:
        if a % 10 != 0:
            mi = min(mi, a % 10)
        ans += (-(-a // 10)) * 10

    if mi == float("inf"):
        print(ans)
        exit()
    print(ans - (10 - mi))



if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    ans = 0
    mi = float("inf")

    if A % 10 != 0:
        mi = min(mi, A % 10)
    if B % 10 != 0:
        mi = min(mi, B % 10)
    if C % 10 != 0:
        mi = min(mi, C % 10)
    if D % 10 != 0:
        mi = min(mi, D % 10)
    if E % 10 != 0:
        mi = min(mi, E % 10)


    ans += (-(-A // 10)) * 10
    ans += (-(-B // 10)) * 10
    ans += (-(-C // 10)) * 10
    ans += (-(-D // 10)) * 10
    ans += (-(-E // 10)) * 10

    if mi == float("inf"):
        print(ans)
        exit()
    print(ans - (10 - mi))



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
meals = []
a = 0

for i in range(5) :
    meal = int(input())
    if meal % 10 == 0 :
        meals.append(meal)
    else :
        if 10 - (meal % 10) > a :
            a = 10 - (meal % 10)
        meals.append(meal + 10 - (meal % 10))

print(sum(meals) - a)

Submission status: Accepted

Solution code:
l=[]
total=0
a=0
for i in range(5):
    t=int(input())
    if t%10 == 0:
        total +=t
    else:    
        total +=(t//10+1)*10
        a=max(a,10-(t%10))
print(total-a)

Submission status: Accepted

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

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

b = [-(-x // 10) * 10 for x in a]

import numpy as np

aa = np.array(a)
bb = np.array(b)

c = max(bb - aa)

print(sum(bb) - c)

Submission status: Accepted

Solution code:
dishes = [int(input()) for i in range(5)]
print(sum(map(lambda x : ((x//10)+1)*10 if x%10!=0 else x ,dishes)) - (10-min(map(lambda x:x%10 if x%10!=0 else 10, dishes))))

Submission status: Accepted

Solution code:
import math
l = [int(input()) for _ in range(5)]
s = [math.ceil(i/10)*10-i for i in l]
print(sum(l)+sum(s)-max(s))

Submission status: Accepted

Solution code:
import math
L = [input() for _ in range(5)]
lm = int(L[0][-1])
v = int(L[0])
for l in L:
  if int(l[-1])<lm and l[-1]!='0':
    lm = int(l[-1])
    v = int(l)
t = 0
L.remove(str(v))
for l in L:
  t += math.ceil(int(l)/10)*10
print(t + v)

Submission status: Accepted

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

Submission status: Accepted

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

X=[A,B,C,D,E]
ans=0

Y=10

for i in range(len(X)):
    if X[i]%10 == 0:
        ans+=X[i]
    else:
        Y=min(Y,X[i]%10)
        ans+=(X[i]//10)*10+10

ans +=-10+Y
print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
from math import ceil
tmp1 = [A,B,C,D,E]
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(0)
    else:
        tmp2.append(10 - tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(sum(tmp1)-max(tmp2))

Submission status: Accepted

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

Submission status: Accepted

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

t = 0
ord = 0
loss = []
for i in range(5):
	t2 = 0
	while t2 < tm[i]:
		t2 += 10
	t += t2
	loss.append(t2 - tm[i])

print(t-max(loss))

Submission status: Accepted

Solution code:
K = [str(input()) for _ in range(5)]

L = []

for k in K:
    if int(k[-1]) == 0:
        pass
    else:
        L.append(int(k[-1]))

K_int = [int(k) for k in K]

if len(L) == 0:
    ans = sum(K_int)
else:
    ans = sum(K_int) + len(L)*10 -sum(L) - (10 - min(L))

print(ans)

Submission status: Accepted

Solution code:
lst = [int(input()) for _ in range(5)]
tmp = [(l+9)%10 for l in lst]
last_index = tmp.index(min(tmp))
ans = 0
for i, l in enumerate(lst):
    if (i == last_index):
        ans += l
    else:
        ans += ((l+9)//10)*10
print(ans)

Submission status: Accepted

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

import math
p = [a, b, c, d, e]
pa = []
for i in range(len(p)):
    if p[i]%10 == 0:
        pa.append(0)
    else:
        pa.append(10 - p[i]%10)

ans = 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 - max(pa)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import math
def main():
    times = [input() for i in range(5)]

    # 1の位最小のものを求める
    mini_one = 10
    mini_one_index = 0
    for i, time in enumerate(times):
        one = int(time[len(time)-1])
        if mini_one > one and one > 0:
            mini_one = one
            mini_one_index = i

    all_time = 0
    for i, time in enumerate(times):
        if i == mini_one_index:
            all_time += int(time)
        else:
            one = int(time[len(time)-1])
            if one == 0:
                all_time += int(time)
            else:
                ten_time = (math.floor(int(time) / 10)+1) * 10
                all_time += ten_time

    print(all_time)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
inp = []
tmp = 10
ans = 0
temp = 0
for _ in range(5):
    inp.append(input())
for i in range(5):
    if tmp > int(inp[i][-1]) and int(inp[i][-1]) != 0:
        tmp = int(inp[i][-1])
        temp = i
last = inp.pop(temp)
for j in inp:
    if j[-1] == "0":
        ans += int(j)
    else:
        ans += int(j[:-1]+ "0") + 10
ans += int(last)
print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
min = 9
min_index = 0
sum = 0
for i in range(len(l)):
    if l[i] % 10 != 0 and l[i] % 10 < min:
        min = l[i] % 10
        min_index = i
for i in range(len(l)):
    if i != min_index:
        sum += (l[i] + 9) // 10 * 10
sum += l[min_index]
print(sum)

Submission status: Accepted

Solution code:
line = []
for i in range(5):
    line.append(int(input()))
line10 = list(map(lambda x: x % 10, line))
pittari = []
for i in range(5):
    if line10[i] == 0:
        pittari.append(i)
if len(pittari) == 5:
    print(sum(line))
else:
    imy = []
    for i in range(5):
        if not(i in pittari):
            imy.append(i)
    imylist = []
    for i in imy:
        imylist.append(line10[i])
    last = line10.index(min(imylist))
    sum = 0
    for i in range(5):
        if i != last and not(i in pittari):
            line[i] = line[i] - line10[i] + 10
            sum += line[i]
    for i in pittari:
        sum += line[i]
    print(line[last] +  sum)

Submission status: Accepted

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

LL = {}

for i in range(len(L)):
	I = str((L[i]-1))[-1]
	I = int(I)
	LL[i] = I

key = [k for k,v in LL.items() if v == min(LL.values())][0]

min = L[key]
L[key] = 0

for i in range(0,5):
	digit_one = str(L[i])[-1]
	if digit_one != "0":
		L[i] += 10 - int(digit_one)
	
print(sum(L) + min)

Submission status: Accepted

Solution code:
import math

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

a = math.ceil(A/10) * 10 - A
b = math.ceil(B/10) * 10 - B
c = math.ceil(C/10) * 10 - C
d = math.ceil(D/10) * 10 - D
e = math.ceil(E/10) * 10 - E

time = 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 - max(a,b,c,d,e)
print(time)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
ans,mgn = 0,0
for i in range(5):
    if(a[i]%10 == 0):
        ans += a[i]
    else:
        ans += int(a[i]//10+1)*10
        mgn = max(mgn, 10-(a[i]%10))
print(ans-mgn)

Submission status: Accepted

Solution code:
import math
cnt=0
fir=10
for i in range(5):
	a=int(input())
	b=(math.ceil(a/10))*10
	cnt += b
	if int(str(a)[-1]) != 0 and fir > int(str(a)[-1]):
		fir = int(str(a)[-1])
print(cnt+(fir-10) if fir != 0 else cnt)

Submission status: Accepted

Solution code:
a,b,c,d,e = [int(input()) for i in range(5)]
x = [a,b,c,d,e]
y = [0]*5
for i in range(5):
    if x[i]%10==0:
        y[i]=0
    else:
        y[i]=10-x[i]%10
print(a+b+c+d+e+sum(y)-max(y))

Submission status: Accepted

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

print(sum(A)+sum(B)-max(B))

Submission status: Accepted

Solution code:
import math
ls = [int(input()) for _ in range(5)]
ans = 0
num = []

for i in ls:
    ans += math.ceil(i/10)*10
    if str(i)[-1] != '0':
        num.append(str(i)[-1])

if num:
    print(ans-10+min([int(i) for i in num]))
else:
    print(ans)

Submission status: Accepted

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

cnt = 10
m = 0
for i in range(5):
    if dish[i] % 10 != 0 and dish[i] % 10 < cnt:
        cnt = dish[i] % 10
        m = i

ans = dish.pop(m)
for d in dish:
    if d % 10 == 0:
        ans += d
    else:
        ans += 10 * (d//10+1)

print(ans)

Submission status: Accepted

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


aa=a%10
bb=b%10
cc=c%10
dd=d%10
ee=e%10

temp=min(aa,bb,cc,dd,ee)

if aa!=0:
	aaa=(a//10)*10+10
else:
	aaa=a

if bb!=0:
	bbb=(b//10)*10+10
else:
	bbb=b
	
if cc!=0:
	ccc=(c//10)*10+10
else:
	ccc=c
	
if dd!=0:
	ddd=(d//10)*10+10
else:
	ddd=d
	
if ee!=0:
	eee=(e//10)*10+10
else:
	eee=e
	
a1=a+bbb+ccc+ddd+eee
a2=aaa+b+ccc+ddd+eee
a3=aaa+bbb+c+ddd+eee
a4=aaa+bbb+ccc+d+eee
a5=aaa+bbb+ccc+ddd+e

ans=min(a1,a2,a3,a4,a5)

print(ans)

Submission status: Accepted

Solution code:
import math
l = [int(input())for _ in range(5)]
lm = []
for i in l:
    if i%10==0:
        lm.append(0)
    else:
        lm.append(10-i%10)
print(sum([10*math.ceil(i/10)for i in l])-max(lm))

Submission status: Accepted

Solution code:
import math
m1=[int(input()) for _ in range(5)]
m2=[math.ceil(x/10)*10 for x in m1]
slack=max([x-y for x,y in zip(m2,m1)])
print(sum(m2)-slack)

Submission status: Accepted

Solution code:
D = [int(input()) for _ in range(5)]
d = [(10-i%10)%10 for i in D]
s = 0
for i in range(5):
    s += D[i]+d[i]
print(s-max(d))

Submission status: Accepted

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

x_1 = [int(i / 10) for i in x]
x_2 = [(i % 10) for i in x]

ans = sum(x_1)*10 

for i in range(x_2.count(0)):
    x_2.remove(0)

if(x_2 != []):
    ans += min(x_2)
    ans += (len(x_2)-1)*10

print(ans)

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 = [l // 10 * 10 if l % 10 == 0 else (l // 10 + 1) * 10 for l in L]
N = [l % 10 for l in L]
N = [n if n != 0 else 10 for n in N]

zipped = zip(L, M, N)
zipped = sorted(zipped, key=lambda x: [x[2]], reverse=False)
L, M, N   = map(list, zip(*zipped))

print(L[0] + sum(M[1:]))

Submission status: Accepted

Solution code:
import math
S = [int(input()) for _ in range(5)]
ans=0
mini=10
for i in S:
    ans+=math.ceil(i/10)*10
    b = i % 10
    if b== 0:
      b=10
    mini=min(b,mini)

if mini == 10:
  print(ans)
else:
  print(ans-(10-mini))

Submission status: Accepted

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



menu_time = 0
apart_time = 0
total_time = 0
max_apart_time = 0
for i in range(5):
    menu_time = list[i]
    apart_time =  0 if menu_time % 10 == 0 else \
        (menu_time // 10 + 1) * 10 - menu_time
    total_time += menu_time + apart_time
    if apart_time > max_apart_time:
        max_apart_time = apart_time

total_time -= max_apart_time

print(total_time)

Submission status: Accepted

Solution code:
x = [input() for _ in range(5)]
ans = []
for i in range(5):
    if x[i][-1] == "0":
        ans.append(int(x[i]))
for j in range(9,0,-1):
    for i in range(5):
        if int(x[i][-1]) == j:
            if len(ans) != 4:
                for k in range(1,10):
                    if (int(x[i]) + k )% 10 == 0:
                        ans.append(int(x[i]) + k)
            else:
                ans.append(int(x[i]))

print(sum(ans))

Submission status: Accepted

Solution code:
from math import ceil

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

min_a = max(a)
index_min = 4
for i in range(5):
    if a[i] % 10 == 0:
        continue
    elif min_a > a[i] % 10:
        min_a = a[i] % 10
        index_min = i

ans = 0
for i in range(5):
    if i == index_min:
        continue
    ans += ceil(a[i]/10) * 10

ans += a[index_min]
print(ans)

Submission status: Accepted

Solution code:
import itertools

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

def round_up_10(x):
    if x%10 == 0:
        return x
    else:
        return x - (x%10) + 10

# 総当り
ans = float("inf")
order = list(itertools.permutations(ABCDE))

for o in order:
    current_time = 0
    for i in range(5):
        current_time += o[i]
        if i == 4:
            break
        current_time = round_up_10(current_time)
    ans = min(ans, current_time)
    
print(ans)

Submission status: Accepted

Solution code:
T=[]
for _ in range(5):
    T.append(int(input()))
ans=sum([(t//10)*10 for t in T])
U=[t%10 for t in T]
U.sort()
if U[4]==0:
    pass
elif U[3]==0:
    ans+=U[4]
elif U[2]==0:
    ans+=10+U[3]
elif U[1]==0:
    ans+=20+U[2]
elif U[0]==0:
    ans+=30+U[1]
else:
    ans+=40+U[0]
print(ans)

Submission status: Accepted

Solution code:
from math import ceil
A= [int(input()) for _ in range(5)]
rA = list(map(lambda x:x%10, A))
res = float('inf')
idx = 0
for i, r in enumerate(rA):
    if res>r>0:
        idx = i
        res = r
ans = A.pop(idx)
tA = [ceil(A[i]/10)*10 for i in range(len(A))]
print(sum(tA)+ans)

Submission status: Accepted

Solution code:
#ABC12３B
import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
lastOrder = min((A-0.5)%10,(B-0.5)%10,(C-0.5)%10,(D-0.5)%10,(E-0.5)%10)
print(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 - 10 + int(lastOrder) + 1)

Submission status: Accepted

Solution code:
L = [int(input()) for _ in range(5)]
t = 0
L2 = []
for i in range(5):
  if L[i]%10 == 0:
    t += L[i]
  else:
    L2.append(L[i])
if L2 == []:
  print(t)
  exit()
min = L2[0]
for k in range(1,len(L2)):
  if min%10 > L2[k]%10:
    t += min//10*10 + 10
    min = L2[k]
  else:
    t += L2[k]//10*10 + 10
print(t+min)

Submission status: Accepted

Solution code:
#2019/10/04
time = list(map(int, open(0).read().split()))
# print(time)

time_residual = [i%10 for i in time]
# print(time_residual)

time_residual_notZero = [i for i in time_residual if i%10 != 0 ]
# print(time_residual_notZero)

if(time_residual_notZero != []):
    ans = sum([-(-i//10)*10 for i in time]) + min(time_residual_notZero) - 10
else:
    ans = sum(time)
print(ans)

Submission status: Accepted

Solution code:
A=[int(input()) for _ in [0]*5]
B=[-(-a//10)*10-a for a in A]
print(sum(B)+sum(A)-max(B))

Submission status: Accepted

Solution code:
import sys
lst=[]
ans=0
for i in range(5):
  a=int(input())
  if a%10==0:
    ans+=a
  else:
    lst.append(a)
if len(lst)!=0:
  C=[[] for _ in range(len(lst))]   
  for i in range(len(lst)):
    v=lst[i]
    c=v%10
    C[i]=[-c,v]
  C=sorted(C)
  for i in range(len(lst)-1):
    v=C[i][1]
    c=-C[i][0]
    ans+=(v+(10-c))
  print(ans+C[-1][1])
else:
  print(ans)

Submission status: Accepted

Solution code:
lis = [int(input()) for _ in range(5)]
lis1 = [lis[i]%10 for i in range(5)]
lis10 = [lis[i]//10 for i in range(5)]
ans = 0
for i in range(5):
    if lis1[i]:
        ans += 10
    if not lis1[i]:
        lis1[i] = 10
minlis1 = min(lis1)
ans += sum(lis10)*10
ans += minlis1-10

print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in [0]*5]
B = [-(-a//10)*10 - a for a in A]
print(sum(B) + sum(A) - max(B))

Submission status: Accepted

Solution code:
time = []
total = 0
for _ in range(5):
    t = int(input())
    if t % 10 == 0:
        total += t
    else:
        total += (t//10+1)*10
        time.append(t)
if time:
    last = min(time, key=lambda x: int(str(x)[-1]))
    print(total - 10+last%10)
else:
    print(total)

Submission status: Accepted

Solution code:
dishes = []
zero = []

for i in range(5):
    x = int(input())
    if int(str(x)[-1]) != 0:
        dishes.append(x)

    else:
        zero.append(x)

dishes = sorted(dishes, key=lambda x: str(x)[-1])
dishes.reverse()

dishes = zero + dishes

ans = 0
for i in range(len(dishes)):
    if i == len(dishes)-1:
        ans += dishes[i]
    else:
        sa = 10 - int(str(dishes[i])[-1])
        if sa == 10:
            ans += dishes[i]
        else:
            ans += dishes[i] + sa

print(ans)

Submission status: Accepted

Solution code:
menu = [int(input()) for _ in range(5)]
x = sorted(list(map(lambda x: 10 - x % 10, [i for i in menu if i % 10 != 0])))
tot = sum(menu) + sum(x[:-1])
print(tot)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
b = [(i//10 + 1) * 10 if i % 10 != 0 else i for i in a]
c = [j-i for i, j in zip(a,b)]
print(sum(b)-max(c))

Submission status: Accepted

Solution code:
times = [int(input()), int(input()), int(input()), int(input()), int(input())]
mods = [10-time%10 if time%10 != 0 else 0 for time in times]
print(sum(times) + sum(mods) - max(mods))

Submission status: Accepted

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

ac = math.ceil(a / 10) * 10
bc = math.ceil(b / 10) * 10
cc = math.ceil(c / 10) * 10
dc = math.ceil(d / 10) * 10
ec = math.ceil(e / 10) * 10

max_diff = max((ac - a, bc - b, cc - c, dc - d, ec - e))
print(ac + bc + cc + dc + ec - max_diff)

Submission status: Accepted

Solution code:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    times = []
    ans = 0
    for _ in range(5):
        time = int(input())
        if time % 10 == 0:
            ans += time
        else:
            times.append(time)
    if len(times)==0:
        print(ans)
        return 0

    times.sort(key=lambda x: x%10,reverse=True)
    ans += times[-1]
    times = times[:-1]
    if len(times)==0:
        print(ans)
        return 0

    for time in times:
        ans += 10*(time//10+1)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
L = [int(input()) for _ in range(5)]
Lm = []
for i in L:
    if i%10 == 0:
        Lm.append(0)
    else:
        Lm.append(10-i%10)
print(sum([10*math.ceil(i/10) for i in L])-max(Lm))

Submission status: Accepted

Solution code:
ls=[0,0,0,0,0]
for i in range(5):
  ls[i]=int(input())
ls2=sorted(ls, key=lambda x: (x-1)%10)
ls3=[((e-1)//10+1)*10 for e in ls2]
print(ls2[0]+ls3[1]+ls3[2]+ls3[3]+ls3[4])

Submission status: Accepted

Solution code:
n=[int(input()) for i in range(5)]
s=[0,0,0,0,0]
for i in range(5):
    if n[i]%10==0:
        s[i]=0
    else:
        s[i]=10-n[i]%10
#print(s)
a=s.index(max(s))
#print(a)
b=0
for i in range(5):
    if i!=a:
        b+=n[i]+s[i]
    else:
        b+=n[i]
print(b)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = [A, B, C, D, E]
a.sort(key=lambda x: (x+9) % 10, reverse=True)
print(sum((i + 9) // 10 * 10 for i in a[:4]) + a[4])

Submission status: Accepted

Solution code:
a_list = []
temp_min = 10
temp_sum = 0
[a_list.append(int(input())) for i in range(5)]
for i in a_list:
    if i%10 != 0:
        temp_min = min(i%10,temp_min)
        temp_sum += 10 - i%10
print(sum(a_list)+temp_sum - 10 + temp_min)

Submission status: Accepted

Solution code:
n = [input() for i in range(5)]
flag = 1
ans = 0
l = []
while flag:
    flag = 0
    for i in range(len(n)-1,0,-1):
        if n[i][-1] < n[i-1][-1]:
            n[i],n[i-1] = n[i-1],n[i]
            flag = 1
for i in range(len(n)):
    if n[i][-1] != '0':
        n[i] = int(n[i])
        l = n.pop(i)
        break
for i in range(len(n)):
    n[i] = int(n[i])
for i in range(len(n)):
    while n[i]%10 != 0:
        n[i] += 1
    ans += n[i]
if l:
    ans += l
print(ans)

Submission status: Accepted

Solution code:
n = [int(input()) for _ in range(5)]
first_digit = []
for num in n:
    z = int(str(num)[-1])
    if z > 0:
        first_digit.append(z)


# print(first_digit)
t = 0
for i in range(len(n)):
    t += -(-n[i] // 10) * 10
if len(first_digit) == 0:
    print(t)
else:
    print(t - (10 - min(first_digit)))

Submission status: Accepted

Solution code:
l = list(map(int, open(0).read().split()))
print(sum([(x+9)//10 for x in l])*10-9+min([(x-1)%10 for x in l]))

Submission status: Accepted

Solution code:
m=[int(input()) for i in range(5)]
k = []
j=[]
for i in range(5):
    j.append(-(-m[i]//10)*10)
    
    
    t=m[i] - (m[i]//10)*10
    if t>0:
        k.append(t)
if len(k)==0:
    print(sum(j))
else:
    print(sum(j)-(10-min(k)))

Submission status: Accepted

Solution code:
def f_b():
    from math import ceil
    *a, = map(int, open(0).read().split())
    a.sort(key=lambda x: (10-x%10)%10)
    print(sum(map(lambda x: ceil(x/10)*10, a[:-1]))+a[-1])

if __name__ == "__main__":
    f_b()

Submission status: Accepted

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

n = 5
s = []
lastS = []
for i in range(n):
    s.append(raw_input())
    lastS.append(int(s[i][-1]))

# 1の位が0でなく最も少ないメニューを探す
min = 9
minMenu = 0
for i in range(n):
    if lastS[i] < min and lastS[i] != 0:
        minMenu = i
        min = lastS[i]

# 時間を計算する
ans = 0
for i in range(n):
    if i != minMenu:
        if lastS[i] != 0:
            ans += (int(s[i]) - lastS[i]) + 10
        else:
            ans += int(s[i])
    else:
        ans += int(s[i])

print ans

Submission status: Accepted

Solution code:
T=[]
t=[]
for i in range(5):
    T.append(int(input()))
    t.append(T[i]%10)
if max(t) == 0 :
    ans = sum(T)
else :
    while 0 in t  :
        t.remove(0)
    ans = sum(T)+10*len(t)-sum(t)-10+min(t)
print(ans)

Submission status: Accepted

Solution code:
import math
ans = 0
min_mod = 10
for i in range(5):
      a = int(input())
      ans += math.ceil(a/10)*10
      if a % 10 != 0:
            min_mod = min(min_mod,a%10)
print(ans + min_mod - 10)

Submission status: Accepted

Solution code:
import math

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

sa = a % 10
if sa == 0:
    sa = 10
sb = b % 10
if sb == 0:
    sb = 10
sc = c % 10
if sc == 0:
    sc = 10
sd = d % 10
if sd == 0:
    sd = 10
se = e % 10
if se == 0:
    se = 10


amari = min(sa,sb,sc,sd,se)


a = math.ceil(a / 10) *10
b = math.ceil(b / 10) *10
c = math.ceil(c / 10) *10
d = math.ceil(d / 10) *10
e = math.ceil(e / 10) *10


if amari == 0:
    print(int(a+b+c+d+e))
else:
    print(int(a+b+c+d+e-10+amari))

Submission status: Accepted

Solution code:
import math
ans = 0
min_mod = 10
for i in range(5):
  a = int(input())
  ans += math.ceil(a/10)*10
  if a % 10 != 0:
    min_mod = min(min_mod, a % 10)
  
print(ans+min_mod-10)