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:
num_list = [int(input()) for i in range(5)]

remains = []
divs = []

for num in num_list:
    remains.append(num % 10)
    divs.append(num // 10)

zeros = remains.count(0)

for i in range(remains.count(0)):
    remains.remove(0)

if len(remains) == 0:
    print(sum(divs) * 10)
else:
    print(sum(divs) * 10 + 40 - zeros * 10 + min(remains))

Submission status: Accepted

Solution code:
# B - Five Dishes
# sys.stdin.readline()
# import sys
import math
# input = sys.stdin.readline
each_time = [int(input()) for i in range(5)]
wait_time = [10*math.ceil(i/10)-i for i in each_time]
result = [i + k for i,k in zip(each_time, wait_time)]
result[wait_time.index(max(wait_time))] = each_time[wait_time.index(max(wait_time))]
print(sum(result))

Submission status: Accepted

Solution code:
# B - Five Dishes
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline
each_time = [int(input()) for i in range(5)]
wait_time = [10*math.ceil(i/10)-i for i in each_time]
result = [i + k for i,k in zip(each_time, wait_time)]
result[wait_time.index(max(wait_time))] = each_time[wait_time.index(max(wait_time))]
print(sum(result))

Submission status: Accepted

Solution code:
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
A=(a+9)//10*10
B=(b+9)//10*10
C=(c+9)//10*10
D=(d+9)//10*10
E=(e+9)//10*10
F=max(A-a,B-b,C-c,D-d,E-e)
print(A+B+C+D+E-F)

Submission status: Accepted

Solution code:
import math

minutes = [int(input()) for i in range(5)]
m = [math.ceil(minutes[k] / 10) * 10 for k in range(5)]

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

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

Submission status: Accepted

Solution code:
import sys

dishes = [int(line.strip()) for line in sys.stdin]
min1 = 10
for d in dishes:
  if 0 < d%10 < min1:
    min1 = d%10
if min1 == 0:
  min1 = 10
dishes = [((d+9)//10)*10 for d in dishes]
print(sum(dishes)-(10-min1))

Submission status: Accepted

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

last = 0
for i in range(len(menu)):
    tmp = menu[i] % 10
    if tmp != 0 :
        mod.append(10 - tmp)
    else:
        mod.append(0)

    last = max(last,mod[i])


print(menu[0]+mod[0]+menu[1]+mod[1]+menu[2]+mod[2]+menu[3]+mod[3]+menu[4]+mod[4]-last)

Submission status: Accepted

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

a_syo = a//10
b_syo = b//10
c_syo = c//10
d_syo = d//10
e_syo = e//10
time1 = (a_syo + b_syo + c_syo + d_syo + e_syo) * 10

a_amari = a%10
b_amari = b%10
c_amari = c%10
d_amari = d%10
e_amari = e%10
lst = []
if a_amari == 0:
    pass
else:
    lst = lst + [a_amari]
if b_amari == 0:
    pass
else:
    lst = lst + [b_amari]
if c_amari == 0:
    pass
else:
    lst = lst + [c_amari]
if d_amari == 0:
    pass
else:
    lst = lst + [d_amari]
if e_amari == 0:
    pass
else:
    lst = lst + [e_amari]
if len(lst) == 0:
    print (time1)
else:
    #print (lst)
    count = len(lst) - 1
    #print (count)
    lst.sort()
    #print (lst)
    time2 = (len(lst) -1)*10 + lst[0]
    print (time1 + time2)

Submission status: Accepted

Solution code:
import math
l = [int(input()) for _ in range(5)]
l_1st = [int(str(10 - int(str(i)[-1]))[-1]) for i in l]
l_rm_i = l_1st.index(max(l_1st))
l_rm = l[l_rm_i]
del l[l_rm_i]

l = [math.ceil(i/10)*10 for i in l]
ans = int((sum(l) + l_rm))
print(ans)

Submission status: Accepted

Solution code:
from itertools import permutations

dishes = [int(input()) for _ in range(5)]
ans = 10**9
for order in permutations(dishes):
    temp = 0
    for i in range(5):
        temp += order[i]
        if i != 4:
            temp += (10 - (order[i] % 10)) % 10
    if temp < ans:
        ans = temp
print(ans)

Submission status: Accepted

Solution code:

dishes = [int(input()) for _ in range(5)]
ans = 0
a = 10

for x in dishes:
  if x % 10 == 0:
    ans += x
  else:
    ans += x - (x%10) + 10
    a = min(a, x%10)
    
if a == 10:
    a = 0
else:
    a -= 10
print(ans + a)

Submission status: Accepted

Solution code:
# ABC123B - Five Dishes
data = list(map(int, [input().rstrip() for _ in range(5)]))
data_need = [(10 - data[i]) % 10 for i in range(5)]

print(sum(data) + sum(data_need) - max(data_need))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
b = []
c = []
for i in range(5):
    a.append(int(input()))
    b.append(a[i]%10)
for i in range(5):
    if b[i] == 0:
        c.append(a[i])
    else:
        c.append(a[i]+10-b[i])
m = 0
for i in range(5):
    if m < 10-b[i] < 10 :
        m = 10-b[i]
print(sum(c)-m)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
b =[]
c = []
for i in range(5):
    b.append(int(a[i]))
for i in range(5):
    while b[i] > 10:
        b[i] = b[i] - 10
if min(b) == 10:
    ans = sum(a)
else:
    for i in range(5):
    	c.append(int(a[i]) +10 -int(b[i]))
    d = sum(c)
    mini = min(b)
    ans = d - 10 + mini
print(ans)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
b =[]
c = []
for i in range(5):
    b.append(int(a[i]))
for i in range(5):
    while b[i] > 10:
        b[i] = b[i] - 10
if min(b) == 10:
    ans = sum(a)
else:
    for i in range(5):
                c.append(int(a[i]) +10 -int(b[i]))
    d = sum(c)
    mini = min(b)
    ans = d - 10 + mini
print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	a = [int(input()) for _ in range(5)]
	last_order = 0
	min_time = 10
	for i,ai in enumerate(a):
		if(ai%10!=0 and min_time > ai%10):
			min_time = ai %10
			last_order = i

	ans = 0
	for i,ai in enumerate(a):
		if(i!=last_order and ai%10==0):
			ans += (ai//10)*10
		elif(i!=last_order):
			ans += (ai//10+1)*10
		else:
			ans += ai

	print(ans)

Submission status: Accepted

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

c=[]
for i in range(5):
    if lst[i]%10!=0:
        c.append(lst[i]%10)
        lst[i]=(lst[i]//10+1)*10

if not c:
    print(sum(lst))
else:
    print(sum(lst)+min(c)-10)

Submission status: Accepted

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

diff = sorted([A%10, B%10, C%10, D%10, E%10])
mindiff = 0
for x in diff:
    if x != 0:
        mindiff = x
        diff.remove(mindiff)
        break

sum = 0
for x in (A, B, C, D, E):
    sum = sum + x
for x in diff:
    if x != 0:
        sum = sum + (10 - x)

print(sum)

Submission status: Accepted

Solution code:
import numpy as np
A = np.array([int(input()) for _ in range(5)]).reshape(-1,1)
A = np.array(A).reshape(-1,1)
A = np.c_[A, (10 - A % 10) * (A % 10 != 0)]
print(sum(A.reshape(-1))-max(A[:,1]))

Submission status: Accepted

Solution code:
import numpy as np
A = np.array([int(input()) for _ in range(5)]).reshape(-1,1)
A = np.array(A).reshape(-1,1)
A = np.c_[A, (10 - A % 10) * (A % 10 != 0)]
print(sum(A[:,0]+A[:,1])-max(A[:,1]))

Submission status: Accepted

Solution code:
just_in = []
not_just = []
for i in range(5):
    t = int(input())
    if t%10:
        not_just.append(t)
    else:
        just_in.append(t)
not_just.sort(key = lambda x:-x%10)

time = 0
src = just_in + not_just
for i in range(5):
    if i == 4:
        time += src[i]
        break
    if src[i]%10:
        time += (src[i]//10 + 1)*10
    else:
        time += src[i]
        
print(time)

Submission status: Accepted

Solution code:
import itertools
R = [i for i in range(5)]
A = []
for i in range(5):
    A.append(int(input()))
t = float('inf')
for k in itertools.permutations(R):
    tmp = 0
    for j in range(5):

        if j != 4:
            if A[k[j]] % 10 != 0:
                tmp += A[k[j]] + 10 - A[k[j]] % 10
            else:
                tmp += A[k[j]]
        else:
            tmp += A[k[j]]

    t = min(t, tmp)

print(t)

Submission status: Accepted

Solution code:
list_1 = []
list_2 = []
list_3 = []

for i in range(5):
    list_1.append(input())

for i in range(5):
    list_2.append(int(list_1[i]) % 10)

for i in range(5):
    if list_2[i] != 0:
        list_3.append(-(list_2[i] - 10))
    else:
        list_3.append(0)

max_num = 0
max_num_2 = 0
for i in range(5):
    if list_3[i] > max_num:
        max_num = list_3[i]
        max_num_2 = i

a1 = int(list_1.pop(max_num_2))
a2 = int(list_3.pop(max_num_2))

ans = 0

for i in range(4):
    ans += int(list_1[i])
    ans += list_3[i]

ans += a1

print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
rest = []
time = 0
for v in l:
  if v %10 == 0:
    time += v
  else:
    time += int(v/10)*10
    rest.append(v%10)
#print(rest)
if rest != []:
  time += ((len(rest)-1)*10)
  time += min(rest)
print(time)

Submission status: Accepted

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
ls = []
for i in range(5):
    ls.append(int(input()))
ls2 = [i%10 for i in ls]
if ls2 == [0,0,0,0,0]:
    print(sum(ls))
else:
    lasttime = 10
    for a in ls:
        b = a%10
        if b < lasttime and b != 0:
            lasttime = b
            ans =a

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

    print(int(sum + ans))

Submission status: Accepted

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

x = 10
ans = 0
for a in A:
    if a % 10 == 0:
        ans += a
    else:
        ans += (a // 10 + 1) * 10
        x = min(x, a % 10)

if x == 10:
    x = 0
else:
    x -= 10
print(ans + x)

Submission status: Accepted

Solution code:
l = []
a = int(input())
a1 = a%10
a2 = a + (10-a1)%10
b = int(input())
b1=b%10
b2 = b + (10-b1)%10
c = int(input())
c1=c%10
c2 = c + (10-c1)%10
d = int(input())
d1=d%10
d2 = d + (10-d1)%10
e = int(input())
e1=e%10
e2 = e + (10-e1)%10
if a1 != 0:
    l.append(a1)
if b1 != 0:
    l.append(b1)
if c1 != 0:
    l.append(c1)
if d1 != 0:
    l.append(d1)
if e1 != 0:
    l.append(e1)

if max(a1,b1,c1,d1,e1) == 0:
    ans = a2+b2+c2+d2+e2
else:
    ans = a2+b2+c2+d2+e2 -10 +min(l)
print(ans)

Submission status: Accepted

Solution code:
menew=[int(input()) for i in range(5)]
small=0
jo=10

for i in range(5):
    if menew[i]%10<jo and menew[i]%10!=0:
        jo=menew[i]%10
        small=menew[i]
if small!=0:
    menew.remove(small)
    ans=0
    for i in range(4):
        if menew[i]%10==0:
            p=0
        else:
            p=10-menew[i]%10
        ans+=menew[i]+p
    ans+=small
    print(ans)
else:
    print(sum(menew))

Submission status: Accepted

Solution code:
from math import ceil
a = []
b = []
for i in range(5):
  w = int(input())
  a.append(w)
  b.append(ceil(w/10)*10)
  
ans = 130*5

for i in range(5):
  w = sum(b) - b[i] + a[i]
  ans = min(ans, w)
  
print(ans)

Submission status: Accepted

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

lst = [a,b,c,d,e]
amari = list(map(lambda x: x % 10,lst ))
sho = list(map(lambda x: x // 10,lst))

for i in range(5):
    if amari[i] == 0:
        amari[i] = amari[i]+10
    else:
        sho[i] = sho[i]+1


def swap(x,y):
 global amari,lst,sho
 temp = amari[x]
 amari[x] = amari[y]
 amari[y] = temp
 temp2 = lst[x]
 lst[x] = lst[y]
 lst[y] = temp2
 temp3 = sho[x]
 sho[x] = sho[y]
 sho[y] = temp3

for i in range(1,5):
    j = i
    while j >= 1:
      if amari[j-1] > amari[j]:
        swap(j-1, j)
      else:
        break      # while文から強制的に抜け出る
      j = j - 1

a = sho[2] + sho[3] + sho[4] + sho[1]

time = a*10


time = time + lst[0]

print(time)

Submission status: Accepted

Solution code:
order_times = [int(input()) for i in range(5)]
loss_times = [10 - (i%10) for i in order_times if i%10 != 0]
loss_times.append(0)
total_time = sum(order_times) + sum(loss_times) - max(loss_times)
print(total_time)

Submission status: Accepted

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

Xs = [A, B, C, D, E]
Xs = sorted(Xs, key = lambda x: - x % 10)
ans = 0
for X in Xs[:-1]:
    ans += (X + 9) // 10 * 10
ans += Xs[-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

import math

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

ans = 0
for A in As:
    ans += math.ceil(A / 10) * 10

ans += min([(A - 1) % 10 for A in As]) - 10 + 1
print(ans)

Submission status: Accepted

Solution code:
x = list(map(lambda x:{"value":x, "offset":0 if x % 10 == 0 else 10 - x % 10}, [int(input()) for _ in range(5)]))
print(sum([y["value"]+y["offset"] for y in x]) - max([y["offset"] for y in x]))

Submission status: Accepted

Solution code:
max = 0
val = 0
dis = 0
lst = []
valdis = 0

for i in range(5):
    num = int(input())
    val = 0
    while num > val:
        val += 10

    dispre = val - num

    if dis < dispre:
        dis = dispre
        max = num
        lst.append(valdis)
        valdis = val
    else:
        lst.append(val)

print(sum(lst) + max)

Submission status: Accepted

Solution code:
lst = []
for i in range(5):
    lst.append(int(input()))
lst_f=[]
for i in range(5):
    lst_f.append(lst[i]%10)
while 0 in lst_f:
    lst_f.remove(0)
if len(lst_f) == 0:
    print(sum(lst))
else:
    print(sum(lst)-sum(lst_f)+10*(len(lst_f)-1)+min(lst_f))

Submission status: Accepted

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

S = [round(x + 4.9, -1) for x in X]
d = [round(x + 4.9, -1) - x for x in X]

print(int(sum(S) - max(d)))

Submission status: Accepted

Solution code:
num=[]
a=[] 
time = 0 
for i in range(5):
    num.append(int(input()))
    if num[i]%10 == 0:
        a.append(0)
    else:
        a.append(10 - num[i]%10)
    time += num[i] + a[i]

time -= max(a)

print(time)

Submission status: Accepted

Solution code:
import numpy as np

nums = []
sortedNums = [0,0,0,0,0]
sortedRemainders = [0,0,0,0,0]
for i in range(5):
	nums.append(int(input()))

remainders = [0,0,0,0,0]
for i in range(5):
	if nums[i] % 10 == 0:
		remainders[i] = 10
	else:
		remainders[i] = nums[i] % 10

sortedRemaindersIndex = np.ndarray.tolist(np.argsort(remainders))

for i in range(5):
	sortedNums[i] = nums[sortedRemaindersIndex[i]]

elapsedTime = 0
for i in range(4):
	if sortedNums[i+1] % 10 == 0:
		elapsedTime += sortedNums[i+1]
	else:
		elapsedTime += sortedNums[i+1] + 10 - sortedNums[i+1] % 10

elapsedTime += sortedNums[0]

print(elapsedTime)

Submission status: Accepted

Solution code:
def amari(num):
    if num%10 ==0:
        return 10
    return num%10

if __name__ =="__main__":
    S = []
    for x in range(5):
        S.append(int(input()))
    max_num = min(S,key=amari)
    S.remove(max_num)
    total=0
    for x in S:
        if x%10 == 0:
            total += x
        else:
            total+=(int(x/10)+1)*10
    print(total+max_num)

Submission status: Accepted

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

m = 9
j = 0
for i in range(5):
  if 0 < a[i] % 10 < m:
          m = a[i] % 10
          j = i

a[j], a[4] = a[4], a[j]

for i in range(5):
  if i != 4:
        a[i] = int(math.ceil(a[i] / 10) * 10)
  #print(a)
  
print(sum(a))

Submission status: Accepted

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

def res(x):
    res_x = 0 if x % 10 == 0 else 10 - x % 10
    return res_x

def gauss(x):
    gx = x if x%10 == 0 else 10 * (x // 10 + 1)
    return gx

ds = [a, b, c, d, e]
ds_sort = sorted(ds, key=lambda x: res(x))
ans = sum([gauss(e) for e in ds_sort[:-1]]) + ds_sort[-1]

print(ans)

Submission status: Accepted

Solution code:
li = [int(input()) for _ in range(5)]  # li = ['hoge', 'bar', 'foo']
minx = 10000
for i in range(5):
    tmp = 0
    for j in range(5):
        if i == j:
            tmp += li[j]
        else:
            if li[j] % 10 == 0:
                tmp += li[j]
            else:
                tmp += (li[j] // 10 + 1) * 10
    if tmp < minx:
        minx = tmp
print(minx)

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
m=a[0]%10
s=0
for i in range(1,5):
  if m > a[i]%10 and a[i]%10 != 0 or m == 0:
    m=a[i]%10
for i in range(5):
  if a[i]%10 == 0:
    s+=a[i]
  else:
    s+=a[i]-a[i]%10+10
if m != 0:
  s-=10-m
print(s)

Submission status: Accepted

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

X = [A,B,C,D,E]
Y = []
for x in X:
    if x%10==0:
        Y.append((0, x))
    else:
        d = 10 - x%10
        Y.append((d, x+d))

Y.sort(reverse=True)
Ans = Y[0][1]-Y[0][0]
for i in range(1,len(Y)):
    Ans += Y[i][1]

print(Ans)

Submission status: Accepted

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

time = 0 # 最後の料理が届く時刻

# 最後に頼む料理を決める
max = 0
j = -1 # 最後に頼む料理
for i in range(5):
    if dishes[i] % 10 != 0:
        point = 10 - (dishes[i] % 10)
    else:
        point = 0
    if point >= max:
        max = point 
        j = i

# 最後に頼む料理以外を頼む
for i in range(5):
    if i == j:
        continue 
    time += dishes[i]
    if dishes[i] % 10 != 0: # 10の倍数に合わせる
        time += 10 - (dishes[i] % 10)

print(time + dishes[j])

Submission status: Accepted

Solution code:
data = [int(input()) for i in range(5)]
a = 10
ans = 0
for i in range(5):
	d = data[i]%10
	if d!=0 and a>d:
		a = d
	ans += (data[i]+9)//10

ans = (ans-1)*10
print(ans+a)

Submission status: Accepted

Solution code:
arr = []
for i in range(5):
    arr.append(int(input()))
index = 0
rem_arr = []
for i in arr:
    time = i % 10
    if time == 0:
        time += 9
    rem_arr.append(time)
last_index = min(enumerate(rem_arr), key=lambda x: x[1])[0]
last = arr[last_index]
arr.pop(last_index)
total = 0
for i in arr:
    if i < 10:
        h = 10
    else:
        h = (i + 9) // 10 * 10
    total += h
total += last
print(total)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
ma = max([0 if a%10 == 0 else 10-a%10 for a in A])
A = [a if a%10 == 0 else a+10-a%10 for a in A]
print(sum(A)-ma)

Submission status: Accepted

Solution code:
import math

li = [input() for i in range(5)]
digit = [li[i][-1:] for i in range(5)]
digitAsc = sorted(digit)

for lastOrderDight in range(5):
    if digitAsc[lastOrderDight] != '0':
        break


for lastOrder in range(5):
    if digit[lastOrder] == digitAsc[lastOrderDight]:
        break

li_i = [int(i) for i in li]

time = 0
for i in range(5):
    if i != lastOrder:
        time += math.ceil(li_i[i] / 10) * 10 
    else:
        time += li_i[i]

print(time)

Submission status: Accepted

Solution code:
import numpy as np

t = np.array([int(input()) for _ in range(5)])
t_wasted = (10 - t % 10) % 10
last = np.argmax(t_wasted)

ans = 0

for i in range(5):
    ans += t[i]

    if i != last:
        ans += t_wasted[i]

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

t = np.array([int(input()) for _ in range(5)])
t_wasted = (10 - t % 10) % 10
t_total = t + t_wasted

last = np.argmax(t_wasted)

ans = 0
for i in range(5):
    if i != last:
        ans += t_total[i]
    else:
        ans += t[i]

print(ans)

Submission status: Accepted

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

# 整数の入力
dish = []

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

mod_dish = [5] * -1

# dish(各々の調理時間)を10で割った余りを算出
for j in range(len(dish)):
    mod_dish.append(dish[j] % 10)

# 余りが0以上、かつ最小のものを一番最後に注文すればよさそう：一番下にもっていく
for k in range(len(dish)-1):
    if mod_dish[k] < mod_dish[k+1] or mod_dish[k+1] == 0:
        mod_dish[k],mod_dish[k+1] = mod_dish[k+1],mod_dish[k]
        dish[k],dish[k+1] = dish[k+1],dish[k]

time = 0

for l in range(len(dish)):
    if l != len(dish) -1 and mod_dish[l] != 0:
        dish[l] = dish[l] + (10 - mod_dish[l])
    
    time += dish[l]

print(str(time))

Submission status: Accepted

Solution code:
n =  [int(input()) for x in range(5)]
minNum = 10
array = 0
for i in range(len(n)):
    num = n[i] % 10
    if((num <= minNum) and (num != 0)):
        minNum = num
        array = i
        
numList = []
a = n[array]
n[array] = 0

for x in n:
    k = ((x + 9) // 10) * 10
    numList.append(k)  
print(sum(numList) + a)

Submission status: Accepted

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

# 整数の入力
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list=[A,B,C,D,E]
last=0
max_rest=0

#余りが一番でかいのを最後に頼めば良い。
#他はX/10を切り上げて*10したとなる。
for i, time in enumerate(list):
  #print(time,":",i)
  if time%10 != 0 and 10 - time%10 > max_rest:
    max_rest = 10 - time%10
    last=i

ans=0
    
for i, time in enumerate(list):
  if i != last:
    ans = ans + 10 * math.ceil(time/10)
  elif i == last:
    ans = ans + time
    
print(ans)

Submission status: Accepted

Solution code:
import math

d = list()
c = list()
a = list()

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

print(sum(c) - max(a))

Submission status: Accepted

Solution code:
import math

A = [int(input()) for _ in range(5)]
C = [math.ceil(a / 10) * 10 for a in A]
R = sorted([(c - a, c) for c, a in zip(C, A)])
t = sum(C) - R[-1][0]
print(t)

Submission status: Accepted

Solution code:
t=[0]*5
for i in range(5):
    t[i]=int(input())
ans=0
min=10
c=6
for i in range(5):
    if t[i]%10!=0 and t[i]%10<min:
        c=i
        min=t[i]%10
for i in range(5):
    if i==c:
        ans+=t[i]
    elif t[i]%10==0:
        ans+=t[i]
    else:
        ans+=t[i]-t[i]%10+10
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dish=[int(input()) for i in range(5)]
loss=[(10-i%10) for i in dish]
loss=[0 if i == 10 else i for i in loss]
last=max(loss)
print(sum(dish)+sum(loss)-last)

Submission status: Accepted

Solution code:
def get_one_position(number):
    return number % 10


def get_ten_div(number):
    return number // 10 * 10 + 10


if __name__ == '__main__':
    numbers = []
    ans = 0
    min_one_point = 9
    min_one_point_index = 5
    for i in range(5):
        number = int(input())
        numbers.append(number)
        if get_one_position(number) <= min_one_point and get_one_position(number) != 0:
            min_one_point = get_one_position(number)
            min_one_point_index = i

    for i in range(len(numbers)):
        if i != min_one_point_index:
            if numbers[i] % 10 == 0:
                ans += numbers[i]
            else:
                ans += get_ten_div(numbers[i])
        else:
            ans += numbers[i]

    print(ans)

Submission status: Accepted

Solution code:
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
f = [a, b, c, d, e]
g = f.count(0)
a1 = A // 10
b1 = B // 10
c1 = C // 10
d1 = D // 10
e1 = E // 10
if g == 5:
    print(A + B + C + D + E)
else:
    f = [i for i in f if i > 0]
    print((a1 + b1 + c1 + d1 + e1 + 4 - g) * 10 + min(f))

Submission status: Accepted

Solution code:
import math

menu = [int(input()) for i in range(5)]
sort_base = [1,2,3,4,5,6,7,8,9,0]
sort = []

for i in sort_base:
    for j in range(5):
        if menu[j] % 10 == i:
            sort.append(menu[j])

sort = sort[::-1]
time = 0

for i in range(4):
    time = time + (math.ceil(sort[i]/10) * 10)

time = time + sort[4]
print(time)

Submission status: Accepted

Solution code:
import numpy as np
t = [int(input()) for i in range(5)] 
a = np.zeros(5)

for i in range(5):
  a[i] = ( t[i] + 9 ) // 10 * 10 - t[i]
  
b = 0  
for j in range(1,5):
  if a[0] < a[j]:
    b = j
    a[0] = a[b]

c = np.zeros(5)
for i in range(5):
  c[i] = ( t[i] + 9 ) // 10 * 10
    
ans = 0     
ans = np.sum(c) + t[b] - c[b]
print(int(ans))

Submission status: Accepted

Solution code:
T = [int(input()) for i in range(5)]
s = sum([x-((x-1)%10+1) for x in T])
m = sorted([(x-1)%10+1 for x in T])
print(s+m[0]+sum([(x+9)//10*10 for x in m[1:]]))

Submission status: Accepted

Solution code:
# 調理時間
a = [int(input()) for i in range(5)]

# 最後の料理は調理時間に左右されない = 21分みたいな最も不利な調理時間の料理を注文すべき
# それ以外の順番は問われない
# 10除算のあまりが最も少ない調理が最後

result = 0
last = 0
for i in a:
  if (i % 10) == 0:
    result += i
  elif last == 0:
    last = i
  elif (i % 10) < (last % 10):
    result += int(last / 10 + 1) * 10
    last = i
  else:
    result += int(i / 10 + 1) * 10
    
result += last
print(result)

Submission status: Accepted

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

#loss time
b =  [i % 10 if i % 10 == 0 else 10 - (i % 10) for i in a ]

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc123
# -*- coding: utf-8 -*-

import math

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

v2=[]
for i in range(5):
    v2.append( math.ceil(v1[i]/10)*10 )

result = 0
for i in range(5):
    if v2[i] - v1[i] > result:
        result = v2[i] - v1[i]

print(v2[0]+v2[1]+v2[2]+v2[3]+v2[4]-result)

Submission status: Accepted

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

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

li2 = list()

for i in li:
    if i % 10 != 0:
        i = (i // 10 + 1) * 10
    li2.append(i)

# li3 = [i for i in li if i % 10 != 0]

li4 = [int(str(i)[-1]) for i in li if i % 10 != 0]

# print(li3, li4)

if not li4:
    print(sum(li))
else:
    print(sum(li2) - 10 + min(li4))

Submission status: Accepted

Solution code:
import math

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

a=math.ceil(A/10)
b=math.ceil(B/10)
c=math.ceil(C/10)
d=math.ceil(D/10)
e=math.ceil(E/10)

z = max(a*10-A, b*10-B, c*10-C, d*10-D, e*10-E)
print((a+b+c+d+e)*10-z)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
    
b = []
c = []
for i in a:
    j = i % 10
    if j == 0:
        b.append(10)
    else:
        b.append(j)
    if (10-j) != 10:
        c.append(10 - j)
    else:
        c.append(0)
        
mini = b.index(min(b))

res = 0
for i, j in enumerate(a):
    if i != mini:
        res += j + c[i]
    else:
        res += j
        
print(res)

Submission status: Accepted

Solution code:
li = []
ans = 0

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

tmp =  [(200 - li[0]) % 10, (200 - li[1]) % 10, (10 - li[2]) % 10, (10 - li[3]) % 10, (10 - li[4]) % 10]
max_i = tmp.index(max(tmp)) 

for i in range(5):
    if i == max_i:
        ans += li[i] 
    
    else:
        add = li[i] + ((10 - li[i]) % 10)
        ans += add

print(ans)

Submission status: Accepted

Solution code:
input_mins = []
input_nums = 5
total_mins = []
total_min = 0

for i in range(input_nums):
  input_mins.append(int(input()))


for i in range(input_nums):
  total_min = 0
  for j in range(input_nums-1):
    position = (i+j) % 5
    amari = input_mins[position] % 10
    if amari == 0:
      total_min += input_mins[position]
    else:
      total_min += input_mins[position]+(10-amari)
  total_min += input_mins[(i+4)%5]
  total_mins.append(total_min)

print(min(total_mins))

Submission status: Accepted

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

counter = 0

sub_List = [(List[i] - 1) % 10 for i in range(5)]

sub_List = sorted(enumerate(sub_List), key=lambda x: x[1])

for i in range(5):
  if i != sub_List[0][0]:
    counter += ((List[i]-1)//10+1)*10

counter += List[sub_List[0][0]]

print(counter)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def f(x):
    if x%10==0:
        return x
    else:
        return x+(10-x%10)
A=f(a)
B=f(b)
C=f(c)
D=f(d)
E=f(e)
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    s=0
else:
    list_a=[]
    if not a%10==0:
        list_a.append(a%10)
    if not b%10==0:
        list_a.append(b%10)
    if not c%10==0:
        list_a.append(c%10)
    if not d%10==0:
        list_a.append(d%10)
    if not e%10==0:
        list_a.append(e%10)
    s=10-min(list_a)
print(A+B+C+D+E-s)

Submission status: Accepted

Solution code:
dish_time = [int(input()) for i in range(5)]
rest=[0,0,0,0,0]
last_min=[]

for j in range(5):
    rest[j] = dish_time[j] - (dish_time[j]//10*10)
    if rest[j] != 0:
        dish_time[j] = (dish_time[j]//10 + 1 ) *10   
        last_min.append(rest[j])

sum_time =  0

for i in range(5):
    sum_time = sum_time + dish_time[i]

if len(last_min) != 0:
    sum_time = sum_time + min(last_min) - 10
    print(sum_time)
else :
    sum_time = sum_time
    print(sum_time)