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:
# -*- coding: utf-8 -*-

def ceil(a):
    if a % 10 == 0:
        return a
    else:
        return (a//10+1)*10

gohan = [0]*5
for i in range(5):
    gohan[i] = int(input())
    
ans = 0
for i in range(5):
    ans += ceil(gohan[i])
    gohan[i] = ceil(gohan[i]) - gohan[i]
    
print(ans - max(gohan))

Submission status: Accepted

Solution code:
a = [ int(input()) for _ in range(5) ]
a = sorted(a,key=lambda x: (x-1)%10)

ans = a[0]
for i in a[1:]:
  ans += i if i%10==0 else i+10-i%10
 
print(ans)

Submission status: Accepted

Solution code:
def answer():
    l = []
    l_sub = []
    serving_time = 0
    for _ in range(5):
        l.append(int(input()))  # 5種類の料理の調理時間の10分わけ

    for v in l:
        l_sub.append((v-1) % 10 +1)
        serving_time += ((v -1)//10 + 1) *10

    serving_time = serving_time - 10 + min(l_sub)
    return serving_time


def main():
    print(answer())

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
abc=[]
answer=0
for i in range(5):
    d=int(input())
    if d%10==0:
        answer+=d
    else:
        answer+=(int(d/10+1))*10
        abc.append(d%10)
if len(abc)>0:
    answer-=10-min(abc)
print(answer)

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]

index = 0
for i in range(1, 5):
    if (l[index] - 1)%10 > (l[i] - 1)%10:
        index = i
        
s = 0
for i in range(5):
    if i == index:
        s += l[i]
    else:
        s += ((l[i]+9) // 10)* 10
        
print(s)

Submission status: Accepted

Solution code:
lst = [int(input()) for i in range(5)]
mod_lst = [(10-lst[i]%10)%10 for i in range(5)]

ans = sum(lst) + sum(mod_lst) - max(mod_lst)

print(ans)
#print(lst)
#print(mod_lst)

Submission status: Accepted

Solution code:
import itertools

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

min_time = 99999
for time_list in list(itertools.permutations([A, B, C, D, E])):
    time = time_list[0]
    time = int((time - 1) / 10) * 10 + 10
    for i, t in enumerate(time_list[1:]):

        if i < 3:
            time += int((t - 1) / 10) * 10 + 10
        else:
            time += t
    min_time = min(min_time, time)

print(min_time)

Submission status: Accepted

Solution code:
ans = 0
etc = []
for i in range(5):
  a = int(input())
  a10 = a % 10
  if a10 == 0:
    A = a
  else:
    A = a + 10 - a10
    etc.append(a10)
  ans += A
if len(etc) != 0:
  ans += min(etc) - 10
print(ans)

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]
li=sorted(li,key=lambda x:10 if x%10==0 else x%10)
print(li[0]+sum(map(lambda x:x+((10-x%10)if x%10 else 0),li[1:])))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-

# abc123_b

# input
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
arr = [a, b, c, d, e]
# output
def get_1(n):
    n = n%10
    return n if n!=0 else 10
def ceil(n):
    import math
    n = n/10
    n = math.ceil(n)
    n = n * 10
    return n
last = min(arr, key=get_1)
arr.remove(last)
arr = list(map(ceil, arr))
ans = sum(arr) + last
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
import sys

A = np.zeros(5)
for i in range(5):
    A[i] = int(input())

A2 = np.ceil(A/10.0).astype(np.int)*10
A3=(A-1)%10+1
print((A3.min()+A2.sum()-10).astype(np.int))

Submission status: Accepted

Solution code:
time = []
mod_10 = []

for i in range(5):
    t = int(input())
    time.append(t)
    mod_10.append(t % 10)
    if mod_10[i] == 0:
        mod_10[i] = 10

flag = False
min_mod = min(mod_10)

for i in range(5):
    if mod_10[i] == min_mod and not flag:
        flag = True
    else:
        time[i] = ((time[i] + 9) // 10) * 10

print(sum(time))

Submission status: Accepted

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

import math

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

good = 10
total = 0

if a%10 < good and a%10 != 0:
    good = a % 10

if b % 10 < good and b%10 != 0:
    good = b % 10

if c % 10 < good and c%10 != 0:
    good = c % 10

if d % 10 < good and d%10 != 0:
    good = d % 10

if e % 10 < good and e%10 != 0:
    good = e % 10

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

total -= 10 - good

print(total)

Submission status: Accepted

Solution code:
def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return list(map(int, ss_raw()))


def ceil(num):
    if int(str(num)[-1]) == 0:
        return num
    return num + 10 - int(str(num)[-1])


total = 0
minus = 0
times = []
for i in xrange(5):
    times.append(int_raw())

for time in times:
    if int(str(time)[-1]) == 0:
        local_minus = 0
    else:
        local_minus = 10 - int(str(time)[-1])
    minus = max(minus, local_minus)
    total += ceil(time)

total -= minus

print(total)

Submission status: Accepted

Solution code:
import itertools
import math

number = []
for i in range(5):
    number.append(float(int(input())/10))

result = []

for j in itertools.permutations(number,5):
    time = 0.0
    for i,k in enumerate(j):
        if i < 4:
            time = math.ceil(time + k)
        else:
            time += k
    result.append(time)
    
print(int(min(result)*10))

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
mod = 10
sm = 0
for i in l:
    if i % 10 != 0:
        mod = min(mod, i % 10)
    sm += -10*(-i//10)
if mod == 10:
    mod = 0
else:
    sm -= 10
print(mod+sm)

Submission status: Accepted

Solution code:
import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
raws = [A, B, C, D, E]
residues = []
for num in raws:
    if num % 10 != 0:
        residues.append(num % 10)
    else:
        residues.append(10)

ans = 0
lastDish = residues.index(min(residues))
for i in range(len(raws)):
    if i != lastDish:
        ans += math.ceil(raws[i] / 10) * 10
    else:
        ans += raws[i]
print(ans)

Submission status: Accepted

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

for j in range(5):
  if timeList[j] % 10 == 0:
    timeAndRe.append([0, timeList[j]])
  else:
  	timeAndRe.append([10 - timeList[j] % 10 ,timeList[j]])

timeAndRe.sort()

sumTime = 0

for k in range(5):
  if k != 4:
    sumTime += (timeAndRe[k][0] + timeAndRe[k][1])
  else:
    sumTime += timeAndRe[k][1]
    
print(sumTime)

Submission status: Accepted

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

time_list = [A, B, C, D, E]
# 最後の一品以外は切り上げ時刻の和を取ることに等しい
time_list_upper = [(((time - 1)//10)+1)*10 for time in time_list]
# 最後の一品は1の位が1～9で最小のやつ。
time_list_ones = [(time - 1) % 10 for time in time_list]
smallest_idx = time_list_ones.index(min(time_list_ones))
smallest = time_list.pop(smallest_idx)
time_list_upper.pop(smallest_idx)

print(sum(time_list_upper) + smallest)

Submission status: Accepted

Solution code:
import sys

if __name__ == "__main__":
    V = [int(sys.stdin.readline()) for i in range(5)]
    ans = 0
    mi = 100
    for v in V:
        if v % 10 == 0:
            ans += v
        else:
            ans += v - (v % 10) + 10
            mi = min(mi, v % 10)

        #print(ans, mi)

    if mi != 100:
        ans -= (10 - mi)

    print(ans)

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
M = [l if l % 10 == 0 else (l // 10 + 1) * 10 for l in L]

d = 0
for l, m in zip(L, M):
    d = max(d, m - l)

print(sum(M) - d)

Submission status: Accepted

Solution code:
import math
a2e_mod = []
for _ in range(5):
  v = input()
  a2e_mod.append([(v + 9) % 10, v])

a2e_mod.sort(reverse=True)
res = 0
for _, v in a2e_mod[:-1]:
  res += math.ceil(v / 10.0) * 10
print int(res + a2e_mod[-1][-1])

Submission status: Accepted

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

ans=0
s=a[0]%10
for i in range(1,5):
  if s>a[i]%10 and a[i]%10!=0:
    s=a[i]%10

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

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]
    S = []
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    ans = 0
    min = S[0]
    min_i = 0
    sum = 0
    for i in range(len(S)):
        if min%10 > S[i]%10 and S[i]%10 != 0:
            min = S[i]%10
            min_i = i
    for i in range(len(S)):
        if i != min_i:
            sum += math.ceil(S[i]/10) * 10
        else:
            sum += S[i]
    print(sum)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A=[int(input()) for _ in range(5)]
d=0
t=0
for a in A:
    if a%10:
        d=max(d,10-a%10)
        t+=a-a%10+10
    else:
        t+=a
print(t-d)

Submission status: Accepted

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

saigo = 199
for ryori in ryoris:
    if ryori % 10 > 0 and ryori % 10 <= saigo % 10:
        saigo = ryori

if saigo == 199:
    saigo = ryoris[0]
    
ryoris.remove(saigo)
# print(saigo,ryoris)
time = 0
for ryori in ryoris:
    time += ryori if ryori % 10 == 0 else 10 * (ryori //10) + 10
#     print(ryori,time)
    
time += saigo
    
print(time)

Submission status: Accepted

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

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

ans = 0
rem = 10
for i in [0] * 5:
    N = input()
    if N % 10 != 0:
        ans += N / 10 * 10 + 10
        rem = min(rem, N % 10)
    else:
        ans += N

ans -= 10
ans += rem
print ans

Submission status: Accepted

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

nums = [a, b, c, d, e]
l = [math.ceil(num/10)*10 for num in nums]
l_sub = [l[i] - nums[i] for i in range(5)]
print(sum(l) - max(l_sub))

Submission status: Accepted

Solution code:
time = []
for i in range(5):
	time.append(int(input()))
remain = [0]
for i in range(5):
	if time[i] % 10 != 0:
		remain.append(10 - time[i] % 10)
sum = 0
for i in range(5):
	if time[i] % 10 == 0:
		sum += time[i]
	else:
		sum += (time[i] // 10 + 1) * 10

print(sum - max(remain))

Submission status: Accepted

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

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

n = 0
for i in range(5):
    n += kiriage(a[i])

p = 10
for i in range(5):
    if a[i] % 10 != 0:
        p = min(p, a[i] % 10)

print(n - 10 + p)

Submission status: Accepted

Solution code:
def cal(a):
    a = int(str(a)[-1])
    b = 0
    if not a == 0:
        b = 10 - a
    return b

a = [int(input()) for _ in range(5)]
b = list(map(cal, a))
ans = 0

for i in range(5):
    index = b.index(min(b))
    ans += a[index]
    if not i == 4:
        ans += b[index]
    b[index] = 124

print(ans)

Submission status: Accepted

Solution code:
import itertools
import math

A= int(input())
B= int(input())
C= int(input())
D= int(input())
E= int(input())
food = list(itertools.permutations((A,B,C,D,E)))
time = 1000

for i in range(len(food)):
    temptime = 0
    for j in range(4):
        temptime += math.ceil(food[i][j]/10)*10
    temptime += food[i][4]
    time = min(temptime,time)

print(time)

Submission status: Accepted

Solution code:
# coding: utf-8
a = []

timeloss =[]
for i in range(5):
    a.append(int(input()))
    timeloss.append((10-a[i]) % 10)

count = 0
for i in range(4):
    if timeloss[i + 1]>timeloss[count]:
        count = i + 1
t = sum(a) + sum(timeloss) - timeloss[count]
print(t)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
B = []
for a in A:
    b = a
    if b%10!=0:
        b+=9
        b = b//10*10
    B.append(b)
min_time = 10**10
for i in range(5):
    time = A[i]
    for j in range(5):
        if j==i:
            continue
        time+=B[j]
    min_time = min(min_time,time)
print(min_time)

Submission status: Accepted

Solution code:
T = [[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(5):
	t = int(input())
	if t%10 == 0:
		T[i][0] = 10
	else:
		T[i][0] = t%10
	T[i][1] = t

T.sort(reverse=True)
# print(T)
ans = 0
for i in range(4):
	if T[i][0] == 10:
		ans += T[i][1]
	else:
		ans += (T[i][1]//10+1)*10
	# print(ans)
ans += T[4][1]
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
data = [None] * 5
data_amari = [None] * 5
data_kiriage = [None] * 5
for itr in range(0,5):
    data[itr] = int(stdin.readline().rstrip())
    if (data[itr]%10 != 0):
        data_amari[itr] = data[itr] % 10
        data_kiriage[itr] = data[itr] + (10-data[itr] % 10)
    else:
        data_amari[itr] = 10
        data_kiriage[itr] = data[itr]

sum = 0
for itr in range(0,5):
    if itr != data_amari.index(min(data_amari)):
        sum += data_kiriage[itr]
    else:
        sum += data[itr]
print(sum)

Submission status: Accepted

Solution code:
inn=[]
hoge=[]
zero=0

mini=0

for i in range(5):
    a=int(input())
    inn.append(a)
    if a%10==0:
        zero +=1

amari=[]
for v in inn:
    amari.append(v%10)

if max(amari)==0:
    print(sum(inn))
    exit()
else:
    amari.sort()
    for v in amari:
        if v!=0:
            mini=v
            break
    for v in inn:
        hoge.append((v//10)*10+10)

    print(sum(hoge)+mini-10-10*zero)
    exit()

Submission status: Accepted

Solution code:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A = [I() for i in range(5)]
num = 0
tmp = 0
for i in range(5):
    if str(A[i])[-1] != "0":
        num = max(num,10 - int(str(A[i])[-1]) )
        tmp += 10
    if len(str(A[i]))!=1:
        tmp += 10*int(str(A[i])[:-1])

print(tmp-num)

Submission status: Accepted

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

ans = 0
minui = 1000000
u = [a,b,c,e,d]
for i in range(len(u)):
    if u[i]%10==0:
        ans += u[i]
        # print(u[i])
    else:
        if (minui>u[i]%10)and(u[i]!=0):
            minui=u[i]%10
        ans += u[i]-u[i]%10+10
        # print(u[i]-u[i]%10+10)


if(minui == 1000000):
    minui=10


     


print(ans-10+minui)

Submission status: Accepted

Solution code:
import numpy as np
import math

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

#最後に注文するものだけに依存する
X=np.zeros(5)
X[0]=a
X[1]=b
X[2]=c
X[3]=d
X[4]=e

Y=np.zeros(5)
for i in range(5):
  Y[i]=math.ceil(X[i]/10)*10

Z=np.zeros(5)
for i in range(5):
  Z[i]=np.sum(Y)-Y[i]+X[i]

print(int(min(Z)))

Submission status: Accepted

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

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


def v(x):
    if x % 10 == 0:
        return 9
    else:
        return x % 10


bb = list(reversed(sorted(map(lambda x: (v(x), x), aa))))

total = 0
for _, x in bb:
    if total % 10 == 0:
        pass
    else:
        total = ((total // 10) + 1) * 10
    total += x

print(total)

Submission status: Accepted

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

for i in range(5):
    a[i][0] = a[i][1] % 10
    if a[i][0] == 0:
        a[i][0] = 10
        a[i][1] -= 10

a.sort(reverse=True)

ans = 0
for i in range(4):
    if a[i][0] == 10:
        ans += a[i][1] + 10
    else:
        ans += a[i][1] + (10 - a[i][0])

ans += a[4][1]
if a[4][0] == 10:
    ans += 10

print(ans)

Submission status: Accepted

Solution code:
from math import ceil
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst0 = [a%10, b%10, c%10, d%10, e%10]
lst = [(a-1)%10, (b-1)%10, (c-1)%10, (d-1)%10, (e-1)%10]
time0 = [int(a/10), int(b/10), int(c/10), int(d/10), int(e/10)]
time = [ceil(a/10), ceil(b/10), ceil(c/10), ceil(d/10), ceil(e/10)]
last = lst.index(min(lst))
time.pop(last)
print(sum(time)*10+lst0[last]+time0[last]*10)

Submission status: Accepted

Solution code:
li = [int(input()) for _ in range(5)]
li_mod = [[i % 10, i] for i in li if i % 10 != 0]
li_mod_r = [i for i in li if i % 10 == 0]
li_mod = sorted(li_mod, reverse = True)
time = 0
if li_mod != []:
  for lis in li_mod[:-1]:
    time += lis[1] + (10-lis[0])
  time += li_mod[-1][1]
if li_mod_r != []:
  time += sum(li_mod_r)
#time += li_mod[-1][1]
print(time)

Submission status: Accepted

Solution code:
l=[]
lp=[10]
for i in range(5):
    l.append(int(input()))
    if l[i]%10!=0:
        lp.append(l[i]%10)
lp_min=min(lp)
if lp_min==10:
    lp_min=0
ans=0
for i in range(5):
    ans+=-(-l[i]//10)*10
if lp_min!=0:
    ans=ans-10+lp_min
print(ans)

Submission status: Accepted

Solution code:
#!venv/bin/python
 
import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 
 
arg = [int(input()) for i in range(5)]

last_i = 0
min = 100;
for i in range(5):
    if arg[i] % 10 == 0:
        continue
    if arg[i] % 10 < min:
        last_i = i
        min = arg[i] % 10

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

print(ans)

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

menu=[INT() for i in range(5)]

last=INF
idx=0
for i in range(5):
    if menu[i]%10!=0:
        if menu[i]%10<last:
            last=menu[i]%10
            idx=i

ans=0
for i in range(5):
    if i!=idx:
        ans+=menu[i]//10*10
        if menu[i]%10!=0:
            ans+=10
ans+=menu[idx]
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]
l0=[i%10 for i in l]
x=[]
for i in range(5):
    if l0[i]!=0:
        l[i]=(1+l[i]//10)*10 
        x.append(l0[i])
if x==[]:
    ans=sum(l)
else:
    ans=sum(l)-10+min(x)
print(ans)

Submission status: Accepted

Solution code:
def main():
    a = []
    for i in range(5):
        a.append(int(input()))
    b = []
    s = 0
    tmp = 0
    for i in a:
        if i%10 != 0:
            tmp = i + (10-i%10)
            b.append(10-i%10)
        else:
            tmp = i
            b.append(0)
        s += tmp
    print(s-max(b))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += ((ls[i] // 10) + 1)* 10
#print(ls1)
if len(ls1) != 0:
    print(sum - max(ls1))
else:
    print(sum)

Submission status: Accepted

Solution code:
# 2019/04/06
# AtCoder Beginner Contest 123 - B

# Input
sum = 0
cl = list()
hmin = 99
minidx = -1

for i in range(5):
    wt = int(input())
    t = int((wt + 9) / 10) * 10
    sum += t
    cl.append(wt)
    wh = wt % 10
    if wh > 0 and wh < hmin:
        hmin = wt % 10
        minidx = i

if hmin < 99:
    sum = sum - (10 - hmin)

# Output
print(sum)

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]
l1=[]
for i in l:
  if i%10>0:
    l1+=[i%10]
if len(l1)>0:
  print(sum(l)-sum(l1)+10*(len(l1)-1)+min(l1))
else:
  print(sum(l))

Submission status: Accepted

Solution code:
ans = 0
m = 10

for v in [int(input()) for _ in range(5)]:
    x = v//10
    y = v%10
    ans += x*10

    if y > 0:
        if m > y:
            m = y
        ans += 10

ans -= (10 - m)
print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ans = 0
import math

a = [A,B,C,D,E]
b = []

for i in range(5):

    if a[i] % 10 != 0:
        
        b.append(a[i] % 10)

if len(b) == 0:

    for i in range(5):

        ans += a[i]

    print(ans)

else:
    
    for i in range(5):

        if a[i] % 10 != 0:

            ans += 10 * ((a[i]//10)+1)

        else:

            ans += a[i]

    print(ans-10+min(b))

Submission status: Accepted

Solution code:
import numpy as np

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

sum_abcde=0
for i in (a,b,c,d,e):
    if(i%10)==0:
        sum_abcde+=int(i)
    else:
        sum_abcde+=((int(i/10) * 10) + 10)


mod_a = a%10
mod_b = b%10
mod_c = c%10
mod_d = d%10
mod_e = e%10


array=np.array((mod_a, mod_b, mod_c, mod_d, mod_e))
if(np.sum(array)==0):
    print(int(sum_abcde))
else:
    print(int(min(array[array!=0])+sum_abcde-10))

Submission status: Accepted

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

if len([i for i in [a % 10, b % 10, c % 10, d % 10, e % 10] if i is not 0]) > 0:
    m = min([i for i in [a % 10, b % 10, c % 10, d % 10, e % 10] if i is not 0])
else:
    m = 10

print((a // 10 + (1 if a % 10 != 0 else 0)) * 10 + (b // 10 + (1 if b % 10 != 0 else 0)) * 10 + (c // 10 + (1 if c % 10 != 0 else 0)) * 10 + (d // 10 + (1 if d % 10 != 0 else 0)) * 10 + (e // 10 + (1 if e % 10 != 0 else 0)) * 10 - 10 + m)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
lst=[]
for i in range(5):
  a=int(input())
  b=10-a%10
  if b==10:
    b=0
  lst.append((b,a))
lst.sort()

ans=0
for i in range(4):
  c=lst[i][1]
  d=lst[i][0]
  ans+=c+d
ans+=lst[4][1]
print(ans)

Submission status: Accepted

Solution code:
import itertools
A = [0]*5
for i in range(5):
    A[i] = int(input())

T_list = []

for x in itertools.permutations(A):
    t = 0
    for y in x:
        z = 0
        if t%10 > 0:
            z = 10 - t%10
        t += y + z
    T_list.append(t)
print(min(T_list))

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
lst = [A, B, C, D, E]
roundupped = [(x + 9) // 10 * 10 for x in lst]
diff = [y - x for x, y in zip(lst, roundupped)]
last = diff.index(max(diff))
sums = 0
for i, x in enumerate(lst):
    if i == last:
        sums += x
    else:
        sums += roundupped[i]
print(sums)

Submission status: Accepted

Solution code:
li = []

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

res = []
for i in range(5):
    if li[i] % 10 == 0:
        res.append((0, li[i]))
    else:
        res.append((((li[i] // 10 + 1) * 10 - li[i]), li[i]))
res.sort(key=lambda x: x[0])

cnt = 0
for i, j in res[:4]:
    cnt += i + j

cnt += res[4][1]
print(cnt)

Submission status: Accepted

Solution code:
N=[]
time=0
tmp=10
for i in range(5):
    N.append(int(input()))

for i in N:
    if i%10==0:
        time += i


    else:
        if i%10<tmp:
            tmp=i%10
        time += i+(10-i%10)

if tmp ==10:
    tmp==0

print(time+tmp-10)

Submission status: Accepted

Solution code:
plates = [int(input()) for _ in range(5)]
plates.sort(key=lambda x:x % 10)
time = 0
first = False
for i in plates:
	if i % 10 == 0:
		time += i
	else:
		if not first:
			first = True
			time += i
		else:
			time += (i // 10) * 10 + 10
print(time)

Submission status: Accepted

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

ans = 10**10

import itertools
t = 0
tt = 0
for P in itertools.permutations(l,len(l)):
    for p in P:
        t += p
        if (p % 10) != 0:
            tt = 10-p%10
            t += (10 - p%10)
    ans = min(ans , t-tt)
    t = 0
print(ans)

Submission status: Accepted

Solution code:
nlist = [int(input()) for i in range(5)]
#print(nlist)
total_time=0
tail=[]
for number in nlist:
    if number % 10 == 0:
        total_time += number
    else:
        total_time += (number+10-(number%10))
        tail.append(number%10)
if tail:
    total_time -= (10-min(tail))
print(total_time)

Submission status: Accepted

Solution code:
import itertools

nums = [0,1,2,3,4]
kumi = list(itertools.permutations(nums))

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

Minimum = 99999

for i in range(len(kumi)):
    temp = 0
    for j in range(5):
        if temp % 10 == 0:
            temp += dishes[kumi[i][j]]
        else:
            temp = temp + 10 - (temp % 10)
            temp += dishes[kumi[i][j]]
    Minimum = min(Minimum, temp)

print(Minimum)

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]
# 下一桁を1～10へ変換
ltgt = [(a-1) %10+1,(b-1) %10+1,(c-1) %10+1,(d-1) %10+1,(e-1) %10+1]
l2 =[math.floor((a-1)//10),math.floor((b-1)//10),math.floor((c-1)//10),math.floor((d-1)//10),math.floor((e-1)//10)]

m = min(ltgt)

print((sum(l2)*10)+40+min(ltgt))

Submission status: Accepted

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

tmp = []
tmp.append(a % 10)
tmp.append(b % 10)
tmp.append(c % 10)
tmp.append(d % 10)
tmp.append(e % 10)

for id, item in enumerate(tmp):
    if item == 0:
        tmp[id] = 10

tmp.sort()
ans = 0

if a % 10 == 0:
    ans += a
else:
    a = (a // 10 + 1) * 10
    ans += a

if b % 10 == 0:
    ans +=  b
else:
    b = (b // 10 + 1) * 10
    ans += b

if c % 10 == 0:
    ans +=  c
else:
    c = (c // 10 + 1) * 10
    ans += c 

if d % 10 == 0:
    ans +=  d
else:
    d = (d // 10 + 1) * 10
    ans += d

if e % 10 == 0:
    ans += e
else:
    e = (e // 10 + 1) * 10
    ans += e
ans -= 10
ans += tmp[0]

print(ans)

Submission status: Accepted

Solution code:
dishes = []
minimum = 9
min_id = 0

for i in range(5):
  t = int(input())
  dishes.append(t)
  if t % 10 <= minimum and t % 10 > 0:
    minimum = t % 10
    min_id = i

print(sum([dishes[i] + (10 - dishes[i] % 10) if i != min_id and dishes[i] % 10 != 0 else dishes[i] for i in range(len(dishes))]))

Submission status: Accepted

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

ind=0
ind_min=9
for i,num in enumerate(n):
    if num % 10 == 0 :
        continue
    if num % 10 < ind_min:
        ind_min = num%10
        ind=i

sum=0
for i,num in enumerate(n):
    if i == ind:
        sum+=num
    else:
        sum+=int((num+9)/10)*10

print(sum)

Submission status: Accepted

Solution code:
s=[int(input()) for i in range(5)]
a=0
b=10
for i in s:
    for j in range(0,140,10):
        if j>=i:
            a+=j
            break
    if i%10>0:
        b=min(b,i%10)

if b==10:
    print(a)
else:
    print(a-10+b)

Submission status: Accepted

Solution code:
import sys
from copy import copy
A = []
for _ in range(5):
  A.append(int(input()))

def dfs(B):
  if len(B) == 1:
    return B[0]
  ans = float('inf')
  for i in range(len(B)):
    C = copy(B)
    x = C.pop(i)
    if x % 10 != 0:
      x += (10 - x % 10)
    ans = min(ans, x + dfs(C))
  return ans

print(dfs(A))

Submission status: Accepted

Solution code:
import math

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

num = min(int(str(A-1)[-1]), int(str(B-1)[-1]), int(str(C-1)[-1]), int(str(D-1)[-1]), int(str(E-1)[-1])) + 1
array = [A, B, C, D, E]

result = 0
for i in array:
    result += math.ceil(i/10) * 10

print(result - 10 + num if num != 0 else result + num)