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 math
l = [int(input()) for _ in range(5)]
l_1st = [int(str(10 - int(str(i)[-1]))[-1]) for i in l]
l_rm_i = l_1st.index(max(l_1st))
l_rm = l[l_rm_i]
del l[l_rm_i]

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

Solution (Python):
from itertools import permutations

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

Solution (Python):

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

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

Solution (Python):

data = list(map(int, [input().rstrip() for _ in range(5)]))
data_need = [(10 - data[i]) % 10 for i in range(5)]

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

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

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

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

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

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

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

	print(ans)

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

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

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

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

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

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

print(sum)

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

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

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

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

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

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

    t = min(t, tmp)

print(t)

Solution (Python):
list_1 = []
list_2 = []
list_3 = []

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

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

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

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

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

ans = 0

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

ans += a1

print(ans)

Solution (Python):
l = [int(input()) for i in range(5)]
rest = []
time = 0
for v in l:
  if v %10 == 0:
    time += v
  else:
    time += int(v/10)*10
    rest.append(v%10)

if rest != []:
  time += ((len(rest)-1)*10)
  time += min(rest)
print(time)

Solution (Python):


ls = []
for i in range(5):
    ls.append(int(input()))
ls2 = [i%10 for i in ls]
if ls2 == [0,0,0,0,0]:
    print(sum(ls))
else:
    lasttime = 10
    for a in ls:
        b = a%10
        if b < lasttime and b != 0:
            lasttime = b
            ans =a

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

    print(int(sum + ans))

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

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

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

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

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

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

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

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

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

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

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

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


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

for i in range(1,5):
    j = i
    while j >= 1:
      if amari[j-1] > amari[j]:
        swap(j-1, j)
      else:
        break      
      j = j - 1

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

time = a*10


time = time + lst[0]

print(time)

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

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

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

print(ans)

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

Solution (Python):


import math

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

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

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

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

Solution (Python):
max = 0
val = 0
dis = 0
lst = []
valdis = 0

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

    dispre = val - num

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

print(sum(lst) + max)

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

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

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

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

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

time -= max(a)

print(time)

Solution (Python):
import numpy as np

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

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

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

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

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

elapsedTime += sortedNums[0]

print(elapsedTime)

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

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

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

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

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

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

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

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

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

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

print(ans)

Solution (Python):
li = [int(input()) for _ in range(5)]  
minx = 10000
for i in range(5):
    tmp = 0
    for j in range(5):
        if i == j:
            tmp += li[j]
        else:
            if li[j] % 10 == 0:
                tmp += li[j]
            else:
                tmp += (li[j] // 10 + 1) * 10
    if tmp < minx:
        minx = tmp
print(minx)

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

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

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

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

print(Ans)

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

time = 0 


max = 0
j = -1 
for i in range(5):
    if dishes[i] % 10 != 0:
        point = 10 - (dishes[i] % 10)
    else:
        point = 0
    if point >= max:
        max = point 
        j = i


for i in range(5):
    if i == j:
        continue 
    time += dishes[i]
    if dishes[i] % 10 != 0: 
        time += 10 - (dishes[i] % 10)

print(time + dishes[j])

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

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

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

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

Solution (Python):
import math

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

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


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

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

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

print(time)

Solution (Python):
import numpy as np

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

ans = 0

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

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

print(ans)

Solution (Python):
import numpy as np

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

last = np.argmax(t_wasted)

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

print(ans)

Solution (Python):



dish = []

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

mod_dish = [5] * -1


for j in range(len(dish)):
    mod_dish.append(dish[j] % 10)


for k in range(len(dish)-1):
    if mod_dish[k] < mod_dish[k+1] or mod_dish[k+1] == 0:
        mod_dish[k],mod_dish[k+1] = mod_dish[k+1],mod_dish[k]
        dish[k],dish[k+1] = dish[k+1],dish[k]

time = 0

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

print(str(time))

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

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

Solution (Python):

import math


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

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



for i, time in enumerate(list):
  
  if time%10 != 0 and 10 - time%10 > max_rest:
    max_rest = 10 - time%10
    last=i

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

Solution (Python):
import math

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

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

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

Solution (Python):
import math

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

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

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

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

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


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


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

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

    print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10
f = [a, b, c, d, e]
g = f.count(0)
a1 = A // 10
b1 = B // 10
c1 = C // 10
d1 = D // 10
e1 = E // 10
if g == 5:
    print(A + B + C + D + E)
else:
    f = [i for i in f if i > 0]
    print((a1 + b1 + c1 + d1 + e1 + 4 - g) * 10 + min(f))

Solution (Python):
import math

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

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

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

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

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

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

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

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

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

Solution (Python):

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





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

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


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

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

Solution (Python):



import math

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

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

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

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

Solution (Python):


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

li2 = list()

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



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



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

Solution (Python):
import math

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

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

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

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

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

Solution (Python):
li = []
ans = 0

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

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

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

print(ans)

Solution (Python):
input_mins = []
input_nums = 5
total_mins = []
total_min = 0

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


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

print(min(total_mins))

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

counter = 0

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

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

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

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

print(counter)

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

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

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

sum_time =  0

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

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

Solution (Python):

minutes = [int(input()) for _ in range(5)]
time=0
l=[]
 
for i in minutes:
    time = time + i
    if(i%10==0):
        l.append(0)
    else:
        l.append(10-i%10)
 
l.sort()
time += sum(l[:-1])
print(time)

Solution (Python):


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

li2 = list()

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



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



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

Solution (Python):
X = []
Y = []
Z = []
for i in range(5):
  x = int(input())
  y = x%10
  z = x//10 + 1
  X.append(x)
  Z.append(z)
  if y != 0:
    Y.append(y)
if len(Y)==0:
  print((sum(Z)-5)*10)
else:
  print((sum(Z)-(6-len(Y)))*10+min(Y))

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

A_rest = A % 10
B_rest = B % 10
C_rest = C % 10
D_rest = D % 10
E_rest = E % 10

A_diff = 0
B_diff = 0
C_diff = 0
D_diff = 0
E_diff = 0

if A_rest != 0:
    A_diff = 10 - (A_rest)
else:
    A_rest = 10
if B_rest != 0:
    B_diff = 10 - (B_rest)
else:
    B_rest = 10
if C_rest != 0:
    C_diff = 10 - (C_rest)
else:
    C_rest = 10
if D_rest != 0:
    D_diff = 10 - (D_rest)
else:
    D_rest = 10
if E_rest != 0:
    E_diff = 10 - (E_rest)
else:
    E_rest = 10

dish_list = [A_rest,B_rest,C_rest,D_rest,E_rest]
min_rest = min(dish_list)

diff = min_rest - 10

time = A + A_diff + B + B_diff + C + C_diff + D + D_diff + E + E_diff + diff

print(time)

Solution (Python):
data = [int(input()) for _ in range(5)]
time = 0
r = []
for d in data:
    time += d
    if d % 10 == 0:
        r.append(0)
    else:
        r.append(10 - d % 10)
r.sort()
time += sum(r[:-1])
print(time)

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

sum_time = 0
last_order_surplus = 10

for dish in dishes:
  if last_order_surplus > int(dish) % 10 & int(dish) % 10 != 0:
    last_order_surplus = int(dish) % 10
  if int(dish) % 10 != 0:
    sum_time += int(int(dish) / 10 + 1)
  else:
    sum_time += int(int(dish) / 10)

print (sum_time * 10 + last_order_surplus - 10)

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


def orders(nums):
  r = [10 - (num % 10) for num in nums if (num % 10)]
  if r:
  	return sum(nums) + sum(r) - max(r)
  return sum(nums)

print(orders(nums))

Solution (Python):
time = []
last = 10

for i in range(5):
    time.append(int(input()))
    if(time[i] % 10 > 0 and time[i] % 10 < last):
        last = time[i] % 10

sum = 0
for i in range(5):
    sum += time[i]
    if(time[i] % 10 != 0):
        sum += (10 - (time[i] % 10))

print(sum + last - 10)

Solution (Python):
import heapq


def solve(order_list):
    priority_queue = []
    
    for key, order in enumerate(order_list):
        priority = (order - 1) % 10
        heapq.heappush(priority_queue, [-priority, order, key])

    sum_time = 0
    
    while priority_queue:
        priority, order, key = heapq.heappop(priority_queue)
        if len(priority_queue) and order % 10:
            sum_time += (order // 10 + 1) * 10
        else:
            sum_time += order
    return sum_time


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    ans = solve([a, b, c, d, e])
    print(ans)


main()

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

Solution (Python):
li=[]

for i in range(5):
    li.append(str(input()))

min=10
f=1
for i in li:
    temp=int(i[-1])
    
    if temp!=0:
        f=0
    if min > temp and temp!=0:
        min=temp
    if f:
        min=10


sum=0
for i in li:
    
    if i[-1]!='0':
        temp=int(i[0:-1]+"0")+10
    else:
        temp=int(i)
    
    sum+=temp

sum-=(10-min)

print(sum)

Solution (Python):



NUM_DISHES = 5
tt = 0
itvs = list()

for i in range(NUM_DISHES):
    st = int(input())
    tt += st
    if st % 10 == 0:
        itvs.append(0)
    else:
        itvs.append(10 - st % 10)

itvs.sort()

for interval in range(len(itvs) - 1):
    tt += itvs[interval]

print "{}".format(tt)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=-(-A//10)*10
b=-(-B//10)*10
c=-(-C//10)*10
d=-(-D//10)*10
e=-(-E//10)*10
print(a+b+c+d+e-max(a-A,b-B,c-C,d-D,e-E))

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=-(-A//10)*10
b=-(-B//10)*10
c=-(-C//10)*10
d=-(-D//10)*10
e=-(-E//10)*10
print(a+b+c+d+e-max(a-A,b-B,c-C,d-D,e-E))

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

n = a[0] % 10
if n == 0: n = 10
idx = 0
for i in range(5):
    if a[i] % 10 == 0:
        continue
    else:
        if n > a[i] % 10:
            n = a[i] % 10
            idx = i

for i in range(5):
    if i != idx and a[i]%10 != 0:
        a[i] = (a[i] // 10) * 10 + 10

print(sum(a))

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

  Amod=A%10
  if Amod==0:
    Amod=10
  Bmod=B%10
  if Bmod==0:
    Bmod=10
  Cmod=C%10
  if Cmod==0:
    Cmod=10
  Dmod=D%10
  if Dmod==0:
    Dmod=10
  Emod=E%10
  if Emod==0:
    Emod=10
  last=min(Amod,Bmod,Cmod,Dmod,Emod)
  
  A_round=((A+9)//10)*10
  B_round=((B+9)//10)*10
  C_round=((C+9)//10)*10
  D_round=((D+9)//10)*10
  E_round=((E+9)//10)*10
  
  time=A_round+B_round+C_round+D_round+E_round
  time=time-10+last

  print(time)

main()