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):
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)

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):


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()

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

sum = 0
edge = 10

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

print(sum + edge - 10)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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



inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    
    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()

Solution (Python):
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:])))

Solution (Python):


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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):

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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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])

Solution (Python):
from math import ceil
from itertools import permutations
X=[]
for i in range(5):
    a=int(input())
    X.append(a)
Z=list(permutations(X))
m=10**10
for A in Z:
    num=0
    for k in range(5):
        if k==4:
          num+=A[k]
          break
        num+=int(ceil(A[k]/10))*10
    m=min(m,num)
print(m)

Solution (Python):
import math
dishes = [int(input()) for _ in range(5)]
dishes_mod = 10
for i in range(5) :
  if(dishes[i]%10 != 0) : dishes_mod = min(dishes_mod, dishes[i]%10)
print(sum(list(map(lambda x: math.ceil(x), list(map(lambda x:x/10, dishes)))))*10-10+dishes_mod)

Solution (Python):
l = [int(input()) for _ in range(5)]
ans = 10**9
for i in range(5):
    ret = 0
    for j in range(5):
        if i==j:
            continue
        else:
            if l[j]%10==0:
                ret += l[j]
            else:
                ret += l[j]+(10-l[j]%10)
    ret += l[i]
    ans = min(ret,ans)
print(ans)

Solution (Python):


def ceil(x):
    if x % 10 == 0:
        return x
    else:
        return x // 10 * 10 + 10


def main():
    data = [int(input()) for _ in range(5)]

    firstdigit = [i % 10 if i % 10 != 0 else 10 for i in data]
    index = firstdigit.index(min(firstdigit))

    totaltime = 0
    for i, time in enumerate(data):
        if i == index:
            totaltime += time
        else:
            totaltime += ceil(time)

    print(totaltime) 


if __name__ == '__main__':
    main()

Solution (Python):
import math

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

mi = an[0]
for a in an[1:]:
    if  a%10 < mi % 10 and a%10 != 0:
        mi = a
an.remove(mi)
hoge = []
for i in an:
    temp = int(math.ceil(i/10))*10
    hoge.append(temp)
ans = sum(hoge) + mi
print(ans)

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

a = [A, B, C, D, E]
a.sort(key=lambda x : (x-1) % 10)

ans = a[0]
for i in a[1:]:
    t = i % 10
    if t == 0:
        ans += i
    else:
        ans += 10 - t + i

print(ans)

Solution (Python):
T = []
total = 0
min_offset = 10
for _ in range(5):
    t = int(input())
    offset = t % 10
    if offset > 0:
        t = (int(t / 10) + 1) * 10
        if offset < min_offset:
            min_offset = offset
    total += t
print(total+min_offset-10)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return int(stdin.readline())

a = li()
b = li()
c = li()
d = li()
e = li()
total = 0
delta = 0
for elem in [a, b, c, d, e]:
    mod = elem % 10
    if mod == 0:
        total += elem
    else:
        d = 10 - mod
        total += elem + d
        delta = max(delta, d)
print(total - delta)

Solution (Python):
AE = [int(input()) for _ in range(5)]
Ans = 0
mini = 10
for f in AE:
    if f%10 == 0:
        Ans += f
    elif f%10 < mini:
        Ans += f + (10-mini)
        mini = f%10
    else:
        Ans += f + (10-f%10)
        
print(Ans)

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

mli = [A % 10 if A % 10 != 0 else 999, B % 10 if B % 10 != 0 else 999, C % 10 if C % 10 != 0 else 999,
      D % 10 if D % 10 != 0 else 999, E % 10 if E % 10 != 0 else 999]

last=mli.index(min(mli))

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

for i in range(len(li)):
      if last==i:
            pass
      else:
            li[i]=math.ceil(float(li[i]/10))*10
print(sum(li))

Solution (Python):
import sys
input = sys.stdin.readline
a = [0,0,0,0,0]
b = [[0,i] for i in range(5)]
for i in range(5):
    a[i] = int(input())
    b[i][0] = a[i] % 10
b.sort()
j = 0
while j < 5 and b[j][0] == 0:
    j += 1
time = 0
if j == 5:
    for i in range(5):
        time += a[i]
else:
    for i in range(5):
        if i != b[j][1]:
            if a[i] % 10 == 0:
                time += a[i]
            else:
                time += (a[i] + (10 - a[i] % 10))
    time += a[b[j][1]]
print(time)

Solution (Python):
nums = [int(input()) for i in range(5)]
ans = 0
min_n = 10
idx = 0
for i in range(5):
    if nums[i] % 10  and min_n > abs(nums[i]%10):
        min_n = abs(nums[i]%10)
        idx = i
for i in range(5):
    if i == idx:
        ans += nums[i]
    else:
        if nums[i] % 10:
            ans += nums[i] + abs(10-nums[i]%10)
        else:
            ans += nums[i]
print(ans)

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
ans = 0
mm = 10
for i in range(5):
    m = a[i] % 10
    if m > 0:
        mm = min(mm, m)
    for j in range(1, 14):
        if a[i] <= 10 * j:
            ans += 10 * j
            break

ans -= 10 - mm
print(ans)

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

def time(x):
    if x%10 == 0:
        return x
    else:
        return x+(10-x%10)
ans = []
ans.append(time(a)+time(b)+time(c)+time(d)+e)
ans.append(time(a)+time(b)+time(c)+time(e)+d)
ans.append(time(a)+time(b)+time(e)+time(d)+c)
ans.append(time(a)+time(e)+time(c)+time(d)+b)
ans.append(time(e)+time(b)+time(c)+time(d)+a)
print(min(ans))

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return


def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    B()

Solution (Python):
from itertools import permutations
from itertools import combinations


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

ans=float('inf')

aa=[]
aa.append(a)
aa.append(b)
aa.append(c)
aa.append(d)
aa.append(e)

per = list(permutations(aa))

for i in range(len(per)):
    p = per[i]
    time = 0
    for j in range(5):
        if(time % 10 != 0):
            time = time+(10-(time%10))
        time += p[j]
    if(time < ans):ans = time

print(ans)

Solution (Python):
ans = 0
b = 10
for _ in range(5):
    a = int(input())
    ans += (a + 9) // 10 * 10
    b = min((a - 1) % 10 + 1, b)
print(ans - 10 + b)

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



min_amari = 10
lis = [a,b,c,d,e]
ans = -10
for e in lis:
    ama = e % 10
    if ama == 0:
        ans += e
    else:
        ans += e + (10-e%10)
        if min_amari > ama:
            min_amari = ama
ans += min_amari 

print(ans)

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

A=10
for i in range(5):
    if L[i]%10==0:
        pass
    else:
        if L[i]%10<A:
            A=L[i]%10
if A==10:
    print(sum(L))
else:
    ans=0
    for i in range(5):
        X=L[i]+9
        X=int(X/10)
        X*=10
        ans+=X
    ans-=10
    ans+=A
    print(ans)

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

cnt = 0
l = [10]
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

cnt -= 10 - min(l)
print(cnt)

Solution (Python):
a = [int(input()) for i in range(5)]
from itertools import permutations

ans = float('inf')

def calc(i):
    ret = i[0]
    for i in i[1:]:
        if ret % 10 != 0:
            ret += (10 - ret % 10) + i
        else:
            ret += i
    return ret

for i in permutations(a, 5):
    ans = min(ans, calc(i))

print(ans)

Solution (Python):
import math

ts = [int(input()), int(input()), int(input()), int(input()), int(input())]

ans = float('inf')
for i in range(5):
    time = 0
    for j in range(4):
        t = ts[(i + j) % 5]
        time += math.ceil(t / 10) * 10
    time += ts[(i + 4) % 5]
    ans = min(time, ans)
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
L=[]
f=0
ct=0
for i in range(5):
  if l[i]%10!=0:
    f+=1
    L.append(l[i]%10)
    ct+=(l[i]//10)*10+10
  else:
    ct+=(l[i]//10)*10
if f==0:
  print(ct)
else:
  print(ct-10+min(L))

Solution (Python):


import itertools
import collections
import bisect

def main():
    
    INF = int(1e15)
    last = INF
    menus = []
    for _ in range(5):
        m = int(input())
        if last == INF:
            last = m
        else:
            if m % 10 != 0:
                m_d = m % 10
                l_d = last % 10
                if m_d < l_d:
                    last = m
        menus.append(m)

    ans = 0
    last_done = False
    for m in menus:
        if m == last and not last_done:
            ans += m
            last_done = True
        else:
            if m % 10 == 0:
                ans += m
            else:
                ans += m + (10 - m % 10)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):


import math
import sys
import itertools
import numpy as np


t = [int(input()) for i in range(5)] 
answer = 0
a=10
for i in range(5):
    a = min(a,(t[i]-1)%10+1)

    answer += t[i] +10 -(t[i]%10)
    if t[i] % 10 == 0:
        answer -= 10

answer = answer -10 + a
print(answer)

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




ans = 0
for i in alist:
    ans += ((i-1) // 10 + 1) *10
    

ans_b = 11
for i in alist:
    if i % 10 == 0:
        ans_b = min(ans_b, 10)
    else:
        ans_b = min(ans_b, i%10)

print(ans - (10 - ans_b))

Solution (Python):
data = [int(input()) for i in range(5)]
l = [10]
def f(x):
    if x%10 == 0:
        return x
    else:
        l.append(x%10)
        return (x//10+1)*10

print(sum([f(x) for x in data])-(10-min(l)))

Solution (Python):
import itertools
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
seq = [A,B,C,D,E]
L = list(itertools.permutations(seq))
ans = float('inf')
for i in range(len(L)):
  sub = 0
  for j in range(4):
    if L[i][j]%10 != 0:
      sub += L[i][j]-(L[i][j]%10)+10
    else:
      sub += L[i][j]
  sub += L[i][4]
  if sub <= ans:
    ans = sub
print(ans)

Solution (Python):
list=[]

for i in range(5):
    x=int(input())
    list.append([(x-1)%10, x])

list=sorted(list)


time=0

for r in range(len(list)):
    if r==0:
        time+=list[0][1]
    else:
        x=list[r][1]
        if x%10==0:
            time+= x
        else:
            time+= (((x-x%10)/10)+1)*10

print(int(time))

Solution (Python):
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)

Solution (Python):
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a = ni()
b = ni()
c = ni()
d = ni()
e = ni()

f = min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)

ans = (a+9)//10+(b+9)//10+(c+9)//10+(d+9)//10+(e+9)//10

print(ans*10+f-9)

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

Qs = []
ans = 0
for A in ABCDEs:
    ans += (A+9)//10*10
    if A%10:
        Qs.append(A%10)

if Qs:
    print(ans-(10-min(Qs)))
else:
    print(ans)

Solution (Python):
A = list(int(input()) for _ in range(5))
B = [0]
for i in range(5):
    if A[i] % 10 != 0:
        
        B.append(10 - A[i] % 10)
B.remove(max(B))
print(sum(A) + sum(B))

Solution (Python):
s = 0
diff = 0
for i in range(5):
    a = int(input())
    if a%10 == 0:
        s += a
    else:
        s += (a//10+1)*10
        diff = max(diff, (a//10+1)*10 - a)
print(s-diff)

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

menu = [A,B,C,D,E]
menu.sort()
count  = 0
for x in menu:
    if x % 10 == 0:
        count += x
    else:
        count += 10 + (x//10)*10

cache = 10
for x in menu:
    if x%10 == 0:
        continue
    if cache > x%10:
        cache = x%10
count -= (10 - cache)
print(count)

Solution (Python):
a=[int(input()) for _ in [0]*5]
b=[(1+(x-1)//10)*10 for x in a]
c=sum(b)
ans=10**3
for i in range(5):
    ans=min(ans,c-b[i]+a[i])
print(ans)

Solution (Python):
dish = [int(input()) for _ in range(5)]
dish_10 = []
dish_1 = []
for i in dish:
    if(i%10==0):
        dish_10.append(int(i/10))
        dish_1.append(10)
    else:
        dish_10.append(int(i/10)+1)
        dish_1.append(i%10)
last = dish_1.index(min(dish_1))
ans = 0
for index,i in enumerate(dish_10):
    if(index!=last):
        ans+=i*10
ans += dish[last]
print(ans)

Solution (Python):
total_time = 0
max_save = 0
for i in range(5):
    time = int(input())
    spent_time = (time // 10 + int(bool(time % 10)))* 10
    max_save = max(max_save, spent_time - time)
    total_time += spent_time
print(total_time - max_save)

Solution (Python):
import math
A = [int(input()) for _ in range(5)]
B = list(A)
Mini = 10 ** 5
for i in range(5):
    count = 0
    for j in range(5):
        if i == j : continue
        B[j] = B[j]/10
        B[j] = math.ceil(B[j]) * 10
        count += B[j]
    count += A[i]
    Mini = min(Mini,count)

print(Mini)

Solution (Python):
an = [int(input()) for i in range(5)]
an2 = [i%10 for i in an]
an3 = [10 if i ==  0 else i for i in an2]

a=an[an3.index(min(an3))]
an.remove(a)
ans = a
for i in an:
     if i%10 == 0:
          ans += i
     else:
          ans += (i//10)*10+10
print(ans)

Solution (Python):
import sys
dishes = [int(input()) for _ in range(5)]
a = [(d%10,d) for d in dishes if d%10>0]
if a==[]:
    print(sum(dishes))
    sys.exit()
min_ = min(a)

ans = min_[1]
dishes.remove(min_[1])
for d in dishes:
    if d%10==0:
        ans += d
    else:
        ans += (d//10+1)*10
print(ans)

Solution (Python):

import math

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

min1 = map(lambda x: x % 10, t)
min1 = min([10 if i == 0 else i for i in min1])

print(sum(map(lambda x: math.ceil(x) * 10, [i/10 for i in t])) - (10 - min1))

Solution (Python):
import itertools

A = [0 for i in range(5)]
for i in range(5):
    A[i] = int(input())
    
ans = 1000
for perm in itertools.permutations(A):
    this_ans = 0
    for a in perm[:-1]:
        if a % 10 == 0:
            this_ans += a
        else:
            this_ans += (a//10 + 1) * 10
    this_ans += perm[-1]
    ans = min(ans, this_ans)

print(ans)

Solution (Python):
a, b, c, d, e = [int(input()) for _ in range(5)]
nums = [a, b, c, d, e]
tmp = [num if num % 10 == 0 else 10 * (num // 10 + 1) for num in nums]
buf = [num % 10 for num in nums if num % 10 != 0]
if not buf:
    print(sum(nums))
    exit()
ans = sum(tmp) + min(buf) - 10
print(ans)

Solution (Python):


if __name__ == '__main__':
    a = []
    b = []
    idx = 0
    r = 10
    for i in range(5):
        a.append(int(input()))
        if a[-1] % 10 == 0:
            if r == 10:
                idx = i
            b.append(a[-1])
        else:
            if r > a[-1] % 10:
                r = a[-1] % 10
                idx = i
            b.append(a[-1] - a[-1] % 10 + 10)
    sum = 0
    for i in range(5):
        if i == idx:
            sum += a[i]
        else:
            sum += b[i]
    print(sum)

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

min = 10
min_ind = 0
for i in range(5):
    if min > list1[i] > 0:
        min = list1[i]
        min_ind = i
cnt = []
for i in range(5):
    if i != min_ind:
        for j in range(1,14):
            if list[i] <= 10 * j:
                cnt.append(10*j)
                break
    else:
        cnt.append(list[i])
print(sum(cnt))

Solution (Python):
import math

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

amari = sorted([val % 10 for val in vals if val % 10 != 0])
rounded = [math.ceil(val/10)*10 for val in vals]


ret = sum(rounded)
if len(amari) > 0:
	ret += amari[0] - 10

print(ret)

Solution (Python):

import copy
import numpy as np
import random
import bisect 
import math

ans = 0
menu_time = []
for i in range(5):
    menu_time.append(int(input()))

amari = 10
for i in range(5):
    if menu_time[i]%10>0:
        amari = min(menu_time[i]%10,amari)
    ans += math.ceil(menu_time[i]/10)*10

ans -= 10
ans += amari


print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def up(i):
    if i%10 != 0:
        return (i//10+1)*10
    else:
        return i
print(min([a+up(b)+up(c)+up(d)+up(e),up(a)+b+up(c)+up(d)+up(e),up(a)+up(b)+c+up(d)+up(e),up(a)+up(b)+up(c)+d+up(e),up(a)+up(b)+up(c)+up(d)+e]))

Solution (Python):
import math

def solve():
  ABCDE = [int(input()) for i in range(5)]
  s = sum(map(lambda v: math.ceil(v * 0.1) * 10, ABCDE))
  k = 10
  for i in ABCDE:
    _i = i % 10
    if _i == 0: continue
    if k == 0: k = _i
    else: k = min(k, _i)
  s = s + k - 10
  return s

print(solve())

Solution (Python):
times = []
ones = [10]
for i in range(5):
    t = int(input())
    times.append((t + 9) // 10 * 10)
    ones.append(t % 10)
ones.sort()
print(sum(times) - 10 + min(filter(lambda x: x, ones)))