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
# Your code here!
import itertools

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


    

m = 1000000
for nums in itertools.permutations(P):
    
    s = 0
    
    for i, num in enumerate(nums):
        s += num
        if s % 10 != 0 and i != 4:
            s += (10 - s % 10)
    m = min([m, s])

print(m)

Submission status: Accepted

Solution code:
lst = [0] * 5

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

s = 0
for i in range(5):
  s += (lst[i]+9) // 10 * 10
  
ans = s
for i in range(5):
  if lst[i] % 10:
  	ans = min(ans, s-10+lst[i]%10)
  
print(ans)

Submission status: Accepted

Solution code:
menu_time=[]
total_time = 0
last_time = 9
for i in range(0,5):
    a = int(input())
    menu_time.append(a)
for i in range(0,5):
    if menu_time[i]%10==0:
        total_time+=menu_time[i]
    else:
        total_time+=(menu_time[i]//10+1)*10
for i in range(0,5):
    if menu_time[i]%10!=0 and menu_time[i]%10<last_time:
        last_time = menu_time[i]%10
    else:
        dum=0
if menu_time[0]%10==menu_time[1]%10==menu_time[2]%10==menu_time[3]%10==menu_time[4]%10==0:
    dum = 0
else:
    total_time+=last_time-10
print(total_time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
b = []
for i in range(5):
	x = a[i]%10
	if x != 0:
	    b.append(10 - x)
ans = 0
for u in a:
    ans += u // 10 * 10
ans += len(b) * 10
if len(b) != 0:
	ans -= max(b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
    
a.sort(reverse=True, key=lambda x: (x-1)%10)

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

Submission status: Accepted

Solution code:
p=[]
m=[]
ans=0
p.append(int(input()))
p.append(int(input()))
p.append(int(input()))
p.append(int(input()))
p.append(int(input()))

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


for i in p:
    if i%10 != 0:
        m.append(i%10)

if len(m) >0:
    print(ans - (10-min(m)))
else:
    print(ans)

Submission status: Accepted

Solution code:
sum =0
min_time =10

for i in range (5):
    x = int(input()) 
    if x%10 > 0 :
        if x%10 < min_time :
            min_time = x%10;
        x = (int(x/10) +1)*10;
        sum = sum+x;
    else:
        sum = sum+x;
print (sum-(10-min_time));

Submission status: Accepted

Solution code:
origin_time = []
wait_time = []
dead_time = []
for i in range(5):
    origin = int(input())
    origin_time.append(origin)
    wait = int((origin + 9)/10) * 10
    wait_time.append(wait)
    dead = wait - origin
    dead_time.append(dead)

print(str(sum(wait_time)-max(dead_time)))

Submission status: Accepted

Solution code:
import math

one = [10]
total = 0
for i in range(5):
    time = input()
    if time[-1] != "0":
        one.append(int(time[-1]))
    time = int(time)
    time = math.ceil(time / 10) * 10
    total += time
total += min(one) - 10
print(int(total))

Submission status: Accepted

Solution code:
import itertools

def f(x):
    if x[1] == 0:
        return x[1]
    else:
        return 10 -x[1] 

a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))


b = []

for i in a:
    c = i - (int(i / 10) * 10) 
    b.append((i, c))

b.sort(key=f)

x = 0

for i in b:
    x += i[0]
    if i[1] != 0:
        x += 10 - i[1]
        l = 10 - i[1]
    else:
        l = 0
x -= l

print(x)

Submission status: Accepted

Solution code:
times = [int(raw_input()) for i in range(5)]
dists = [(i % 10 or 10) for i in times]
last_index = dists.index(min(dists))
print sum([(time / 10 + (1 if time % 10 else 0)) * 10 for ind, time in enumerate(times) if ind != last_index] + [times[last_index]])

Submission status: Accepted

Solution code:
import math
import sys

ts = [int(i) for i in sys.stdin.read().split('\n') if i != '']
ds = [int(math.ceil(t / 10) * 10) - t for t in ts]
m = max(ds)
ds.remove(m)
ans = sum(ts) + sum(ds)
print(ans)

Submission status: Accepted

Solution code:
A=[int(input()) for i in range(5)]
B=[a-a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b-a) for a,b in zip(A,B)]
print(sum(B)-max(diff))

Submission status: Accepted

Solution code:
lst = []
for i in range(5):
    lst.append(int(input()))
lst.sort(reverse=True, key = lambda x : (x - 1) % 10)
s = 0
for i in range(5):
    s += lst[i]
    if s % 10 != 0 and i != 4:
        s += 10 - s % 10

print(s)

Submission status: Accepted

Solution code:
ar = []
br = []
cr = []
mn = 10
for i in range(5):
    l = input()
    if int(l) % 10 == 0:
        ar.append(int(l))
    else:
        br.append(int(l))
        if mn > int(l) % 10:
            mn = int(l) % 10
for r in br:
    if str(r)[-1] == str(mn) and len(cr) == 0:
        cr.append(r)
    else:
        r += 10 - (r % 10)
        ar.append(r)
if len(cr) == 1:
    print(sum(ar) + cr[0])
else:
    print(sum(ar))

Submission status: Accepted

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

Submission status: Accepted

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

next_times = [0] * 5

for i, time in enumerate(times):
    next_times[i] = (time + 9) // 10 * 10

ans = 0xdeadbeef

for i in range(5):
    time = sum(next_times) - next_times[i] + times[i]
    ans = min(ans, time)

print(ans)

Submission status: Accepted

Solution code:
A=list(int(input())for i in range(5))
B=[a-a%10+10 if a%10!=0 else a for a in A]
diff=[(b-a)for a,b in zip(A,B)]
print(sum(B)-max(diff))

Submission status: Accepted

Solution code:
A=list(int(input())for i in range(5))
ans=0
num=0
com=0
for a in A:
    if a%10==0:
        ans+=a
    else:
        tmp=10-a%10
        ans+=(a//10+1)*10
        if com<tmp:
            com=tmp
            num=a
if num==0:
    print(ans)
else:
    ans-=(num//10+1)*10
    ans+=num
    print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

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

idx = 0
wk = 9
for i,d in enumerate(a):
    dd = d % 10
    if dd == 0:
        continue
    if dd < wk:
        wk = dd
        idx = i

a[N-1],a[idx] = a[idx],a[N-1]

sum = 0
for i in range(N-1):
    if (a[i] % 10) != 0:
        sum += int((a[i] / 10 + 1)) * 10
    else:
        sum += int(a[i])

sum += a[N-1]

print(sum)

Submission status: Accepted

Solution code:
times = [int(input()) for _ in range(5)]
delays = [(10 - t) % 10 for t in times]
max_delay = max(delays)

print(sum(times) + sum(delays) - max_delay)

Submission status: Accepted

Solution code:
time = [0 for _ in range(5)]
wait = [0 for _ in range(5)]
for i in range(5):
    time[i] = int(input())
    wait[i] = 10 - (time[i] % 10)
    if wait[i] == 10:
        wait[i] = 0
print(sum(time) + sum(wait) - max(wait))

Submission status: Accepted

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

amari = []
totalTime = sum(t)

for num in t:
    if num%10 != 0:
        amari.append(10 - num%10)
amari.sort(reverse=True)

for i in amari[1:]:
    totalTime = totalTime + i

print(totalTime)

Submission status: Accepted

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

R=[a,b,c,d,e]
TT=0
t=[0]*5
T=[0]*5

for i in range(10):
	if (R[0]+i)%10 == 0:
		t[0]=a+i
	if (R[1]+i)%10 == 0:
		t[1]=b+i
	if (R[2]+i)%10 == 0:
		t[2]=c+i
	if (R[3]+i)%10 == 0:
		t[3]=d+i
	if (R[4]+i)%10 == 0:
		t[4]=e+i

for k in range(5):
    TT+=t[k]

for j in range(5):
    T[j]=TT-t[j]+R[j]
print(min(T))

Submission status: Accepted

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

time = 0
for dish_time in data:
    time += (dish_time + 9) // 10 * 10

time -= max([10 - time % 10 for time in data if time % 10] + [0])

print(time)

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
T = [(-(-i//10))*10 for i in t]
t_min = [i%10 for i in t]
t_min = min([i for i in t_min if i != 0]) if t_min != [0 for i in range(5)] else 10
print(sum(T) - 10 + t_min)

Submission status: Accepted

Solution code:
a,b=[],[]
c,time=0,0
for i in range(5):
  c=int(input())
  a.append(c)
  if c%10==0:
    b.append(10-c%10)
  else:
    b.append(c%10)#1~10
for i,j in enumerate(b):
  if j==10:
    time+=a[i]
  else:
    time+=a[i]+10-j

print(time-10+min(b))

Submission status: Accepted

Solution code:
l = list(int(input()) for i in range(5))
nlist = []
Sum = 0

for i in range(5):
    if l[i]%10 == 0:
        nlist.append(0)
    else:
        nlist.append(10 - (l[i]%10))
        
if nlist[0] == nlist[1] == nlist[2] == nlist[3] == nlist[4] == 0:
    print(l[0]+l[1]+l[2]+l[3]+l[4])
else:
    #リストlにリストnlistをそれぞれ加える
    for i in range(5):
        Sum += l[i] + nlist[i]
    print(Sum - max(nlist))

Submission status: Accepted

Solution code:
import math
arr = []
tmp = 0
rem = 10
ans = 0
for i in range(5):
    x = int(input())
    arr.append(x)
    if (x%10 < rem) and (x%10 >0):
        rem = x % 10
        tmp = x
for item in arr:
    if item == tmp:
        arr.remove(item)
        arr.append(item)
for item in arr:
    ans+= math.ceil(item/10)*10
print (ans - 10 + rem)

Submission status: Accepted

Solution code:
l = list(int(input()) for i in range(5))
A=[]
sum=0

for i in range(5):
    if l[i]%10 == 0:
        A.append(0)
    else:
        A.append(10-(l[i]%10))
    
if A[0]==A[1]==A[2]==A[3]==A[4]==0:
    print(l[0]+l[1]+l[2]+l[3]+l[4])
else:
    for k in range(5):
        sum += l[k]+A[k]
    print(sum-max(A))

Submission status: Accepted

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

def ceilOnesPlace(i:int):
    return int((i + 9) / 10) * 10

S = sum([ceilOnesPlace(con) for con in ipt])

S -= max([(10 - (con%10))%10 for con in ipt])

print(S)

Submission status: Accepted

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

minnum = 1000
minidx = 6
for i, con in enumerate(ipt):
    if con % 10 != 0:
        if minnum > con % 10:
            minnum = con % 10
            minidx = i

print(sum([int((con+9)/10)*10 if i != minidx and con%10 != 0 else con for i,con in enumerate(ipt)]))

Submission status: Accepted

Solution code:
#入力を受け取る
a = []
for i in range (5):
  a += [int(input())]
#各メニューが届くのに必要な時間を計算
b = []
c = 9
d = -1
if (a[0] % 10 == 0 and a[1] % 10 == 0 and a[2] % 10 == 0 and a[3] % 10 == 0 and a[4] % 10 == 0):
  time = 0
  for i in range (5):
    time += a[i]
else:
  for i in range (5):
    m = a[i] % 10
    if m == 0:
      b += [a[i]]
    elif c >= m:
      c = m
      b += [((d // 10) + 1) * 10]
      d = a[i]
    else:
      b += [(a[i] // 10 + 1) * 10]
  time = d
  for i in range (5):
    time += b[i]
print(time)

Submission status: Accepted

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

m = 10
a = [A, B, C, D, E]

for i in range(len(a)):

 if a[i] % 10 <= m and a[i] % 10 != 0:
     m = a[i] % 10


for j in range(len(a)):
  if a[j] % 10 != 0:
     a[j] = a[j] + (10 - a[j] % 10)

print(sum(a) - (10 - m))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
ans=10
a=0
for i in range(5):
    t=int(input())
   
    l=t%10 
    a+=t+(10-l)
    if(l==0):
        a-=10
    if(l!=0 and l<ans):
        ans=l
    #print(ans)
print(a-(10-ans))

Submission status: Accepted

Solution code:
ans = 0
for _ in range(5):
    i = int(input())
    if i % 10 == 0:
        ans += i
    elif ans % 10 == 0:
        ans += i
    else:
        if ans % 10 > i % 10:
            ans = (ans // 10 + 1) * 10
            ans += i
        else:
            ans += (i // 10 + 1) * 10
print(ans)

Submission status: Accepted

Solution code:
A = []
for i in range(5):
    a = int(input())
    A.append(a)
min_mod = 10
mod_list = []
for a in A:
    if a % 10 == 0:
        min_mod = min(min_mod, 10)
    else:
        min_mod = min(min_mod, a % 10)
    mod_list.append(a % 10)
for i,m in enumerate(mod_list):
    if m == min_mod:
        break
ans = 0
for j in range(5):
    if j == i:
        continue
    ans += (A[j] // 10) * 10 + 10 * ((A[j] % 10) > 0)
ans += A[i]
print(ans)

Submission status: Accepted

Solution code:
import math
T = [int(input()) for i in range(5)]
m = [(T[i]+9)%10 for i in range(5)]
idx = m.index(min(m))
d = m[idx]+1
result = sum([math.ceil(T[i]/10)*10 for i in range(5)])
result -= 10 - d
print(result)

Submission status: Accepted

Solution code:
time=[]
for i in range(5):
    temp=[]
    temp.append(int(input()))
    if temp[0]%10==0:
        temp.append(0)
    else:
        temp.append(10-temp[0]%10)
    time.append(temp)
time=sorted(time,key=lambda x:x[1])
sum=0
for i in range(5):
    sum+=time[i][0]
    sum+=time[i][1]
print(sum-time[4][1])

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

aa = [int(input()) for _ in range(5)]
ans = 0
tmp = INF
for a in aa:
    ans += (a-1)//10 * 10 + 10
    tmp = min(tmp,(a-1)%10+1)

print(ans+tmp-10)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
n = [int(input()) for i in range(5)]
# 最後の注文だけ決めれば良い。
m = list(map(lambda x:(x-1)%10,n))
min_m_idx = m.index(min(m))

l = list(map(lambda x:math.ceil(x/10)*10,n))
del l[min_m_idx]
print(n[min_m_idx] + sum(l))

Submission status: Accepted

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

total = 0
compare = 0
largest = 0

if sum(food)%10 == 0:
    print(sum(food))

else:
    for x in food:
        if (10 - (x % 10) > compare) and ((x % 10) != 0):
            largest = x
            compare = 10 - (x % 10)

    food.remove(largest)

    for i in range(len(food)):
        if food[i] % 10 != 0:
            total += round(food[i] + 5.1, -1)
        else:
            total += food[i]

    print(int(total+largest))

Submission status: Accepted

Solution code:
tot = 0
m = 0
for i in range(5):
    s = int(input())
    if s % 10 == 0:
        rem = 0
    else:
        rem = s%10 - 10
        s = 10*(s//10 + 1)
    m = min(m, rem)
    tot += s

print(tot+m)

Submission status: Accepted

Solution code:
class Dish:

    dish_sum = 0
    dish_max = 0

    def __init__(self,value):
        self.value = value
        self.diff = (10 - value) % 10
        Dish.dish_sum += self.value + self.diff
        Dish.dish_max = self.diff if Dish.dish_max < self.diff else Dish.dish_max


dishes = [Dish(int(input())) for i in range(5)]
print(Dish.dish_sum - Dish.dish_max)

Submission status: Accepted

Solution code:
import numpy as np
from itertools import permutations

# Input
menus = []
for i in range(5):
  menus.append(int(input()))

# Main
def calc(menus):
  t = 0
  for i, menu in enumerate(menus):
    t += menu
    if i < 4:
	    t = np.ceil(t / 10) * 10
  return t

minima = np.inf
for menu in permutations(menus):
  minima = min(minima, calc(menu))
print(int(minima))

Submission status: Accepted

Solution code:
waitTime = []
_time = 0
for i in range(0,5):
    t, mod = divmod(int(input()), 10)
    _time += (t * 10)
    if mod != 0:
        waitTime.append(mod)
if len(waitTime) > 0:
    waitTime = sorted(waitTime, reverse= True)
    _time += (len(waitTime) - 1) * 10
    _time += min(waitTime)
print(_time)

Submission status: Accepted

Solution code:
import math

ans = 0
maxRemain = 0

for i in range(5):
    a = int(input())

    rn = math.ceil(a/10)*10
    ans = ans + rn 

    if maxRemain < (rn - a):
        maxRemain = rn - a

print(ans-maxRemain)

Submission status: Accepted

Solution code:
import math

inputList = []
for i in range(5):
    a = int(input())
    inputList.append((math.ceil(a/10)*10 - a, a))

inputList.sort()

ans = 0
for i in range(4):
    ans = ans + inputList[i][0] + inputList[i][1]

ans = ans + inputList[4][1]
print(ans)

Submission status: Accepted

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

a_s = (a + (10 - a%10) if (a%10 != 0) else a)
a_a = a%10
b_s = (b + (10 - b%10) if (b%10 != 0) else b)
b_a = b%10
c_s = (c + (10 - c%10) if (c%10 != 0) else c)
c_a = c%10
d_s = (d + (10 - d%10) if (d%10 != 0) else d)
d_a = d%10
e_s = (e + (10 - e%10) if (e%10 != 0) else e)
e_a = e%10

answer = (a_s + b_s + c_s + d_s + e_s)

List =[]
List.append(a_a)
List.append(b_a)
List.append(c_a)
List.append(d_a)
List.append(e_a)
List.sort()

for i in range(5):
    if(List[i] != 0):
        answer = answer - (10-List[i])
        break

print(answer)

Submission status: Accepted

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

l=[]
l.append([a,a%10])
l.append([b,b%10])
l.append([c,c%10])
l.append([d,d%10])
l.append([e,e%10])
for i in range(5):
  if l[i][1] == 0:
    l[i].append(l[i][0])
  else:
    l[i].append(l[i][0] + (10 - l[i][1]))
    
l.sort(key=lambda x:x[2] - x[0])
s = 0
for i in range(5):
  if i == 4 or l[i][1] == 0: s += l[i][0]
  else: s += l[i][0]+(10 - l[i][0]%10)
print(s)

Submission status: Accepted

Solution code:
A,B,C,D,E = [int(input()) for _ in range(5)]
a = (10-A) % 10
b = (10-B) % 10
c = (10-C) % 10
d = (10-D) % 10
e = (10-E) % 10
if a == b == c == d == e == 0:
  print(A+B+C+D+E)
else:
  print(A+B+C+D+E+a+b+c+d+e-max(a,b,c,d,e))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum-10+minmo)

Submission status: Accepted

Solution code:
import math
inp = [int(input()) for _ in range(5)]
answer = sum([math.ceil(ent / 10) * 10 for ent in inp])
gaps = [ent % 10 for ent in inp if ent % 10 > 0]
if len(gaps):
	answer = answer - 10 + min(gaps)
print(answer)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
A.sort()
dec = 10
dsum = 0
f = 0
for i in A:
    if i % 10 >= 1:
        dec = min(dec,i % 10)
        f = 1
    if not i % 10 == 0:
        dsum = dsum + (i - (i % 10) + 10)
    else:
        dsum = dsum + i
print(dsum+dec-10 if f == 1 else dsum)

Submission status: Accepted

Solution code:
import math

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

A_ceil = math.ceil(A/10)*10
B_ceil = math.ceil(B/10)*10
C_ceil = math.ceil(C/10)*10
D_ceil = math.ceil(D/10)*10
E_ceil = math.ceil(E/10)*10

f = max([A_ceil-A, B_ceil-B, C_ceil-C, D_ceil-D, E_ceil-E])

print(A_ceil+B_ceil+C_ceil+D_ceil+E_ceil-f)

Submission status: Accepted

Solution code:
times = [int(input()) for i in range(5)]
diff = [i % 10 for i in times if i % 10 != 0]
diff += [10]
ordertime = [((i + 9) // 10) for i in times]
print(sum(ordertime) * 10 + (-10 + min(diff)))

Submission status: Accepted

Solution code:
lis = [int(input()) for i in range(5)]
rep = [i - i % 10 + 10 if i % 10 != 0 else i for i in lis]
diff = [(r - l) for l, r in zip(lis, rep)]
print(sum(rep) - max(diff))

Submission status: Accepted

Solution code:
item = []

for i in range(5):
    item += [str(input())]

i = [
    item[0][len(item[0]) - 1],
    item[1][len(item[1]) - 1],
    item[2][len(item[2]) - 1],
    item[3][len(item[3]) - 1],
    item[4][len(item[4]) - 1]
]
i_replace = [int(a) if int(a) > 0 else 10 for a in i]

min_item = min(i_replace)
last_item = item[int(i_replace.index(min_item))]
item.pop(int(i_replace.index(min_item)))

rep = []
for ii in item:
    if int(ii[len(ii) - 1]) == 0:
        t = int(ii)
    else:
        s = 10 - int(ii[len(ii) - 1])
        t = int(ii) + s

    rep += [t]

rep += [int(last_item)]


print(sum(rep))

Submission status: Accepted

Solution code:
xs = [int(input()) for i in range(5)]
ps = []
for x in xs:
	ps.append(((x-1)%10+1, x))
ps.sort()
ans = 0
ans += ps[0][1]
for i in range(1, 5):
	ans += (ps[i][1] + 9) // 10 * 10
print(ans)

Submission status: Accepted

Solution code:
import math
minutes = []
for _ in range(5):
    minutes.append(int(input()))
minutes.sort(reverse = True, key = lambda x: x % 10 if x % 10 != 0 else 10)
x = 0
for minute in minutes:
    x = math.ceil(x / 10) * 10
    x += minute
print(x)

Submission status: Accepted

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

li2 = [];ans = 0
for i in li:
    if i%10 == 0:
        ans += i
    else:
        ans += i + (10-i%10)
        li2.append(i%10)
if li2 != []:
    ans -= 10-min(li2)

print(ans)

Submission status: Accepted

Solution code:
diff = list()
ans = 0
for i in range(5):
  x = int(input())
  ans += x if x %10 == 0 else x + 10 - (x % 10)
  diff.append(0 if x %10 == 0 else 10 - (x % 10))
diff = sorted(diff, reverse = True)
ans -= diff[0]
print(ans)

Submission status: Accepted

Solution code:
def f(x):
	if x!=0:
		return 10-x
	else:
		return x
def g(x):
	if x%10==0:
		return 10
	else:
		return x%10
a=[]
for i in range(5):
	a.append(int(input()))
b=[]
for i in range(5):
	b.append((g(a[i]),i))
c=[]
for i in range(5):
	c.append(f(b[i][0])+a[i])
b.sort()
t=b[0][1]
ans=0
for i in range(5):
	if i !=t:
		ans+=c[i]
ans+=a[t]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sum = 0
mind = 10
for i in range(5):
    A = int(input())
    d = A%10
    sum += A-d
    if d != 0:
        sum += 10
        mind = min(mind, d)

print(sum - 10 + mind)

Submission status: Accepted

Solution code:
A,B,C,D,E=int(input()),int(input()),int(input()),int(input()),int(input())
orders = {'A': A, 'B': B, 'C': C, 'D': D, 'E': E}
orders = sorted(orders.items(), key=lambda item: (10 if item[1] % 10 == 0 else item[1] % 10), reverse=True)
res = 0
while orders:
  if res % 10 != 0:
    res += (10 - res % 10)
  order = orders.pop(0)
  res += order[1]
print(res)

Submission status: Accepted

Solution code:
import itertools

a = [int(input()) for _ in range(5)]
ans = 130*5
for i in itertools.permutations(range(5)):
    tmp = 0
    for j in i:
        if a[i[j]]%10 == 0:
            tmp += a[i[j]]
        else:
            tmp += (a[i[j]] + (10 - a[i[j]]%10))
    if a[i[4]]%10 != 0:
        tmp -= (10 - a[i[4]]%10)
    if ans > tmp:
        ans = tmp

print("{}".format(ans))

Submission status: Accepted

Solution code:
def main() -> None:
    num = [int(input()) for _ in range(5)]
    ans = 0
    m = [0]
    for i in num:
        if i % 10:
            ans += i + 10 - i % 10
            m.append(10 - i % 10)
        else:
            ans += i
    print(ans - max(m))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

extra = [0]*5

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

ex = sum(extra) - max(extra) # 商品が届いてからの余剰時間を最小化したいので、最大の余剰時間を引く
print(sum(time) + ex)

Submission status: Accepted

Solution code:
order = [int(input()) for i in range(5)]
diff = (sorted(map(lambda x: (x % 10), order)))
diff = [i for i in diff if i != 0]

sum_order = sum(list(map(lambda x: -(-x //10), order))) * 10

if diff != []:
    sum_order += (-10 + diff[0])
    
print (sum_order)

Submission status: Accepted

Solution code:
import math
l = []
ans = 0
for i in range(5):
    x = int(input())
    l.append(x)
for i in range(1,10):
    f = False
    for j in l:
        if j % 10 == i:
            ans += j
            l.remove(j)
            f = True
            break
    if f: break
for x in l:
    ans += math.ceil(x/10) * 10
print(ans)

Submission status: Accepted

Solution code:


arr=[int(input()),int(input()),int(input()),int(input()),int(input())]
min=99
min_index=-1
for i,t in enumerate(arr):
    t_mod10 = t % 10
    if t_mod10 != 0 and t_mod10 < min:
        min = t_mod10
        min_index = i

sum = 0
for i,t in enumerate(arr):
    if i == min_index:
        sum += t
    else:
        sum += (t + 9) // 10 * 10

print(sum)

Submission status: Accepted

Solution code:
import itertools

def calc_time(dishes):
    time_sum = 0
    for t in dishes[:len(dishes) - 1]:
        time_sum += ((t - 1) // 10) * 10 + 10
    time_sum += dishes[-1]

    return time_sum

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

dishes_list = [A, B, C, D, E]

min_time = 10000
for dishes in itertools.permutations(dishes_list):
    if min_time > calc_time(dishes):
        min_time = calc_time(dishes)

print(min_time)

Submission status: Accepted

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

ans = 0
b = []
for aa in a:
    if aa%10 == 0:
        ans += aa
    else:
        b.append((aa, aa%10))
if len(b) > 0:
    b = sorted(b, key = lambda x: x[1], reverse = True)
    ans += sum([10*(bb//10+1) for bb, _ in b[:-1]])
    ans += b[-1][0]
print(ans)

Submission status: Accepted

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


def my_round(val):
    if val % 10 == 0:
        return val
    else:
        return val + (10 - val % 10)


def main():
    alpha = [int(input()) for _ in range(5)]
    ans = [0 for _ in range(5)]

    for i in range(5):
        for j, a in enumerate(alpha):
            if i == j:
                ans[i] += a
            else:
                ans[i] += my_round(a)

    print(min(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
A.sort(key=lambda x: x%10 if x%10!=0 else x)

#print(A)

ans = A[0]
for i in range(1,5):
    ans += ( (A[i] +9  )// 10 * 10)
print(ans)

Submission status: Accepted

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

a.sort(key=lambda x:(x-1)%10)

b=0
for i in range(5):
  if i==0:
    b+=a[i]
  else:
    c=(a[i]-1)//10+1
    b+=c*10
print(b)

Submission status: Accepted

Solution code:
n = 5;
a = [int(input()) for i in range(n)];
last = 9;
time = 0;
flag = True;

for i in a:
	if last % 10  >= i % 10 >= 1:
		time += last  // 10 * 10 + 10;
		last = i;
		flag = False;

	elif i % 10 == 0:
		time += i;

 	else:
		time += i  // 10 * 10 + 10;

if flag:
	print(time + last - 9);

else:	
	print(time + last - 10);

Submission status: Accepted

Solution code:
list1 = []
list2 = []

time = 0
for n in range(5):

    list1.append(int(input()))

for n in list1:
    q = n // 10
    mod = n % 10
    time += 10 * q
    if mod != 0:
        time += 10
        list2.append(mod)


if list2 != []:
    time = time - 10 + min(list2)
    print int(time)
else:
    print int(time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
result = 0
min = 10
for i in range(5):
    time = int(input())
    result = result+time if time%10 == 0 else result + time + 10-(time%10)
    if time % 10 < min and time % 10 !=0:
        min = time % 10
print(result - (10-min))

Submission status: Accepted

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

def po(x):
  p=x
  while p>10:
    p=p-10
  return p

k=[po(a),po(b),po(c),po(d),po(e)]
f=min(k)


s=a+b+c+d+e+40-po(a)-po(b)-po(c)-po(d)-po(e)+f

print(s)

Submission status: Accepted

Solution code:
list = []
keta = []
keta2 = []

for i in range(5) : 
    list.append(int(input()))
    
for i in range(5) : 
    a = str(list[i])
    keta.append(int(a[-1]))
    
    
# 0 は 10 に変更
for i in keta : 
    if i == 0 : keta2.append(int("10"))
    else : keta2.append(i)

    
# # minの位置を取得, 例外位置
# ex = keta2.index(min(keta2))


# minをリストから削除
sum = list.pop(keta2.index(min(keta2)))

num = 0

def ten(sel) : 
    global num
    if int(str(sel)[-1]) == 0 : num = sel
    else : 
        ten(sel+1)


for i in list : 
    if i == 0 : sum += i
    else : 
        ten(i)
        sum += num
        
print(sum)

Submission status: Accepted

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

dishes = [A, B, C, D, E]

dishes_time = [10 * (i // 10) +  10 if i % 10 != 0 else 10 * (i // 10) for i in dishes]

sum_time = sum(dishes_time)

FinishTime = 0x100000

for i in range(5):
    prov_time = sum_time - dishes_time[i] + dishes[i]
    if sum_time - dishes_time[i] + dishes[i] < FinishTime:
        FinishTime = prov_time

print(FinishTime)