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:
import sys
input = sys.stdin.readline
li = [[0]*2 for _ in range(5)]
count = 0
total = 0
for i in range(5):
    li[i][0] = int(input())
    li[i][1] = li[i][0]%10
    if li[i][1] == 0:
        count += 1
li.sort(key=lambda x:x[1])
for i in range(count):
    total += li[0][0]
    li = li[1:]
if count != 5:
    for i in range(5-count-1):
        total += (li[-1][0]+10-li[-1][1])
        li = li[:-1]
    print(total+li[0][0])
else:
    print(total)

Submission status: Accepted

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

minute = 9
z = 0
for i in range(4):
    if minute > food[i] % 10 and food[i] % 10 != 0:
        minute = food[i] % 10
        z = i

ans = 0
for i in range(5):
    if z != i:
        ans += math.ceil(food[i] / 10) * 10
ans += food[z]

print(ans)

Submission status: Accepted

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

a.sort(key = lambda x:(x-1)%10)
ans = a[0]

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

print(ans)

Submission status: Accepted

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

count = 0
tmp = 10
tmp1 = 124
ABCDE = []
for i in [A,B,C,D,E]:
  if tmp >= i%10 and i%10 != 0:
    tmp = i%10
    tmp1 = i

for i in [A,B,C,D,E]:
  if tmp1 == i and count == 0:
    ABCDE.append(i)
    count = 1
  elif i%10 != 0:
    ABCDE.append(10-(i%10) + i)
  elif i%10 == 0:
    ABCDE.append(i)
print(sum(ABCDE))

Submission status: Accepted

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

*_menus, = map(lambda x: math.ceil(x/10)*10, menus)

diff = []
for i in range(len(menus)):
    diff.append(_menus[i] - menus[i])

print(sum(_menus) - max(diff))

Submission status: Accepted

Solution code:
lis=[]
for i in range(5):
    x=int(input())
    if x%10!=0:
        lis.append([x%10,x])
    else:
        lis.append([10,x])
lis1=sorted(lis,reverse=True)
t=0
for i in range(4):
    if lis1[i][0]!=0:
        t+=lis1[i][1]+10-lis1[i][0]
    else:
        t+=lis1[i][1]
print(t+lis1[4][1])

Submission status: Accepted

Solution code:
A = []
B = []
C = []
s = 10
for _ in range(5):
  A.append(int(input()))
for a in A:
  s = a%10
  if s != 0:
    B.append(a-s+10)
    C.append(s)
  else:
    B.append(a)
if len(C) == 0:
  print(sum(A))
else:
  b = sum(B)
  print(b-10 +min(C))

Submission status: Accepted

Solution code:
lst=[int(input()) for i in range(5)]
count=0
num=0
for u in lst:
    if u%10==0:
        count+=u
    else:
        v=u//10+1
        num=max(num,v*10-u)
        count+=v*10
print(count-num)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from functools import reduce

lst = [int(input()) for i in range(5)]
lst.sort(key=lambda x: 10 - (x % 10) if x % 10 > 0 else 0)
ans = 0
for i, v in enumerate(lst):
  ans += v + (10 - v % 10) if v % 10 > 0 and i != len(lst) - 1 else v

print(ans)

Submission status: Accepted

Solution code:
A=[int(input()) for i in range(5)]
from itertools import permutations, combinations,combinations_with_replacement,product
L = list(permutations(range(5), 5))
ans = sum(A)+100
for i in L:
  time = 0
  for j in i:
    if time%10 !=0:
      time += (10-time%10)
    time += A[j]
  ans = min(ans ,time)
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[(i,i%10) for i in [a,b,c,d,e] if i%10!=0]
y=[i for i in [a,b,c,d,e] if i%10==0]
x=sorted(x,key=lambda x:x[1])
ans = sum(y)
if len(x)==0:
  print(ans)
else:
  ans += sum((i[0]//10+1)*10 for i in x[1:])
  ans+=x[0][0]
  print(ans)

Submission status: Accepted

Solution code:
dishes = [int(input()) for _ in range(5)]
tuple_ = tuple(n for n in map(lambda num: num % 10, dishes) if n)
print(sum(map(lambda num: num + 10 * (num % 10 != 0) - (num % 10), dishes)) + min(tuple_ if tuple_ else (10,)) - 10)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
if all(n%10==0 for n in a):
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b)
else:
    A = min([j%10 for j in a if j%10 != 0])
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b-(10-A))

Submission status: Accepted

Solution code:
a=int(input())
p=a%10
b=int(input())
q=b%10
c=int(input())
r=c%10
d=int(input())
s=d%10
e=int(input())
t=e%10
l=[a,b,c,d,e]
m=[p,q,r,s,t]
ans=0
if set(m)==set([0]):
    minimum=10
else:
    minimum=min(list(set(m)-set([0])))
def func(n):
    if n%10==0:
        return n
    else:
        return (n//10)*10+10
for i in range(5):
    ans+=func(l[i])
ans=ans-10+minimum
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

l = [a,b,c,d,e]
s = 0

Min = 10

for i in range(len(l)):
    s  = l[i] % 10 
    if ( 9>= s >=1 and Min > s):
        Min = s

for i in range(len(l)):   
    s  = l[i] % 10 

    if(s == Min):
        Min = 99
    elif(9>= s >=1):
        l[i] += 10 - s
    
print(sum(l))

Submission status: Accepted

Solution code:
import math

dishes = [int(input()) for i in range(5)]
up = [math.ceil(dish/10)*10 for dish in dishes]
loss = [x-y for x, y in zip(up, dishes)]
print(sum(up)-max(loss))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1



A=[int(input()) for i in range(5)]
A.sort(key=lambda x:(x-1)%10,reverse=True)
ans=0
for i in range(4):
    ai=A[i]
    ans+=math.ceil(ai/10)*10
ans+=A[-1]
print(ans)

Submission status: Accepted

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

A.sort(key=lambda x: 10 if x % 10 == 0 else x % 10, reverse=True)
ans = 0
for a in A[:4]:
    ans += a+(-a%10)
ans += A[-1]

print(ans)

Submission status: Accepted

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

x =[]
j=[]
for i in l:
    t = i%10
    if t != 0:
        x.append(t)
        j.append(i+10-t)
    else:
        j.append(i)

if len(x) == 0:
    print(sum(j))
else:
    print(sum(j)-10+min(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
mnu = []
idx = []
for _ in range(5):
    tim = input()
    mnu.append(int(tim))
    idx.append(10) if tim[-1] == "0" else idx.append(int(tim[-1]))

lst = idx.index(min(idx))
res = mnu[lst]
for i in range(5):
    if lst == i:
        continue
    res += (ceil(mnu[i]/10)*10)
print(res)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
k=[]
for i in l:
    m=10
    for j in range(14):
        if 10*j-i>=0:
            m=10*j-i
            break
    k.append(m)
print(sum(l)+sum(k)-max(k))

Submission status: Accepted

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

mi = [a%10,b%10,c%10,d%10,e%10]
mm = [i for i in mi if i != 0]
mm.sort()
sum = 0
for i in range(5):
	if p[i]%10 != 0:
		sum += (p[i]//10+1)*10
	else:
		sum += p[i]//10*10
if (mm):
	sum -= 10- mm[0]
print (sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = []
x = []
for _ in range(5):
    l = int(input())
    L.append(l)
    x.append((10-(l%10))%10)

ans = 0
for i in range(len(L)):
    ans += L[i]+x[i]

ans = ans - max(x)
print(ans)

Submission status: Accepted

Solution code:
L=[int(input()) for _ in range(5)]
sum=0
modL=[(L[i]-1)%10 for i in range(5)]
last = modL.index(min(modL))
for i in range(5):
    if L[i]%10==0:
        sum += L[i]
    else:
        sum += (int(L[i]//10)+1)*10
if L[last]%10!=0:
    sum -= 10 - L[last]%10
print(sum)

Submission status: Accepted

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

l=[a,b,c,d,e]
ansl=[]
import itertools
for v in itertools.permutations(l,5):
  orderl=list(v)
  #print(orderl)
  t=0
  for order_time in orderl:
    if t%10!=0:
      t=((t//10)+1)*10
    t+=order_time
  ansl.append(t)
print(min(ansl))

Submission status: Accepted

Solution code:
def p_b():
    x = [int(input()) for _ in range(5)]
    m = 10
    idx = -1
    for i, e in enumerate(x):
        tmp = int(str(e)[-1])
        if tmp == 0:
            continue
        if m > tmp:
            m = tmp
            idx = i
    ans = 0
    for i, e in enumerate(x):
        if i == idx:
            ans += e
        else:
            ans += (e + 9) // 10 * 10

    print(ans)
p_b()

Submission status: Accepted

Solution code:
import math

A = [0] * 5
amari = [0] * 5
jikann = [0] * 5

for i in range(5):
    A[i] = int(input())
    amari[i] = A[i] % 10
    jikann[i] = math.ceil(A[i] / 10)
# print(A)
# print(amari)
# print(jikann)

if 0 in amari:
    amari.remove(0)
min_index = amari.index(min(amari))

jikann.pop(min_index)
print(sum(jikann) * 10 + A[min_index])

Submission status: Accepted

Solution code:
k=[]

k.append(input())
k.append(input())
k.append(input())
k.append(input())
k.append(input())

m_num=9
m_index=0
for i in range(len(k)):
    if int(k[i][-1]) != 0:
        if int(k[i][-1]) < m_num:
            m_num = int(k[i][-1])
            m_index = i
            
#print(m_num,m_index)
sum=0
for i in range(len(k)):
    if i==m_index:
        sum+=int(k[i])
    else:
        sum+=((int(k[i])-1)//10 + 1) * 10
    
print(sum)

Submission status: Accepted

Solution code:
#テストファイルで実行する時
import sys
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

l = [0]*5

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

t = [0]*5

for i in range(5):
	t[i] = l[i]%10
	if t[i] == 0:
		t[i] = 10

#print(l)		
#print(t)

k = -1

k = t.index(min(t))

#print(k)

for i in range(5):
	if i != k and l[i]%10 != 0:
		l[i] = l[i] + (10-l[i]%10)

#print(l)

print(sum(l))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
import math
def print_ans(ar):
    """Test Case
    >>> print_ans(['29', '20', '7', '35','120'])
    215
    >>> print_ans(['101', '86', '119','108', '57'])
    481
    >>> print_ans(['123', '123', '123','123','123'])
    643
    """
    tmp_list = np.array([int(a[-1]) for a in ar])
    tmp_list[tmp_list == 0] = 10
    min_arg = tmp_list.argmin()
    ans = 0
    for i, a in enumerate(ar):
        if i != min_arg:
            tmp = math.ceil(int(a) / 10) * 10
        else:
            tmp = int(a)
        ans += tmp
    print(ans)


    

if __name__ == '__main__':
    ar = [input().rstrip() for _ in range(5)]
    print_ans(ar)

Submission status: Accepted

Solution code:
C = [int(input()) for _ in range(5)]
ans = 0
tmp = []
for c in C:
    if c % 10 == 0:
        ans += c
    else:
        tmp.append(c)
tmp.sort()
t_max = 0
for t in tmp:
    t_max = max(t_max, 10 - (t % 10))
    ans += 10 - (t % 10) + t
print(ans-t_max)

Submission status: Accepted

Solution code:
x = [int(input()) for _ in range(5)]
ran = [i for i in range(10,131,10)]
res = []

for q in x:
  low = 200
  for p in ran:
    if low>p-q and p-q>=0:
      low = p-q
  else:
    res.append(low)
res.sort()
res.pop(-1)
print(sum(x)+sum(res))

Submission status: Accepted

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

ans = 0
m = 10
x = 0
for i in range(5):
  if l[i]%10 < m and l[i]%10 > 0:
    m = l[i]%10
    x = i
for i in range(5):
  if i == x or l[i]%10 == 0:
    ans += l[i]
  else:
    ans += l[i] + 10 - l[i]%10
print(ans)

Submission status: Accepted

Solution code:
abcde =[ int(input()) for _ in range(5)]
output = 0
min_keta = 100
for val in abcde:
    if val%10 != 0:
        min_keta = min(val%10,min_keta)
        val = (val//10 +1)*10
    output += val
if min_keta != 100:
    print(output -10 + min_keta)
else:
    print(output)

Submission status: Accepted

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

t = 0
last_dish = 0

for i in range(5):
    if (ls[i] - 1) % 10 < (last_dish - 1) % 10:
        t += 10 * ((last_dish - 1) // 10 + 1)
        last_dish = ls[i]
    else:
        t += 10 * ((ls[i] - 1) // 10 + 1)
    
print(t + last_dish)

Submission status: Accepted

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

for i in range(5):
  if num[i]%10 == 0:
    a.append(10)
  else:
    a.append(num[i]%10)
    
num_min = min(a)
index_min = a.index(num_min)
if num[index_min]%10 != 0:
  num_minus = num[index_min]//10*10 + 10
else:
  num_minus = num[index_min]
num_plus = num[index_min]

for j in range(5):
  if num[j]%10 != 0:
    num[j] = num[j]//10*10 + 10

ans = sum(num) - num_minus + num_plus
print(ans)

Submission status: Accepted

Solution code:
import math

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

keta_1 = []

def roundup(arg_num):
    return math.ceil(arg_num/10)*10

for i in range(5):
    if str(list_aaa[i])[-1:] =="0":
        keta_1.append("9")
    else:
        keta_1.append(str(list_aaa[i])[-1:])
aaa_index = (keta_1.index(min(keta_1,key= lambda x: int(x))))
#print(keta_1)
#print(aaa_index)

aaa =list_aaa.pop(aaa_index)
bbb =list(map(lambda x: round(x,-1),list_aaa))

#print(aaa)
#print(bbb)
sum_bbb= sum(list(map(lambda x: roundup(x),list_aaa)))


print(sum_bbb+aaa)

Submission status: Accepted

Solution code:
import sys
import math
import numpy as np

def main():
    dish = np.array(sys.stdin.read().split())

    minute = [int(dish[i][-1]) for i in range(5)]
    m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10

    res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m

    print(int(res))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import itertools

a=[int(input()) for i in range(5)]
b=list(itertools.permutations(a))
c=[]
for i in range(120):
    summary=0
    for j in range(5):
        if j==4:
            summary=summary+b[i][j]
        elif b[i][j]%10!=0:
            summary=summary+((10-b[i][j]%10)+b[i][j])
        else:
            summary=summary+b[i][j]
    c.append(summary)

print(min(c))

Submission status: Accepted

Solution code:
a = [list(input()) for _ in range(5)]
b = [int(''.join(a[i])) for i in range(len(a))]
c = []
h = 10
y = 0
for i in range(5):
    if 0 < int(a[i][-1]) <= h:
        h = int(a[i][-1])
        y = a.index(a[i])
r = b[y]
b[y] = 0
for i in range(5):
    while b[i] % 10 != 0:
        b[i] += 1

print(sum(b) + r)

Submission status: Accepted

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

a = list(map(lambda x: x % 10, l))
for i in range(len(a)):
    if a[i] == 0:
        a[i] = 10
a
mini = min(a)
index = a.index(mini)
def calc(x):
    if x % 10 == 0:
        return x
    else:
        return 10 + (x // 10) * 10
ans = 0
for i in range(len(l)):
    if i == index:
        #print(l[i])
        ans += l[i]
    else:
        add = calc(l[i])
        #print(add)
        ans += add
print(ans)

Submission status: Accepted

Solution code:
A = []
B = []
for i in range(5):
    a = int(input())
    A.append(a)
    B.append((a+9)-(a+9)%10)
ans = A[0] + sum(B) - B[0]
for i in range(1,5):
    ans = min(ans, A[i] + sum(B) - B[i])
print(ans)

Submission status: Accepted

Solution code:
import math
time = [int(input()) for _ in range(5)]
bad = 9
def swap(i):
  time[i],time[-1] = time[-1],time[i]
for i in time:
  if i % 10 == 0:
    continue
  else:
    if bad % 10 > i % 10:
      bad = i
if bad in time:
  index = time.index(bad)
  swap(index)
for i in range(4):
  if time[i] % 10 != 0:
    time[i] = time[i] + (10 - time[i] % 10)
print(sum(time))

Submission status: Accepted

Solution code:
five_dish = [int(input()) for _ in range(5)]
idx = 0
maxdiff = 0
result = 0
for i in range(len(five_dish)):
    tmp = five_dish[i] % 10
    if tmp != 0:
        if 10 - tmp > maxdiff:
            maxdiff = 10 - tmp
            idx = i
for j in range(len(five_dish)):
    if j == idx:
        continue
    else:
        if five_dish[j] % 10 == 0:
            result += five_dish[j]
        else:
            result += five_dish[j] + (10 - (five_dish[j] % 10))
result += five_dish[idx]
print(result)

Submission status: Accepted

Solution code:
dish = [0]*5
dish = [list(input()) for i in range(len(dish))]
time = 0
sumtime = 0

dish_sort = sorted(dish, key=lambda x:x[-1],reverse=True)
dish_sort = [''.join(dish_sort[i]) for i in range(len(dish))]
dish_sort = [int(i) for i in dish_sort]
dish1 = [i for i in dish_sort if i%10==0]
dish2 = [i for i in dish_sort if not i%10==0]
dish3 = dish1 + dish2

if len(dish2)==0:
    dish2.append(dish3[-1])
for i in range(len(dish3)-1):
    while dish3[i] > time:
        time += 10
    sumtime += time
    time = 0
print(sumtime+dish2[-1])

Submission status: Accepted

Solution code:
import numpy as np
X=[]
Y=[]
Z=[]
for i in range(5):
  x=int(input())
  X += [x]
for i in range(5):
  Y +=[-(-X[i]//10)*10]

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

answer=sum(Y)-max(Z)

print(answer)

Submission status: Accepted

Solution code:
A = []
for _ in range(5):
    A.append(int(input()))
ans = 0
maxx = 0
for i in A:
    x = 0
    if str(i)[-1] != '0':
        x = 10 - int(str(i)[-1])
        if x > maxx:
            maxx = x
    ans += (i + x)
print(ans - maxx)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    l=[int(input()) for i in range(5)]
    l2=list(map(lambda x: x%10 if x%10!=0 else 10,l))
    l3=list(map(lambda x: -(-x//10)*10,l))
    print(sum(l3)-(10-sorted(l2)[0]))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
li = 6
m = 10
for i in range(5):
    v = A[i] % 10
    if not v == 0:
        if v < m:
            m = v
            li = i

ans = 0
for i in range(5):
    if i == li or A[i] % 10 == 0:
        ans += A[i]
    else:
        ans += (A[i] // 10 + 1) * 10

print(ans)

Submission status: Accepted

Solution code:
import math

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

li = [[0, a], [1, b], [2, c], [3, d], [4, e]]
idx = sorted(list(map(lambda x: [x[0], (x[1] % 10) + 10] if (x[1] % 10) == 0 else [x[0], (x[1] % 10)], li)), key=lambda x: x[1])[0][0]
print(sum(map(lambda x: li[x][1] if x == idx else math.ceil(li[x][1] * 0.1) * 10, [0, 1, 2, 3, 4])))

Submission status: Accepted

Solution code:
import math

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

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

idx = sorted(list(map(lambda x: [x, x[1] + 10] if x[1] == 0 else x, [[0, (a % 10)], [1, (b % 10)], [2, (c % 10)], [3, (d % 10)], [4, (e % 10)]])), key=lambda x: x[1])[0][0]
print(sum(map(lambda x: li[x] if x == idx else math.ceil(li[x] * 0.1) * 10, [0, 1, 2, 3, 4])))

Submission status: Accepted

Solution code:
l = []
x = 2147483647
index = 0
for i in range(5):
   l.append( int(input()) )
   n = int(l[i]%10)
   if n>0 and n<x:
      x = n
      index = i

ans = 0
for i in range(5):
    if i == index:
        ans += l[i]
    elif l[i]%10 != 0:
        ans += int(l[i]/10)*10 +10
    else:
        ans += l[i]

print(ans)

Submission status: Accepted

Solution code:
l=[int(input()) for _ in range(5)]
l_1=[]
for i in l:
  if i%10!=0:
    l_1.append(((i+9)//10)*10)
  else:l_1.append(i)
nnn=9999999    
for i in range(5):
  num_1=0
  for j in range(5):
    if i==j:
      num_1+=l[j]
    else:num_1+=l_1[j]
  nnn=min(nnn,num_1)
print(nnn)

Submission status: Accepted

Solution code:
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    ls = []
    for i in range(5):
        n = int(input().rstrip('\n'))
        ls.append([n, 0 if n % 10 == 0 else 10 - n % 10, (n + 10 - 1) // 10 * 10])
    ls.sort(key=lambda x: x[1])
    t = 0
    for i in range(4):
        t += ls[i][2]
    print(t + ls[-1][0])


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import math

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



diff = [0 if (ai%10)==0 else 10-(ai%10) for ai in a]
max_diff=max(diff)

a10 = [math.ceil(ai/10)*10 for ai in a]

ret=sum(a10)-max_diff

print(ret)

Submission status: Accepted

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

time_for_serve = [int(input()) for _ in range(5)]
time_for_serve_ceil = [ceil(s / 10) * 10 for s in time_for_serve]
time_to_multiple_ten = [s % 10 for s in time_for_serve]

for i in range(len(time_to_multiple_ten)):
    if time_to_multiple_ten[i] == 0:
        time_to_multiple_ten[i] = 10

print(sum(time_for_serve_ceil) - time_for_serve_ceil[time_to_multiple_ten.index(min(time_to_multiple_ten))] + time_for_serve[time_to_multiple_ten.index(min(time_to_multiple_ten))])

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
ans=0
b=sorted([a[i]%10 for i in range(5)])
for i in range(5):
    #print(ans)
    ans+=((a[i]+9)//10)*10
for i in range(5):
    if b[i]!=0:
        ans+=b[i]-10
        break
print(ans)

Submission status: Accepted

Solution code:
dish = [int(input()) for x in range(5)]

loss_max = 0
loss_total = 0
for i in dish:
    if i%10 != 0:
        loss_total+=(10 - i%10)
        if loss_max < 10 - i%10:
            loss_max = 10 - i%10

print(sum(dish) + loss_total - loss_max)

Submission status: Accepted

Solution code:
import itertools,math
A = [int(input()) for _ in range(5)]
p = 2 ** 10 - 1
tens = 0
for i in range(5):
    if 0 < A[i] % 10 < p:
        p = A[i] % 10
    tens += math.ceil(A[i]/10)
if p == 2 ** 10 - 1:
    print(tens * 10)
else:
    print((tens-1) * 10 +p)

Submission status: Accepted

Solution code:
from math import ceil
cook = [int(input()) for _ in range(5)]
a = sorted([((mod-1) % 10, i) for i, mod in enumerate(cook)])
ans = cook.pop(a[0][1])

for _ in range(4):
    tmp = cook.pop()
    ans += ceil(tmp/10)*10

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=[a%10,b%10,c%10,d%10,e%10]
g=[]
if len(f)-f.count(0)==0:
    print(10*math.ceil(a/10)+10*math.ceil(b/10)+10*math.ceil(c/10)+10*math.ceil(d/10)+10*math.ceil(e/10))
else:
    for i in f:
        if i >0:
            g.append(i)
    print(10*math.ceil(a/10)+10*math.ceil(b/10)+10*math.ceil(c/10)+10*math.ceil(d/10)+10*math.ceil(e/10)-10+min(g))

Submission status: Accepted

Solution code:
lst = [int(input()) for i in range(5)]
i1,i2 = 0,0
for i,x in enumerate(lst):
    i3 = 10 - (x % 10)
    if i3 >= i1 and not(i3 == 10):

        i1 = i3
        i2 = i


lst.append(lst.pop(i2))

ans = 0
for i in range(4):

    if lst[i] % 10 == 0:
        ans = ans + lst[i]

    else:
        ans = ans + ((lst[i] // 10 + 1)*10)


print(ans+lst[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l=[int(input()) for I in range(5)]
p=sorted([d%10 for d in l if d%10!=0])
if len(p)==0:print(sum(l))
else:
  a=p[0]
  print(sum(l)+(len(p)-1)*10-sum(p)+a)

Submission status: Accepted

Solution code:
# 2019-11-12 22:40:44(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    dishes = [int(x) for x in sys.stdin.read().split()]
    

    total = 0
    for i in range(5):
        if dishes[i] % 10 != 0:
            total += (dishes[i] // 10 + 1) * 10
        else:
            total += dishes[i]
    

    remainder = [dishes[i] % 10 for i in range(5) if dishes[i] % 10 != 0]
    if remainder:
        ans = total - (10 - min(remainder))
    else:
        ans = total
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
h=[int(input()) for i in range(5)]
h=sorted(h, key=lambda x:x%10)
total=0
frag=True
for i in h:
    if i%10==0:
        total+=i
    elif frag==True and i%10!=0:
        total+=i
        frag=False
    else:
        i=i//10
        i=i*10+10
        total+=i
print(total)

Submission status: Accepted

Solution code:
import math

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

ra = math.ceil(a / 10) * 10 - a
rb = math.ceil(b / 10) * 10 - b
rc = math.ceil(c / 10) * 10 - c
rd = math.ceil(d / 10) * 10 - d
re = math.ceil(e / 10) * 10 - e

ans = a + b + c + d + e + ra + rb + rc + rd + re - max(ra, rb, rc, rd, re)

print(ans)

Submission status: Accepted

Solution code:
import math 

al = []
for _ in range(5):
    al.append(int(input()))
    

tmp = 11
log = -1
for idx,a in enumerate(al):
    point = a % 10
    if point == 0:
        point = 10
    if tmp > point:
        tmp = point
        log = idx

ans = 0
for idx, a in enumerate(al):
    if idx != log:
        ans += math.ceil(a / 10) * 10
    else:
        ans += a
    
print(ans)

Submission status: Accepted

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

for j in range(0,5):
  ans+=a[j]
  if a[j]%10>0:
    ans+=(10-(a[j]%10))
    b.append(a[j]%10)
        
if min(b)!=0:
  x=min(b)
    
print(ans-10+x)

Submission status: Accepted

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

m = 10
l = 0

for i in [A,B,C,D,E]:
    j = i // 10
    l += j * 10
    if i % 10 != 0:
        m = min(i%10,m)
        l += 10
        
l += m - 10
print(l)

Submission status: Accepted

Solution code:
List= [int(input()) for i in range(5)]
amari =9
time = 0
flag = False;
for i in List:
    if(i%10 != 0):
        time += 10 - i%10
        amari = min(amari,i%10)
        flag = True
output = sum(List) + time
if(flag):
    output -= 10 - amari
print(output)

Submission status: Accepted

Solution code:
b=10
d=[]
ans=[]
k=-10000
for i in range(5):
  a=int(input())
  d.append(a)
  if b>a%10 and a%10!=0:
    b=a%10
    k=i
  if a%10==0:
    ans.append(a)
  else:
    ans.append((a//10+1)*10)
if k!=-10000:
  ans[k]=d[k]
print(sum(ans))

Submission status: Accepted

Solution code:
l = list([int(input()) for _ in range(5)])
 
ans = 0
ml = []
 
for i in range(len(l)):
  ans += l[i]
  if ans % 10 == 0:
    pass
  else:
    ans += 10 - (ans % 10)

for i in range(len(l)):
  ml.append(l[i] % 10)
  if ml[i] == 0:
    ml[i] = 10
  
ans -= 10 - min(ml)
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
T = np.zeros(5, dtype=int)
T[0] = int(input())
T[1] = int(input())
T[2] = int(input())
T[3] = int(input())
T[4] = int(input())
res = np.argsort(T%10)
selected_index = 0
for i in range(5):
  if(T[res[i]]%10 > 0):
    selected_index = res[i]
    break
tim = (T//10 + (T%10 != 0))*10
tim[selected_index] = T[selected_index]
print(sum(tim))

Submission status: Accepted

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

y = []
for i in range(len(arr)):
    next_time = ((arr[i] + 10) // 10) * 10
    diff = next_time - arr[i]
    if diff == 10:
        y.append([arr[i], 0])
    else:
        y.append([arr[i], diff])

y.sort(key=lambda x: -x[1])

ans = 0
for i in range(len(y)):
    if i == 0:
        ans += y[i][0]
    else:
        ans += y[i][0] + y[i][1]

print(ans)

Submission status: Accepted

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

amari.sort()
print(sum(ans+ans2)-(10-amari[0]) if len(amari)!=0 else sum(ans+ans2) )

Submission status: Accepted

Solution code:
l = [ int(input()) for _ in range(5) ]
r = sorted([ 10-((10-i)%10) for i in l ])
u = [ -(-i//10)*10 for i in l ]
print(sum(u)-(10-r[0]))