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:
# coding: utf-8
# Your code here!

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

minr = 10
minf = 0
for f in food:
    if f % 10 != 0 :
        if f % 10 < minr :
            minr = f % 10
            minf = f
if minf == 0:
    minf = food[0]
        

food.remove(minf)
food.append(minf)

sumf = 0
i = 0
for f in food:
    if i == 4:
        sumf += f
    elif f % 10 != 0:
        sumf += int(f/10) * 10 + 10
    else:
        sumf += f
    i+=1
print(sumf)

Submission status: Accepted

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

min = 10

dish = [a,b,c,d,e]
total = 0
for i in dish:
    if i % 10 != 0 and i % 10 < min:
        min = i % 10
    total -= (- i // 10) * 10

total += min - 10

print(total)

Submission status: Accepted

Solution code:

import sys

dishesList = [int(input()) for i in range(5)]
min = 100000
targetIndex=9999

for i,v in enumerate(dishesList):
    last = v%10
    if last !=0 and last < min:
        min = last
        targetIndex=i

newList = []
for i,v in enumerate(dishesList):

    if i==targetIndex:
        newList.append(v)
        continue

    last = v%10
    if last==0:
        diff=abs(10-last)
        add=v+diff
        newList.append(v)
    else:
        diff=10 - last
        add=v+diff
        newList.append(add)

ans=0

for i in newList:
    ans += i

print(ans)

Submission status: Accepted

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

sa = 10
count = 0
for i in li:
    count += (10 * (i // 10) )
    if i % 10 != 0:
        count+= 10
        if i % 10 < sa:
            sa = i % 10

if sa == 10:
    print(count)
else:
    print(count - 10 + sa)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def ten(n):
    if n % 10 == 0:
        return n // 10
    else:
        return n // 10 + 1
def per(n):
    if n % 10 == 0:
        return 0
    else:
        return 10 - n % 10
print((ten(a) + ten(b) + ten(c) + ten(d) + ten(e))*10 - max(per(a),per(b),per(c),per(d),per(e)))

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
b = [a[i]%10 for i in range(5)]
bl = sorted(b)
bb = 0
for i in bl:
  if i > 0:
    bb = i
    break

t = 0
for i in range(5):
  if i != b.index(bb):
    t += a[i]
    if t%10!=0:
      t +=(10-t%10)
t+=a[b.index(bb)]
print(t)

Submission status: Accepted

Solution code:
input = open(0).read
A = [int(i) for i in input().split()]
L = []

for a in A:
    if 0 < a % 10:
        tmp = 10 - a % 10
        L.append(tmp)

L.sort(reverse=True)
print(sum(A) + sum(L[1:]))

Submission status: Accepted

Solution code:
def main():

    """ convenient functions
    # for i, a in enumerate(iterable)
    # q, mod = divmod(a, b)
    # divmod(x, y) returns the tuple (x//y, x%y)
    # Higher-order function: reduce(operator.mul, xyz_count, 1)
    # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
    """

    """convenient decorator
    # @functools.lru_cache():
    # to facilitate use of recursive function
        # ex:
        # from functools import lru_cache
        # import sys
        # sys.setrecursionlimit(10**9)
        # @lru_cache(maxsize=None)
        # def fib(n):
        #     if n < 2:
        #         return n
        #     return fib(n-1) + fib(n-2)
        # print(fib(1000))
    """
    
    # import numpy as np
    import sys
    sys.setrecursionlimit(10**7)
    from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
    # accumulate() returns iterator! to get list: list(accumulate())
    from math import factorial, ceil, floor, sqrt
    def factorize(n):
        """return the factors of the Arg and count of each factor
        
        Args:
            n (long): number to be resolved into factors
        
        Returns:
            list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
        """
        fct = []  # prime factor
        b, e = 2, 0  # base, exponent
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def combinations_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        # TODO: How should I do when n - r is negative?
        if n < 0 or r < 0:
            raise Exception('combinations_count(n, r) not defined when n or r is negative')
        if n - r < r: r = n - r
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result
    def combinations_with_replacement_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        if n < 0 or r < 0:
            raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
        elif n == 0:
            return 1
        else:
            return combinations_count(n + r - 1, r)
    from bisect import bisect_left, bisect_right
    from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
    from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
    from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
    import operator
    from operator import itemgetter
    # ex1: List.sort(key=itemgetter(1))
    # ex2: sorted(tuples, key=itemgetter(1,2))
    from functools import reduce, lru_cache
    def chmin(x, y):
        """change minimum
        if x > y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current minimum value
            y (long): potential minimum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x > y:
            x = y
            return (x, True)
        else:
            return (x, False)
    def chmax(x, y):
        """change maximum
        if x < y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current maximum value
            y (long): potential maximum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x < y:
            x = y
            return (x, True)
        else:
            return (x, False)

    from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
    def gcds(numbers):
        return reduce(gcd, numbers)
    def lcm(x, y):
        return (x * y) // gcd(x, y)
    def lcms(numbers):
        return reduce(lcm, numbers, 1)

    # first create factorial_list
    # fac_list = mod_factorial_list(n)
    INF = 10 ** 18
    MOD = 10 ** 9 + 7
    modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
    def modinv(a, p = MOD):
        # evaluate reciprocal using Fermat's little theorem:
        # a**(p-1) is identical to 1 (mod p) when a and p is coprime
        return modpow(a, p-2, p)
    def modinv_list(n, p = MOD):
        if n <= 1:
            return [0,1][:n+1]
        else:
            inv_t = [0,1]
            for i in range(2, n+1):
                inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
            return inv_t
    def modfactorial_list(n, p = MOD):
        if n == 0:
            return [1]
        else:
            l = [0] * (n+1)
            tmp = 1
            for i in range(1, n+1):
                tmp = tmp * i % p
                l[i] = tmp
            return l
    def modcomb(n, k, fac_list = [], p = MOD):
        # fac_list = modfactorial_list(100)
        # print(modcomb(100, 5, modfactorial_list(100)))
        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        if len(fac_list) <= n:
            a = factorial(n) % p
            b = factorial(k) % p
            c = factorial(n-k) % p
        else:
            a = fac_list[n]
            b = fac_list[k]
            c = fac_list[n-k]
        return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
    def modadd(a, b, p = MOD):
        return (a + b) % MOD
    def modsub(a, b, p = MOD):
        return (a - b) % p
    def modmul(a, b, p = MOD):
        return ((a % p) * (b % p)) % p
    def moddiv(a, b, p = MOD):
        return modmul(a, modpow(b, p-2, p))

    """ initialize variables and set inputs
    # initialize variables
        # to initialize list, use [0] * n
        # to initialize two dimentional array, use [[0] * N for _ in range(N)]
    # set inputs
        # open(0).read() is a convenient method:
        # ex) n, m, *x = map(int, open(0).read().split())
        #     min(x[::2]) - max(x[1::2])
        # ex2) *x, = map(int, open(0).read().split())
        #     don't forget to add comma after *x if only one variable is used
    # preprocessing
        # transpose = [x for x in zip(*data)]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
        # flat = [flatten for inner in data for flatten in inner]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
    # calculate and output
        # output pattern
        # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
    """

    # functions used
    r = lambda: sys.stdin.readline().strip()
    r_int = lambda: int(r())
    R = lambda: list(map(int, r().split()))
    Rmap = lambda: map(int, r().split())
    Rfloat = lambda: list(map(float, r().split()))
    Rtuple = lambda: tuple(map(int, r().split()))

    """ how to treat input
    # single int: int(r())
    # single string: r()
    # single float: float(r())
    # line int: R()
    # line string: r().split()
    # line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
    # lines int: [R() for _ in range(n)]
    """

    if __name__ != '__main__':
        # for test
        sys.stdin = open('sample.txt')

    # ----------------------------------
    # main

    tmp = 0
    sumup = 0
    memo = 10
    for i in range(5):
        tmp = int(r())
        if tmp % 10 != 0:
            sumup += tmp - (tmp % 10) + 10
            memo = min(memo, tmp % 10)
        else:
            sumup += tmp
    if memo == 10:
        print(sumup)
    else:
        print(sumup+memo-10)
    
    # end of main
    # ----------------------------------

    """memo: how to use defaultdict of list
    # initialize
    Dic = defaultdict(list)
    # append / extend
    Dic[x].append(y)
    # for
    for k, v in Dic.items():
    """

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import ceil
ds = [int(input()) for i in range(5)]
t = sum(10 * ceil(x / 10) for x in ds)
rs = [x % 10 for x in ds if x % 10 != 0]
r = (min(rs) - 10) if rs else 0
print(t + r)

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def change_color(t):
    if t == '0':
        return '1'
    return '0'


def solve(inputs):
    [A] = string_to_int(inputs[0])
    [B] = string_to_int(inputs[1])
    [C] = string_to_int(inputs[2])
    [D] = string_to_int(inputs[3])
    [E] = string_to_int(inputs[4])
    foods = [A, B, C, D, E]
    time = 0

    while len(foods) > 0:
        optimal_f = -1
        optimal_i = -1
        for i, f in enumerate(foods):
            futility = (time + f) % 10
            if futility == 0:
                optimal_i = i
                break
            if futility > optimal_f or optimal_f == -1:
                optimal_f = futility
                optimal_i = i
        time += foods[optimal_i]
        foods.pop(optimal_i)
        if len(foods) != 0 and time % 10 != 0:
            time += 10 - (time % 10)
    return time


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(5))
    print(ret)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
 
l = [a, b, c, d, e]
s = []
 
for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))
if len(s) > 0:
    s.sort()
    del s[-1]
 
ans = sum(l) + sum(s)
print(ans)

Submission status: Accepted

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


def f(n):
    return (10 - (n % 10)) % 10


ans = a + b + c + d + e
ans += f(a) + f(b) + f(c) + f(d) + f(e)
ans -= max(f(a), f(b), f(c), f(d), f(e))

print(ans)

Submission status: Accepted

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

sum = int(0)
min = int(10)
for i in range(5):
    x = a[i]%10
    sum += a[i]//10*10
    if min>x and x!=0:
            min = x
    if x!= 0:        
            sum += 10

print(sum + min-10)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    b = int(input())
    a.append([(b+9) % 10, b])
a = sorted(a, reverse=True)
c = 0
for i in range(4):
    c += (a[i][1] + 9) // 10 * 10
print(c + a[4][1])

Submission status: Accepted

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

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

for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))
if len(s) > 0:
    s.sort()
    del s[-1]

ans = sum(l) + sum(s)
print(ans)

Submission status: Accepted

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

    min_mod = 10
    elapsed_time = 0
    for x in [A, B, C, D, E]:
        mod = x % 10
        if 0 < mod < min_mod:
            min_mod = mod
        time = x if x % 10 == 0 else (x // 10 + 1) * 10
        elapsed_time += time

    elapsed_time = elapsed_time - (10 - min_mod)
    print(elapsed_time)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def smaller(x, y):
	if x < y:
		return x
	return y

lst = []
for i in range(0, 5):
	lst.append(int(input()))
min = 5000000000000000
for i in range(0, 5):
	first = lst[i]
	lst1 = lst[:i]
	if i != 4:
		lst1 = lst1 + lst[i+1:]
	time1 = first - first % 10
	if first % 10 != 0:
		time1 += 10
	for j in range(0, 4):
		second = lst1[j]
		lst2 = lst1[:j]
		if j != 3:
			lst2 = lst2 + lst1[j+1:]
		time2 = time1 + second - second % 10
		if second % 10 != 0:
			time2 += 10
		for k in range(0, 3):
			third = lst2[k]
			lst3 = lst2[:k]
			if k != 2:
				lst3 = lst3 + lst2[k+1:]
			time3 = time2 + third - third % 10
			if third % 10 != 0:
				time3 += 10
			for p in range(0, 2):
				fourth = lst3[p]
				time4 = time3 + fourth - fourth % 10
				if fourth % 10 != 0:
					time4 += 10
				fifth = lst3[(p+1)%2]
				time5 = time4 + fifth
				min = smaller(min, time5)
print(min)

Submission status: Accepted

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

time = [[a, a%10], [b, b%10], [c, c%10], [d, d%10], [e, e%10]]
ans = 0

for i in range(5):
	if time[i][1] == 0:
		time[i][1] = 10
		
time = sorted(time, key = lambda x:x[1], reverse = True)

for i in range(4):
	ans += time[i][0] + (10 - time[i][1])
	
print(ans + time[4][0])

Submission status: Accepted

Solution code:
time = [0]*5
time_ = [0]*5
for i in range(5):
    time[i] = int(input())
    time_[i] = time[i] % 10
    if time_[i] == 0:
        time_[i] = 10

idx = time_.index(min(time_))
ans = 0
for i in range(5):
    if i == idx:
        ans += time[i]
    else:
        if 1 <= time_[i] and time_[i] <= 9:
            ans += ((time[i]//10)+1)*10
        else:
            ans += time[i]

print(ans)

Submission status: Accepted

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

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  if dish%10 == 0:
    ans += dish
  else:
    ans += dish + 10 - dish%10
  if dish%10 < min_digits and dish%10 !=0:
    digits_idx = idx
    min_digits = dish%10
if min_digits == 10:
  print(ans)
else:
  ans -= (10 - min_digits)
  print(ans)

Submission status: Accepted

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

L = [A, B, C, D, E]
S = [10]
for l in L:
    if l % 10 != 0:
        S.append(l % 10)
min_s = min(S)

s = 0
flag = True
for l in L:
    if flag and min_s == l % 10:
        s += l
        flag = False
    elif 0 == l % 10:
        s += l
    else:
        s += 10 * (l // 10) + 10
print(s)

Submission status: Accepted

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

ceiled = [(x+9)//10*10 for x in A]
can_save = [y - x for x,y in zip(A,ceiled)]

answer = sum(ceiled) - max(can_save)
print(answer)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

l1=[]
l2=[]
for _ in range(5):
    m = int(input())
    if m % 10 == 0:
        l1.append(m)
    else:
        l2.append([m, int(str(m)[-1])])

l2 = sorted(l2, key=lambda x: x[1], reverse=True)
ans = sum(l1)
for i in range(len(l2)):
    if i+1 != len(l2):
        ans += l2[i][0]+10-l2[i][1]
    else:
        ans += l2[i][0]

print(ans)

Submission status: Accepted

Solution code:
import math

a = [int(input()) for _ in range(5)]
print(min([sum(map(lambda x: (math.ceil(x/10)*10), a)) - (math.ceil(a[i]/10)*10) + a[i] for i in range(5)]))

Submission status: Accepted

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

A=[]
N=5
for i in range(N):
    A.append(int(input()))
B=[roof10(A[n]) for n in range(N)]
x=max([B[n]-A[n] for n in range(N)])
print(sum(B)-x)

Submission status: Accepted

Solution code:
def more(n):
    n=int(n)
    c=n%10
    if c==0:
        b=n
    else:
        a=n//10
        b=(a+1)*10
    return b
info=[]
for i in range(5):
    a=int(input())
    info.append([a,more(a),more(a)-a])
#print(info)
info2=sorted(info,key=lambda x:x[2])
#print(info2)
print(info2[4][0]+sum(info2[i][1] for i in range(4)))

Submission status: Accepted

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

    max_wait = 0
    sum_wait = 0
    for d in t:
        wait = (10 - d % 10) % 10
        if max_wait < wait:
            max_wait = wait
        sum_wait += d + wait
    print(sum_wait - max_wait)


main()

Submission status: Accepted

Solution code:
import math
t=[]
for _ in range(5):
  x=int(input())
  t.append(x)
tt=[]
for i in t:
  tt.append(math.ceil(i*0.1))
sa=[]
for i in range(5):
  sa.append(tt[i]*10-t[i])
print(sum(tt)*10-max(sa))

Submission status: Accepted

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

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

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

order_time = (sum([(dish - 1) // 10 + 1 for dish in dishes])) * 10
final_dish = min([(dish - 1) % 10 + 1 for dish in dishes]) - 10

ans = order_time + final_dish
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in l:
    while i%10!=0:
        i += 1
    l_kiriage.append(i)

l_sa = [l_kiriage[x]-l[x] for x in range(5)]

print(sum(l_kiriage) - max(l_sa))

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_MOD = 9
min_ind = -1
for i in range(5):
    x = l[i]%10
    if x <= min_MOD and x != 0:
        min_ind = i
        min_MOD = x
#print(min_ind)
        
ans = 0
for i in range(5):
    if i == min_ind:
        ans += l[i]
    else:
        if l[i]%10 == 0:
            ans += l[i]
        else:
            ans += l[i]+10 - l[i]%10
print(ans)

Submission status: Accepted

Solution code:
#r, d, x = map(int,input().split())
#n = int(input())
#h = list(map(int,input().split()))
ls = [int(input()) for i in range(5)]
#s = input()
one = [(i-1)%100 %10 for i in ls]
one.index(min(one))
ten = [ls[i] + (10 - one[i] - 1) if i != one.index(min(one)) else ls[i] for i in range(len(ls))]
print(sum(ten))

Submission status: Accepted

Solution code:
dish=[]
d1=[]
dif=[]
for i in range(5):
    dish.append(int(input()))
for j in range(5):
    d1.append((-(-dish[j]//10))*10)
for k in range(5):
    dif.append(d1[k]-dish[k])
    
print(sum(d1)-max(dif))

Submission status: Accepted

Solution code:
n=[int(input()) for i in range(5)]
ans=sum([(i//10+1)*10 if i%10!=0 else i for i in n])
k=10


for i in n:
    i2=str(i)
    i2=i2[len(i2)-1]
    if i2!="0" and int(i2)<k:
        k=int(i2)

print(ans-(10-k))

Submission status: Accepted

Solution code:
time = []
time_up = []
time_amari = []
for _ in range(5):
    t = int(input())
    if t%10!=0:
        t_up = (t//10+1)*10
        t_amari = t_up-t
    else:
        t_up = t
        t_amari = -1
    time.append(t)
    time_up.append(t_up)
    time_amari.append(t_amari)
s = sum(time_up)
pos = time_amari.index(max(time_amari))
print(s-time_up[pos]+time[pos])

Submission status: Accepted

Solution code:
def zan(n):
	return 0 if n%10==0 else 10-n%10

def marume(n):
	return n if n%10==0 else n//10*10+10
def resolve():
	a=[int(input()) for i in range(5)]
	l=list(map(zan,a))
	mx=max(l)
	print(sum(list(map(marume,a)))-mx)
	
resolve()

Submission status: Accepted

Solution code:
def main():
    time = []
    ans = 0
    min_time = 10
    for i in range(5):
        time.append(int(raw_input()))
    for i in time:
        if i%10 == 0:
            ans += i
        else:
            ans += ((i//10)+1)*10
            min_time =min(min_time,i%10)
    print(ans + min_time - 10)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = [[int(input()), 0]for i in range(5)]
for i in range(5):
    if a[i][0] % 10 == 0:
        a[i][1] = 9
    else:
        a[i][1] = a[i][0] % 10
a = sorted(a, key=lambda x: x[1], reverse=True)
b = 0
for i in range(5):
    if i == 4:
        b += a[i][0]
    else:
        b += (a[i][0] + 9) // 10 * 10
print(b)

Submission status: Accepted

Solution code:
T=list(int(input()) for _ in range(5))
tmin=10
ans=0
for t in T:
    ans+=(-(-t//10))*10
    if t%10!=0:
        tmin=min(tmin,t%10)

print(ans+tmin-10)

Submission status: Accepted

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

lst = sorted(lst, key =lambda x: 10 if x%10==0 else x%10, reverse = 1)
ans = 0
for l in lst[:4]:
    if l%10 == 0:
        ans += l
    else:
        ans += l//10*10 + 10
ans += lst[4]
print(ans)

Submission status: Accepted

Solution code:
def tenmod(n,c=0):
    if (n+c) % 10 == 0:
        return (n,c)
    return tenmod(n,c+1)

lst = list(map(int,[input() for i in range(5)]))
order_sort = sorted(list(map(tenmod,lst)),key=lambda x: x[1])
print(sum([x+y for x,y in order_sort[:4]])+order_sort[4][0])

Submission status: Accepted

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

n_ = [0]
for i in n:
    if i % 10 == 0:
        continue
    n_.append(10 - i % 10)

print(sum(n) + sum(n_) - max(n_))

Submission status: Accepted

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

ans = []

for p in itertools.permutations(l):
  t = p[0]
  for i in range(1, 5):
    t = math.ceil(t/10)*10
    t += p[i]
  ans.append(t)
print(int(min(ans)))

Submission status: Accepted

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

import math

print(sum([math.ceil(i/10) * 10 for i in l]) - max([math.ceil(i/10) * 10 - i for i in l]))

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
mod = [l[i] % 10 for i in range(5)]
time = 0
if max(mod) == 0:
    print(sum(l))
else:
    min = 0
    for i in range(5):
        if mod[i] != 0:
            time += l[i] + (10 - mod[i])
            if min < 10 - mod[i]:
                min = 10 - mod[i]
        else:
            time += l[i]
    print(time - min)

Submission status: Accepted

Solution code:
meal = [int(input()) for i in range(5)]
mod = [meal[i]%10 for i in range(5)]
time = 0
if max(mod) == 0:
  for i in range(5):
    time += meal[i]
  print(time)
else:
  min = 0
  for i in range(5):
    if mod[i] != 0:
      time += meal[i] + (10-mod[i])
      if min < 10 - mod[i]:
        min = 10-mod[i]
    else:
      time += meal[i]
  print(time - min)

Submission status: Accepted

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

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

max_dif = max(dif)
k = dif.index(max_dif)

sum_time = 0
for i in range(5):
  if i == k:
    sum_time += dish[i]
  else:
    if dif[i] != 0:
      sum_time += ((dish[i] // 10) + 1) * 10
    else:
      sum_time += dish[i]
    
print(sum_time)

Submission status: Accepted

Solution code:
def addTime(n):
    keta = n%10
    if keta == 0:
        return n
    return n+10 - keta

def calcKeta(n):
    if n%10!=0:
        return n%10
    return 10

food = [int(input()) for _ in range(5)]
foods = sorted(food,key=calcKeta)
min_food_time = foods[0]
foods.remove(min_food_time)
print(sum(list(map(addTime,foods)))+min_food_time)

Submission status: Accepted

Solution code:
a=[]
mv=10
for i in range(5):
    n=input()
    if n[-1]!='0':
        mv=min(mv,int(n[-1]))
    a.append(int(n))

mvb=True
ans=0
t=0
for i in range(5):
    if str(a[i])[-1]==str(mv) and mvb:
        mvb=False
        t=a[i]
        continue
    ans+=a[i]
    while ans%10!=0:
        ans+=1
print(ans+t)

Submission status: Accepted

Solution code:
lst = [int(input()) for i in range(5)]
dit=[]
time=0
for i in range(5):
    x = lst[i]
    if lst[i]%10==0:
        y=0
    else:
        y=10-lst[i]%10
    dit.append([x,y])
dit_sorted=sorted(dit,key=lambda x:x[1])
for i in range(4):
    if dit_sorted[i][1]==0:
        time += dit_sorted[i][0]
    else:
        time += (dit_sorted[i][0]//10+1)*10
time += dit_sorted[4][0]
print(time)

Submission status: Accepted

Solution code:
ABCDE=[]
modABCDE=[]
for i in range(5):
  ABCDE+=[int(input())]
  if ABCDE[i]%10!=0:
    modABCDE+=[ABCDE[i]%10]  
if modABCDE!=[]:
  MIN=min(modABCDE)
else:
  MIN=10  
ans=sum(ABCDE)-sum(modABCDE)+(len(modABCDE)-1)*10+MIN
print(ans)

Submission status: Accepted

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

price = sorted(price, key=lambda x: x % 10)
ret = float('inf')

for i in range(5):
    s = sum(map(lambda x: x // 10 * 10 + (10 if x % 10 > 0 else 0), price[:i] + price[i + 1:])) + price[i]

    ret = min(ret, s)

print(ret)

Submission status: Accepted

Solution code:
dish = []
ans = 0
for _ in range(5):
    cost = int(input())
    rest = 10 - cost % 10
    if rest == 10:
        rest = 0
    dish.append((rest, cost))

dish.sort()
for r, c in dish:
    ans += r + c
print(ans-dish[4][0])

Submission status: Accepted

Solution code:
import sys
import math

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    minv = 10
    sumv = 0
    for i in range(5):
        tmp = INT()
        if tmp % 10 > 0:
            minv = min(minv, tmp%10)
        sumv += math.ceil(tmp/10) * 10
    print(sumv - 10 + minv)



if __name__ == '__main__':
    main()