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:
inList = []
for i in range(5):
    inList.append(int(input()))
saigo = []
minCnt = 130
for i in inList:
    minx = int(i % 10)
    if minx != 0:
        minCnt = min(minCnt, minx)
    saigo.append(minx)
if minCnt == 130:
    minCnt = 0
minIdx = saigo.index(minCnt)
appx = inList.pop(minIdx)
inList.append(appx)
ans = 0
for i in range(len(inList)):
    ans += int(inList[i])
    if i != len(inList) - 1:
        amari = ans % 10
        if amari != 0:
            ans += + (10 - amari)

print(ans)

Submission status: Accepted

Solution code:
times = []
times.append(int(input()))
times.append(int(input()))
times.append(int(input()))
times.append(int(input()))
times.append(int(input()))
times.sort(key=lambda a:-a % 10)
ans = 0
for i, time in enumerate(times):
  ans += ((time - 1) // 10 + 1) * 10 if i < len(times) - 1 else time
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
inputs = []
inputs.append(int(input()))
inputs.append(int(input()))
inputs.append(int(input()))
inputs.append(int(input()))
inputs.append(int(input()))
amari_list = []
time = 0
for input in inputs:
  amari = input % 10
  if amari == 0:
    time += input
  else:
    time += (input // 10) * 10
    amari_list.append(amari)
if len(amari_list) > 0:
  time += (len(amari_list) - 1)*10
  time += min(amari_list)
# 出力
print(time)

Submission status: Accepted

Solution code:
nums = []
flg = True
for _ in range(5):
    nums.append(int(input()))
amaris = []
minnum = 10
for num in nums:
    amaris.append(num%10)
    if num%10 < minnum and num%10!=0:
        minnum = num%10
count = 0
amari_count = 0
for num,amari in zip(nums,amaris):
    if amari == 0:
        count += num
        amari_count += 1
    else:
        count += (num//10+1)*10
print(count+minnum-10)

Submission status: Accepted

Solution code:
import numpy as np

i = 0
j = 0

nums = []
first_digits = []
min_first_digit = 9
index = 0
sum = 0

while i < 5:
  x = int(input())
  nums.append(x)
  
  if x % 10 <= min_first_digit and x % 10 != 0:
    min_first_digit = x % 10
    index = i
  i += 1
  
while j < 5:
  if j == index:
    sum += nums[j]
  else:
    if nums[j] % 10 == 0:
      sum += nums[j]
    else:
      sum += (nums[j] + 10 - (nums[j] % 10))
  j += 1
    
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

arr = [read_int()[0] for _ in range(5)]
arm = [arr[i] % 10 for i in range(5)]

def solve():
    ans = 0
    for i in range(5):
        ans += arr[i] - arm[i]
    arm.sort()
    initial = True
    for i in range(5):
        if arm[i] == 0:
            continue
        if initial:
            initial = False
            ans += arm[i]
        else:
            ans += 10
    return ans

if __name__ == "__main__":
    print(solve())

Submission status: Accepted

Solution code:
import math

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

menu.sort(key = lambda x: int(x%10) if int(x%10) != 0 else 9,reverse=True)

sum = 0
for m in menu[:-1]:
    sum += math.ceil(m/10)*10

print(sum+menu[-1])

Submission status: Accepted

Solution code:
import numpy as np


def read():
    foods = np.empty((5, ), dtype=np.int32)
    for i in range(5):
        foods[i] = int(input().strip())
    return foods,


def solve(foods):
    mod_10 = (foods+9) % 10
    order_indice = np.argsort(mod_10)[::-1]

    # sort foods
    foods = foods[order_indice]

    order_time = np.empty((5, ), dtype=np.int32)
    for i, food in enumerate(foods):
        order_time[i] = (food + 9) // 10 * 10
    order_time[4] = foods[4]
    return np.sum(order_time)


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))

Submission status: Accepted

Solution code:
import math
 
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10
L = [A,B,C,D,E]
L = [10 if i == 0 else i for i in L]
min_ = L.index(min(L))
A = math.ceil(a*0.1)*10
B = math.ceil(b*0.1)*10
C = math.ceil(c*0.1)*10
D = math.ceil(d*0.1)*10
E = math.ceil(e*0.1)*10
m = A+B+C+D+E
if min_ == 0:
  m = m - A + a
elif min_ == 1:
  m = m - B + b
elif min_ == 2:
  m = m - C + c
elif min_ == 3:
  m = m - D + d
elif min_ == 4:
  m = m - E + e
print(m)

Submission status: Accepted

Solution code:
import numpy as np

dish_min = []
 
for i in range(5):
   dish_min.append(int(input()))
    
p = [i%10 for i in dish_min]
pp = [(i-1)%10 for i in dish_min]
x = np.argmin(pp)

for i in range(5):
  if i != x and p[i]:
  	dish_min[i] += (10 - p[i])

print(sum(dish_min))

Submission status: Accepted

Solution code:
from operator import itemgetter
import math
a=[i for i in input()]
b=[i for i in input()]
c=[i for i in input()]
d=[i for i in input()]
e=[i for i in input()]
nums = []
nums.append(a)
nums.append(b)
nums.append(c)
nums.append(d)
nums.append(e)
nums.sort(key=itemgetter(-1),reverse = True)
last = 0
for num in nums:
    if num[-1]!="0":
        last= num[-1]
ans = 0
for num in nums:
    ans+=math.ceil(int("".join(num))/10)*10
if last !=0:
    print(ans-(10-int(last)))
else:
    print(ans)

Submission status: Accepted

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

ans = 0
for i, a in enumerate(abcde):
    if a % 10 == 0:
        ans += a

b = abcde[0]
for a in abcde:
    if a % 10 != 0:
        if a % 10 < b:
            b = a % 10
        ans -= a % 10
        ans += a + 10
b = 10 - b

ans -= b
print(ans)

Submission status: Accepted

Solution code:
import math

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

times = 0
# mod10が最小のもの(0除く)を最後にすれば最小？
min_10 = []
for c in range(len(cook)):
    min_10.append((cook[c] - 1) % 10)  # 0覗いて最小になるように、cookから1引いたもののmod10を比較

min_index = min_10.index(min(min_10))
total_time = 0
for c in range(len(cook)):
    if min_index == c:
        continue
    else:
        total_time += int(math.ceil(cook[c] / 10) * 10)
total_time += cook[min_index]

print(total_time)

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(5)]
ans=sum(l)
for i in range(len(l)):
    if(l[i]%10==0):
        l[i]=0
    else:
        l[i]=(10-l[i]%10)
l.sort()
del l[-1]
print(ans+sum(l))

Submission status: Accepted

Solution code:
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a%10
b1=b%10
c1=c%10
d1=d%10
e1=e%10
A=[a1,b1,c1,d1,e1]
for i in range(5):
  if 0 in A:
    A.remove(0)
if A==[]:
  cnt=(a//10 + b//10+c//10+d//10+e//10)*10
  A.append(0)
else:
  cnt=(a//10 + b//10+c//10+d//10+e//10)*10+10*(len(A)-1)
cnt1=cnt+min(A)
print(cnt1)

Submission status: Accepted

Solution code:
ans = 0
a = []
for _ in range(5):
    x = int(input())
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10
        a.append(x%10)

ans += (len(a)-1)*10
if a != []:
    ans += min(a)
else:
    ans += 10

print(ans)

Submission status: Accepted

Solution code:
lis = []
for i in range(5):
  lis.append(int(input()))
nmax = 0
index = 0
for v,item in enumerate(lis):
  if item % 10 != 0:
    if 10 - (item % 10) > nmax:
      nmax = 10 - (item % 10)
      index = v
nsum = lis.pop(index)
t = 0
while(t < 4):
  if lis[t]%10 != 0: 
    lis[t] += (10 - (lis[t] % 10))
  t += 1 
nsum += sum(lis)
print(nsum)

Submission status: Accepted

Solution code:
times = [int(input()) for i in range(5)]
cost = 0
p_times = [time % 10 for time in times]

if (sum([i % 10 for i in p_times]) == 0) & (min(times) > 0):
    last_order = False
else:
    last_order = min([i for i in p_times if i > 0])
    last_order_idx = p_times.index(last_order)

if last_order:
    cost = times.pop(last_order_idx)

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

print(cost)

Submission status: Accepted

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

order = [a,b,c,d,e]
set = []
for i in order:
  set.append([(i-1)%10,i])

set.sort(reverse=True)

time = 0

for i in set[:-1]:
  time += 10 * ((i[1]-1) // 10 + 1)
time += set[-1][1]

print(time)

Submission status: Accepted

Solution code:
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = int(i[-1])
    if val != 0:
        lst_diff.append(10 - val)

if lst_diff == []:
    lst_diff = [0]
diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

Submission status: Accepted

Solution code:
import math
n = 5
lst = []
mini = 10
for i in range(5):
    tmp=int(input())
    if tmp % 10 == 0:
        tmp2 = 10
    else:
        tmp2 = tmp % 10
    if tmp2 < mini:
        mini = tmp % 10
    tmp = math.ceil(tmp/10)
    lst.append(tmp)
print(int(sum(lst)*10) - (10 - mini))

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
B = [A[i] % 10 for i in range(5)]
C = [10 - B[i] for i in range(5) if B[i] != 0]
if C == []:
    C.append(0)

ans = 0
for i in range(5):
    ans += A[i]
    if B[i]: ans += 10 - B[i]

print(ans - max(C))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
count = 10
num = 0
num1 = 0


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


list1 = [a,b,c,d,e]
for i in range(len(list1)):
    if count > list1[i] % 10 and list1[i]%10 != 0:
        count = list1[i]%10
        num = i

for j in range(len(list1)):
    if j == num:
        num1 += list1[j]
    elif list1[j]%10==0:
        num1 += list1[j]        
    else:
        num1 += f(list1[j])
    
print(num1)

Submission status: Accepted

Solution code:
import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
list1 = [A,B,C,D,E]
list2 = [i%10 for i in list1]
min_item=max(list2)
for i in range(1,10):
    if i in list2:
        min_item = min(min_item,i)
min_index = list2.index(min_item)
total_time = 0
time_seq =[]

for i in range(5):
    if i == min_index:
        continue
    time1 = math.ceil(list1[i]/10) * 10
    total_time += time1
    time_seq.append(time1)
    
total_time += list1[min_index]
print(int(total_time))

Submission status: Accepted

Solution code:
from itertools import permutations
from sys import stdin

def main():
    I = [int(input()) for _ in [0] * 5]

    ans = float('inf')
    for i in permutations(I):
        p = 0
        for j in i[:4]:
            p += ((j + 9) // 10) * 10
        p += i[4]
        ans = min(ans, p)
    print(ans)

input = lambda: stdin.readline()
main()

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]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
times=tenmod.count(0)
if times!=0:
  for i in range(times):
    tenmod.remove(0)
if times!=5:
  key=min(tenmod)
else:
  key=0
alltime=0
lastflag=0
for i in range(5):
  if l[i]%10==0:
    alltime+=l[i]
  elif l[i]%10==key and lastflag==0:
    alltime+=l[i]
    lastflag+=1
  else:
    alltime+=int(l[i]/10)*10+10
print(alltime)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


n = [input() for i in range(5)]

mn = [10 if i[-1] == "0" else int(i[-1]) for i in n]
mn = min(mn)

n=[int(i) for i in n]

ans=0

for i in n:
    if i%10==0:
        ans+=i
    else:
        ans+=i-i%10+10

ans -= 10-mn

print(ans)

Submission status: Accepted

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

def get(x):
    y = x % 10
    if y == 0:
        return 10
    else:
        return y

A = get(a)
B = get(b)
C = get(c)
D = get(d)
E = get(e)


x = min([A, B, C, D, E]) % 10

if x == 0:
    print(10 * ((-(-a // 10) + -(-b // 10) + -(-c // 10) + -(-d // 10) + -(-e // 10))) + x)
else:
    print(10 * ((-(-a // 10) + -(-b // 10) + -(-c // 10) + -(-d // 10) + -(-e // 10))) + x - 10)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a_f = 10 - a % 10
b_f = 10 - b % 10
c_f = 10 - c % 10
d_f = 10 - d % 10
e_f = 10 - e % 10
# print(a,b,c,d,e)
lis = [a_f, b_f, c_f, d_f, e_f]
lis.sort()
lis
lis2 = []
for i in lis:
    # print(i)
    if i is not 10:
        lis2.append(i)
    else:
        break
lis2 = lis2[:-1]
# print(lis2)
print(a + b + c + d + e + sum(lis2))

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
t.sort()
count = 0
min_list = [t[0]%10,t[1]%10,t[2]%10,t[3]%10,t[4]%10]
min_list.sort()
for i in range(5):
    x = min_list[i]
    if x != 0:
        break
f =min([t[0]%10,t[1]%10,t[2]%10,t[3]%10,t[4]%10])
for i in range(5):
    if t[i]%10 == 0 :
        t[i] = t[i]-1
        count = 1
a =(t[4]//10+1)*10
b =(t[3]//10+1)*10
c =(t[2]//10+1)*10
d =(t[1]//10+1)*10
e =(t[0]//10+1)*10
if count == 0:
        print(a+b+c+d+e+f-10)
else:
    if min_list == [0]*5:
        print(a+b+c+d+e)
    else:
        print(a+b+c+d+e+x-10)

Submission status: Accepted

Solution code:
def ten_mod(x):
    ans = 10 if (x%10)==0 else x%10
    return ans

x = int(input())
ans = x if (x%10)==0 else int(x/10)*10+10
last = x

for i in range(5-1):
    x = int(input())
    ans += x if (x%10)==0 else int(x/10)*10+10
    if ten_mod(last) > ten_mod(x):
        last = x

ans = ans - 10 + (last%10) if (last%10) != 0 else ans
print(ans)

Submission status: Accepted

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

aa = a % 10
bb = b % 10
cc = c % 10
dd = d % 10
ee = e % 10

a = a - aa
b = b - bb
c = c - cc
d = d - dd
e = e - ee

k = 0

if aa == 0:
    aa = 10
elif aa > 0:
    k += 1
if bb == 0:
    bb = 10
elif bb > 0:
    k += 1
if cc == 0:
    cc = 10
elif cc > 0:
    k += 1
if dd == 0:
    dd = 10
elif dd > 0:
    k += 1
if ee == 0:
    ee = 10
elif ee > 0:
    k += 1

print(a + b + c + d + e + (k - 1) * 10 + min(aa, bb ,cc, dd, ee))

Submission status: Accepted

Solution code:
result = 0
A = list()
for i in xrange(5):
    tmp = int(raw_input())
    A.append(tmp)
    result += int(tmp/10) * 10
min = 10
red_count = 0
for i in xrange(5):
    if A[i] % 10 == 0: red_count += 1
    elif min > A[i] % 10:
        min = A[i] % 10

if min == 10: print result
else: print (result+10*(4-red_count)+min)

Submission status: Accepted

Solution code:
foods = [int(input()) for i in range(5)]
time = 0
rest = list(map(lambda x: x % 10, foods))
for i in range(5):
    if rest[i] == 0:
        time += foods[i]
    else:
        time += foods[i] - rest[i] + 10

if any(rest):
    print(time - 10 + min([i for i in rest if i != 0]))
else:
    print(time)

Submission status: Accepted

Solution code:
import itertools
import math

def ceiler(list):
    a, b, c, d, e = list
    a = math.ceil(a/10)
    b = math.ceil(b/10)
    c = math.ceil(c/10)
    d = math.ceil(d/10)
    return a, b, c, d, e
    
l = [int(input()) for _ in range(5)]

a, b, c, d, e = ceiler(l)
time = (a + b + c + d)*10 + e

for i in itertools.permutations(l):
    a, b, c, d, e = ceiler(i)
    if time > (a + b + c + d)*10 + e:
        time = (a + b + c + d)*10 + e
print(time)

Submission status: Accepted

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

import itertools

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

menu = (a, b, c ,d , e)
l_menu = list(itertools.permutations(menu))
t = 0
min_t =1000000

for i in range(len(l_menu)):
    for j in range(5):
        t += l_menu[i][j]
        if t % 10 > 0 and j <4:
            t += 10 - (t % 10)
    if min_t > t:
        min_t = t
    t = 0

print(min_t)

Submission status: Accepted

Solution code:
import sys
 
 
A = int(sys.stdin.readline().strip())
B = int(sys.stdin.readline().strip())
C = int(sys.stdin.readline().strip())
D = int(sys.stdin.readline().strip())
E = int(sys.stdin.readline().strip())



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

sur = []
i = 0
while(i<len(l)):
    if(l[i]%10==0):
        sur.append(0)
    else:
        sur.append(10 - l[i]%10)
    i += 1
    

j=0
t=0
while(j<len(l)):
    if(j!=sur.index(max(sur))):
        if(l[j]%10==0):
            t += l[j]
        else:
            t += int(l[j]/10)*10 + 10
    else:
        t += l[j]
    j += 1

print(t)

Submission status: Accepted

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

total_time = 0
max_wait_time = 10
for i in range(5):
    total_time += int(data[i]/10)*10
    if data[i]%10 != 0:
        total_time += 10
        if data[i]%10 < max_wait_time:
            max_wait_time = data[i]%10
print(total_time - (10-max_wait_time))

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
l_d = []
for i in l:
  if i % 10 == 0:
    l_d.append(0)
  else:
    n = (i//10+1)*10 - i
    l_d.append(n)
c = []
for i, j in zip(l_d, l):
  c.append([i, j])
  
from operator import itemgetter
c.sort(key=itemgetter(0))
a, b = zip(*c)
d = list(b)
for n, i in enumerate(list(d[:-1])):
  if i % 10 == 0:
    continue
  else:
    d[n] = (i//10+1)*10    
print(sum(d))

Submission status: Accepted

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

if sum(data)%10==0:
    print(sum(data))
else:
    cnt=1000
    index=0
    for ind,j in enumerate(data):
        if j%10 < cnt and j%10 != 0:
            index=ind
            cnt=j%10
    ans=0
    for k in data:
        if k % 10 == 0:
            ans += k
        else:
            ans+=(k//10+1)*10
    ans=ans+(data[index]%10)-10
    print(ans)

Submission status: Accepted

Solution code:
from math import ceil
ts = [int(input()) for _ in range(5)]
m = 10 - min([t % 10 for t in ts if not t % 10 == 0] + [10])
tss = [ceil(t / 10) * 10 for t in ts]
print(sum(tss) - m)

Submission status: Accepted

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

m = sorted([xx for xx in x if xx % 10], key=lambda y: y %
           10) + [xx for xx in x if xx % 10 == 0]

n = [(10 - mm % 10) for mm in m if mm % 10]

print(sum(m) + sum(n[1:]))

Submission status: Accepted

Solution code:
import math

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

a_f=math.ceil(float(A)*0.1)*10
b_f=math.ceil(float(B)*0.1)*10
c_f=math.ceil(float(C)*0.1)*10
d_f=math.ceil(float(D)*0.1)*10
e_f=math.ceil(float(E)*0.1)*10

x=a_f+b_f+c_f+d_f+e_f

y=set([A%10,B%10,C%10,D%10,E%10])
if 0 in y:
	y.remove(0)
if len(y)==0:
    print(x)
else:
    z=min(y)
    print(x+z-10)

Submission status: Accepted

Solution code:
import math
x = []
sum = 0
max = 9
memo_m1 = 0
for i in range(5):
    x.append(int(input()))
for i in range(5):
    temp = x[i] % 10
    if temp != 0 and temp < max:
        max = temp
        memo_m1 = i
        
for i in range(5):
    if i == memo_m1 :
        continue
    sum += math.ceil(x[i]/10)*10

print(sum + x[memo_m1])

Submission status: Accepted

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

orders_ = []
for order in [A, B, C, D, E]:
  if order % 10 == 0:
    orders_.append((order, 0))
  else:
    orders_.append((order, 10 - order % 10))
orders = sorted(orders_, key=lambda x: x[1])
tet = 0
for order in orders[:-1]:
  tet += order[0] + order[1]
tet += orders[-1][0]  
print(tet)

Submission status: Accepted

Solution code:
dish=[0]*5
less=[0]*5
cnt = 0

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

for i in range(5):
    less[i] = dish[i]%10
    if less[i]==0:
        less[i]+=10
index_less = less.index(min(less))
time = dish[index_less]

for i in range(5):
    while dish[i]%10>0:
        dish[i]+=1
    time+=dish[i]
    
print(time-dish[index_less])

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a, b, c, d, e]
li_2 = []
d = 10
count = 0
adr = 0
for i in li:
    li_2.append(i % 10)
for i in li_2:
    if i < d and i != 0:
        d = i
        ans = adr
    adr += 1
if d == 10:
    d = 0
    ans = 0
for i in range(5):
    if i != ans and li_2[i] != 0:
        count += (li[i] - li_2[i] + 10)
    elif i != ans and li_2[i] == 0:
        count += li[i]
count += li[ans]
print(count)

Submission status: Accepted

Solution code:
import math


def main():
    ans = 0
    t = []
    for _ in range(5):
        x = input()
        if x[-1] == '0':
            ans += int(x)
        else:
            t.append(int(x))
    if len(t) > 0:
        t.sort(key=lambda x: str(x)[-1])
        for i in range(1, len(t)):
            ans += math.ceil(t[i] / 10) * 10
        ans += t[0]
    print(ans)


main()

Submission status: Accepted

Solution code:
import numpy as np

ryouri = np.array([0]*5)
amari = np.array([0]*5)

for i in range(5):
    ryouri[i] = int(input())
    if ryouri[i]%10 != 0:
        amari[i] = 10-ryouri[i]%10
    
amari[amari.argmax()] = 0
ryouri += amari

print(ryouri.sum())

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a = []
for i in range(5):
    b = int(input())
    a.append(b)
mn = 0xFFFFFFFFFFFFFF
for i in list(itertools.permutations(a)):
    k = 0
    count = 0
    for j in i:
        count += 1
        k += j
        if count == 5:
            mn = min(mn, k)
        l = 10 - (k % 10)
        if l == 10:
            pass
        else:
            k += l
print(mn)

Submission status: Accepted

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

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = -1
for i in range(len(num)):
    if num[i] != 0:
        if last_index == -1:
            last_index = i
        if num[i] <= num[last_index]:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)

Submission status: Accepted

Solution code:
A = []
min_1 = 9
min_index = 0
for i in range(5):
    a = int(input())
    A.append(a)
    if (a%10 == 0):
        continue
    if (a%10 <= min_1):
        min_1 = a%10
        min_index = i

t = A.pop(min_index)
for a in A:
    if a%10 == 0:
        t += a
    else:
        t += ((a//10)+1)*10
print(t)

Submission status: Accepted

Solution code:
def f1(a):
    if a%10==0:
        return a
    else:
        return (a//10+1)*10

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

brr = map(f1, arr)
crr = filter(lambda x: x!=0, map(lambda x: x%10,arr))
if len(crr)>0:
    print(sum(brr)-10+min(crr))
else:
    print(sum(brr))

Submission status: Accepted

Solution code:
foodtime = []
for i in range(5):
    foodtime.append(int(input()))
thinkfood = []
for j in range(5):
    thinkfood.append((foodtime[j]-1)%10)
thinkfood = sorted(thinkfood)
u = 10-(thinkfood[0]+1)
ans = 0
for k in range(5):
    if foodtime[k]%10==0:
        ans += foodtime[k]
    else:
        ans += foodtime[k] - (foodtime[k]%10) + 10
print(ans - u)

Submission status: Accepted

Solution code:
t = [0]*5
m = [0] * 5
min = 10
min_idx = 0
for i in range(5):
    t[i] = int(input())
    m[i] = t[i] % 10
    if( min > m[i] and m[i] != 0):
        min = m[i]
        min_idx = i
for i in range(5):
    if( i != min_idx ):
        if( m[i] != 0):
            t[i] += (10 - m[i])
print(sum(t))

Submission status: Accepted

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

res = 0
x   = 10
for i in range(5):
    res = res + math.ceil(l[i]/10)
    if l[i] % 10 != 0:
        x = min(x,l[i] % 10)
    
res = res * 10 - 10 + x

print(res)

Submission status: Accepted

Solution code:
A = [0,0,0,0,0]
B = []
for i in range(5):
    A[i] = int(input())
    b = 10 - A[i] %10
    if b == 10:
        b = 0
    B.append ([b, A[i]]) # 10のあまりをだす
B.sort()

re = 0
for i in range(5):
    if i == 4:
        B[i][0] = 0
    re += B[i][0] + B[i][1]
    
print(re)

Submission status: Accepted

Solution code:
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

lis,f = [],[]
for i in range(5):
    lis.append(I())
    if lis[-1] % 10 != 0:
        f.append(lis[-1] % 10)
print(sum(lis+list(map(lambda x: 10-x, sorted(f)[1:]))))

Submission status: Accepted

Solution code:
s = list(map(int,[input() for i in range(5)]))
sum_time = sum(s)
s_10mod = [(10 -(i % 10)) %10 for i in s]
s_10mod.sort()
sum_10mod = sum(s_10mod) - s_10mod[-1]
print(sum_time + sum_10mod)

Submission status: Accepted

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

    count+=int(a/10)*10
    if a%10!=0:
        m.append(a%10)
        count+=10
if len(m)==0:
    flag=False
else:
    flag=True


if flag==True:
    mini=min(m)
    a=[] 
    for i in l:
        if mini==i%10:
            a.append(i)

    if len(a)==0:
        print(count)
    else:
        last=min(a)
        b=10-mini
        count-=b
        print(count)
else:
    print(sum(l))

Submission status: Accepted

Solution code:
import math
menu = []
m1 = []
for i in range(5):
   menu.append(int(input()))
   m1.append(menu[i]%10)
   if(m1[i] == 0): m1[i] += 10
a = m1.index(min(m1))
b = menu.pop(a)
tot = 0
for i in range(4):
   tot += math.ceil(menu[i]/10)*10
tot += b
print(tot)

Submission status: Accepted

Solution code:
dishes = [input() for i in range(5)]
min = 9
index = 0
for i in range(len(dishes)):
    if min > int(dishes[i][-1]) and int(dishes[i][-1]) != 0:
        min = int(dishes[i][-1])
        index = i
ans = 0
for i in range(len(dishes)):
    x = 0
    if i != index:
        if int(dishes[i][-1]) != 0:
            x = 10 - int(dishes[i][-1])
        ans += int(dishes[i]) + x
ans += int(dishes[index])
print(ans)

Submission status: Accepted

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

key=[]
sums=0

for num in nums:
  if num%10==0:
    key.append(10)
  else:
    key.append(num%10)

flag=True

for i in range(len(nums)):
  if nums[i]==nums[key.index(min(key))] and flag:
    flag=False
    continue
  sums+=((10-key[i])+nums[i])
  
print(sums+nums[key.index(min(key))])

Submission status: Accepted

Solution code:
sum_a = 0
max_a = 0
for i in range(5):
  num = int(input())
  sum_a += num if num % 10 == 0 else ((num // 10) + 1) * 10
  if (10 - (num % 10) > max_a) and (num % 10 != 0):
    max_a = 10 - (num % 10)
print(sum_a - max_a)

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
LL = [i % 10 for i in L]
if LL == [0] * 5:
    print(sum(L))
else:
    L2 = LL[:]
    while 0 in L2:
        L2.remove(0)
    ma = min(L2)
    r = LL.index(ma)
    print(L[r] + sum([L[i] if L[i] % 10 == 0 else L[i] + 10 - L[i] % 10 for i in [j for j in range(5) if j != r]]))

Submission status: Accepted

Solution code:
l=[]
m=[]
n=[]
a=0
for i in range(5):
  s=int(input())
  n.append(s)
  m.append(round(int(s+5),-1))
  if s%10 != 0:
    l.append(s%10)
    a+=1
if a ==0:
  print(sum(n))
else:
  print(sum(m)+min(l)-10)

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
l2 = []
cnt = 0
cnt2 = 0
for i in range(5):
    res = l[i] - (l[i]//10)*10
    if res == 0:
        cnt += l[i]
        flag = True
    else:
        cnt += (l[i]//10)*10
        l2.append(res)
        cnt2 += 1

if l2 == []:
    l2.append(0)
if cnt2 >= 1:
    cnt2-= 1

print(cnt+min(l2)+cnt2*10)

Submission status: Accepted

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

nums = [a,b,c,d,e]
f = [[0 for i in range(2)] for j in range(5)]
for i in range(len(nums)):
  ichi = str(nums[i])[-1]
  atai = nums[i]
  if int(ichi) == 0:
    f[i][0] = 0
  else:
    f[i][0] = 10 - int(ichi)
  f[i][1] = atai
  #f.append(str(nums[i])[-1])
n = len(nums)
f_sorted =sorted(f)
#print(f_sorted)
ans = 0
for i in range(len(nums)):
  if i != n-1:
    if f_sorted[i][1] % 10 == 0:
      ans += f_sorted[i][1]
    else:
      ans += ((f_sorted[i][1] // 10) + 1) * 10
  else:
    ans += f_sorted[i][1]
  #print(ans)
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]
r = [dish % 10 for dish in l]
m = 10
i = 0
for j in range(5):
  if (r[j] != 0) & (r[j] < m):
    m = r[j]
    i = j
    
t = 0
for j in range(5):
  if i == j or r[j] == 0:
    t += l[j]
  else:
    t += ((l[j] // 10) + 1) * 10
    
print(t)