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.

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

counter = 0
lst_wait = []
for k in range(5):
    time_wait = lst[k] % 10
    if time_wait % 10 == 0:
        wait_time = 0
        lst_wait.append(wait_time)
    else:
        wait_time = 10 - time_wait
        lst_wait.append(wait_time)
    
lst_com = list(zip(lst_wait,lst))
lst_com_ch = sorted(list(lst_com))
total_time = 0

for i in range(4):
    total_time = total_time + list(lst_com_ch)[i][0] +list(lst_com_ch)[i][1]

total_time += list(lst_com_ch)[4][1]

print(total_time)

Solution (Python):
a = [int(input()) for _ in range(5)]
ans = 1000


def solve(l, t):
    global ans
    if len(l) == 0:
        if ans > t:
            ans = t
        return
    if t % 10 > 0:
        t = t+10-t % 10
    for i, v in enumerate(l):
        solve(l[:i]+l[i+1:], t+l[i])


solve(a, 0)
print(ans)

Solution (Python):


import sys

debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    a_e = [int(e) for e in lines[:5]]

    return (a_e,)

def permutation(tmp):

    if len(tmp) == 0:
        return [[]]
    else:
        result = []
        for i in range(len(tmp)):
            head = tmp[i]
            tail = tmp[0:i] + tmp[i+1:]
            for r in permutation(tail):
                result.append([head] + r)
        return result

def solve(a_e):

    result = 130 * 5
    for r in permutation(a_e):
        if debug:
            log("r=%s" % r)
        total = 0
        for e in r[:4]:
            tmp = e + total
            m = tmp % 10
            if m == 0:
                total = tmp
            else:
                total = tmp + (10 - m)
            if debug:
                log("e=%d, tmp=%d, total=%s" % (e, tmp, total))
        total = total + r[4]
        if debug:
            log("total=%s" % total)

        if total < result:
            if debug:
                log("r=%s" % r)
            result = total
 
    return result

def main():
    

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

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

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

l10=[int(i) for i in x if i % 10==0]
res=x
for n in l10:
    res.remove(n)

if not len(l10)==5:
    min_d=9
    for i in res:
        if int(str(i)[-1])<=min_d:
            min_d=int(str(i)[-1])
            min_num=i
    
    re2=res
    
    re2.remove(min_num)
    
    s=0
    for si in re2:
        if len(str(si))==2:
            s+=int(str(si)[0])*10+10
        elif len(str(si))==1:
            s+=10
        else:
            s+=int(str(si)[:-1])*10+10 
    print(sum(l10)+min_num+s)
else:
    print(sum(l10))

Solution (Python):
import math
a = []
k = 0
for i in range(5):
    tmp = int(input())
    a.append([tmp,(tmp-1)%10])
a.sort(reverse=True, key=lambda x:x[1])
for i in range(4):
    k += (math.ceil(a[i][0]/10))*10
k += a[4][0]
print(k)

Solution (Python):
A = input()
B = input()
C = input()
D = input()
E = input()

last = [0] * 5
last[0] = int(A[-1])
last[1] = int(B[-1])
last[2] = int(C[-1])
last[3] = int(D[-1])
last[4] = int(E[-1])

total = [0] * 5
total[0] = int(A)
total[1] = int(B)
total[2] = int(C)
total[3] = int(D)
total[4] = int(E)


compare = []
index = []
i = 0


def ceil(src, range):
    x = str(src)
    if x[-1] == "0":
        return src

    return ((int)(src / range) + 1) * range


for i in range(5):
    if last[i] == 0:
        last[i] = 9

min_number = min(last)
min_idx = last.index(min(last))


ans = 0
for j in range(5):
    ans += ceil(total[j], 10)

    if j == min_idx:
        ans -= ceil(total[j], 10)


ans = ans + total[min_idx]

print(ans)

Solution (Python):
def ceil(src, range):
    if src % 10:
        return ((int)(src / range) + 1 ) * range
    else:
        return src

def main():
    input_list = []
    rand_up_list = []
    sa = {}
    for i in range(5):
        num = int(input())
        input_list.append(num)
        rand_up_list.append(ceil(num,10))
        sa[i] = rand_up_list[i] - input_list[i]
    test = sorted(sa.items(), key=lambda x: x[1])
    sum = 0
    for i in range(5):
        if i < 4:
            sum += rand_up_list[test[i][0]]
        else:
            sum += input_list[test[i][0]]
    print(sum)
    
main()

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

min = 10
index = 0
for i in range(5):
  if (array[i]%10) < min and 0<(array[i]%10):
    min = array[i]%10
    index = i
    
sum = int(0)
for i in range(5):
  ans = array[i]//10
  amari = array[i]%10
  if i == index :
    sum += array[i]
  elif amari == 0:
    sum += int(ans*10)
  else:
    sum += int(ans*10 +10)
  
print(sum)

Solution (Python):


t_net = [int(input()) for _ in range(5)]
t_next = [(t+9)//10*10 for t in t_net]
diff = [y-x for x,y in zip(t_net, t_next)]

t_tuple = list(zip(t_net, t_next, diff))
t_tuple.sort(key=lambda x:x[2])
print(sum([x[1] for x in t_tuple[:-1]])+t_tuple[-1][0])

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
dic = {"A":A,"B":B,"C":C,"D":D,"E":E}
 
arr1 = []
arr2 = []
res = 0
 
for k,v in dic.items():
    if v % 10 != 0:
        arr1.append((int(v / 10) + 1 ) * 10 - v)
    res += v
    
if len(arr1) > 0:
    fraction = sum(arr1)     
    for i in arr1:
        arr2.append(fraction - i)

    print(res + min(arr2))
else:
    print(res)

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

items = [a, b, c, d, e]
import itertools
import math
min_total = 1000
p = itertools.permutations(items, len(items))
for v in itertools.permutations(items, len(items)):
    total = 0
    for i, item in enumerate(v):
        if i != len(v) - 1:
            total += math.ceil(item / 10) * 10
        else:
            total += item
    min_total = min(min_total, total)
print(min_total)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


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


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, D, E):
    a = A, B, C, D, E
    ans = sum(a)
    r = []
    for v in a:
        if v % 10 != 0:
            r.append(10 - v % 10)
    
    ans += sum(r)
    if r:
        ans -= max(r)
    return ans


def main():
    A = read_int()
    B = read_int()
    C = read_int()
    D = read_int()
    E = read_int()

    print(slv(A, B, C, D, E ))


if __name__ == '__main__':
    main()

Solution (Python):
import copy
import itertools

def cooktime(n):
  if n % 10 == 0:
    ans  = n
  else:
    ans = (n//10+1)*10  
  return ans

l = []
for i in range(5):
  l.append(int(input()))
best = 9999
all_list = list(itertools.permutations(l))
while len(all_list):
  seq = all_list.pop()
  sum = 0
  for i in range(len(seq)):
    if i==4:
      sum += seq[i]
    else:
      sum = cooktime(sum+seq[i])
  if sum < best:
    best = sum

print(best)

Solution (Python):
import math

a = [0] * 5
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())

b = [0] * 5
c = [0] * 5

for i in range(5):
    b[i] = math.ceil(a[i] / 10) * 10

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

Solution (Python):
b=10
sum=0
for _ in range(5):
  a=int(input())
  if a%10 !=0:
      sum += (a+10-a%10)
      if b>(a%10):
          b=a%10
  else:
      sum += a
print(sum-10+b)

Solution (Python):
import numpy as np
n=5
a=[int(input()) for i in range(n)]
b=[0] * 5
for i in range(5):
    b[i]=10-a[i]%10
    if b[i]==10:
        b[i]=0
b=np.array(b)
c=list(b.argsort())
x=0
for i in range(4):
    unchi=a[c[i]]
    x=x+unchi    
    if (unchi%10)!=0:
        omake=10-unchi%10
        x=x+omake
    
x=x+a[c[4]]
print(x)

Solution (Python):
def ceil(src, range):
    if src % 10:
        return ((int)(src / range) + 1 ) * range
    else:
        return src

def main():
    input_list = []
    rand_up_list = []
    sa = {}
    for i in range(5):
        num = int(input())
        input_list.append(num)
        rand_up_list.append(ceil(num,10))
        sa[i] = rand_up_list[i] - input_list[i]
    test = sorted(sa.items(), key=lambda x: x[1])
    sum = 0
    for i in range(5):
        if i < 4:
            sum += rand_up_list[test[i][0]]
        else:
            sum += input_list[test[i][0]]
    print(sum)
    
main()

Solution (Python):
ls = [int(input()) for i in range(5)]

na = []
for n in ls:
  if n%10 == 0:
  	na.append(n//10)
nb = []
rb = []
for n in ls:
  if n%10 != 0:
    nb.append(n//10 + 1)
    rb.append(n%10)


if len(rb) == 0:
  print(sum(na)*10 + sum(nb)*10)
else:
  minr = max(min(rb), 0)
  print(sum(na)*10 + sum(nb)*10 -10 + minr)

Solution (Python):
from math import ceil
time = [int(input()) for i in range(5)]
mod = []
for t in time:
    if t % 10 == 0: mod.append(10)
    else: mod.append(t % 10)

total = 0
for i in range(5):
    total += 10 * ceil(time[i]/10)
total -= (10 - min(mod))
print(total)

Solution (Python):
lis = [int(input()) for _ in range(5)]
times = [(l + 9) // 10 * 10 for l in lis]
loss = [(10 - l % 10) % 10 for l in lis]
print(sum(times) - max(loss))

Solution (Python):
from sys import stdin
import math

order = {'0': 0, '9': 1, '8': 2, '7': 3, '6': 4, '5': 5, '4': 6, '3': 7, '2': 8, '1': 9}
r = 0
foods = sorted([stdin.readline().rstrip() for _ in range(5)], key=lambda food: order[food[-1]])

for i, food in enumerate(foods):
    if food[-1] == '0' or i == 4:
        r += int(food)
    else:
        r += 10 * (math.floor(int(food) / 10) + 1)

print(r)

Solution (Python):
x = [int(input()) for i in range(5)]
mintime = 100000
for i in range(5):
    for j in range(5):
        for p in range(5):
            for q in range(5):
                for w in range(5):
                    time = 0
                    if i != j and i != p and i != q and i != w and j != p and j != q and j != w and p != q and p != w and q != w:
                        time += x[i]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[j]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[p]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[q]
                        if time % 10 != 0:
                            time += (10 - (time % 10))
                        time += x[w]
                        if time < mintime:
                            mintime = time
print(mintime)

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

mi = 9
ar = a % 10
if ar > 0 and ar < mi:
  mi = ar
br = b % 10
if br > 0 and br < mi:
  mi = br
cr = c % 10
if cr > 0 and cr < mi:
  mi = cr
dr = d % 10
if dr > 0 and dr < mi:
  mi = dr
er = e % 10
if er > 0 and er < mi:
  mi = er

li = [a,b,c,d,e]
su = 0
fl = 0
for i in li:
  if i%10==mi and fl == 0:

    su = su + i
    fl = 1
  else:

    if i%10 == 0:
      su = su+i
    else:
      su = su + i//10*10+10
print(su)

Solution (Python):
import math

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


def main():
    M = [A, B, C, D, E]
    L = [int(math.ceil(m / 10) * 10) for m in M]

    x = min([(m-1) % 10 for m in M]) + 1

    print(sum(L) - 10 + x)


if __name__ == '__main__':
    main()

Solution (Python):
l=[input() for i in range(5)]
a=[0, 0, 0, 0, "9"]

for i in range(5):
  if int(a[4][-1]) >= int(l[i][-1]) and not(int(l[i][-1]) == 0):
      a[4] = l[i]

if a[4] is "9":
  a[4] = l[0]

l.remove(a[4])
l = [int(i) for i in l]
l.sort()
for j in range(4):
  while(not(int(l[j]) % 10 is 0)):
    l[j]+=1
  a[j] = int(l[j])
  
a[4] = int(a[4])
print(sum(a))

Solution (Python):
L = [int(input()) for i in range(5)]
l = [n % 10 if not (n % 10 == 0) else 100 for n in L]
i = l.index(min(l))
I = 10 - (L[i] % 10) + L[i] if not(L[i] % 10 == 0) else L[i]
SUM = sum([n + 10 - (n % 10) if not (n % 10 == 0) else n for n in L])

ans = SUM - I + L[i]
print(ans)

Solution (Python):
a = [int(input()) for i in range(5)]
r = 10
last = 0
for i in range(5):
    if a[i] % 10 != 0 and a[i] % 10 < r:
        last = i
        r = int(a[i] % 10)


b = [int((a[i] + 9) / 10) * 10 for i in range(5)] 
time = 0
for i in range(5):
    if i != last:
        time = time + b[i]
    
time = time + a[last]
print(time)

Solution (Python):
T = sorted([int(input()) for _ in range(5)])

T_sub = []
cnt = 0
for i in range(10, 131, 10):
    while T[cnt] <= i:
        T_sub.append(i - T[cnt])
        cnt += 1
        if cnt == 5:
            break
    if cnt == 5:
        break

max_index = T_sub.index(max(T_sub))

new_T = []
for i in range(5):
    if i == max_index:
        pass
    else:
        new_T.append(T[i])
new_T.append(T[max_index])

time = 0
for i in range(5):
    time += new_T[i]
    if i == 4:
        print(time)
        exit()
    else:
        while time % 10 != 0:
            time += 1

Solution (Python):




A = int(input())

B = int(input())

C = int(input())

D = int(input())

E = int(input())


order_list         = [A, B, C, D, E]
ordered_order_list = []
counter = 0


for i, order in enumerate(order_list):




    
    
  
  if i == 0:

    ordered_order_list.append(order)
    if order % 10 ==0:
       counter += 1
    continue






  
  if order % 10 == 0:
    ordered_order_list.insert(0, order)
    counter += 1
  
  else:

    order_units_digit        = order % 10

    target_order             = ordered_order_list[len(ordered_order_list) -1]
    target_order_units_digit = target_order % 10

    if(target_order_units_digit > order_units_digit):
      ordered_order_list.append(order)
    else:
      ordered_order_list.insert(len(ordered_order_list) -1, order)
       
answer = 0

for l, ordered_order in enumerate(ordered_order_list):
  if l == len(ordered_order_list) - 1:
    answer += ordered_order
    continue
  if(l<counter):
    answer += ordered_order
  else:
    answer += (int(ordered_order/10) + 1) * 10


print(str(answer))

Solution (Python):
a = [[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(5):
    a[i][0] = int(input())


time = 0

for j in range(5):
    if a[j][0]%10 == 0:
      a[j][1] = 0
    else:
      a[j][1] = 10-(a[j][0]%10)

for k in range(5):
    a.sort(key=lambda x:x[0])
    a.sort(key=lambda x:x[1])


for l in range(4):
  if a[l][1] == 0:
    time += a[l][0]
  else:
    time += (a[l][0]+(10-(a[l][0]%10)))
time += a[4][0]
print(time)

Solution (Python):
import math

all_list = [int(input()) for _ in range(5)]
tmp = 0
for i in all_list:
    j = math.ceil(i/10)*10
    tmp_i = j - i
    if tmp < tmp_i:
        tmp = tmp_i
for i, num in enumerate(all_list):
    all_list[i] = math.ceil(num/10)*10
result = sum(all_list)
result -= tmp
print(result)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a >= 100:
    a1 = a % 10
else:
    a2 = a - 100
    a1 = a2 % 10
if b >= 100:
    b1 = b % 10
else:
    b2 = b - 100
    b1 = b2 % 10
if c >= 100:
    c1 = c % 10
else:
    c2 = c - 100
    c1 = c2 % 10
if d >= 100:
    d1 = d % 10
else:
    d2 = d - 100
    d1 = d2 % 10
if e >= 100:
    e1 = e % 10
else:
    e2 = e - 100
    e1 = e2 % 10
if a1 == 0:
    a1 = 9
if b1 == 0:
    b1 = 9
if c1 == 0:
    c1 = 9
if d1 == 0:
    a1 = 9
if e1 == 0:
    e1 = 9
lis = [a1,b1,c1,d1,e1]
if a1 == min(lis) :
    answer = math.ceil(b / 10) * 10 + math.ceil(c/ 10) * 10 + math.ceil(e/ 10)* 10+ math.ceil(d/ 10) * 10 + a
if b1 == min(lis):
    answer = math.ceil(a/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + b
if c1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(a/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + c
if d1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(a/ 10)* 10 + d
if e1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(a/ 10)* 10 + math.ceil(d/ 10)* 10 + e
print(answer)

Solution (Python):
from itertools import permutations
lis = [int(input()) for _ in range(5)]
ans = 1e9
for li in permutations(lis):
    cnt = 0
    for i in range(5):
        if cnt % 10 != 0:
            cnt += 10 - (cnt % 10)
        cnt += li[i]
    ans = min(ans, cnt)
print(ans)

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

b = [[i, i%10] for i in a]

b.sort(key=lambda x:x[1])
s=0
flag = 0
for i in range(5):
    if b[i][1] == 0:
        s += b[i][0]
    else:
        if flag == 0:
            s += b[i][0]
            flag = 1
        else :
            s += (b[i][0]+10)//10*10
print(s)

Solution (Python):
array = [int(input()) for i in range(5)]
array2 = [] 
array3 = []

for i in array:
  array2.append(((i//10 + 1) *10) if i%10 != 0 else i//10 * 10)
  array3.append(i%10 if i%10 != 0 else 10)

print(sum(array2)-(10-min(array3)))

Solution (Python):
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())


menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()

if int(menu[4])==0:
    iti=0
    marume=0
else:
    while menu[0]=="0":
        menu.remove("0")
    iti=int(menu[0])
    marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
                
print(iti + marume +time)

Solution (Python):
list = [int(input()) for i in range(5)]
list.sort(key=lambda x: (x-1)%10)
sum = 0
for i in list[1:]:
    if i%10!=0: i = 10-(i%10)+i
    sum += i
print(sum+list[0])

Solution (Python):
sum = 0
amari_min = 10
for i in range(5):
    tmp = int(input())
    amari = tmp % 10
    if amari == 0:
        a = tmp / 10
    else:
        a = int(tmp / 10) + 1
    sum += a
    if amari != 0:
        if amari_min > amari:
            amari_min = amari

sum *= 10
print(int(sum - 10 + amari_min))

Solution (Python):
num_list = []
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
num_list.append(int(input()))
minutes = 0
dist_10 = 0
min_dist_10 = 0
min_list_num = 0
for _ in range(5):
    minutes += min_dist_10
    min_dist_10 = 10
    for i in range(len(num_list)):
        num = num_list[i] + minutes
        dist_10 = 10-int((str(num)[-1:]))
        if (str(num)[-1:]) == "0":
            min_dist_10 = 0
            min_list_num = i
            break
        if min_dist_10 > dist_10:
            min_dist_10 = dist_10
            min_list_num = i
    minutes += int(num_list.pop(min_list_num))
print(minutes)

Solution (Python):
import numpy as np


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

time = np.array([a, b, c, d, e])
time_10 = np.ceil(time / 10) * 10
xx0, xx1 = np.meshgrid(time,time_10)

time_set = (1 - np.eye(xx1.shape[0])) * xx1 + np.eye(xx0.shape[0]) * xx0

print(int(np.min(time_set.sum(axis=0))))

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

num = [[a,0],[b,1],[c,2],[d,3],[e,4]]
index = 0
f = 10
for n,i in num:
    if n%10==0:
        continue
    if f > n%10:
        index = i
        f = n%10

sm = 0
for n,i in num:
    if index == i:
        sm += num[i][0]
    elif n%10==0:
        sm += num[i][0]
    else:
        sm += num[i][0] + (10 - num[i][0]%10)
print(sm)

Solution (Python):
import math

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

f = [a,b,c,d,e]
n = [math.ceil((i/10))*10 for i in f]
m = [math.ceil((i/10))*10-i for i in f]
s = sum(n)-max(m)
print(s)

Solution (Python):

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

def dfs(time,depth,list):
	if(depth == 5):
		time_t.append(time)
	time += (10 - time%10)%10
	for ind,l in enumerate(list):
		new_list = list[0:ind]+list[ind+1:len(list)]
		dfs(time+a[l],depth+1,new_list)

dfs(0,0,[0,1,2,3,4])
print(min(time_t))

Solution (Python):
import math
import itertools
X = [int(input()) for i in range(5)]
T = []
for x in list(itertools.permutations(X)):
    t = 0
    for i in x:
        t = math.ceil(t  / 10) * 10 + i
    T.append(t)
print(min(T))

Solution (Python):
import numpy as np
T = np.array([int(input()) for i in range(5)])

T_0 = T[np.mod(T, 10) == 0]
T_o = T[np.mod(T, 10) != 0]

T_c = T_o + 10 - np.mod(T_o, 10)
T_s = np.sort(np.mod(T_o, 10))
if T_0.size == 5:
    print(np.sum(T_0))
else:
    print(np.sum(T_c) - 10 + np.sum(T_0) + T_s[0])

Solution (Python):

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

min=t[0]
length=len(t)
for i in range(length):
    if min%10>t[i]%10 and t[i]%10!=0:
        min=t[i]
t.remove(min)
t.append(min)
ans=0
for _ in range(length-1):
    if t[_]%10!=0:
        ans+=t[_]+10-t[_]%10
    else:
        ans+=t[_]
print(ans+t[length-1])

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

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

a = 10 - A % 10
b = 10 - B % 10
c = 10 - C % 10
d = 10 - D % 10
e = 10 - E % 10

def func(x):
    if x == 10 :
        x = 0
    return x

a = func(a)
b = func(b)
c = func(c)
d = func(d)
e = func(e)
    
    
get = [a,b,c,d,e]

z = 0
k = 0 
for i in  range(5):
    if z < get[i]:
        z = get[i]
        k = i
        
A_ = A + a
B_ = B + b
C_ = C + c
D_ = D + d
E_ = E + e

pocket_ = [A_, B_, C_, D_, E_]

print(sum(pocket_) - pocket_[k] + pocket[k])

Solution (Python):

time = []
last = 0
amari = 10
flg = True
sum = 0

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

for i in range(5):
    temp = time[i]%10
    if temp > 0 and temp < amari:
        amari = temp
        last = time[i]

for i in range(5):
    if time[i] == last and flg == True:
        sum += last
        flg = False
    else:
        sum += time[i]
        if time[i]%10 != 0:
            sum += 10-(time[i]%10)
print(sum)

Solution (Python):
import sys
import itertools
import math

"""
B - Five Dishes
https://atcoder.jp/contests/abc123/tasks/abc123_b
"""


def order(order_list):
    t1 = math.ceil(order_list[0] / 10) * 10
    t2 = t1 + math.ceil(order_list[1] / 10) * 10
    t3 = t2 + math.ceil(order_list[2] / 10) * 10
    t4 = t3 + math.ceil(order_list[3] / 10) * 10
    t5 = t4 + order_list[4]
    return t5


if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    all_order = sorted([a, b, c, d, e])

    all_cases = list(itertools.permutations(all_order))

    min_time = sys.maxsize

    for e in all_cases:
        time = order(e)
        if time < min_time:
            min_time = time

    print(min_time)

Solution (Python):
import sys
import itertools
import math

"""
B - Five Dishes
https://atcoder.jp/contests/abc123/tasks/abc123_b
"""


def order(order_list):
    t1 = math.ceil(order_list[0] / 10) * 10
    t2 = t1 + math.ceil(order_list[1] / 10) * 10
    t3 = t2 + math.ceil(order_list[2] / 10) * 10
    t4 = t3 + math.ceil(order_list[3] / 10) * 10
    t5 = t4 + order_list[4]
    return t5


if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    all_order = sorted([a, b, c, d, e])

    all_cases = list(itertools.permutations(all_order))

    min_time = sys.maxsize

    for e in all_cases:
        time = order(e)
        if time < min_time:
            min_time = time

    print(min_time)

Solution (Python):
T = [int(input()) for _ in range(5)]

MaxTime = 0
for t in T:
	MaxTime += ((t + 9) // 10) * 10

MaxDiffTime = 10
for t in T:
	if t % 10 != 0:
		MaxDiffTime = min(MaxDiffTime, t % 10)

print(max(0, MaxTime - (10 - MaxDiffTime)))

Solution (Python):



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


sum_time = 0
b = {}

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



sort_dict = sorted(b.items(), key=lambda x:x[1], reverse=True)


for i in range(4):
    d = sort_dict[i]
    index = d[0]
    sub = 10 - d[1]
    sum_time += a[d[0]] + sub

d = sort_dict[4]
index = d[0]
sum_time += a[d[0]]

print(sum_time)

Solution (Python):
array=[int(input()) for i in range(5)]
array2=[array[i]%10 for i in range(5)]
n=10
sum=0
for i in range(5): 
    if array2[i]<n and array2[i]!=0: n=array2[i]
    if array2[i]!=0: sum += int(array[i]/10)+1
    else: sum += int(array[i]/10)
if n!=10: print(sum*10-(10-n))
else: print(sum*10)

Solution (Python):
t = [int(input()) for i in range(5)]
sum = 0
amari = [0, 0, 0, 0, 0]

for i in range(5):
    sum += -(-t[i] // 10) * 10

    amari[i] = t[i] % 10
    if amari[i] == 0:
        amari[i] = 10





if min(amari) != 10:
    print(sum - 10 + min(amari))
else:
    print(sum)

Solution (Python):
import math
a=int(input());b=int(input());c=int(input());d=int(input());e=int(input())

N=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
X=[a%10,b%10,c%10,d%10,e%10]
n=0
while(n!=5):
  if X[n]==0:
    X[n]=10
  n+=1

else:
  print(N-(10-min(X)))

Solution (Python):

import math

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

result = 0
mod_res = 10
for x in [a, b, c, d, e]:
    if 0 < x % 10 < mod_res:
        mod_res = x % 10
flag = True
for x in [a, b, c, d, e]:
    if x % 10 == mod_res and flag:
        result += x
        flag = False
    else:
        result += math.ceil(x / 10) * 10
        
print(result)

Solution (Python):
import math
a,b,c,d,e=[int(input()) for i in range(5)]
x=[]
y=[]
def ceil(src, range):
  return ((int)(src / range) + 1 ) * range
for s in [a,b,c,d,e]:
  if s%10 != 0:
    x.append(s%10)
    t=min(x)
  if s<10:
    y.append(10)
  elif s%10==0:
    y.append(s)
  else:
    y.append(ceil(s,10))
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
  print(a+b+c+d+e)
else:
  ans = sum(y)
  ans= ans-10+t
  print(ans)

Solution (Python):
n=[]
for _ in range(5):n+=[int(input())]
n.sort(key=lambda m:(m-1)%10)
for i in range(1,5):n[i]=(n[i]//10+(n[i]%10>0))*10
print(sum(n))

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

mono = [A,B,C,D,E]
amari = [A%10,B%10,C%10,D%10,E%10]
minamari = 9
jun = []
for i in range(5):
    if amari[i]==0:
        jun.insert(0,mono[i])
    elif amari[i]<minamari:
        jun.append(mono[i])
        minamari = amari[i]
    else:
        jun.insert(0,mono[i])
        
for i in range(4):
    if jun[i]%10>0:
        jun[i]=(jun[i]//10)*10+10

output = sum(jun)
print(int(output))

Solution (Python):
import numpy as np
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
 
aa = A // 10
bb = B // 10
cc = C // 10
dd = D // 10
ee = E // 10
 
r = np.array([a, b, c, d, e])
k = (r > 0).sum()
if k > 0:
  l = r[r != 0].min()
  print((aa + bb + cc + dd + ee) * 10 + 10*(k-1) + l)
else:
  print(A + B + C + D + E)

Solution (Python):
A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0

for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)

Solution (Python):

data = [input() for i in range(5)]
num_data = list(map(int, sorted([i for i in data if i[-1] != '0'],key=lambda x:x[-1],reverse=True)))

zero_data = list(map(int, [i for i in data if i[-1] == '0']))
res = 0
for i in range(len(num_data)):
    if i == len(num_data)-1:
        res += num_data[i]
    elif num_data[i] < 10:
        res += 10
    elif num_data[i] - 100 < 0:
        info = str(num_data[i])[0]
        res +=(int(info)+1) * 10
    else:
        info = str(num_data[i])[1]
        res += num_data[i] + ((int(info) + 1) * 10) - int(str(num_data[i])[-1]) -(int(info) * 10)
print(res + sum(zero_data))