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:
abcde = [int(input()) for _ in range(5)]

s = 0
t = 125
for i in range(5):
  if abcde[i]%10 != 0:
    if int(str(abcde[i])[-1]) < t:
      s = i
      t = int(str(abcde[i])[-1])

ans = 0
for i in range(5):
  if s == i: continue
  if abcde[i] % 10 == 0: ans += abcde[i]
  else:
    while abcde[i]%10 != 0:
      abcde[i] += 1
    ans += abcde[i]
print(ans+abcde[s])

Submission status: Accepted

Solution code:
Time = [int(input()) for X in range(0,5)]
Loss = [(10-X%10)%10 for X in Time]
print(sum(Time)+sum(sorted(Loss)[:4]))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

import math

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

def get_ceiled_num(num):
    ret = math.ceil(num/10)*10
    return ret

#diff_a2e = [i-get_ceiled_num(i) for i in a2e]
#
#idxs = [i[0] for i in sorted(enumerate(diff_a2e), key=lambda x:-x[1])]
#
#ans = 0
#
#for idx in idxs[:-1]:
#    ans += get_ceiled_num(a2e[idx])
#
#ans += a2e[idxs[-1]]
#    
#print(ans)

ceiled_a2e = [get_ceiled_num(i) for i in a2e]

tot = sum(ceiled_a2e)

ans = tot

for i,j in zip(a2e, ceiled_a2e):
    tmp = tot-(j-i)
    ans = min(ans, tmp)
    
print(ans)

Submission status: Accepted

Solution code:
time = [int(input()) for _ in range(5)]
dif = 0
dif_max = 0
for i in time:
    tmp = abs(10-int(str(i)[-1]))
    tmp = 0 if tmp == 10 else tmp
    dif += tmp
    dif_max = max(dif_max,tmp)

print(sum(time)+dif-dif_max)

Submission status: Accepted

Solution code:
# coding: utf-8
import itertools
import math
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
List=[A,B,C,D,E]
ans=10000000
for i in itertools.permutations(List, 5):
    AList=list(i)
    R=0
    for i in range(5):
        if str(AList[i])[-1]!=0 and i!=4:
            R+=math.ceil((AList[i])/10)*10
        else:
            R+=AList[i]
    ans=min(ans,R)
    #print(AList)
    #print(ans)
print(ans)

Submission status: Accepted

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

m = 10
ans = 0
for i in (a, b, c, d, e):
    q, mod = divmod(i, 10)
    if mod == 0:
        ans += i
    else:
        m = min(m, mod)
        ans += (q + 1) * 10
print(ans - 10 + m)

Submission status: Accepted

Solution code:
time = list(int(input()) for i in range(5))

def f(x):
    return (10-x%10)%10

b = list(map(f, time))

ans = sum(time) + sum(b) - max(b)
print(ans)

Submission status: Accepted

Solution code:
a = list(int(input()) for _ in range(5))
b = list(map(lambda x: (10-x%10)%10, a))

ans = sum(a)+sum(b)-max(b)
print(ans)

Submission status: Accepted

Solution code:
import math
A = [int(input()) for _ in range(5)]
ad = 0
rm = 0
for i in range(5):
    ad += math.ceil(A[i]/10)*10
    rm = max(math.ceil(A[i]/10)*10 - A[i],rm)
print(ad-rm)

Submission status: Accepted

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

ma = 0
for i in range(1,5):
  if m[i][-1] == '0':
    continue
  if int(m[ma][-1]) > int(m[i][-1]):
    ma = i
c = 0
for i in range(5):
  tmp = int(m[i])
  if i != ma and tmp % 10 !=0:
    tmp = tmp // 10 * 10 + 10
  c += tmp
print(c)

Submission status: Accepted

Solution code:
p=[int(input()) for i in range(5)]
q=[10*(0--i//10) for i in p]
res=10**6
for i in range(5):
    res =min(res,sum(q)-q[i]+p[i])
print(res)

Submission status: Accepted

Solution code:
A=[int(input()) for _ in range(5)]
ceiled=[(x+9)//10*10 for x in A]
can_save=[y-x for x,y in zip(A,ceiled)]
ans=sum(ceiled)-max(can_save)
print(ans)

Submission status: Accepted

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

flg = -1
for i in range(1,10):
    if flg != -1:
        break
    for j in range(5):
        if abcde[j][-1]==str(i):
            flg = j
            break
total = 0
for i in range(5):
    if flg==i:
        total += int(abcde[i])
    else:
        total += math.ceil(int(abcde[i])/10)*10
print(total)

Submission status: Accepted

Solution code:
from math import ceil

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

x = min((a - 1) % 10, (b - 1) % 10, (c - 1) % 10, (d - 1) % 10, (e - 1) % 10) + 1
ans = ceil(a / 10) * 10 + ceil(b / 10) * 10 + ceil(c / 10) * 10 + ceil(d / 10) * 10 + ceil(e / 10) * 10
ans -= (10 - x)
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import permutations
def main():
    #入力
    readline=stdin.readline
    li=[int(readline()) for _ in range(5)]

    ans=float("inf")
    for i in permutations(li):
        tmp=0
        for j in range(5):
            if j!=4:
                if i[j]%10==0:
                    tmp+=i[j]
                else:
                    tmp+=i[j]+10-i[j]%10
            else:
                tmp+=i[j]

        ans=min(ans,tmp)

    print(ans)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    li=[int(readline()) for _ in range(5)]

    res=10
    res_i=0
    for i in range(5):
        if li[i]%10==0:
            pass
        else:
            if li[i]%10<res:
                res=li[i]%10
                res_i=i

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

        else:
            ans+=li[i]

    print(ans)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
import math
def roundup(x):
    return int(math.ceil(x/10))*10


def main():
    import math
    inlis = []
    roundlis = []
    gapdic = {}
    cnt = 0
    for i in range(5):
        a = int(input())
        inlis.append(a)
        roundlis.append(roundup(a))
        gap = roundup(a) - a
        gapdic[i] = gap
    
    gapdic= sorted(gapdic.items(), key = lambda x:x[1])
    num = 1
    ans = 0
    for tup in gapdic:
        if num != len(inlis):
            ans += roundlis[tup[0]]
            #print(tup, roundlis[tup[0]])
        else:
            ans += inlis[tup[0]]
        num += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
T = [int(input()) for _ in range(5)]
U = [T[i] for i in range(5)]

for i in range(5):
    if T[i] % 10 == 0:
        T[i] = 10
    else:
        T[i] %= 10
    U[i] += (10-T[i])

ans = sum(U)

T.sort()
ans -= (10-T[0])

print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
orders = sorted([a, b, c, d, e], key=lambda x: 10 if x % 10 == 0 else x % 10, reverse=True)
total = 0
for o in orders[:-1]:
    total += ((o + 9) // 10) * 10
total += orders[-1]
print(total)

Submission status: Accepted

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

temp = 10
index = 0
for i,dish in zip(range(len(dishes_time)),dishes_time):
    if temp > int(str(dish)[-1]) and int(str(dish)[-1])!=0:
        temp = int(str(dish)[-1])
        index = i

for i in range(len(dishes_time)):
    if index != i:
        if dishes_time[i]%10!=0:
            dishes_time[i] = (dishes_time[i]//10)*10 + 10
print(sum(dishes_time))

Submission status: Accepted

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

temp = 10
index = 0
for i,dish in zip(range(len(dishes_time)),dishes_time):
    if temp > int(str(dish)[-1]) and int(str(dish)[-1])!=0:
        temp = int(str(dish)[-1])
        index = i

for i in range(len(dishes_time)):
    if index != i:
        if dishes_time[i]%10!=0:
            dishes_time[i] = (dishes_time[i]//10)*10 + 10
print(sum(dishes_time))

Submission status: Accepted

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

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

mintime = 9
minindex = 4
for i, m in enumerate(menu):
    if m % 10 == 0:
        continue

    if m % 10 < mintime:
        minindex = i
        mintime = m % 10

ans = menu[minindex]
for i, m in enumerate(menu):
    if i == minindex:
        continue
    if m % 10 != 0:
        m += 10 - m % 10
    ans += m

print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for n in range(5)]
B = [(a+9)//10*10 for a in A]
C = sum(B)
print(min([C-B[n]+A[n] for n in range(5)]))

Submission status: Accepted

Solution code:
import math
X = [int(input()) for _ in range(5)]
t = 0
m = 100
for x in X:
  t += (math.ceil(x/10))*10
  if x%10 != 0:
    m = min(m, x%10)
print(t+m-10 if m!=100 else t)

Submission status: Accepted

Solution code:
from itertools import permutations

def f(a,g):
    return ((a+(g-1))//g)*g

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

P=[A,B,C,D,E]
Q=permutations(P)

M=10**100
for (v,w,x,y,z) in Q:
    M=min(M,f(v,10)+f(w,10)+f(x,10)+f(y,10)+z)
print(M)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = []
ans.append(((b-1)//10+1+(c-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+a)
ans.append(((a-1)//10+1+(c-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+b)
ans.append(((a-1)//10+1+(b-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+c)
ans.append(((a-1)//10+1+(b-1)//10+1+(c-1)//10+1+(e-1)//10+1)*10+d)
ans.append(((a-1)//10+1+(b-1)//10+1+(c-1)//10+1+(d-1)//10+1)*10+e)
print(min(ans))

Submission status: Accepted

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [[a%10,a//10*10+10,a],[b%10,b//10*10+10,b],[c%10,c//10*10+10,c],[d%10,d//10*10+10,d],[e%10,e//10*10+10,e]]
s.sort()
for i in range(5):
    if s[0][0] == 0:
        s[0][1]-=10
        s.append(s.pop(0))
    else:
        break
s = np.array(s)
ans = s[0][2] + sum(s[1:,1])
print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
m = [(x+9)//10*10 for x in l]
d = [x - y for (x, y) in zip(m, l)]
print(sum(m)-max(d))

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
m = [(x+9)//10*10 for x in l]
s = sum(m)
print(min([s-m[i]+l[i] for i in range(5)]))

Submission status: Accepted

Solution code:
import math

l = [int(input()) for _ in range(5)]
m = [math.ceil(l[i]/10)*10 for i in range(5)]
s = sum(m)
ans = [s-m[i]+l[i] for i in range(5)]
print(min(ans))

Submission status: Accepted

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

from itertools import permutations

def ceil_base10(x):
    q,r = divmod(x, 10)
    return 10*(q + min(r, 1))

ans=10**12
for A,B,C,D,E in permutations([a,b,c,d,e], 5):
    s = sum([ceil_base10(x) for x in [A,B,C,D]]) + E
    ans = min(ans, s)

print(ans)

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
a =[]
for i in range(5):
    x = int(input())
    x2 =x %10
    x3 =x
    #10分刻みにする
    x /= 10 
    if not x.is_integer():
        x=int(x)*10 +10
    else:
        x =int(x)*10
    if x2 ==0:
        x2 =10
    a.append((x2,x,x3))
a.sort(reverse=True)
ans =0
for i in range(4):
    ans +=a[i][1]
ans +=a[4][2]
print(ans)

Submission status: Accepted

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

A = list(map(int, input().split()))

res = 0
mi = 10

for a in A:
    x, y = divmod(a, 10)
    if not y:
        res += x
    else:
        res += x + 1
        mi = min(mi, y)
print(res * 10 + mi - 10)

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
X=[A%10,B%10,C%10,D%10,E%10]
minimum=100
for i in range(5):
  if X[i]!=0:
    minimum=min(minimum,X[i])
Y=[A,B,C,D,E]
if minimum==100:
  minimum=0
last=X.index(minimum)
time=0
import math
for i in range(5):
  if i!=last:
    time =time+10*math.ceil(Y[i]/10)
if X==[0,0,0,0,0]:
  print(sum(Y))
else:
  print(time+Y[last])

Submission status: Accepted

Solution code:
import itertools

foods = [int(input()) for _ in range(5)]
all_route = list(itertools.permutations(foods))
ans = []
for route in all_route:
    total = 0

    for i in range(len(route) - 1):
        total += route[i]
        if route[i] % 10 != 0:
            total += 10 - route[i] % 10
    total += route[-1]
    ans.append(total)
print(min(ans))

Submission status: Accepted

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

s = []
for i in range(5):
    s.append(t[i] % 10)

o = 5
p = 10
for i in range(5):
    if s[i] > 0:
        if p > s[i]:
            o = i
            p = s[i]

m = 0
for i in range(5):
    if i != o:
        if s[i] == 0:
            m += t[i]
        else:
            m += t[i] - t[i] % 10 + 10

if o != 5:
    m += t[o]
print(m)

Submission status: Accepted

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

new_list = []
for i in range(5):
    time = time_list[i]
    amari = 10 - int(str(time_list[i])[-1])
    if amari == 10:
        amari = 0
    new_list.append((time, amari))

new_list = sorted(new_list, key=lambda x: x[1])

total = 0
for i in range(4):
    total += new_list[i][0]
    total += new_list[i][1]

total += new_list[4][0]
print(total)

Submission status: Accepted

Solution code:
def order(x):
    return (x + 9) // 10 * 10

def wait(x):
    return order(x) - x

dishes = [int(input()) for _ in range(5)]
total = sum(order(i) for i in dishes)
total -= max(wait(i) for i in dishes)
print(total)

Submission status: Accepted

Solution code:
from itertools import permutations
dishes = [int(input()) for _ in range(5)]
res = 10 ** 3
for di in permutations(dishes):
    tmp = 0
    for d in di:
        if tmp % 10 != 0:
            tmp += (10 - tmp % 10)
        tmp += d
    res = min(res, tmp)
print(res)

Submission status: Accepted

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
import math
from operator import itemgetter
input = sys.stdin.readline

list_time = [int(input()) for i in range(5)]
list_CeilMati = [[0, 0] for i in range(5)]

temp = 0.0
for i in range(5):
    temp = list_time[i]/10
    list_CeilMati[i][0] = math.ceil(temp) * 10
    list_CeilMati[i][1] = list_CeilMati[i][0] - list_time[i]

# print(list_CeilMati)
list_CeilMati.sort(key=lambda x: x[1])
# print(list_CeilMati)

ans = 0
for i in range(5):
    ans += list_CeilMati[i][0]
ans -= list_CeilMati[5-1][1]

print(ans)

Submission status: Accepted

Solution code:
l = []
for i in range(5): l.append(int(input()))
ok = False
for i in range(5):
    if l[i] % 10 != 0: ok = True
if ok == 0:
    print(sum(l))
    exit()
mini = 9
for i in range(5):
    if l[i] % 10 != 0 and l[i] % 10 < mini % 10:
        mini = l[i]
ans = mini
for i in range(5):
    d = l[i] // 10
    if l[i] % 10 != 0: d += 1
    ans += d * 10
d = mini // 10
d += 1
ans -= d * 10
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=10*(math.ceil(a/10))
B=10*(math.ceil(b/10))
C=10*(math.ceil(c/10))
D=10*(math.ceil(d/10))
E=10*(math.ceil(e/10))

re1=A-a
re2=B-b
re3=C-c
re4=D-d
re5=E-e
result=[[re1,A],[re2,B],[re3,C],[re4,D],[re5,E]]
result.sort()
ans=0
for i in range(5):
    if i==4:
        ans+=result[i][1]-result[i][0]
        break
    ans+=result[i][1]
print(ans)

Submission status: Accepted

Solution code:
from math import ceil
lst = []
ten = []
for i in range(5):
  t = int(input())
  if t % 10 == 0:
    ten.append(t)
  else:
    lst.append(t)
if lst == []:
  print(sum(ten))
  exit()
x = min(lst, key=lambda x: x % 10)
lst.remove(x)
for i in range(len(lst)):
  lst[i] = 10 * (lst[i] // 10 + 1)
print(x + sum(lst) + sum(ten))

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
y = 0
x = [i%10 for i in a]
if max(x) > 0:
    y = 10 - min(filter(lambda i:i!= 0, x))
b = [(i+9) // 10 *10 for i in a]
print(sum(b) - y)

Submission status: Accepted

Solution code:
import math

li=[int(input()) for _ in range(5)]
m,last,ans,lm=10,li[0],0,0

for i in range(5):
  l = li[i]
  if 0 < l % 10 < m :
    m = l % 10
    last = l
    lm = i

for i in range(5):
  l=li[i]
  if l == last and i == lm:
    ans += l
  else:
    ans += math.ceil(l/10)*10
    
print(ans)

Submission status: Accepted

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

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

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

for i in range(5):
    if ABCDE[i][0] % 10 == 0:
        ABCDE[i].append(ABCDE[i][0])
        ABCDE[i].append(0)
        
    else:
        wait = ((ABCDE[i][0] // 10) + 1) * 10
        ABCDE[i].append(wait)
        ABCDE[i].append(wait - ABCDE[i][0])

ABCDE.sort(key = lambda x : x[2])

ans = ABCDE[4][0]

for i in range(4):
    ans += ABCDE[i][1]
    
print(ans)

Submission status: Accepted

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

rem = float("inf")
last = 0
for time in times:
    if time % 10 < rem and time % 10 != 0:
        rem = time % 10
        last = time
if last:
    times.remove(last)

total_time = 0
for time in times:
    if time % 10 == 0:
        total_time += time
    else:
        total_time += time + (10 - time % 10)
total_time += last

print(total_time)

Submission status: Accepted

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

total_time = 0
while times:
    if len(times) != 1:
        for i in range(len(times)):
            if times[i] % 10 == 0:
                total_time += times[i]
                times.remove(times[i])
                break
        else:
            rem = 0
            re_time = 0
            for time in times:
                if time % 10 > rem:
                    rem = time % 10
                    re_time = time
            total_time += re_time + (10 - rem)
            times.remove(re_time)
    else:
        total_time += times.pop()
        
print(total_time)

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(5)]
s=[]
for i in range(5):
    s.append((((l[i]//10)+1)*10-l[i])%10)
print(sum(l)+sum(s)-max(s))

Submission status: Accepted

Solution code:
def t(n):
  if n%10==0:
    return n
  else:
    return ((n//10)+1)*10
def k(n):
  if n%10==0:
    return 0
  else:
    return 10-(n%10)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
L=[k(a),k(b),k(c),k(d),k(e)]
print(t(a)+t(b)+t(c)+t(d)+t(e)-max(L))

Submission status: Accepted

Solution code:
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()

a=[]
r=[]
for i in range(5):
  s=ii()
  a.append(s)
  r_=s%10
  if r_==0:
    r_=10
  r.append(r_)
  
ans=0
while len(r)>1:
  k=r.index(max(r))
  remain=r.pop(k)
  A=a.pop(k)
  #print(A)
  ans+=A-remain+10
  
print(ans+a[0])

Submission status: Accepted

Solution code:
import itertools

A = [int(input())for i in range(0,5,1)]

ans = 10**10
for Atmp in list(itertools.permutations(A)):
    time = 0
    for i in range(0,5,1):
        if time%10 != 0:
            time += (10-time%10)
        time += Atmp[i]
    ans = min(ans,time)
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=A%10
b=B%10
c=C%10
d=D%10
e=E%10
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
abcde=[a,b,c,d,e]
small=min(abcde)
abcde.sort()
while (small==0) & (len(abcde)!=0):
    try:
        del abcde[0]
        small=abcde[0]
    except:
        pass
if len(abcde)==0:
    small=10
print(A+B+C+D+E-(10-small))

Submission status: Accepted

Solution code:
List=[int(input()) for i in range(5)]
num=[10,20,30,40,50,60,70,80,90,100,110,120,130]
time=0
table=[]
for i in range(5):
    subtract=0
    for j in range(len(num)):
        if List[i]<=num[j]: 
            subtract=num[j]
            break
    table.append([subtract-List[i],List[i]])
table.sort()
for i in range(5):
    time+=table[i][0]+table[i][1]
time-=table[4][0]
print(time)

Submission status: Accepted

Solution code:
import math
A = [int(input()) for _ in range(5)]
B = 0
C = 0
for i in range(5):
    B += math.ceil(A[i]/10)*10
    C = max(math.ceil(A[i]/10)*10 - A[i],C)
print(B-C)

Submission status: Accepted

Solution code:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a2 = (math.ceil(a / 10)) * 10
b2 = (math.ceil(b / 10)) * 10
c2 = (math.ceil(c / 10)) * 10
d2 = (math.ceil(d / 10)) * 10
e2 = (math.ceil(e / 10)) * 10
ls = [0 for i in range(5)]
ls[0] = a + b2 + c2 + d2 + e2
ls[1] = a2 + b + c2 + d2 + e2
ls[2] = a2 + b2 + c + d2 + e2
ls[3] = a2 + b2 + c2 + d + e2
ls[4] = a2 + b2 + c2 + d2 + e
print(min(ls))

Submission status: Accepted

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

ans = 0
min_div = 10
for i in l:
  ans += 10 * ((i + 10 - 1) //10)
  if i % 10 != 0:
  	min_div = min(min_div, i % 10)
print(ans - (10 - min_div))

Submission status: Accepted

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

zako=9
switch=0
for i in range(5):
    b=a[i]%10
    if b<=zako and b!=0:
        zako=b
        memory=i
        switch=1

if switch==0:
    memory=1
x=a.pop(memory)

lst=[]

for i in range(4):
    c=a[i]//10
    c=c*10
    if a[i]%10!=0:
        c+=10
    lst.append(c)

print(x+sum(lst))

Submission status: Accepted

Solution code:
A = []
m = 0
ans = 0
for i in range(5):
  a = int(input())
  if a%10 != 0:
    if round(a+5, -1) - a > m:
      m = round(a+5, -1) - a
    ans += round(a+5,-1)
  else:
    ans += a
print(ans-m)

Submission status: Accepted

Solution code:
from itertools import permutations
import numpy as np

lis = [int(input()) for i in range(5)]
total = np.inf
now = 0
for a,b,c,d,e in permutations(lis,5):
    now = ((a-1)//10+1)*10+((b-1)//10+1)*10+((c-1)//10+1)*10+((d-1)//10+1)*10+e
    total = min(total,now)
    #print(now)
    #print(total)

print(total)

Submission status: Accepted

Solution code:
import math
count = 0
amari = 10
for i in range(5):
  n = int(input())
  if n%10 == 0:
    count += n
  else:
    count += math.ceil(n/10)*10
    amari = min(amari,n%10)
if amari %10 == 0:
  print(count + amari - 10) 
else:
  print(count + amari -10)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = A%10
if a==5 or a==0:
  a = a+0
else:
  a = 10-a
b = B%10
if b==5 or b==0:
  b = b+0
else:
  b = 10-b
c = C%10
if c==5 or c==0:
  c = c+0
else:
  c = 10-c
d = D%10
if d==5 or d==0:
  d = d+0
else:
  d = 10-d
e = E%10
if e==5 or e==0:
  e = e+0
else:
  e = 10-e
remainder = min(a+b+c+d, a+b+c+e, a+b+d+e)
minimalr = min(remainder, a+c+d+e, b+c+d+e)
print(A+B+C+D+E+minimalr)

Submission status: Accepted

Solution code:
import math
m = [int(input()) for _ in range(5)]
ans = 0
b = 0
for i in m:
  ans+=math.ceil(i/10)*10
  if i%10!=0:
    b=max(b, 10-i%10)
print(ans-b)

Submission status: Accepted

Solution code:
import math
a = []
for _ in range(5):
    a.append(int(input()))
ans = 0
b = 0

for i in a:
    ans += math.ceil(i/10)*10
    if i%10 != 0:
        b = max(b, 10-i%10)
print(ans-b)

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

n = 10
cnt = 0

for i in range(len(a)):
	if int(a[i][-1]) < n and int(a[i][-1]) != 0 :
		n = int(a[i][-1])
		cnt = i

for i in range(len(a)):
	if i == cnt:
		a[i] = int(a[i])
	elif int(a[i][-1]) == 0:
		a[i] = int(a[i])
	else:
		a[i] = (int(a[i])//10 + 1)*10

print(sum(a))

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

n = 9
cnt = 0
for i in range(len(a)):
	if int(a[i][-1]) < n and int(a[i][-1]) != 0 :
		n = int(a[i][-1])
		cnt = i
for i in range(len(a)):
	if i == cnt:
		a[i] = int(a[i])
	elif int(a[i][-1]) == 0:
		a[i] = int(a[i])
	else:
		a[i] = (int(a[i])//10 + 1)*10
print(sum(a))

Submission status: Accepted

Solution code:
D = [int(input()) for t in range(5)]
lag=[]
for i in range(5):
	lag.append(int(round(D[i]+4.1,-1))-D[i])
lag.pop(lag.index(max(lag)))
print(sum(D)+sum(lag))

Submission status: Accepted

Solution code:
def KiriageTime(x):
  return (x+9)//10*10

def sabun(x):
  return KiriageTime(x)-x

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
KiriageTotal=KiriageTime(A)+KiriageTime(B)+KiriageTime(C)+KiriageTime(D)+KiriageTime(E)
print(KiriageTotal-max(sabun(A),sabun(B),sabun(C),sabun(D),sabun(E)))

Submission status: Accepted

Solution code:
import math
 
S = []
L = []
for i in range(5):
    D = int(input())
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)
    
print(int((sum(S) - max(L))*10))

Submission status: Accepted

Solution code:
from math import ceil
time=[int(input()) for i in range(5)]
amari=[]
ans=0
for i in time:
    if i%10!=0:
        amari.append([i%10,ceil(i/10),i])

    else:
        amari.append([114514,ceil(i/10),i])
amari.sort()
amari.reverse()
for i in range(len(amari)):
    ans+=amari[i][1]*10
ans-=amari[-1][1]*10
ans+=amari[-1][2]
print(ans)

Submission status: Accepted

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

a2 = (a+9)//10 * 10
b2 = (b+9)//10 * 10
c2 = (c+9)//10 * 10
d2 = (d+9)//10 * 10
e2 = (e+9)//10 * 10

sum = a2+b2+c2+d2+e2
ans = 1e18
ans = min(ans, sum-a2+a)
ans = min(ans, sum-b2+b)
ans = min(ans, sum-c2+c)
ans = min(ans, sum-d2+d)
ans = min(ans, sum-e2+e)

print(ans)

Submission status: Accepted

Solution code:
import math

S = []
L = []
for i in range(5):
    D = int(input())
    T = math.ceil(D/10)
    S.append(T)
    L.append(T-D/10)

print(int((sum(S) - max(L))*10))

Submission status: Accepted

Solution code:
def solve():
    d = [int(input()) for _ in range(5)]
    d.sort(reverse=True, key=lambda a: a % 10 if a % 10 > 0 else 9)
    for i in range(4):
        d[i] = -(-d[i]//10) * 10
    print(sum(d))


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
ais = map(int, [raw_input() for _ in range(5)] )
ais.sort(key = lambda x:-x % 10)
s = 0
for i in range(4):
  s += (ais[i] + 9)/10 * 10
s += ais[-1]
print s

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
answer = 0
cooking_time_order = sorted([A, B, C, D, E], key=lambda x: 10 - (x % 10))
for _ in range(5):
    if cooking_time_order[-1] % 10 == 0:
        answer += cooking_time_order[-1]
        cooking_time_order.pop()
    else:
        break
if len(cooking_time_order) == 0:
    pass
else:
    for cooking_time in cooking_time_order[:-1]:
        answer += (cooking_time + (10 - (cooking_time % 10)))
    answer += (cooking_time_order[-1])
print(answer)

Submission status: Accepted

Solution code:
import sys

a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
c = int(sys.stdin.readline())
d = int(sys.stdin.readline())
e = int(sys.stdin.readline())

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

min_m = 10
for dish in dishes:
    diff = dish % 10
    if diff > 0:
        min_m = min(min_m, diff)

ans = 0
tmp = -1
for dish in dishes:
    diff = dish % 10
    if min_m != 10 and diff == min_m and tmp == -1:
        tmp = dish
    else:
        if diff:
            ans += dish + 10 - diff
        else:
            ans += dish
tmp = 0 if tmp == -1 else tmp
print(ans + tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lis = [int(input()) for _ in range(5)]
lis2 = [i % 10 for i in lis]

x = 0
a = 9
time = 0

for id,val in enumerate(lis2):
    if 0 < val < a:
        x = id
        a = val

for id2, val2 in enumerate(lis):
    if id2 == x:
        continue
    else:
        time += (-(-val2//10)) * 10

print(time+lis[x])

Submission status: Accepted

Solution code:
d = list(map(int,open(0)))
d.sort(key=lambda x:(x-1)%10, reverse=True)
print(sum((x+9)//10*10 for x in d[:-1]) + d[-1])

Submission status: Accepted

Solution code:
from math import ceil
a=[int(input()) for i in range(5)]
ans=10
sum=0
for i in a:
  x=(i-1)%10+1
  ans=min(ans,x)
  sum+=ceil(i/10)*10
if ans==10:
  print(sum)
else:
  print(sum+ans-10)