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:
minute = [int(input()) for _ in range(5)]
mod = [x % 10 for x in minute]
wait = [0 if x == 0 else 10 - x for x in mod]
wait.remove(max(wait))
print(sum(minute)+sum(wait))

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]

min = 9
min_idx = 0
for i, n in enumerate(l):
    m = n % 10
    if m != 0 and m < min:
        min = m
        min_idx = i

sum = 0
for i, n in enumerate(l):
    if min_idx == i or n % 10 == 0:
        sum += n
    else:
        sum += (n // 10 + 1) * 10

print(sum)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
tmp = 10
ans = 0
for a in A:
    mod = a % 10
    if mod == 0:
        ans += a
    else:
        ans += a - mod + 10
        tmp = min(tmp, mod)
ans += tmp - 10
print(ans)

Submission status: Accepted

Solution code:

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

    amari = 0
    amari_max = 0
    for i in range(5):
        if a[i] % 10 != 0:
            amari += 10 - a[i] % 10
            if amari_max <  10 - a[i] % 10:
                amari_max = 10 - a[i] % 10
    print(sum(a)+amari-amari_max)

main()

Submission status: Accepted

Solution code:
times = []

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

min_over = 9
loss_index = 0

for index, time in enumerate(times):
    step, mod = divmod(time, 10)
    if mod != 0:
        if min_over > mod:
            loss_index = index
            min_over = mod

fin = 0
for i in range(5):
    if i == loss_index:
       fin += times[i]
    else:
        step, mod = divmod(times[i], 10)
        if mod == 0:
            fin += times[i]
        else:
            fin += (step + 1) * 10

print(fin)

Submission status: Accepted

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

def io_generator():
	return input()

#+++++++++++++++++++


def gt(t):
	m=t%10
	if m > 0:
		return t+(10-m),10-m
	return t,0
	
def main(io):
	l =[ int(io()) for _ in range(5)]
	ll=[gt(t) for t in l]
	dd= sum([t[0] for t in ll])
	nn=max([t[1] for t in ll])
	return dd-nn

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Submission status: Accepted

Solution code:
a=0
lists=[0]
minb = 0
for _ in range(5):
    b=input()
    if b[-1]!='0':
        lists.append(10-int(b[-1]))
        if len(b) != 1:
            a=a+(int(b[:-1])+1)*10
        else:
            a=a+10
    else:
        a=a+int(b)
print(a-max(lists))

Submission status: Accepted

Solution code:
import itertools

X = [int(input()) for _ in range(5)]
mi = 10 ** 5
for xi in itertools.permutations(X, 5):
    count = 0
    for i, a in enumerate(xi):
        count += a
        if i < 4:
            count += (10 - (count % 10)) % 10
    mi = min(mi, count)

print(mi)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = [int(input()) for _ in range(5)]

time = 0

min_r = 10
for i in a:
    r = i % 10
    if r == 0:
        time += i
    else:
        time += i + 10 - r
        min_r = min(r, min_r)

if min_r != 10:
    time -= 10 - min_r 

print(time)

Submission status: Accepted

Solution code:
A = [input() for i in range(5)]
A.sort(key = lambda x:x[-1])
A = [int(a) for a in A]
res = 0
for a in A:
	if a%10 == 0:
		res += a
	else:
		while a%10 != 0:
			a += 1
		res += a 
for a in A:
	b = str(a)
	if b[-1] != '0':
		res -= 10-int(b[-1])
		print(res)
		exit()
print(res)

Submission status: Accepted

Solution code:
from math import ceil as c;a=[int(input())for i in range(5)];print(sum([c(i/10)for i in a])*10-max([c(i/10)*10-i for i in a]))

Submission status: Accepted

Solution code:
dish = []
for i in range(5):
    dish.append(int(input()))
ichi = 0
for i in range(1,5):
    if dish[i]%10 > 0 and dish[ichi] % 10 > dish[i] % 10:
        ichi = i
for i in range(5):
    if i != ichi and dish[i]%10 > 0:
        dish[i] += 10 - dish[i]%10
print(sum(dish))

Submission status: Accepted

Solution code:
total = 0
m = 10
for _ in range(5):
  t = int(input())
#  print(t)
  total += ((t-1) // 10 + 1) * 10
#  print(total)
  if 0 < t % 10 < m:
    m = t % 10
#print(m)
print(total-10+m)

Submission status: Accepted

Solution code:
import math
count = 0
diff = 0
for i in range(5):
  tmp = int(input())
  count += math.ceil(tmp/10)*10
  if math.ceil(tmp/10)*10 - tmp > diff:
    diff = math.ceil(tmp/10)*10 - tmp
print(count - diff)

Submission status: Accepted

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

min1 = 10
temp = 0
for i in range(5):
    if (a[i]-1) %10 < min1:
        min1 = (a[i]-1) %10
        temp = i
        
count = 0
for i in range(5):
    if i == temp:
        count += a[i]
    else:
        count += (int((a[i]-1)/10)+1)*10

print(count)

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    A = [int(input()) for _ in range(5)]

    ans = 0
    B = []
    for a in A:
        if a % 10 == 0:
            ans += a
        else:
            B.append(a)

    B = sorted(B, key=lambda x: -(x%10))
    n = len(B)
    for i in range(n-1):
        ans += (B[i] // 10 + 1) * 10

    if n > 0:
        ans += B[n-1]


    return ans


if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

b = sorted([i % 10 for i in a if i % 10 != 0])

ans = sum(a)

for i in range(len(b) - 1):
    ans += (10 - b[i + 1])

print(ans)

Submission status: Accepted

Solution code:
s = []
min = 10
sum = 0
for i in range(5):
  s.append(int(input()))
  if min>s[i]%10 and s[i]%10 != 0:
    min = s[i]%10    
for j in s:
  if j%10 != 0:
    sum += (j//10+1)*10
  else:
    sum += j

print(sum-(10-min))

Submission status: Accepted

Solution code:
import numpy as np
S = np.zeros(5)
s = np.zeros(5)

S[0] = int(input())
S[1] = int(input())
S[2] = int(input())
S[3] = int(input())
S[4] = int(input())
ANS = 0
for i in range(5):
    s[i] = (S[i]-1)%10
    ANS = ANS -(-S[i]//10)*10

ANS = ANS - (10-(s[s.argmin()]+1))
print(str(int(ANS)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [0]*5
a_one = [0]*5
a_ten = [0]*5
for i in range(5):
    a[i] = int(input())
    a_one[i] = a[i]%10
    if a_one[i] == 0:
        a_one[i] = 10
    a_ten[i] = abs(10-a_one[i])

min_one_index = a_one.index(min(a_one))
ans = 0
for i in range(5):
    if i != min_one_index:
        ans += a[i]+a_ten[i]
    else :
        ans += a[i]
print(ans)

Submission status: Accepted

Solution code:
import math

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

about = [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]
one = [a%10,b%10,c%10,d%10,e%10]
one.sort()
count = 0
for i in one:
    if i != 0:
        count = i
        break
if sum(one) == 0:
    count = 10
print(sum(about)+count-10)

Submission status: Accepted

Solution code:
price = [int(input()) for _ in range(5)]
min_sum = float('inf')
for i in range(5):
    sum = 0
    for j in range(5):
        if j == i:
            sum += price[i]
        else:
            if price[j] % 10 == 0:
                sum += price[j]
            else:
                sum += price[j] + 10 - (price[j] % 10)
    if sum <  min_sum:
        min_sum = sum
print(min_sum)

Submission status: Accepted

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

def deci(N):
    if N%10==0:
        return 10
    else:
        return N%10

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

m=min(deci(A),deci(B),deci(C),deci(D),deci(E))

print(gauss(A)+gauss(B)+gauss(C)+gauss(D)+gauss(E)-10+m)

Submission status: Accepted

Solution code:
a = []
b = []
for i in range(5):
    n = int(input())
    if n % 10 == 0:
        b.append(10)
    else:
        b.append(n % 10)
    while n % 10 != 0:
        n = n + 1
    a.append(n)

print(a[0] + a[1] + a[2] + a[3] + a[4] - 10 + min(b))

Submission status: Accepted

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

Submission status: Accepted

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

data_list = [a,b,c,d,e]
least_number = 10
result = 0
for i in range (5):
    if int(str(data_list[i])[-1])<least_number and int(str(data_list[i])[-1])!=0:
        least_number = int(str(data_list[i])[-1])
    if int(str(data_list[i])[-1])==0:
        result += data_list[i]
    else:
        result += data_list[i] + 10 -int(str(data_list[i])[-1])

print(result + least_number -10)

Submission status: Accepted

Solution code:
import sys

def main():

    times = []

    for line in sys.stdin:
        line = line.rstrip()
        t = int(line)
        times.append(t)

    times.sort(key=lambda t: t % 10 if t % 10 != 0 else 10, reverse=True)

    # print(times)
    # 下一ケタが0,9,8,...の順に食べていく。1の位は切り上げ

    s = 0
    for t in times[:-1]:
        new_t = t if t % 10 == 0 else (t // 10) * 10 + 10
        s += new_t

    s += times[-1]
    print(s)

    return 0

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
A.sort(key=lambda x: (x-1) % 10)
time = 0
for i, a in enumerate(reversed(A)):
    if a % 10 == 0 or i == 4:
        time += a
    else:
        time += a + 10 - (a % 10)
print(time)

Submission status: Accepted

Solution code:
import itertools

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

lp = []
for i in itertools.permutations(l):
    lp.append(i)

min_ = 10 ** 10

# lpi: list
for lpi in lp:
    t = 0
    t += lpi[0]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x

    t += lpi[1]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x
    t += lpi[2]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x
    t += lpi[3]
    if t % 10 != 0:
        x = t % 10
        t += 10 - x
    t += lpi[4]
    min_ = min(min_, t)

print(min_)

Submission status: Accepted

Solution code:
a = []
loss = 0
ans = 0
for i in range(5):
    a.append(int(input()))
    t = 10 - a[i] % 10
    if t != 10 and t > loss: loss = t
for i in range(5):
    ans += (a[i] + 9) // 10 * 10
print(ans - loss)

Submission status: Accepted

Solution code:
a = []

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


result = 0
min_min = 10
for each in a:
    if each % 10 != 0:
        result += each + 10 - (each % 10)
        if min_min > each % 10:
            min_min = each % 10
    else:
        result += each
print(result - (10 - min_min))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A = INT()
B = INT()
C = INT()
D = INT()
E = INT()

tmp1 = [A, B, C, D, E]
tmp2 = [x%10 for x in tmp1]
min_=10 # 最後に頼む料理
index = None
for i in range(len(tmp2)):
	if tmp2[i] != 0:
		if tmp2[i] < min_:
			min_ = tmp2[i]
			index = i
for i in range(len(tmp1)):
	if i == index:
		continue
	if tmp1[i]%10 != 0:
		tmp1[i] = (tmp1[i] - tmp1[i]%10) + 10
print(sum(tmp1))

Submission status: Accepted

Solution code:
order = []

for _ in range(5):
  order.append(int(input()))

import numpy as np

order = np.array(order)

order_first = np.sort(((order-1) % 10))+1
order = ((order-1) // 10 + 1) * 10
print(order.sum() + order_first[0] - 10)

Submission status: Accepted

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

Submission status: Accepted

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

modMax, index = 0, 0
for i in range(5):
    if A[i]%10 != 0 and modMax < 10-A[i]%10:
        modMax = 10-A[i]%10
        index = i

ans = 0
for i in range(5):
    if i == index: ans += A[i]
    elif A[i]%10 != 0: ans += A[i] + 10-A[i]%10
    else: ans += A[i]

print( ans )

Submission status: Accepted

Solution code:
A=[]

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

m=10
s=10

for i in range(5):
    if A[i]%10<m and A[i]%10!=0:
        m=A[i]%10
        s=i

su=0

for i in range(5):
    if i==s:
        su+=A[i]
    elif A[i]%10!=0:
        su+=(A[i]//10+1)*10
    else:
        su+=A[i]
        
print(su)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import math

a = []
min_v = 10
min_i = 0
for i in range(5):
    v = int(input())
    a.append(v)

    r = v % 10
    if r < min_v and r > 0:
        min_v = r
        min_i = i

res = 0
for i in range(5):
    if i == min_i:
        res += a[i]
    else:
        res += math.ceil(a[i]/10)*10
        
print(res)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict, Counter
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

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

ans = INF
for row in permutations(l, 5):
    t = 0
    for ind, i in enumerate(row):
        t += i
        if ind == 4:
            break
        for j in range(10):
            if (t + j) % 10 == 0:
                t += j
    if t<ans:
        ans = t

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]
min=a
for x in l:
    y=x%10
    if y!=0:
        if y<(min%10):
            min=x
ans=min
k=0
for x in l:
    if k==0:
        if x==min:
            k+=1
        else:
            if x%10==0:
                ans+=x
            else:
                ans+=x-(x%10)+10
    else:
        if x%10==0:
            ans+=x
        else:
            ans+=x-(x%10)+10

print(ans)

Submission status: Accepted

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

pos, minn = 0, 10
for i, a in enumerate(A):
    if a % 10 < minn and a % 10 != 0:
        minn = a % 10
        pos = i

res = 0
for i, a in enumerate(A):
    if i == pos:
        res += a
    else:
        if a % 10 == 0:
            res += a
        else:
            res += a + (10 - (a % 10))
print(res)

Submission status: Accepted

Solution code:
#coding: utf-8
l = []
ans = 0
rest = 10
for i in range(5):
    l.append(int(input()))
    if l[i] % 10 != 0:
        rest = min(rest, l[i] % 10)
for i in range(5):
    if l[i] % 10 != 0:
        ans += l[i] // 10 * 10 + 10
    else:
        ans += l[i]
print(ans + rest - 10)

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
a = min(map(lambda x: ((x-1) % 10 + 1), t))
b = sum(map(lambda x: -(-x // 10)*10, t))
print(a+b-10)

Submission status: Accepted

Solution code:
time_list = [input() for _ in range(5)]
min_time = 10
for time in time_list:
    if time[-1]=="0":
        continue
    min_time = min(int(time[-1]), min_time)
ans = 0
for time in time_list:
    if time[-1]=="0":
        ans += int(time)
    else:
        ans += (int(time)//10 + 1)* 10
if min_time == 10:
    print(ans)
else:
    print(ans - (10-min_time))

Submission status: Accepted

Solution code:
import sys
c = [int(sys.stdin.readline()) for _ in range(5)]
cc = [(v + 9) // 10 * 10 for v in c]
ccc = sorted(zip(cc, c), key=lambda x:x[1] - x[0], reverse=True)
ret = sum([v[0] for v in ccc[:-1]]) + ccc[-1][1]
print(ret)

Submission status: Accepted

Solution code:
import math

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

mod = 10
idx = 0
for i, ord in enumerate(order):
    tmp = ord % 10
    if tmp < mod and tmp > 0:
        mod = tmp
        idx = i

for i in range(5):
    if i != idx:
        order[i] = math.ceil(order[i] / 10.) * 10

print(sum(order))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

last = 10
time = 0

for item in array:
	r = item%10
	if r != 0:
		time += (int(item/10)+1)*10
		last = min(last, r)
	else:
		time += item

print(time-10+last)

Submission status: Accepted

Solution code:
dis = []
dist = [0,0,0,0,0]

for i in range(5):
    dis.append(int(input()))
    a = dis[i] % 10
    if a!=0:
        dist[i] = 10-a
        dis[i] = dis[i]+dist[i]

b = dist.index(max(dist))
print(sum(dis)-dist[b])

Submission status: Accepted

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

def readInts():
  return [int(s) for s in input().split(" ")]

def sortKey(n):
  if n % 10 == 0:
    return 10
  else:
    return n % 10

def ceil10(n):
  if n % 10 > 0:
    return n + (10 - n % 10)
  else:
    return n

def main():
  A = readInts()[0]
  B = readInts()[0]
  C = readInts()[0]
  D = readInts()[0]
  E = readInts()[0]

  orders = sorted([A, B, C, D, E], key=sortKey)
  s = orders[0] + sum(map(ceil10, orders[1:]))
  print(s)

if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

perm = list(itertools.permutations(a))
ans = sum(a)+100

for b in perm:
	hoge = 0
	for i in range(5):
		hoge += b[i]
		if i != 4:
			hoge += (10-(hoge%10))%10
	ans = min(hoge,ans)
print(ans)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
r = list(map(lambda x: (x // 10 + 1) * 10 if x % 10 != 0 else x, a))
ans = sum(r)
adv = []
for i in range(5):
    adv.append(r[i] - a[i])
adv.sort()
ans -= adv[4]
print(ans)

Submission status: Accepted

Solution code:
import itertools
x = []

for i in range(5):
    x.append(int(input()))
order = list(itertools.permutations(x))
res = 10**17
for l in order:
    t = 0
    for item in l:
        if t%10 == 0:
            t+=item
        else:
            t = (t//10+1)*10
            t += item
    res = min(res,t)
print(res)

Submission status: Accepted

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


if a % 10 != 0:
    minhasuu = a % 10
    a = ((a // 10) + 1) * 10
if b % 10 != 0:
    if minhasuu > b % 10:
        minhasuu = b % 10
    b = ((b // 10) + 1) * 10
if c % 10 != 0:
    if minhasuu > c % 10:
        minhasuu = c % 10
    c = ((c // 10) + 1) * 10
if d % 10 != 0:
    if minhasuu > d % 10:
        minhasuu = d % 10
    d = ((d // 10) + 1) * 10
if e % 10 != 0:
    if minhasuu > e % 10:
        minhasuu = e % 10
    e = ((e // 10) + 1) * 10

print(a + b + c + d + e + minhasuu - 10)

Submission status: Accepted

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

sum = 0
edge = 10

for ele in lst:
    if ele % 10 == 0:
        # do something
        sum += ele
    else:
        sum += ((ele - 1) // 10 + 1) * 10
        edge = min(edge, ele % 10)

print(sum + edge - 10)

Submission status: Accepted

Solution code:
ms = [int(input()), int(input()), int(input()), int(input()), int(input())]
margin = [(10 - (m % 10)) % 10 for m in ms]
print(sum(ms)+sum(margin) - max(margin))

Submission status: Accepted

Solution code:
A=[0]*5
for i in range(5):
    A[i]=int(input())
que=10
que_num=0
ans=0
for i in range(5):
    if que>A[i]%10 and A[i]%10!=0:
        que=A[i]%10
        que_num=i
for i in range(5):
    if i==que_num:
        ans+=A[i]
    else:
        if A[i]%10!=0:
            ans+=A[i]-A[i]%10+10
        else:
            ans+=A[i]
print(ans)

Submission status: Accepted

Solution code:
def main():
    res = 0
    ts = []
    for _ in range(5):
        t = int(input())
        if t % 10 == 0:
            res += t
        else:
            ts.append(t)
    for (i, t) in enumerate(sorted(ts, key=lambda x: x % 10)):
        if i == 0:
            res += t
        else:
            res += t + 10 - t % 10
    print(res)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    a = get_int()
    b = get_int()
    c = get_int()
    d = get_int()
    e = get_int()
    da, ma = divmod(a, 10)
    db, mb = divmod(b, 10)
    dc, mc = divmod(c, 10)
    dd, md = divmod(d, 10)
    de, me = divmod(e, 10)
    ta = (a + 9) // 10
    tb = (b + 9) // 10
    tc = (c + 9) // 10
    td = (d + 9) // 10
    te = (e + 9) // 10
    mm = min(list(filter(lambda m: m != 0, [ma, mb, mc, md, me])) + [inf])
    if mm == ma:
        print(10 * (tb + tc + td + te) + a)
    elif mm == mb:
        print(10 * (ta + tc + td + te) + b)
    elif mm == mc:
        print(10 * (ta + tb + td + te) + c)
    elif mm == md:
        print(10 * (ta + tb + tc + te) + d)
    elif mm == me:
        print(10 * (ta + tb + tc + td) + e)
    else:
        print(a + b + c + d + e)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
abcde = [int(input()) for i in range(5)]
tmp = zip(abcde, list(map(lambda x: 10 if x % 10 == 0 else x % 10, abcde)))
tmp = sorted(tmp, key=lambda x: x[1])
print(tmp[0][0] + sum(map(lambda x: x[0]+(10-x[1]), tmp[1:])))

Submission status: Accepted

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

import math


order = []

for _ in range(5):
    order.append(int(input()))

sorted_order = sorted(order, key=lambda x: (x - 1) % 10, reverse=True)

t = 0
for i, n in enumerate(sorted_order):
    if i == len(sorted_order) - 1:
        t += n
    else:
        t += math.ceil(n / 10) * 10

print(int(t))

Submission status: Accepted

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

times = list()
times.append(a)
times.append(b)
times.append(c)
times.append(d)
times.append(e)

time_sum = 0
small = 10
for time in times:
    if time % 10 == 0:
        time_sum += time
    else:
        time_sum += (time // 10 + 1) * 10
        small = min(small, time % 10)
print(time_sum - 10 + small)

Submission status: Accepted

Solution code:
e,*a=sorted(eval('int(input()),'*5),key=lambda x:(x%10-1)%10);t=0
for i in a:t-=-i//10*10
print(t+e)

Submission status: Accepted

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

sum_time=sum(time)
divide_time=[]
for i in range(5):
    amari=time[i]%10
    divide=10-amari
    if divide==10:
        divide=0
    divide_time.append(divide)
result=sum_time+sum(divide_time)-max(divide_time)
print(result)

Submission status: Accepted

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

ans = 0
flag = 0
for i in num:
    if i % 10 == 0:
        ans += i
    else:
        ans += i // 10 * 10 + 10
        flag = 1

ma = 0
if flag:
    for i in num:
        if i % 10 == 0:
            continue
        ma = max(ma, 10 - i % 10)

print(ans - ma)

Submission status: Accepted

Solution code:
# coding: utf-8
ns = [int(input()) for _ in range(5)]
ans = 0
min = 10
for n in ns:
    a = n % 10
    b = n // 10
    if a == 0:
        ans += b * 10
    else:
        if a < min:
            min = a
        ans += (b + 1) * 10
print(ans - (10 - min))

Submission status: Accepted

Solution code:
ans = 0
x = [int(input()) for _ in range(5)]
y = 200
for i, xi in enumerate(x):
    xx = xi % 10
    if xx == 0:
        xx = 10
    if y > xx:
        y = xx
        j = i

for i in range(5):
    if i == j:
        ans += x[i]
    else:
        ans += (x[i] + 10 - 1) // 10 * 10
print(ans)

Submission status: Accepted

Solution code:
s = 0
mn = 10
for i in range(5):
  a = int(input())
  q, mod = divmod(a, 10)
  if mod == 0:
    s += a
  else:
    s += a - mod + 10
    mn = min(mn, mod)
if mn != 10:
  print(s + mn - 10)
else:
  print(s)

Submission status: Accepted

Solution code:
times = [int(input()) for _ in range(5)]
times1 = []
total = 0
for t in times:
  t1 = t % 10
  if t1 == 0:
    total += t
  else:
    times1.append(t1)
    total += (t//10 + 1) * 10
if len(times1) >= 1:
    total = total + min(times1) - 10
print(total)

Submission status: Accepted

Solution code:
A=[input() for i in range(5)]
B=[0,0,0,0,0]
C=[0,0,0,0,0]
for j in range (0,5):
  if int(A[j])%10 == 0:
    C[j]=10
  else:
    B[j]=int(A[j])%10
    C[j]=B[j]
ans=0
for k in range(0,5):
  ans += int(A[k])-C[k]+10
m=min(C)
print(ans+m-10)

Submission status: Accepted

Solution code:
li=[int(input()) for i in range(5)]
t = [0,0,0,0,0]
for i in range(5):
    if li[i] % 10 == 0:
        t[i] = 10
    else:
        t[i] = li[i] % 10
T = 10 - min(t)

score = 0
for i in range(5):
    if li[i] % 10 == 0:
        score += li[i]
    else:
        score += li[i] + 10 - li[i] % 10

score -= T
print(score)

Submission status: Accepted

Solution code:
def main():
	r = [0]*5
	r[0] = int(input())
	r[1] = int(input())
	r[2] = int(input())
	r[3] = int(input())
	r[4] = int(input())

	total = 0
	mod_min = 10

	for x in r:
		div = x//10
		total += div*10
		mod = x%10
		if mod != 0:
			if mod < mod_min:
				mod_min = mod
			total+=10
	total = total - 10 + mod_min
	print(total)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A = [0] * 5
for i in range(5):
  A[i] = int(input())
A.sort(reverse=True, key=lambda x: x % 10)
for i in range(5):
  if A[4] % 10 == 0:
    A = [A[4]] + A[:4]
  else:
    break
t = 0
for a in A[:4]:
  a += 9
  t += a - a % 10
print(t + A[4])