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:
a = [int(input()) for _ in range(5)]
b = [i%10 for i in a]

min_value = b[0]
for i in range(len(a)):
    if min_value == 0 and b[i] != 0:
        min_value == b[i]

    if b[i] != 0 and b[i] < min_value:
        min_value = b[i]

cnt = 0
flag = 0
for i in range(len(a)):
    if b[i] == min_value and flag == 0:
        flag = 1
        cnt += a[i]
    else:
        if b[i] != 0:
            cnt += (a[i] + 10 - b[i])
        else:
            cnt += a[i]

print(cnt)

Submission status: Accepted

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

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

m = 9999
for i in s:
    t = 0
    ss = s[0:]
    ss.remove(i)
    for j in ss:
        t += j if j%10 == 0 else j + 10-j%10
    t += i    
    m = min(m, t) 

print(m)

Submission status: Accepted

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

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

t = 0
ss = []
for i in s:
    if i%10 != 0:
        ss.append(i)
    else:
        t += i

if len(ss) > 0:
    mx = ss[0]
    m1 = ss[0]%10
    for i in ss:
        if i%10 < m1:
            m1 = i%10
            mx = i
    ss.remove(mx)
    for i in range(0,len(ss)):
        t += ss[i] + (10-ss[i]%10)
    t += mx

print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ActualTiming=[]
Timecost=[]
for i in range(5):
	A=int(input())
	ActualTiming.append(A)
for i in range(5):
	X=0
	while X<ActualTiming[i]:
		X=X+10
	Timecost.append(X)
M=max(Timecost[j]-ActualTiming[j] for j in range(5))
print(sum(Timecost)-M)

Submission status: Accepted

Solution code:
mlist = [int(input()) for i in range(5)]
minmin = 10
cnt = 0
for i in mlist:
  if i%10 != 0:
    minmin = min(minmin,i%10)
  else:
    cnt+=1
ans = 0
for i in mlist:
  if i%10 != 0:
    ans += (i//10 +1)*10
  else:
    ans +=i
if cnt <5:
  ans = ans + minmin - 10
else:
  ans = sum(mlist)
print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
ans = 0
m = 0
for a in A:
    tmp = 0
    while (a + tmp) % 10 != 0: tmp += 1
    ans += a + tmp
    if m < tmp: m = tmp
print(ans-m)

Submission status: Accepted

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

#minA = 124
minIdx = 0
minV = 9


for i in range(5):
    temp = A[i] % 10
    if 0 < temp and temp < minV:
        minIdx = i
        minV = temp

ans = 0

for i in range(5):
    if i == minIdx:
        ans += A[i]
    else:
        if A[i] % 10 == 0:
            ans += A[i]
        else:
            ans += A[i] + 10 - (A[i] % 10)

print(ans)

Submission status: Accepted

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

a = [((i - 1) // 10 + 1) * 10 for i in M]
b = [(i - 1) % 10 for i in M]

ans = sum(a) + min(b) - 9
print(ans)

Submission status: Accepted

Solution code:
A=[]
for _ in range(5):
  A.append(int(input()))
  
B=list(map(lambda x:(int((x-1)//10)+1)*10,A))
C=list(map(lambda x:int((x-1)%10),A))

ans=sum(B)+min(C)-9
print(ans)

Submission status: Accepted

Solution code:
A = []
for i in range(5):
  A.append(int(input()))
B = list(map(lambda x : (int((x - 1) // 10) + 1) * 10, A))
C = list(map(lambda x : int((x - 1) % 10), A))
ans = sum(B) - 9 + min(C)
print(ans)

Submission status: Accepted

Solution code:
from itertools import permutations
from math import ceil
    

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

min_time = float('inf')


for order in list(permutations([0,1,2,3,4])):
    total = 0
    for i in range(5):
        total += time_list[order[i]]
        if i!=4:
            total = ceil(total / 10) * 10
    min_time = min(min_time, total)
   
  
print(min_time)

Submission status: Accepted

Solution code:
t = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a, b, c, d, e]
for i in f:
    t += ((i - 1) // 10 + 1) * 10
g = [(f[i] - 1) % 10 + 1 for i in range(5)]
t = t - 10 + min(g)
print(t)

Submission status: Accepted

Solution code:

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

diff = []
result = 0
for i in cooks:
    result += i
    x = 10 - (i % 10)
    if x == 10:
        x = 0

    diff.append(x)

diff.sort()
last = diff.pop()
result += sum(diff)

print(result)

Submission status: Accepted

Solution code:
sum=0
m=10
for i in range(5):
    dish=int(input())
    if dish%10==0:
        sum+=dish
    else:
        sum+=dish+10-dish%10
        m=min(m,dish%10)
    
print(sum-10+m)

Submission status: Accepted

Solution code:

sum=0
m=10
for i in range(5):
  dish=int(input())
  if dish%10==0:
    sum+=dish
  else:
    sum+=dish+10-dish%10
    m=min(m,dish%10)
    
print(sum-10+m)

Submission status: Accepted

Solution code:
def round_up(i):
    if i % 10 == 0:
        return i
    return 10 - i % 10 + i


minutes = [int(input()) for i in range(5)]
m = [round_up(i) for i in minutes]
last = min((minutes[l] - 1) % 10 for l in range(5)) + 1

print(sum(m) + last - 10)

Submission status: Accepted

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

n = 0
m = 10
for idx, i in enumerate(F):
    if i % 10 == 0:
        continue
    if i % 10 < m:
        m = i % 10
        n = idx

T = F[n]
for idx, i in enumerate(F):
    if idx == n:
        continue
    T += (int(i) + 9) // 10 * 10

print(T)

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]
s=sum(l)
ll=[10-a%10,10-b%10,10-c%10,10-d%10,10-e%10]
for i in range(5):
        if ll[i]==10:
                ll[i]=0
ll.sort()

print(s+sum(ll[:4]))

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Ts = [A, B, C, D, E]
Ts.sort(key=lambda T: (T-1)%10)
#print(Ts)
def c(T):
  return (T+9)//10*10
r = Ts[0]
r += c(Ts[1])
r += c(Ts[2])
r += c(Ts[3])
r += c(Ts[4])
print(r)

Submission status: Accepted

Solution code:
import numpy as np

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

time = 0
drem_min = 100
for d in dishes:
	if d%10 == 0:
		tmp = d
	else:
		if d%10 < drem_min:
			drem_min = d%10 
		tmp = (d//10+1)*10
	time += tmp

if drem_min<10:
	time = time - 10 + drem_min
print(time)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc123/tasks/abc123_b
# B - Five Dishes

time_list = []

for _ in range(5):
    time_list.append(int(input().split()[0]))

# 10の倍数からの差が一番大きいやつを最後に頼んだ方が良い
ichi_list = [int(str(x)[-1]) for x in time_list]
sabun_list = [10 - int(str(x)[-1]) if int(str(x)[-1]) != 0 else 0 for x in time_list]

# print(ichi_list)
# print(sabun_list)

last_order_time = max(sabun_list)
last_order_time_index = sabun_list.index(last_order_time)

total = 0
i = last_order_time_index 
total = sum(time_list[:i] + time_list[i+1:])
total += sum(sabun_list[:i] + sabun_list[i+1:])
total += time_list[i]
print(total)

Submission status: Accepted

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

target = [A,B,C,D,E]
num_list = [1,2,3,4,5,6,7,8,9,0]

ans_sur  = num_list.index(0)
ans = int()

#num_listのindexが最小の値をリストの最後に
#したいのでその判定
for i in target:
	number = num_list.index(i%10)
	if ans_sur >= number:
		ans_sur = number
		ans = i

target.pop(target.index(ans))
target00 = list()
#上のfor文でlistからpopされなかった要素について
#1の位を00秒に合わせる
for i in target:
	if i % 10 != 0:
		#00秒に合わせる
		target00.append(i+(10-i%10))
	else:
		#1桁台が0の時は何もせずにappend
		target00.append(i)

target00.append(ans)
print(sum(target00))

Submission status: Accepted

Solution code:
li=[]
li2=[]
ans=0
for i in range(5):
  li.append(int(input()))
for i in range(5):
  li2.append((li[i]-1)%10)
for i in range(5):
  ans+=((li[i]-1)//10)*10
print(ans+min(li2)+41)

Submission status: Accepted

Solution code:
x = []
y = 100
for i in range(5):
	x.append(int(input()))
	if x[-1] % 10 == 0:
		y = min(y,10)
	else:
		y = min(y, x[-1]%10)

sum = 0
for i in range(5):
	if x[i] % 10 == 0:
		sum += x[i]
	else:
		sum += x[i] + 10 - (x[i]%10)
sum -= 10 - y
print(sum)

Submission status: Accepted

Solution code:
time = [int(input()) for i in range(5)]
lst = []
for i in time:
  lst.append(i%10)
lst.sort()
while 0 in lst:
  lst.remove(0)
times = []
for i in lst[1:]:
  times.append(10-i)
total = sum(time) + sum(times)
print(total)

Submission status: Accepted

Solution code:
def five_dishes(a,n):
    b = []
    ttime = 0
    maxnum,opt,pos = 0,0,0
    for i in range(n):
        if a[i]%10 == 0:
            pass
        else:
            opt = 10 - a[i]%10
        if maxnum < opt:
            maxnum = opt
            pos = i
    tmp = a.pop(pos)
    for i in range(n-1):
        if a[i]%10 == 0:
            ttime += a[i]
        else:
            ttime += a[i] + 10 - a[i]%10
 
    else:
        ttime += tmp
 
    print("%d"  %ttime)
 
if __name__ == '__main__':
    a = [int(raw_input()) for i in range(5)]
    five_dishes(a,len(a))

Submission status: Accepted

Solution code:
ABCDE = [int(input()) for _ in range(5)]
ABCDE_ = [(ABCDE[i] + 9) // 10 * 10 for i in range(5)]

s = sum(ABCDE_)
m = float('inf')
for i in range(5) :
    m = min(m, s - (ABCDE_[i] - ABCDE[i]))
    
print(m)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sm = 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
mi = max((10-a%10)%10,(10-b%10)%10,(10-c%10)%10,(10-d%10)%10,(10-e%10)%10)
print(sm-mi)

Submission status: Accepted

Solution code:
import copy
a = [int(input()) for i in range(5)]
b = copy.deepcopy(a)
for i in range(len(a)):
    if str(a[i])[-1] != "0":
        a[i] = (a[i]//10+1)*10
l = [a[i]-b[i] for i in range(len(a))]
print(sum(a)-max(l))

Submission status: Accepted

Solution code:
import math
cookT = {}
lastOrder = 0

for i in range(5):
  cookT[i] = int(input())
  
lastOrder = max(cookT.items(), key=lambda x:(10-x[1]%10)%10)[0]

totalT = 0
for i in range(5):
  if i == lastOrder:
    totalT += cookT[lastOrder]
  else:
    tempX = cookT[i]
    tempY = math.ceil(tempX%10 / 10)*10
    totalT += tempX//10 *10 + tempY
print(totalT)

Submission status: Accepted

Solution code:
li = [int(input()) for _ in range(5)]
 
s = 0
temp = 10
for i in range(5):
    if li[i]%10 != 0 and li[i]%10 < temp:
        temp = li[i]%10
        s = i
else:
    t = li.pop(s)
    
ans = 0

for i in li:
    if i%10 == 0:
        ans += i//10
    else:
        ans += 1 + i//10
        
print(ans * 10 + t)

Submission status: Accepted

Solution code:
import math

menu = [int(input()) for i in range(5)]
last_menu_index = min([[i, x % 10 ] for i, x in enumerate(menu) if x % 10 != 0 ]+[[123,123]], key=lambda x: x[1])[0]
print(sum([math.ceil(x / 10) * 10 if last_menu_index != i else menu[last_menu_index] for i, x in enumerate(menu)]))

Submission status: Accepted

Solution code:
menu=[None]*5
min=None
min_i=-1
for i in range(5):
  menu[i]=int(input())
  wait = menu[i]%10
  if min==None or (min > wait and wait != 0):
    min=wait
    min_i=i
    
sum = 0
for i in range(5):
  if i==min_i:
    sum = sum + menu[i]
  else:
    sum = sum + (menu[i]%10!=0)*10+(menu[i]//10)*10

print(sum)

Submission status: Accepted

Solution code:
li = []
ans = 0
for i in range(5):
    num = int(input())
    ans += num
    if num % 10 == 0:
        continue
    else:
        p = num//10
        li.append((10*(p+1))-num)
li = sorted(li)
print(ans + sum(li[:-1]))

Submission status: Accepted

Solution code:
items = [int(input()) for _ in range(5)]
items = sorted(items, key=lambda x:x%10)
flag = False
for i in range(len(items)):
    if items[i] % 10 == 0:
        continue
    elif flag is False:
        flag = True
        continue
    tmp = items[i] // 10
    items[i] = tmp * 10 + 10


print(sum(items))

Submission status: Accepted

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

for i in range(5):
    if x[i]%10!=0:
        a+=x[i]-(x[i]%10)+10
        
        if b <= 10-x[i]%10:
            b=10-x[i]%10
        
    else:
        a+=x[i]

print(a-b)

Submission status: Accepted

Solution code:
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
A+=bool(a)*10-a
B+=bool(b)*10-b
C+=bool(c)*10-c
D+=bool(d)*10-d
E+=bool(e)*10-e
print(A+B+C+D+E-max(-a%10,-b%10,-c%10,-d%10,-e%10))

Submission status: Accepted

Solution code:
def main():
    dish = [int(input()) for i in range(5)]
    dish_10 = [ [dish[i]%10, dish[i]] for i in range(5)]
    for i in range(len(dish_10)):
    	if (dish_10[i][0]==0):
    		dish_10[i][0] = 10
    dish_10.sort()
    ans = 0
    for i in range(1,5):
        ans += ceiling_10(dish_10[i][1])
    ans += dish_10[0][1]
    print(ans)
 
def ceiling_10(i):
    if (i%10 == 0):
        return i
    else:
        return (i//10+1)*10
main()

Submission status: Accepted

Solution code:
b = 0
c = []

for i in range(5):
    a = int(input())
    
    if a%10 == 0:
        pass
    else:
        b = max(b,10-a%10)
        a = a//10*10+10
    c.append(a)
print(sum(c)-b)

Submission status: Accepted

Solution code:
a = []
b = []
min = 10
minutes = 0
min_index = 0

for i in range(5):
    a.append(int(input()))
    if 0 < a[i] % 10 < min:
        min = a[i] % 10
        min_index = i

a[4], a[min_index] = a[min_index], a[4]

for i in range(4):
    if a[i] % 10 != 0:
        minutes += (a[i] // 10 + 1) * 10
    else:
        minutes += a[i]

minutes += a[4]

print(minutes)

Submission status: Accepted

Solution code:
res = 0
minS = 10
for i in range(5):
  N = int(input())
  s = N % 10
  t = N // 10
  if s == 0:
    res = res + t * 10
  else:
    minS = min(minS, s)
    res = res + (t + 1)*10
if minS != 10:
  minS -= 10
else:
  minS = 0
print(minS + res)

Submission status: Accepted

Solution code:
lis = [int(input()) for _ in range(5)]
jud = []
fixed = 0
fixed_index = 0
for i in range(5):
  jud.append(lis[i]%10)
for k in range(5):
  if jud[k] == 0:
    jud[k] += 9
for j in range(5):
  if min(jud) == jud[j]:
    fixed = lis[j]
    fixed_index = j
    break
for m in range(5):
  if lis[m]%10 != 0:
    lis[m] = (lis[m]//10+1)*10
lis[fixed_index] = fixed
print(sum(lis))

Submission status: Accepted

Solution code:
t=[int(input()) for _ in range(5)]
s=[]
for i in range(5):
    s.append(t[i]%10)
    t[i]=-(-t[i]//10)*10
S=sorted(s)[-5+s.count(0)]
if S==0:
    print(sum(t))
else:print(sum(t)-10+S)

Submission status: Accepted

Solution code:
x=list(int(input()) for _ in range(5))

import numpy as np

y=[0]*5

for i in range(5):
	if x[i]%10==0:
		y[i]=9
	else:
		y[i]=x[i]%10

res=0

for i in range(5):
	if i==np.argmin(y) or x[i]%10==0:
		res+=x[i]
	else:
		res+=x[i]+10-x[i]%10
  
print(res)

Submission status: Accepted

Solution code:
time_list = []
loss_time_list = []
for i in range(5):
  time_list.append(int(input()))
  loss_time_list.append((10-time_list[i]%10)%10)
#print(loss_time_list)
print(sum(time_list)+sum(loss_time_list)-max(loss_time_list))

Submission status: Accepted

Solution code:
*a,=map(int,open(0));print(-max(-j%10for j in a)-sum(-i//10for i in a)*10)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dishes = []
for i in range(5):
    dishes.append(int(input()))
last = 10
last_index = 5
for i in range(5):
    if dishes[i] % 10 != 0 and last > dishes[i]%10:
        last = dishes[i]%10
        last_index = i

ans = 0
for i in range(5):
    if i != last_index:
        if dishes[i] % 10 != 0:
            ans += dishes[i] + 10 - dishes[i] % 10
        else:
            ans += dishes[i]
    else:
        ans += dishes[i]
print(ans)

Submission status: Accepted

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

a, b, c, d, e = sorted((a, b, c, d, e), key=lambda x: x%10 if x%10>0 else 10, reverse=True)

ans = int(math.ceil(a / 10))*10 \
        + int(math.ceil(b / 10))*10 \
        + int(math.ceil(c / 10))*10 \
        + int(math.ceil(d / 10))*10 \
        + e
print(ans)

Submission status: Accepted

Solution code:
lmod = []
l = []
for i in range(5):
    l.append(int(input()))
    if l[i]%10 != 0:
        lmod.append(10 - l[i]%10)
    else:
        lmod.append(0)
lmod.pop(lmod.index(max(lmod)))
s = sum(l) + sum(lmod)
print(s)

Submission status: Accepted

Solution code:
import math

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

min1 = map(lambda x: x % 10, t)
min1 = min([10 if i == 0 else i for i in min1])

print(sum(map(lambda x: math.ceil(x) * 10, [i/10 for i in t])) - (10 - min1))

Submission status: Accepted

Solution code:
dishes = []
for _ in range(5):
  dishes.append(int(input()))
  
times = []
for _ in range(5):
  n = dishes.pop(0)
  time = n
  for dish in dishes:
    time += ((dish + 9) // 10) * 10
  times.append(time)
  dishes.append(n)
  
print(min(times))

Submission status: Accepted

Solution code:
def get_last(num):
    str_num = str(num)
    last_num = str_num[-1]
    if int(last_num) == 0:
        return 10
    else:
        return int(last_num)

def gauss_10(num):
    if get_last(num) == 10:
        return num
    else:
        return num + (10-get_last(num))

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


list_last = [get_last(i) for i in list]
last_index = list_last.index(min(list_last))

total = 0
for i, minutes in enumerate(list):
    if i == last_index:
        total += minutes
    else:
        total += gauss_10(minutes)
print(total)

Submission status: Accepted

Solution code:
# ABC B - five dishes
import  math
from itertools import permutations

min_t = 100000
X = [int(input()) for i in range(5)]
for x in list(permutations(X)):
    t = 0
    for i in range(4):
        t += x[i]
        t = math.ceil(t/10)*10
    t += x[4]
    if t < min_t:
        min_t = t
print(min_t)

Submission status: Accepted

Solution code:
import itertools

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

res = 1 << 28
for ss in itertools.permutations(s):
    tmp = 0
    tmp += (ss[0] + 9) // 10 * 10
    tmp += (ss[1] + 9) // 10 * 10
    tmp += (ss[2] + 9) // 10 * 10
    tmp += (ss[3] + 9) // 10 * 10
    tmp += ss[4]
    res = min(res, tmp)

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


times = get_nums(5)

min_quot = 10
target_idx = 5
for i, time in enumerate(times):
    quot = time % 10
    if quot > 0 and quot < min_quot:
        min_quot = quot
        target_idx = i

total = 0
for i, time in enumerate(times):
    if target_idx == i:
        total += time
        continue

    if time % 10 == 0:
        total += time
    else:
        total += int((time // 10 + 1) * 10)

print(total)

Submission status: Accepted

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

min_time = 999999
for i in range(5):
    time_sum = 0
    for j in range(5):
        if j == i:
            time_sum += dish[j]
        else:
            time_sum += dish[j] + ((10 - (dish[j] % 10)) % 10)
    if min_time > time_sum:
        min_time = time_sum

print(min_time)

Submission status: Accepted

Solution code:
d_arr = []
d_arr.append(int(input()))
d_arr.append(int(input()))
d_arr.append(int(input()))
d_arr.append(int(input()))
d_arr.append(int(input()))

d_arr.sort(key=lambda x:(10-(x%10))%10)
print(sum([((x-1)//10+1)*10 for x in d_arr[:4]])+d_arr[4])

Submission status: Accepted

Solution code:
t = []
T = []
d = []
index_cnt = 0
ma = 0
for i in range(5):
    temp = input()
    t.append(int(temp))
    if t[i] % 10 != 0:
        Ti = t[i] + (10 - t[i] % 10)
    else:
        Ti = t[i]
    T.append(Ti)
    di = 10 - t[i] % 10
    if di == 10:
        d.append(0)
    else:
        d.append(di)
    if d[i] > ma:
        ma = d[i]
        index_cnt = i
total = 0
for i in range(5):
    if i == index_cnt:
        total += t[i]
    else:
        total += T[i]
print(total)

Submission status: Accepted

Solution code:
# ABC 123 B

a = 10

arr = []

for i in range(5):
    num = int(input())
    if num % 10 != 0:
        a = min(a, num % 10)
        num -= num % 10
        num += 10
    arr.append(num)

ans = sum(arr)
if a != 10:
    ans -= (10-a)

print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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

def main():
  l=[I() for _ in range(5)]

  mn=inf
  for c in itertools.permutations(l,5):
    t=0
    for x in c:
      if t%10==0:
        t+=x
      else:
        t+=10-(t%10)
        t+=x

    mn=min(mn,t)

  return mn

# main()
print(main())

Submission status: Accepted

Solution code:
N = [int(input()) for i in range(5)] 
list_sho = []
list_amari = []

for i in range(len(N)):
  list_sho.append(N[i]//10)
  list_amari.append(N[i]%10)
  
min1 = list_amari.index(min(list_amari))#あまりが最小になるうち一つの位置を取得
sum1 = 0

for i in range(len(N)):
  if N[i] % 10 == 0:
    sum1 += N[i]
  else:
    sum1 += ((N[i]//10) + 1) * 10

if N[min1]%10 == 0:
  while min(list_amari) == 0:
    list_amari.remove(0)
    if len(list_amari) == 0:
      break
  if len(list_amari) == 0:
    sum1 =  sum1
  else:
    sum1 =  sum1 - 10 +  min(list_amari)
  print(sum1)
else:
  sum1 = sum1 - 10 +  N[min1]%10
  print(sum1)

Submission status: Accepted

Solution code:
import math
 
T = list(map(int, (input() for _ in range(5))))
T2 = [math.ceil(t / 10) * 10 for t in T]
m = max(t2 - t for t, t2 in zip(T, T2))
print(sum(T2) - m)

Submission status: Accepted

Solution code:
A=[int(input()) for _ in range(5)]
cook=[]
for i in range(5):
  a=(10-A[i])%10
  cook.append(a)


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

Submission status: Accepted

Solution code:
A=[int(input()) for _ in range(5)]
cook=[]
for i in range(5):
  a=(10-A[i])%10
  cook.append(a)

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

Submission status: Accepted

Solution code:
import itertools

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())
A = tuple(A)

time = 0
time_min = 100000000

list = list(itertools.permutations(A))

for l in list:
    count = 0
    time = 0
    while True:
        if count == 4:
            time = time + l[count]
            break
        if (l[count] % 10) != 0:
            time = time + l[count] + (10 - (l[count] % 10))
            count = count + 1
        else:
            time = time + l[count]
            count = count + 1
    if time < time_min:
        time_min = time

print(time_min)

Submission status: Accepted

Solution code:
time = []
b = 0
for i in range(5):
    a = int(input())
    if a % 10 == 0:
        pass
    else:
        b = max(b, 10 - a % 10)
        a = (a // 10) * 10 + 10
    time.append(a)
print(sum(time) - b)

Submission status: Accepted

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    t = list(map(int,sys.stdin.readlines()))
    m = 0
    res = 0
    for e in t:
        if e%10 !=0:
            k = 10 - e%10
        else:
            k = 0
        res += e+k

        m = max(m,k)

    print(res-m)

Submission status: Accepted

Solution code:
import itertools

def q47(a, b, c, d, e):
    f = [a, b, c, d, e]
    min = 0
    for i in itertools.permutations(f):
        t = 0
        for j in i:
            if t % 10 == 0:
                t += j
            else:
                t += 10 - t % 10
                t += j
        if min == 0:
            min = t
        elif t < min:
            min = t
    return min
        
            
    
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

print(q47(A, B, C, D, E))

Submission status: Accepted

Solution code:
from math import ceil
from itertools import permutations


def ret(perm):
    now = 0
    for i in range(4):
        now += perm[i]
        now = ceil(now / 10) * 10
    now += perm[-1]
    return now


X = [int(input()) for _ in range(5)]
perms = permutations(X)
ans = 1e100
for perm in perms:
    ans = min(ans, ret(perm))
print(ans)

Submission status: Accepted

Solution code:
a=[]
b=[]
for i in range(5):
    a.append(int(input()))
    if str(a[i])[-1]=='0':
        b.append(10)
    else:
        b.append(int((str(a[i])[-1])))
        a[i]=a[i]//10*10+10
print(sum(a)-(10-min(b)))

Submission status: Accepted

Solution code:
def round_up(n):
    if n%10 != 0:
        return n + 10 - (n%10)
    else:
        return n

def round_up_count(n):
    if n%10 != 0:
        return 10 - n%10
    else:
        return 0

orders = []

max_rc = 0
last_order_index = 0
last_order_time = 0

for i in range(5):
    order = int(input())
    orders.append(order)
    last_order_time += round_up(order)
    rc = round_up_count(order)
    if max_rc <= rc:
        last_order_index = i
        max_rc = rc

print(last_order_time - round_up_count(orders[last_order_index]))

Submission status: Accepted

Solution code:
def ru(n):
  if n % 10 ==0:
    return n
  else:
    return ((n//10)+1)*10
li1=[int(input()) for i in range(5)]
li2=[ru(li1[i]) for i in range(5)]
sub= [x - y for (x, y) in zip(li2, li1)]
print(sum(li2)-max(sub))

Submission status: Accepted

Solution code:
time=[]
back=0
for i in range(5):
    A=int(input())
    if A%10==0:
        pass
    else:
        back=max(back,10-A%10)
        A=(A//10)*10 +10

    time.append(A)

print(sum(time)-back)

Submission status: Accepted

Solution code:
import numpy as np 
x =[]
for i in range(5):
    x.append(int(input()))
x = np.array(x)
y = x.copy()
z = x%10
y[y%10 !=0] = y[y%10 !=0] + 10 - y[y%10 !=0]%10
if all(x%10==0):
    minz = 0
    print(sum(y))
else:
    minz = min(z[z%10!=0])
    print(sum(y)-10+minz)

Submission status: Accepted

Solution code:
def ceil(x):
    k = x % 10
    if k == 0:
        return x
    else:
        return x + (10 - k)
d = []
for i in range(5):
    d.append(int(input()))
d_min = []
min = 124
sum = 0
index = -1
for i in range(5):
    d_min.append((d[i]) % 10)
for i in range(5):
    if d_min[i] != 0:
        if min > d_min[i]:
            min = d_min[i]
            index = i
if index == -1:
    index = 0
for i in range(5):
    if i != index:
        sum = sum + ceil(d[i])
sum += d[index]
print(sum)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a=[]
last=0
lasttime=0
ans=0
for _ in range(5):
    a.append(int(input()))
for i in range(5):
    if a[i]%10!=0 and lasttime<10-a[i]%10:
        lasttime=10-a[i]%10
        last=i
for j in range(0,last):
    if a[j]%10==0:
        ans=ans+a[j]
    else:
        ans=ans+(a[j]//10+1)*10
for j in range(last+1,5):
    if a[j]%10==0:
        ans=ans+a[j]
    else:
        ans=ans+(a[j]//10+1)*10
ans=ans+a[last]
print(ans)

Submission status: Accepted

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

cnt = 0
temp = 9

for ai in a:
    cnt += (ai // 10 + int((ai % 10) != 0))*10
    temp = min((ai - 1) % 10, temp)

print(cnt+temp+1-10)

Submission status: Accepted

Solution code:
nums = [int(input()) for _ in range(5)]
l = list(map(int,filter(lambda x:x !="0",[str(n)[-1] for n in nums])))
r = [(n+9) // 10 for n in nums]
print(sum(r)*10-(10-min(l))) if len(l) != 0 else print(sum(r)*10)

Submission status: Accepted

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

x = 10
time = 0
for i in range(5):
	if x >= s[i]%10 > 0:
		x = s[i]%10
	time += -(-s[i]//10)*10

print(time-10+x)