Problem:


Score: 200 points

Problem Statement

The restaurant AtCoder serves the following five dishes:

ABC Don (rice bowl): takes A minutes to serve.

ARC Curry: takes B minutes to serve.

AGC Pasta: takes C minutes to serve.

APC Ramen: takes D minutes to serve.

ATC Hanbagu (hamburger patty): takes E minutes to serve.

Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.

This restaurant has the following rules on orders:

An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).

Only one dish can be ordered at a time.

No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.

E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

Constraints

A, B, C, D and E are integers between 1 and 123 (inclusive).

Input

Input is given from Standard Input in the following format:

A
B
C
D
E

Output

Print the earliest possible time for the last dish to be delivered, as an integer.

Sample Input 1

29
20
7
35
120

Sample Output 1

215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:

Order ABC Don at time 0, which will be delivered at time 29.

Order ARC Curry at time 30, which will be delivered at time 50.

Order AGC Pasta at time 50, which will be delivered at time 57.

Order ATC Hanbagu at time 60, which will be delivered at time 180.

Order APC Ramen at time 180, which will be delivered at time 215.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 2

101
86
119
108
57

Sample Output 2

481

If we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:

Order AGC Pasta at time 0, which will be delivered at time 119.

Order ARC Curry at time 120, which will be delivered at time 206.

Order ATC Hanbagu at time 210, which will be delivered at time 267.

Order APC Ramen at time 270, which will be delivered at time 378.

Order ABC Don at time 380, which will be delivered at time 481.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 3

123
123
123
123
123

Sample Output 3

643

This is the largest valid case.



Sample input:
29
20
7
35
120


Sample output:
215

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
a = []
for i in range(5):
    a.append(int(input()))
sum = 0
r =10
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r = min(r,a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+r)

Submission status: Accepted

Solution code:
import math
s = 0
m = 10
for i in range(5):
  n = int(input())
  if n % 10 != 0:
    m = min(m, int(str(n)[-1]))
    
  s += math.ceil( n * 0.1 )
if m % 10 != 0:
  s +=  m * 0.1 - 1
print(int(s*10))

Submission status: Accepted

Solution code:
ls =[]
for i in range(5):
    ls.append(int(input()))
rm = 10
time = 0
for i in ls:
    if i % 10 == 0:
        time += i
    else:
        time += (i//10+1)*10
        rm = min(rm,i%10)
time += rm - 10
print(time)

Submission status: Accepted

Solution code:
import math

dish=[int(input()) for _ in range(5)]
count={str(i%10):[] for i in range(10,-1,-1)}
for t in dish:
	one=t%10
	count[str(one)].append(t)

ans=0
d=0
for k,v in count.items():
	if v!=[]:
		for c in v:
			if d>3:
				ans+=c
			else:
				ans+=math.ceil(c/10)*10
				d+=1
print(int(ans))

Submission status: Accepted

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

min=9

min_f=0

for i in range(5):
    if min> li[i]%10 >0:
        min=li[i]%10
        min_f=i

cnt=0

for i in range(5):
    if i==min_f:
        continue
    if li[i]%10==0:
        cnt+=li[i]
    else:
        cnt+=li[i]+10-li[i]%10
print(cnt+li[min_f])

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
l = [a,b,c,d,e]
ld = [(a+9)%10,(b+9)%10,(c+9)%10,(d+9)%10,(e+9)%10]
i = ld.index(min(ld))
last = l[i]
l.remove(l[i])
for j in l:
  ans += ((j+9)//10)*10
print(ans+last)

Submission status: Accepted

Solution code:
import itertools, math
a = [int(input()) for i in range(5)]
x = 130*5
for i in itertools.permutations(a):
    y = 0
    for j in range(4):
        y+=math.ceil(i[j]/10)*10
    y+=i[4]
    x=min(x,y)
print(x)

Submission status: Accepted

Solution code:
from math import *
d = []
l = []
for i in range(5):
    n = int(input())
    t = ceil(n/10)
    d.append(t)
    l.append(t-n/10)
print(int((sum(d) - max(l))*10))

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    import math

    dishes = [int(input()) for _ in range(5)]
    dev_dis = [item % 10 for item in dishes if item % 10 != 0]
    dev_dis.sort()

    res = sum(dishes)
    if dev_dis:
        for item in dev_dis[1:]:
            if item != 0:
                res += 10 -item

    print(res)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
menu = [int(input()) for i in range(5)]
def kuriage(n):
    if n %10 == 0:
        return 0
    else:
        return 10-(n %10)
ans = 0
mini = 10
k = 5
for i in range(5):
    if menu[i] %10 < mini and menu[i]%10 !=0:
        mini = menu[i] %10
        k = i
for i in range(5):
    if i == k:
        menu[i], menu[-1] = menu[-1], menu[i]

for i in range(5):
    if i != 4:
        ans += menu[i] + kuriage(menu[i])
    else:
        ans += menu[-1]
        print(ans)

Submission status: Accepted

Solution code:
import math
import itertools
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
p = list(itertools.permutations([A, B, C, D, E], 5))
# print(p)
ans = 10**9
for pi in p:
    order1 = 0
    order2 = math.ceil(pi[0] / 10) * 10
    order3 = math.ceil((order2 + pi[1]) / 10) * 10
    order4 = math.ceil((order3 + pi[2]) / 10) * 10
    order5 = math.ceil((order4 + pi[3]) / 10) * 10
    total = order5 + pi[4]
    ans = min(ans, total)
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    (*A,) = map(int, read().split())

    ans = INF
    for i in range(5):
        res = A[i]
        for j in range(5):
            if j != i:
                res += (A[j] + 9) // 10 * 10
        if ans > res:
            ans = res

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from itertools import permutations
import math


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

lis = list(permutations(x,5))


minimum = 0
for i in x:
    minimum += math.ceil(i/10)*10

total = 0
for l in lis:
    total = l[0]
    for i in range(1,5):
        total += math.ceil(l[i]/10)*10
    minimum = min(minimum,total)

print(minimum)

Submission status: Accepted

Solution code:
import math
ans=0
A=[int(input()) for i in range(5)]
a=10
p=0
for i in range(5):
  if a>(A[i]%10) and A[i]%10!=0:
    p=i
    a=A[i]%10
for i in range(5):
  if i==p:
    ans+=A[i]
  else:
    ans+=10*(math.ceil(A[i]/10))
print(ans)

Submission status: Accepted

Solution code:
R=[int(input()) for i in range(5)]
r=[]
p=10
for i in range(5):
    if R[i] % 10 != 0:
        p = min(p,R[i]%10)
ans = 0
for i in range(5):
    if R[i] % 10 != 0:
        if R[i] % 10 == p:
          ans += R[i]
          p = 10
        else:
          ans += R[i] - R[i] % 10 + 10
    else:
        ans += R[i]
print(ans)

Submission status: Accepted

Solution code:
import math


def roundup(x):
    return int(math.ceil(x / 10.0)) * 10


l = [int(input()) for _ in range(5)]
ll = [roundup(v) for v in l]

m = sum(ll)
print(min([m - ll[i] + l[i] for i in range(5)]))

Submission status: Accepted

Solution code:
from itertools import permutations

a, b, c, d, e = [int(input()) for _ in range(5)]

result = 10 ** 9

p = permutations([a, b, c, d, e])
for case in p:
  t = 0
  for i, dish in enumerate(case):
    if i != 4 and dish % 10 != 0:
      dish += 10 - dish % 10
    t += dish
  
  result = min(result, t)
  
print(result)

Submission status: Accepted

Solution code:
L = [int(input()) for _ in range(5)]
M = [(10-i%10)%10 for i in L]

print(sum(L)+sum(M)-max(M))

Submission status: Accepted

Solution code:
time = 0
dif = [0] * 5
for i in range(5):
    y = int(input())
    x = (y + 9) // 10 * 10
    dif[i] = x-y
    time += x 
dif.sort(reverse = True)
time -= dif[0]
print(time)

Submission status: Accepted

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

loss = [(10-i%10)%10 for i in a]

print(sum(a+loss)-max(loss))

Submission status: Accepted

Solution code:
from itertools import permutations
from math import ceil
D = []
for _ in range(5):
    D.append(int(input()))
res = float("inf")
for a in permutations(D,5):
    t = 0
    for b in a[:-1]:
        t += ceil(b/10)*10
    t += a[-1]
    res = min(res, t)
print(res)

Submission status: Accepted

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

for i in range(5):
  if int(s[i]) % 10 == 0:
    x10 = x10 + 1
  else:
    a.append(int(s[i]) % 10)
  sum = sum + ((int(s[i]) - 1) // 10 + 1) * 10

  
b = [int(s) for s in a]

if x10 == 5:
  print(sum)
else:
  print(sum - 10 + min(b))

Submission status: Accepted

Solution code:
def chk(n):
    for i in range(14):
        if i*10 >= n:
            return i*10
    

menu = []
time = []
for i in range(5):
    menu.append(int(input()))
    time.append(menu[i]%10)
#print(menu,time)
min_i = [10,10]
for i in range(5):
    if time[i]!=0:
        if time[i]<min_i[0]:
            min_i[0] = time[i]
            min_i[1] = i
#print(min_i)
ans = 0
for i in range(5):
    if i == min_i[1]:
        ans += menu[i]
    else:
        ans += chk(menu[i])
print(ans)

Submission status: Accepted

Solution code:
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m <= num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))

Submission status: Accepted

Solution code:
import itertools
a=[]
for i in range(5):
    a.append(int(input()))
out=sum(a)+50
ls = list(itertools.permutations(range(5)))
for i in ls:
    t=0
    for j in i:
        if t%10 != 0:
            t+=10-t%10
        t+=a[j]
    if t <=out:
        out=t
print(out)

Submission status: Accepted

Solution code:
N = [int(input()) for i in range(5)]
Ni = [0]*5
smallmin = 11
for i in range(5):
    Ni[i] = N[i]%10
    if Ni[i] == 0:
        Ni[i] = 10
    if Ni[i]<smallmin:
        smallmin = Ni[i]
        LAST = i
ans = 0
for i in range(5):
  if i == LAST:
    ans += N[i]
  else:
    ans = ans + N[i] + (10-Ni[i])
print(ans)

Submission status: Accepted

Solution code:
u = []
time = 0
for i in range(5):
    s = int(input())
    t = ((s+ 9) // 10) * 10
    u.append(t - s)
    time += t
    
print(time - max(u))

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
nn = [a, b, c, d, e]
s = False
for i in nn:
    if s == False and i%10 != 0:
        chk = i%10
        last = i
        s = True
    elif s == False and i%10 == 0:
        pass
    elif s == True and i%10 != 0:
        if chk > i%10:
            chk = i%10
            last = i
if s == False:
    last = a
#print(last)
s = False
for i in nn:
    if s == False and i == last:
        ans += i
        s = True
    else:
        if i%10 == 0:
            ans += i
        else:
            ans += i + (10 - i%10)
    #print(ans)
print(ans)

Submission status: Accepted

Solution code:
T=[]
for i in range(5):
    T.append(int(input()))
t=[]
for i in range(5):
    t.append(T[i]%10)
a=0
if 0 not in t:
    for i in range(5):
        if t[i]==min(t):
            a=T[i]
            T.remove(T[i])
            break
    for i in range(4):
        a+=((T[i]//10)+1)*10

if 0 in t:
    U=[s for s in T if s%10==0]
    G=[s for s in T if s%10!=0]
    g=[]
    for i in range(len(G)):
        g.append(G[i]%10)
        
    for i in range(len(U)):
        a+=U[i]
        
    for i in range(len(G)):
        if g[i]==min(g):
            a+=G[i]
            G.remove(G[i])
            break
            
    for i in range(len(G)):
        a+=((G[i]//10)+1)*10

print(a)

Submission status: Accepted

Solution code:
import math


def resolve():
    import sys
    import string
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    a = int(input().rstrip())
    b = int(input().rstrip())
    c = int(input().rstrip())
    d = int(input().rstrip())
    e = int(input().rstrip())

    max_loss = 0
    ans = 0
    for x in [a,b,c,d,e]:
        if max_loss < (10 - (x % 10)) % 10:
            max_loss = 10 - (x % 10)
        ans += math.ceil(x / 10.0) * 10

    ans -= max_loss
    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
sum=0
minb=10
for i in range(5):
    a=int(input())
    sum += a//10*10 if a%10==0 else a//10*10+10
    b = a%10
    minb = min(minb if b==0 else b, minb)
print(sum-10+minb)

Submission status: Accepted

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

ls = [A,B,C,D,E]
ls2 = []
for i in itertools.permutations(ls, 5):
  ls2.append(list(i))
minimum = 10**9+7
for i in range(120):
  ls3 = ls2[i]
  now = 0
  for j in range(5):
    if j == 0:
      now += ls3[j]
    else:
      if now%10 == 0:
        now += ls3[j]
      else:
        now = 10*(now//10+1)
        now += ls3[j]
  if now < minimum:
    minimum = now
print(minimum)

Submission status: Accepted

Solution code:
sum=0
max=0
for i in range(5):
  A=int(input())
  s=((A+9)//10)*10
  #print(s)
  p=abs(A-s)%10
  if p>max:
    max=p
    #print(max)
  sum+=s
print(sum-max)

Submission status: Accepted

Solution code:
import math
minutes = [int(input()) for _ in range(5)]
minutes = sorted(minutes,key = lambda x:-x%10)
cnt = 0
for i in minutes:
    cnt += math.ceil(i/10)*10

if minutes[-1] % 10 !=0:
    cnt -= 10 - minutes[-1] % 10
print(cnt)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

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

idx = -1
mi = 10

for i in range(5):
    remain = l[i] % 10
    if remain != 0:
        if mi > remain:
            mi = remain
            idx = i
ans = 0
for i in range(5):
    remain = l[i] % 10
    if (remain == 0):
        ans += l[i]
    else:
        if (i == idx):
            ans += l[i]
        else:
            ans += (l[i] // 10 + 1)*10
print(ans)

Submission status: Accepted

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

t = 0

m = 10

for x in a:
    t += (x + 9) // 10 * 10
    m = min((x - 1) % 10 + 1, m)

print(t-10+m)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
alist=[a,b,c,d,e]
num=0
import math
for i in range(5):
  num+=math.ceil(alist[i]/10)*10
num2=10
for i in range(5):
  if alist[i]%10!=0:
    num2=min(num2,alist[i]%10)
print(num-10+num2)

Submission status: Accepted

Solution code:
x,y=[],[]
t=10
for i in range(5):
    x.append(int(input()))
    y.append(x[i]%10)
    if 0<y[i]<t:
        t=y[i]
    if x[i]%10!=0:
        x[i]=((x[i]//10)+1)*10
    y[i]=x[i]
print(sum(y)+t-10)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
a = min(l, key=lambda x: (x-1)%10)
ret = 0
flag = 0
for i in l:
    if i != a or flag == 1:
        ret += i
    else:
        flag = 1
        
    if ret%10 != 0:
        ret += 10-(ret%10)
ret += a
print(ret)

Submission status: Accepted

Solution code:
#B - Five Dishes 
import itertools
ABCDE = [int(input()) for _ in range(5)]
def calc(food):
    time = 0
    for i in food:
        if time % 10 != 0:
            while time % 10 != 0:
                time += 1    
        time += i
    return time
FOOD = list(itertools.permutations(ABCDE))

mini = 650
for j in FOOD:
        ans = calc(list(j))
        if mini > ans:
            mini = ans

print(mini)

Submission status: Accepted

Solution code:
def multiple_of_ten(number):
    while number % 10 != 0:
        number += 1
    return number


def max_difference_between_two_lst(lst1, lst2):
    difference_lst = []
    for i in range(len(lst1)):
        number1 = lst1[i]
        number2 = lst2[i]
        difference_lst.append(abs(number1 - number2))
    max_difference = max(difference_lst)
    return max_difference


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

    new_time_lst = []
    for i in range(5):
        time = time_lst[i]
        new_time_lst.append(multiple_of_ten(time))

    max_difference = max_difference_between_two_lst(time_lst, new_time_lst)
    fastest = sum(new_time_lst) - max_difference
    print(fastest)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
sa=[0]*5
l=[0]*5
for i in range(5):
  l[i]=10*((a[i]+9)//10)
  sa[i]=10*((a[i]+9)//10)-a[i]
print(sum(l)-max(sa))

Submission status: Accepted

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

if A % 10 == 0:
    a = 0
else:
    a = 10 - A % 10

if B % 10 == 0:
    b = 0
else:
    b = 10 - B % 10

if C % 10 == 0:
    c = 0
else:
    c = 10 - C % 10

if D % 10 == 0:
    d = 0
else:
    d = 10 - D % 10

if E % 10 == 0:
    e = 0
else:
    e = 10 - E % 10

sum = A + B + C + D + E + a + b + c + d + e - max(a,b,c,d,e)

print(sum)

Submission status: Accepted

Solution code:
a = []
for _ in range(5):
    a.append(int(input()))
res = 0
last_num = a[0]
for i in range(5):
    if a[i] % 10 == 0:
        res += a[i]
    else:
        if last_num % 10 == 0:
            last_num = a[i]
        elif a[i] % 10 < last_num % 10:
            last_num = a[i]
        res += (a[i] // 10 + 1) * 10

if last_num % 10 != 0:
    res -= 10 - last_num % 10
print(res)

Submission status: Accepted

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

L = [-i%10 for i in T]

print(sum(T) + sum(L) - max(L))

Submission status: Accepted

Solution code:
import numpy as np
dishes = [int(input()) for _ in range(5)]
dishes = sorted(dishes, key=lambda x: x % 10)
minutes = 0
first = True
for i in dishes:
    if i % 10 == 0:
        minutes += i
    else:
        if first:
            minutes += i
            first = False
        else:
            minutes += int(np.ceil(i/10)*10)
print(minutes)

Submission status: Accepted

Solution code:
K=[int(input()) for _ in range(5)]
ans=0
c=10
for i in range(5):
  r=K[i]%10
  if r==0:
    r=10
  c=min(r,c)
for k in range(5):
  if K[k]%10==0:
    ans+=K[k]
  else:
    ans+=(K[k]//10)*10+10
print(ans-10+c)

Submission status: Accepted

Solution code:
import math
a = [int(input()) for i in range(5)]
w = [ (10 - i % 10) % 10 for i in a]
print(sum(a)+sum(w)-max(w))

Submission status: Accepted

Solution code:
def order(n):
    if n == 0: return 10
    else: return n


def ceil(num, target):
    if num % target == 0: return num
    return ((int)(num / target) + 1) * target


P = [input() for _ in range(5)]
P_sorted = sorted(P, key=lambda pi: order(int(pi[-1])), reverse=True)

ans = 0
for pi in P_sorted[:-1]:
    ans += ceil(int(pi), 10)

print(ans + int(P_sorted[-1]))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
last = 0
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d // 10)+1) *10
    if last <= d10 - d:
      last = d10 - d
    dish[index] = d10
print(sum(dish)-last)

Submission status: Accepted

Solution code:
import math

a = [int(input()) for _ in range(5)]
a_2 = [(i-1)%10 for i in a]

last_item=a[a_2.index(min(a_2))]
print(int(sum([math.ceil(i/10)*10 for i in a])+((last_item-1)%10-9)))

Submission status: Accepted

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

menuTimeList = [A, B, C, D, E]
menuExtraTimeList = [0, 0, 0, 0, 0]

maxExtraTime = 0
for i in range(5):
    extraTime = 0
    if menuTimeList[i] % 10 == 0:
        menuExtraTimeList[i] = 0 
    else:
        extraTime = 10 - menuTimeList[i] % 10
        menuExtraTimeList[i] = extraTime
    if maxExtraTime < extraTime:
        maxExtraTime = extraTime

answer = sum(menuTimeList) + sum(menuExtraTimeList) - maxExtraTime
print(answer)

Submission status: Accepted

Solution code:
X = [0] * 5

for c in range(5):
    ABC = input()
    X[c] = [int(ABC), int(ABC[-1])]
    if X[c][1] == 0:
        X[c][1] = 10
        X[c].append(X[c][0])
    else:
        X[c].append(X[c][0] + (10 - X[c][1]))

X.sort(reverse=True, key=lambda val:val[1])

ans = sum([X[x][2] for x in range(4)]) + X[4][0]

print(ans)

Submission status: Accepted

Solution code:
X = list(map(int, [input() for _ in range(5)]))
X = sorted(X, key=lambda x: x%10)
r = 0
for x in X:
    if x % 10 == 0:
        r += x
    else:
        if r % 10 == 0:
            r += x
        else:
            r += (1+x//10) * 10
print(r)

Submission status: Accepted

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

amari = [10]
for i in range(5):
    if time[i]%10 != 0:
        amari += [time[i]%10]
mia = min(amari)


import math
ti = 0
for i in range(5):
    ti += math.ceil(time[i]/10)*10


print(ti-10+mia)

Submission status: Accepted

Solution code:
cook_list = []
cook_list_2 = []

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

for c in cook_list:
    cook_list_2.append(((c+9)//10)*10)
    
max_diff = 0
for j in range(5):
    if cook_list_2[j] - cook_list[j] >= max_diff:
        max_diff = cook_list_2[j] - cook_list[j]
    
ans = sum(cook_list_2) - max_diff
print(ans)

Submission status: Accepted

Solution code:
#import sys
#input=sys.stdin.read
#*x,=map(int, input().split("\n"))
x=[int(input()) for _ in range(5)]
tmp=100
for i in range(5):
    if x[i]%10:
        tmp = min(tmp,x[i]%10)
        x[i]//=10
        x[i]*= 10
        x[i]+=10
ans= sum(x)
if tmp<100:
    ans-=10
    ans+=tmp
print(ans)

Submission status: Accepted

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

u = list(map(lambda s: math.ceil(s/10) * 10, t))
z = [b - a for (a, b) in zip(t, u)]
print(sum(u) - max(z))

Submission status: Accepted

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

r = []

if A%10 != 0:
    r.append(10 - A%10)
    A += 10 - A%10
if B%10 != 0:
    r.append(10 - B%10)
    B += 10 - B%10
if C%10 != 0:
    r.append(10 - C%10)
    C += 10 - C%10
if D%10 != 0:
    r.append(10 - D%10)
    D += 10 - D%10
if E%10 != 0:
    r.append(10 - E%10)
    E += 10 - E % 10

if r:
    print(A+B+C+D+E-max(r))
else:
    print(A+B+C+D+E)

Submission status: Accepted

Solution code:
li = []
for i in range(5):
    li.append(int(input()))
mi = 10
for i in range(5):
    a = li[i]%10
    if mi > a and a != 0:
        mi = a
        t = i
if mi != 10:
    a = li[t]
    li.remove(a)
    for i in range(4):
        if li[i] % 10 != 0:
          li[i] += (10 - li[i] % 10)
    print(sum(li) + a)
else:
    print(sum(li))

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

food = []

for _ in range(5):
    food.append(inint())

all = sum(food)
loss = []

for f in food:
    loss_t = 200
    for i in range(0,131, 10):
        if 0 <= i-f < loss_t:
            loss_t = abs(f-i)
    loss.append(loss_t)

print(all+sum(loss)-max(loss))

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a%10==0:
    A=a
else:
    A=((a//10)+1)*10
if b%10==0:
    B=b
else:
    B=((b//10)+1)*10
if c%10==0:
    C=c
else:
    C=((c//10)+1)*10
if d%10==0:
    D=d
else:
    D=((d//10)+1)*10
if e%10==0:
    E=e
else:
    E=((e//10)+1)*10
    
time=A+B+C+D+E
muda=[]
muda.append(A-a)
muda.append(B-b)
muda.append(C-c)
muda.append(D-d)
muda.append(E-e)
print(time-max(muda))

Submission status: Accepted

Solution code:
ans = 0
x = []
y = []
for i in range(5):
    x.append(int(input()))
    y.append(x[i]%10)

for i in range(5):
    if y[i] == 0:
        ans += x[i]
    else:
        ans += x[i]-y[i]+10
m = 10
for i in y:
    if i == 0:
        continue
    else:
        m = min(m,i)
if m == 10:
    print(ans)
else:
    print(ans+m-10)

Submission status: Accepted

Solution code:
import math
abc = [int(input()) for _ in range(5)]
tmp = 9
ans = 0
ii = 0
for i in range(5):
    tmpp = min(tmp, (abc[i]-1)%10)
    if tmp != tmpp:
        tmp = tmpp
        ii = i
for i in range(5):
    if i == ii:
        ans += abc[i]
    else:
        ans += (math.ceil(abc[i]/10))*10
print(ans)

Submission status: Accepted

Solution code:
L = []
R = []

for _ in range(5):
  x = int(input())
  L.append(x)
  R.append(-x%10)

print(sum(L)+sum(R)-max(R))

Submission status: Accepted

Solution code:
import math
x=[int(input()) for _ in range(5)]
y=[math.ceil(i/10)*10 for i in x]
ans_m=sum(y)
ans=sum(y)
for i in range(5):
  ans = min(ans, ans_m-y[i]+x[i])
print(ans)

Submission status: Accepted

Solution code:
import sys
from math import ceil


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = [input() for _ in range(5)]
    mi = 10
    for s in S:
        if not s[-1] == '0':
            mi = min(mi, int(s[-1]))
    S = list(map(lambda x: ceil(int(x) / 10) * 10, S))
    print(sum(S) - (10 - mi))


if __name__ == '__main__':
    main()

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:
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:
a =int(input())
b= int(input())
c= int(input())
d= int(input())
e= int(input())
A = abs(a%10-10)
B = abs(b%10-10)
C = abs(c%10-10)
D = abs(d%10-10)
E = abs(e%10-10)
lst= [A,B,C,D,E]
ad = 0
cnt = 0
for i in lst:
    if (i != 10) and (i>ad):
        ad = i
    if i == 10:
        cnt += 1
ans = (a//10+b//10+c//10+d//10+e//10+5-cnt)*10-(ad)
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def g(x):
    if x%10==0:
        return 10
    else:
        return x%10
m=min(g(a),g(b),g(c),g(d),g(e))
def f(x):
    if x%10==0:
        return x
    else:
        return (x//10+1)*10
a=f(a)
b=f(b)
c=f(c)
d=f(d)
e=f(e)
print(a+b+c+d+e+m-10)

Submission status: Accepted

Solution code:
def solve():
  A = [int(input()) for _ in range(5)]
  m = 0
  ans = 0
  for a in A:
    ans += -(-a//10)*10
    if a%10>0:
      m = max(m,10-a%10)
  ans -= m
  return ans
print(solve())

Submission status: Accepted

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

res = 10 ** 5
for i in itertools.permutations(range(5)):
    sum_min = 0
    for j in range(len(i)):
        if j == 4:
            sum_min += a_to_e[i[j]]
        else:
            sum_min += (a_to_e[i[j]] + 9) // 10 * 10
    res = min(res, sum_min)

print(res)

Submission status: Accepted

Solution code:
import math

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

s = 0
t = 0

for a in abc:
    s += math.ceil(a / 10)
    if a % 10 != 0:
        t = max(t, 10 - a % 10)
        
if t != 0:
    print(s * 10 - t)
else:
    print(s * 10)

Submission status: Accepted

Solution code:
dishes = []
n = 5
max_rest = 10
for i in range(n):
    dish = int(input())
    if (dish - 1) % 10 < (max_rest - 1) % 10:
        max_rest = dish
    
    dishes.append((dish + 9) // 10 * 10) 
    
res = sum(dishes) - (max_rest + 9) // 10 * 10 + max_rest
print(res)
# print(dishes)

Submission status: Accepted

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

kouho = list(itertools.permutations([a, b, c, d, e]))
ans = 10 ** 6
for k in kouho:
    temp = 0
    for t in range(5):
        amari = k[t] % 10
        if amari != 0 and t != 4:
            temp += 10 - amari
        temp += k[t]
    ans = min(ans, temp)
print(ans)

Submission status: Accepted

Solution code:
from itertools import permutations
a = [int(input()) for i in range(5)]
p = permutations(a,5)
ans = 10**9
for l in p:
    now = 0
    for i,item in enumerate(l):
        if i == 4:
            now += item
        else:
            now += item + int(bool(item%10))*10 - item%10
    ans = min(ans,now)
print(ans)

Submission status: Accepted

Solution code:
a=[]
b=[]
ori=[]
ans=0
for i in range(5):
  c=int(input())
  ori.append(c)
  if c%10!=0:
    a.append((c//10+1)*10)
  else:
    a.append(c)
  
  if c%10==0:
    b.append(100)
  else:
    b.append(c%10)
a.pop(b.index(min(b)))
print(ori[b.index(min(b))]+sum(a))

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict


def input():
    return sys.stdin.readline().rstrip()


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

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

    d = 0
    p = []

    for i in range(5):
        x, y = divmod(W[i], 10)
        if y == 0:
            d += x
            p.append(10)
        else:
            d += x + 1
            p.append(y)

    print(d * 10 + min(p)-10)


if __name__ == "__main__":
    main()