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:
def resolve():
    import math
    a = [int(input()) for _ in range(5)]
    b = []
    for i in range(5):
        if a[i]%10 != 0:
            b.append(a[i]%10)
    if len(b) == 0:
        amin = 10
    else:
        amin = min(b)
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
    print(ans-10+amin)

resolve()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    ans = 0
    a = 10**3
    for i in range(5):
        x = int(input())
        ans += ((x + 9) // 10) * 10
        aa = x % 10
        if aa == 0:
            continue
        a = min(a, aa)
    if a == 10 ** 3:
        a = 10
    ans -= 10 - a
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# Problem B - Five Dishes

from itertools import permutations
import math

# input
nums = [0]*5
for i in range(5):
    n = int(input())
    nums[i] = n

# initialization
pattern_moto = [i for i in range(5)]
patterns = permutations(pattern_moto)
min_time = 1000

# time count
for p in patterns:
    tmp = 0
    for i in range(4):
        tmp += nums[p[i]]
        tmp = math.ceil(tmp/10)*10
    tmp += nums[p[4]]
    min_time = min(min_time, tmp)

# output
print(min_time)

Submission status: Accepted

Solution code:
from itertools import permutations
A = [int(input()) for _ in range(5)]
cmin = 10**4
for x in permutations(range(5),5):
    cnt = A[x[0]]
    if cnt%10>0:
        cnt = (cnt//10)*10+10
    for i in range(1,4):
        cnt += A[x[i]]
        if cnt%10>0:
            cnt = (cnt//10)*10+10
    cnt += A[x[4]]
    cmin = min(cmin,cnt)
print(cmin)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
l.sort(key=lambda x: 10 if x%10==0 else x%10)
l = l[::-1]
ans = 0
for i in range(5):
    if i == 4 or l[i]%10==0:
        ans += l[i]
    else:
        ans += ((l[i]//10)+1)*10
print(ans)

Submission status: Accepted

Solution code:
def main():
    A = [int(input()) for i in range(5)]
    B = []
    for a in A:
        if a % 10 == 0:
            B.append(a)
        else:
            B.append((1+a//10)*10)
    ans = sum(B)
    maxV = max(A, key=lambda x: (10 - x % 10) % 10)
    print(ans - (10 - maxV % 10) % 10)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
menu = []

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

from itertools import permutations
from math import ceil

min_sum = 10**10
for i in permutations(menu, 5):
    sum = 0
    for j in range(4):
        sum += ceil(i[j]/10) * 10
    sum += i[4]
    if sum < min_sum:
        min_sum = sum

print(min_sum)

Submission status: Accepted

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

abcde.sort(key=lambda x: (x % 10))

flag = False
ans = 0
for x in abcde:
    if x % 10 == 0 or flag:
        if x % 10 == 0:
            ans += x
        else:
            ans += ((x//10)+1)*10
    else:
        ans += x
        flag = True
print(ans)

Submission status: Accepted

Solution code:
def resolve():
  a = int(input())
  b = int(input())
  c = int(input())
  d = int(input())
  e = int(input())
  x = 10
  if a%10 != 0:
    x = min(x, a%10)
    a = a - a%10 + 10
  if b%10 != 0:
    x = min(x, b%10)
    b = b - b%10 + 10
  if c%10 != 0:
    x = min(x, c%10)
    c = c - c%10 + 10
  if d%10 != 0:
    x = min(x, d%10)
    d = d - d%10 + 10
  if e%10 != 0:
    x = min(x, e%10)
    e = e - e%10 + 10

  ans = (a + b + c + d + e) - 10 + x
  print(ans)

  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
from math import ceil

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

mmin = 10
ans = 0
for ai in A:
    ans += 10*ceil(ai/10)
    if ai%10 != 0:
        mmin = min(mmin, ai%10)
if mmin%10 == 0:
    print(ans)
else:
    print(ans - 10 + mmin)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
# A = [101, 86, 119, 108, 57]
# A = [29, 20, 7, 35, 120]
# A = [123, 123, 123, 123, 123]
B = [(10-a % 10) % 10 for a in A]
C = [-(-a//10)*10 for a in A]
print(sum(C)-max(B))

Submission status: Accepted

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

from itertools import permutations

LL = list(permutations(LL))

ans = float("inf")
for L in LL:
    res = 0
    for l in L[:-1]:
        res += (l + 10 - 1) // 10 * 10
    res += L[-1]
    ans = min(ans, res)

print(ans)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
import itertools
a = list(itertools.permutations(a, 5))
ans = int(1e10)
for i in range(len(a)):
    cnt = 0
    for j in range(5):
        if j != 4:
            cnt += (a[i][j]+9)//10*10
        else:
            cnt += a[i][j]
    ans = min(ans, cnt)
print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
d = 10
ans = 0
for a in A:
    ans += 0--a//10*10
    if a%10:
        d = min(d,a%10)
print(ans - 10 + d)

Submission status: Accepted

Solution code:
from itertools import permutations as perm

l = [int(input()) for _ in range(5)]
res = 10 ** 100
for p in perm(l):
    tmp = 0
    for i in p:
        tmp = (tmp + 9) // 10 * 10
        tmp += i
    res = min(res, tmp)
print(res)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return

#B
def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
# ABC 123: B – Five Dishes
import math

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

last_dish_index = 0
from10 = 0

for i in range(len(dishes)):
    tmp = dishes[i] % 10
    if tmp != 0 and 10 - tmp > from10:
        last_dish_index = i
        from10 = 10 - tmp % 10

last_dish = dishes.pop(last_dish_index)
print(sum([math.ceil(t / 10) * 10 for t in dishes]) + last_dish)

Submission status: Accepted

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

Submission status: Accepted

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

last_index = -1
last_t = 10
for i in range(len(a)):
    if (a[i]-1) % 10 < last_t:
        last_t = (a[i]-1) % 10
        last_index = i

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

print(total)

Submission status: Accepted

Solution code:
order_li= [int(input()) for i in range(5)]
loss_li = [0 if order%10==0 else 10-order%10 for order in order_li]

ans = sum(order_li)+sum(loss_li)-max(loss_li)
print(ans)

Submission status: Accepted

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

import math

max=0
sum=0
for a in T:
  if 10-a%10>max and a%10!=0:
    max=10-a%10
  sum += math.ceil(a/10)*10
sum -= max  
print(sum)

Submission status: Accepted

Solution code:
#B
import math
a = []
a1 = []
f = 10
for i in range(5):
    a.append(int(input()))
    a1.append(math.ceil(a[i] / 10) * 10)
    if f > a[i] % 10 and a[i] % 10 != 0:#ロスタイムfが小さい0はすぐに注文できるから
        f = a[i] % 10
#累計時間sum(a1)-最小ロスタイムf
print(sum(a1) - 10 + f)

Submission status: Accepted

Solution code:
from itertools import permutations

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

min_time = 99999999999999
for xs in list(permutations(x)):
  total = 0
  for i in range(5):
    if i != 4:
      hoge = xs[i] // 10 if xs[i] % 10 == 0 else xs[i] // 10 + 1
      total += hoge * 10
      
    else:
      total += xs[i]
      
  min_time = min(total, min_time)
print(min_time)

Submission status: Accepted

Solution code:
S = [int(input()) for i in range(5)]
R = list(S)
for i in range(5):
    R[i]=R[i]%10
#print(R)
for i in range(5):
    if R[i]!=0:
        R[i]=10-R[i]
w=sorted(R)
#print(w)
W=w[0]+w[1]+w[2]+w[3]
ans = sum(S) + W
#print(W)
print(ans)

Submission status: Accepted

Solution code:
S=[int(input()) for i in range(5)]
R=list(S)
for i in range(5):
    R[i]=R[i]%10
L=sorted(R)[::-1]

for i in range(5):
    if L[i]!=0:
        L[i]=10-L[i]
W=sorted(L)

total=S[0]+S[1]+S[2]+S[3]+S[4]
mati=W[0]+W[1]+W[2]+W[3]
print(total+mati)

Submission status: Accepted

Solution code:
import math
a=[]
a1=[]
f=0
for i in range(5):
    a.append(int(input()))
    a1.append(math.ceil(a[i]/10)*10)
    if 10-a[i]%10>=f and a[i]%10!=0:
        f=10-a[i]%10
        
print(sum(a1)-f)

Submission status: Accepted

Solution code:
import math

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

ceil = lambda number: math.ceil(number / 10) * 10

minutes = [A, B, C, D, E]
ceiled_minutes = list(map(ceil, minutes))

minimum = 10
for minute in minutes:
    digit_1st = minute % 10
    if digit_1st == 0: continue

    if minimum is None or digit_1st < minimum:
        minimum = digit_1st
diff = 10 - minimum

answer = sum(ceiled_minutes) - diff

print(answer)

Submission status: Accepted

Solution code:
import math

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

ceil = lambda number: math.ceil(number / 10) * 10

minutes = [A, B, C, D, E]
ceiled_minutes = list(map(ceil, minutes))

maximum_diff = 0
for minute in minutes:
    ceiled = ceil(minute)
    diff = ceiled - minute
    if diff == 0: continue

    if maximum_diff is None or diff > maximum_diff:
        maximum_diff = diff

answer = sum(ceiled_minutes) - maximum_diff
    
print(answer)

Submission status: Accepted

Solution code:
import math

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

ceil = lambda number: math.ceil(number / 10) * 10
ceiled_A = ceil(A)
ceiled_B = ceil(B)
ceiled_C = ceil(C)
ceiled_D = ceil(D)
ceiled_E = ceil(E)

maximum_diff = 0
for minitues in [A, B, C, D, E]:
    ceiled = ceil(minitues)
    diff = ceiled - minitues
    if diff == 0: continue

    if maximum_diff is None or diff > maximum_diff:
        maximum_diff = diff

answer = ceiled_A + ceiled_B + ceiled_C + ceiled_D + ceiled_E - maximum_diff
    
print(answer)

Submission status: Accepted

Solution code:
def main():
    ans, m_rem = 0, 0
    for _ in range(5):
        m = int(input())
        rem = m % 10
        if rem == 0:
            ans += m
        else:
            m_rem = max(m_rem, 10 - rem)
            ans += m + 10 - rem
    print(ans - m_rem)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from itertools import permutations
lst = []
for _ in range(5):
    lst.append(int(input()))
    
ans = float('inf')
for p in permutations(lst):
    elsp = 0
    for i, k in enumerate(p):
        if i <= 3:
            elsp += k
            tmp = elsp//10
            if elsp%10==0:
                elsp = tmp*10
            else:
                elsp = (tmp+1)*10
        else:
            elsp += k
    if elsp <= ans:
        ans = elsp
print(ans)

Submission status: Accepted

Solution code:
menu,fir_digi=[int(input()) for i in range(5)],[]
for i in range (5):
    fir_digi.append(menu[i]%10)
while min(fir_digi)==0:
    fir_digi[fir_digi.index(0)]=10
for i in range (5):
    if i!=fir_digi.index(min(fir_digi)) and fir_digi[i]!=10:
            menu[i]=int(menu[i]/10)*10+10
print(sum(menu))

Submission status: Accepted

Solution code:
num = []
t_sum = 0

for i in range(5):
    t = int(input())
    t_sum += t
    if t%10 == 0:
        num.append(0)
    else:
        num.append(10-t%10)
num = sorted(num)

ans = 0
for i in range(len(num)-1):
    ans += num[i]

print(ans + t_sum)

Submission status: Accepted

Solution code:
str_menu,int_menu,fir_digi,ans=[str(input()) for i in range(5)],[],[],0
for i in range (5):
    fir_digi.append(int(str_menu[i][-1]))
    int_menu.append(int(str_menu[i]))
while min(fir_digi)==0:
    fir_digi[fir_digi.index(0)]=10

for i in range (5):
    if i!=fir_digi.index(min(fir_digi)):
        if fir_digi[i]!=10:
            int_menu[i]=int(int_menu[i]/10)*10+10
    ans=ans+int_menu[i]
print(ans)

Submission status: Accepted

Solution code:
import sys

a = input()
b = input()
c = input()
d = input()
e = input()
tmp = [a,b,c,d,e]
l = [int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]

minimum = 10
num = 0
for i in range(5):
	if minimum > l[i] and l[i] != 0:
		minimum = l[i]
		num = i

ans = 0
for i in range(5):
	if i != num:
		if l[i] != 0:
			add = 10 - l[i]
		else:
			add = 0
		ans += int(tmp[i]) + add

ans += int(tmp[num])
print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
ans = 0
m = []
for i in range(5):
    if l[i] % 10 != 0:
        m.append(l[i] % 10)
m.sort()
for i in l:
    if i % 10 != 0:
        ans += ((i // 10) + 1) * 10
    else:
        ans += i
if m != []:
    print(ans - 10 + m[0])
else:
    print(ans)

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    from itertools import permutations, combinations,combinations_with_replacement,product
    a=[0]*5
    for i in range(5):
        a[i]=int(input())
    tmin=130*5+1
    alist=list(permutations(a))
    for ai in alist:
        t=ai[0]
        t=int((t-1)//10+1)*10+ai[1]
        t=int((t-1)//10+1)*10+ai[2]
        t=int((t-1)//10+1)*10+ai[3]
        t=int((t-1)//10+1)*10+ai[4]
        tmin=min(t,tmin)
    print(tmin)

Submission status: Accepted

Solution code:
dishes = []
serve = []
for i in range(5):
    dish = int(input())
    dishes.append(dish)
    if dish % 10 != 0:
        time = 10 - dish%10
        serve.append(time)
if serve == []:
    print(sum(dishes))
else:
    sort_serve = sorted(serve)
    sort_serve.remove(sort_serve[len(sort_serve)-1])
    ans = sum(dishes) + sum(sort_serve)
    print(ans)

Submission status: Accepted

Solution code:
t=[]
max_time=999
flg=False
for i in range(5):
    t.append(int(input()))
    if (t[i]%10)<max_time and (t[i]%10)!=0:
        max_time=(t[i]%10)
        flg=True
    if t[i]%10!=0:
        t[i]+=10-(t[i]%10)
if flg:
    print(sum(t)-(10-max_time))
else:
    print(sum(t))

Submission status: Accepted

Solution code:
N = [int(input()) for _ in range(5)]
n = [10 - x % 10 if x % 10 != 0 else 0 for x in N]

ans = sum(N) + sum(n) - max(n)
print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
cnt = 0
Max = 10
Max_i = 0
for i in range(len(A)):
    if 0 < A[i]%10 < Max:
        Max = A[i]%10
        Max_i = i
for i in range(len(A)):
    if i != Max_i:
        cnt += A[i]
    while cnt%10 != 0:
        cnt += 1
print(cnt+A[Max_i])

Submission status: Accepted

Solution code:
def main():
  A = int(input())
  B = int(input())
  C = int(input())
  D = int(input())
  E = int(input())
  
  a = (10 - A) % 10
  b = (10 - B) % 10
  c = (10 - C) % 10
  d = (10 - D) % 10
  e = (10 - E) % 10
 
  print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  A = int(input())
  B = int(input())
  C = int(input())
  D = int(input())
  E = int(input())
  
  a = (10 - A) % 10
  b = (10 - B) % 10
  c = (10 - C) % 10
  d = (10 - D) % 10
  e = (10 - E) % 10
 
  print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
from itertools import permutations

l = [int(input()) for _ in range(5)]
res = 10**9
for r in permutations(l, r=5):
    x = 0
    for i in range(4):
        x += r[i]
        if r[i]%10>0:
            x += 10-r[i]%10
    x += r[-1]

    res = min(res, x)
print(res)

Submission status: Accepted

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

lis = [a,b,c,d,e]
lis2 = [999]*5
for i in range(5):
  if lis[i]%10==0:
    lis2[i] = 10
  else:
    lis2[i] = lis[i]%10

last = lis2.index(min(lis2))
total = 0
for i in range(5):
  if i ==last:
    total += lis[i]
  else:
    total += -(-lis[i]//10)*10
    
print(total)

Submission status: Accepted

Solution code:
import itertools


D = [int(input()) for _ in range(5)]
min_time = 1000
for p in itertools.permutations(range(5)):
    time = 0
    for i in range(5):
        time += D[p[i]]
        if i < 4:
            dm = D[p[i]]%10
            time += 0 if dm == 0 else 10-dm
    min_time = min(min_time, time)
print(min_time)

Submission status: Accepted

Solution code:
# nabc123_b.py
# 調理時間%10=0 をとった後、調理時間%10 が大きい順にとって行く
dishes = [int(input()) for i in range(5)]
lest_time = 0
ans = 0
for dish in dishes:
    if dish%10==0:
        ans += (dish)
    else:
        ans += (dish+10-dish%10)
    if lest_time < 10-dish%10 and dish%10!=0:
        lest_time = 10-dish%10
print(ans-lest_time)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = [ir() for _ in range(5)]
ceil_time = [(x+9)//10*10 for x in A]
can_save = [y - x for y, x in zip(ceil_time, A)]
answer = sum(ceil_time) - max(can_save)
print(answer)

Submission status: Accepted

Solution code:
time=[int(input()) for _ in range(5)]
t1=[10]*5
for i in range(5):
  if time[i]%10!=0:
    t1[i]=time[i]%10
last=min(t1)
t=0
a=0
for i in range(5):
  if a==0 and t1[i]==last:
    t+=time[i]
    a=1
  else:
    t+=time[i]-t1[i]+10
print(t)

Submission status: Accepted

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

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li == []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Submission status: Accepted

Solution code:
abcde = list(map(int, open(0).read().split()))

minimum = abcde[0] % 10
num = 0
for i in range(len(abcde)):
    if abcde[i] % 10 < minimum and abcde[i] % 10 != 0:
        minimum = abcde[i] % 10
        num = i

ans = 0
for i in range(len(abcde)):
    if i == num:
        ans += abcde[i]
        continue
    
    if abcde[i] % 10 != 0:
        ans += (abcde[i] // 10 + 1) * 10
    else:
        ans += abcde[i]
        
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = np.zeros(5, np.int32)
for i in range(5):
    A[i] = ir()

remain = A % 10
remain = remain[remain>0]
ceil10 = (np.ceil(A/10) * 10).astype(np.int32)
answer = ceil10.sum()
if len(remain) != 0:
    minus = 10 - remain.min()
    answer -= minus
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
ans=0
A=list()
M=list()
for i in range(5):
  a = int(input())
  if(a%10!=0):
    M.append(a%10)
  b=int(math.ceil(a/10)*10)
  A.append(b)
  ans+=b

if not M:
  print(ans)
else:
  ans+=min(M)-10
  print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
l = [input() for _ in range(5)]
m = 11
ans = 0
for i in range(len(l)):
    n = int(l[i][-1])
    if n == 0: n = 10
    if n < m:
        m = n
        ind = i
for t in range(len(l)):
    if t == ind:
        ans += int(l[t])
    else:
        n = int(l[t][-1])
        if n == 0: n = 10
        ans += (int(l[t]) + 10 - n)
print(ans)

Submission status: Accepted

Solution code:
import math
x=0
ans=0
for i in range(5):
  a=int(input())
  b=math.ceil(a/10)*10
  x=max(x,b-a)
  ans+=b
print(ans-x)

Submission status: Accepted

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

import math
ans = 0
minmod = 10
for i in range(5):
  if time[i]%10!=0:
    minmod = min(minmod,time[i]%10)
  else:
    minmod = min(minmod,10)
  ans += math.ceil(time[i]/10)*10

ans -= (10-minmod)
print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
B =[]
C =[]
for i in range(5):
    B.append(-10*(A[i]//-10))

for i in range(5):
    C.append(B[i]-A[i])
print(sum(B)-max(C))

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
tmp = 10

for i in range(5):
    if A[i] % 10 != 0:
        tmp = min(tmp, A[i] % 10)
        A[i] = A[i] // 10 * 10 + 10

print(sum(A) - (10 - tmp))

Submission status: Accepted

Solution code:
import math
Time=[int(input()) for _ in range(5)]
amari=[math.ceil(Time[i]/10)*10 for i in range(5)]

last=min((Time[i]-1)%10 for i in range(5))
last+=1

print(amari[0]+amari[1]+amari[2]+amari[3]+amari[4]+last-10)

Submission status: Accepted

Solution code:
n = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a, b, c, d, e]

for i in f:
    n += ((i - 1) // 10 + 1) * 10

g = [(f[i] - 1) % 10 + 1 for i in range(5)]
n = n - 10 + min(g)
print(n)

Submission status: Accepted

Solution code:
import math
A = [int(input()) for _ in range(5)]
B = 10
ans = 0
for i in range(5):
  if A[i] % 10 < B and A[i]%10 > 0:
    B = A[i] % 10
    ans = -10+B
for j in A:
  ans += math.ceil(j/10)*10
print(ans)

Submission status: Accepted

Solution code:
A = 0
B = []
B.append(0)
for i in range(5):
  I = int(input())
  A += I
  T = I % 10
  if T != 0:
    B.append(10 - T)
print(A + sum(B) - max(B))

Submission status: Accepted

Solution code:
import math
a = [int(input()) for _ in range(5)]
tempo_total = 0
entrega = 0
for i in range(5):
    resto = 10 - a[i] % 10
    if resto > entrega and resto != 10:
        entrega = resto
tempo_total -= entrega
for item in a:
    tempo_total += math.ceil(item/10) * 10
print(tempo_total)

Submission status: Accepted

Solution code:
import math
lost_max=0
time=0
for _ in range(5):
    x=int(input())
    time+=math.ceil(x/10)*10
    lost_max=max(math.ceil(x/10)*10-x,lost_max)
print(time-lost_max)

Submission status: Accepted

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

maxv = 0
b = 4
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)

Submission status: Accepted

Solution code:
import itertools
def func(n,j):
   if(n % 10 == 0 or j==4):
      return n
   return n //10 * 10 + 10
def myAnswer(A:int,B:int,C:int,D:int,E:int) -> int:
   dishes = [A,B,C,D,E]
   ans = 10**9
   for i in itertools.permutations(dishes):
      total = 0
      for j,a in enumerate(i):
         total+= func(a,j)
      ans = min(total,ans)
   return ans


def modelAnswer():
   tmp=1
def main():
   A = int(input())
   B = int(input())
   C = int(input())
   D = int(input())
   E = int(input())
   print(myAnswer(A,B,C,D,E))

if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
X = [int(input()) for _ in range(5)]
ans = 0
Y = []
for i in range(len(X)):
    Y.append(X[i] % 10 if X[i] % 10 != 0 else 10)

m = Y.index(min(Y))

for j in range(len(X)):
    if j == m:
        ans += X[j]
    elif X[j] % 10 == 0:
        ans += X[j]
    else:
        ans += X[j]//10 * 10 + 10

print(ans)

Submission status: Accepted

Solution code:
A=[]
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
count=0
rem=10
for t in A:
    if t%10==0:
        count+=t
    else:
        count+=(((t//10)+1)*10)
        if t%10<rem:
            rem=t%10
print(count-10+rem)

Submission status: Accepted

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

sum = 0
sorted_list = []
for l in lista:
    diff = 10-int(str(l)[len(str(l))-1])
    if diff == 10:
        diff = 0
    sorted_list.append((diff, l))
sorted_list.sort()
pos = 0
for s in sorted_list:
    if pos < len(sorted_list)-1:
        sum+=(s[0]+s[1])
    else:
        sum+=s[1]
    pos+=1
print(sum)

Submission status: Accepted

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


def lastDigit(x):
    return x % 10


xs.sort(key=lastDigit)
# print(xs)
time = 0
first = True
for x in xs:
    if x % 10 == 0:
        time += x
    else:
        if first:
            time += x
            first = False
        else:
            time += x + 10 - x % 10
print(time)

Submission status: Accepted

Solution code:
import math

ans = 0
cost = 0
time_list = [int(input()) for i in range(5)]
for i in time_list:
    if math.ceil(i / 10) * 10 - i != 0:
        cost = max(cost,math.ceil(i / 10) * 10 - i)
    ans += math.ceil(i / 10) * 10
print(ans - cost)

Submission status: Accepted

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

MIN = 10
ans = 0
for i in (A,B,C,D,E):
    if i % 10 != 0:
        MIN = min(MIN, i % 10)
        ans += i - i % 10 + 10
    else:
        ans += i
ans -= 10 - MIN
print(ans)

Submission status: Accepted

Solution code:
menu = [int(input()) for _ in range(5)]
ans = 0
mod = []
for time in menu:
    if time % 10 == 0:
        ans += time
    else:
        ans += time
        mod.append(10 - time % 10)
try:
    mod.remove(max(mod))
    ans += sum(mod)
except:
    pass
print(ans)

Submission status: Accepted

Solution code:
import math
list = [input() for i in range(5)]
one_min = 10
for i in range(5):
    if one_min >= int(list[i][-1]) > 0:
        one_min = int(list[i][-1])
sum = 0
for i in range(5):
    sum += math.ceil(int(list[i])/10)*10
print(sum - 10 + one_min)

Submission status: Accepted

Solution code:
from itertools import permutations

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

base = [A, B, C, D, E]
ans = 10e9
for orders in permutations(base, 5):
    wait = orders[0]
    for order in orders[1:]:
        for i in range(0, 11):
            if (wait + i) % 10 == 0:
                wait = wait + i + order
                break
    ans = min(ans, wait)

print(ans)

Submission status: Accepted

Solution code:
*t, = map(int, open(0).read().split())
try:
    m = 10 - min([i%10 for i in t if i%10])
except ValueError:
    m = 0
print(sum([-(-j // 10) for j in t])*10 - m)

Submission status: Accepted

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

for i in range(5):
    OK += food[i] % 10
    
if OK == 0:
    print(sum(food))
else:
    for i in range(5):
        x = food[i] % 10
        if 0 < x < a:
            a = x
            remove = food[i]

    food.remove(remove)

    ans = remove

    for i in range(4):
        ans += -(-food[i]//10)*10

    print(ans)

Submission status: Accepted

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

for i in range(5):
  if time[i][0]%10!=0:
    time[i].append(time[i][0]%10)
  else:
    time[i].append(10)

time = sorted(time, key = lambda time:time[1])
ans = 0
import math
for i in range(1,5):
  ans = ans + math.ceil(time[i][0]/10)*10
  
ans = ans + time[0][0]
print(ans)

Submission status: Accepted

Solution code:
ans = 0
ma = 10
for i in range(5):
    a = int(input())
    ans += (-(-a//10))*10
    if a%10 != 0:
        if a%10 <= ma:
            ma = a%10

print(ans  - (10 - ma))

Submission status: Accepted

Solution code:
import math
total_time = 0
los_ari = False
min_los = 9

for i in range(5):
  T=int(input())
  total_time = total_time + 10 * math.ceil(T/10)
  if T%10!=0:
    los_ari = True
    if T%10<min_los:
      min_los = T%10
      
if los_ari:
  total_time = total_time - (10-min_los)
print('{:.0f}'.format(total_time))