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
def main():
    a = []
    for _ in range(5):
        b = int(input())
        a.append([b % 10, b])
    
    a.sort()
    result = 0
    f = 1
    for i in a:
        if i[0] != 0:
            if f:
                result += i[1]
                f = 0
            else:
                result += (i[1]//10 + 1) * 10

        else:
            result += i[1]
    
    print(result)


if __name__ == "__main__":
    main()

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

bk = [x[i]%10 for i in range(5)]
new_bk = [(e if e !=0 else 9) for e in bk]
bmin = min(new_bk)
last_index=new_bk.index(bmin)
last = x.pop(last_index)
intbk=[math.ceil(e/10)*10 for e in x]
print(sum(intbk)+last)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while 10 in li :
   li.remove(max(li))
if len(li)>0 :
   li.remove(max(li))
print(s+sum(li))

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

l = [A,B,C,D,E]
l = sorted(l)

ans = 0
tl = []
for v in l:
    temp = v % 10
    while temp > 10:
        temp = v % 10
    if temp == 0:
        temp = 100
    tl.append(temp)

tt = []
for i in range(5):
    tt.append([l[i], tl[i]])


tt.sort(key=lambda x:x[0])
tt.sort(key=lambda x:x[1],reverse=True)


a = tl.index(min(tl))


l = [x[0] for x in tt]

for i,v in enumerate(l):
    if i != len(l) - 1:
        temp = v % 10
        if temp != 0:
            temp = 10 - temp + v
        else:
            temp = v
        ans = ans + temp
    else:
        ans = ans + v
    

print(ans)

Solution (Python):
import math

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




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




skip = int()
last = 9
for i in range(5):
    if array[i] % 10 == 0:
        
        
        
        pass
    else:
        
        if array[i] % 10 <= last:
            
            last = array[i] % 10
            skip = i
        else:
            pass


counter = 0
for i in range(5):
    if i == skip:
        pass
    else:
        counter += 10*math.ceil(array[i] / 10)

counter = counter + array[skip]

print(counter)

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

num_first =[]

for str1 in num_list:
  number=10-int(str1[-1])
  if number==10:
    number=0
  num_first.append(number)

index=num_first.index(max(num_first))
sum=0
for i in range(5):
    sum=sum+int(num_list[i])+num_first[i]
    if i == index:
      sum=sum-num_first[i]
    
    
print(sum)

Solution (Python):
import math
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
t = []
b = []
u = []
for i in a:
	if(i%10 == 0):
		b.append(i)
	else:
		t.append(i)
		u.append(i%10)
if(sum(u) != 0):
	min_t = u.index(min(u))
	ss = t.pop(min_t)
	u.pop(min_t)

	for i in range(len(t)): 
		u[i] = 10 - u[i]
		t[i] = t[i] + u[i]
	print(sum(b) + sum(t) + ss)

else:
	print(sum(b))

Solution (Python):
import math

menu = [int(input()) for _ in range(5)]
num = [0, 1, 2, 3, 4]

min = float('inf')

def plus(a, b):
    c = a + b
    if (c % 10 != 0):
        c += 10 - c % 10
    return c

for index1 in num:
    for index2 in set(num) - set([index1]):
        for index3 in set(num) - set([index1, index2]):
            for index4 in set(num) - set([index1, index2, index3]):
                index5 = list((set(num) - set([index1, index2, index3, index4])))[0]
                sum = 0
                sum = plus(sum, menu[index1])
                sum = plus(sum, menu[index2])            
                sum = plus(sum, menu[index3])            
                sum = plus(sum, menu[index4])            
                sum = sum + menu[index5]
                if (sum < min):
                    min = sum

print(min)

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

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

moda = a % 10
modb = b % 10
modc = c % 10
modd = d % 10
mode = e % 10

mod_list = [moda, modb, modc, modd, mode]

min = 124
flag = -1
for cnt, i in enumerate(mod_list):
    if i != 0 and i < min:
        min = i
        flag = cnt

cnt = 0
for i in range(0, 5):
    if i == flag:
        cnt = cnt + input_list[i]
    elif mod_list[i] == 0:
        cnt = cnt + input_list[i]
    else:
        cnt = cnt + input_list[i] + (10 - mod_list[i])

print(cnt)

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

dishes=[a,b,c,d,e]
mod_dishes=[]
time_dishes=[]
for i in dishes:
    if i%10 != 0:
        mod_dishes.append(i%10)
        time_dishes.append(i+(10-i%10))
    else:
        mod_dishes.append(10)
        time_dishes.append(i)                   
                          
x=10
for i in mod_dishes:
    if i < x:
        x = i

y = 10-x
z=0
for i in time_dishes:
    z = z + i

z = z - y
print(z)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
t = [a, b, c, d, e]
times = []
amari_not_zero = []
for i in range(len(t)):
    amari = t[i] % 10
    if amari == 0:
        times.append([t[i], amari])
    else :
        amari_not_zero.append([t[i], amari])
anz = sorted(amari_not_zero, key=lambda x: x[1], reverse=True)
for i in range(len(anz)):
    times.append(anz[i])

finish_time = 0
buf = 0
for i in range(len(times)):
    if i == len(times) - 1:
        finish_time += times[i][0]
    else :
        for j in range(14):
            buf2 = buf - times[i][0]
            if (not buf2 < 0) and buf2 <= 10:
                finish_time += buf
                break
            buf += 10
    buf = 0
print(finish_time)

Solution (Python):
dishes = sorted([int(input()) for _ in range(5)], key=lambda x:int(str(x)[-1]))

for dish in dishes:
    if int(str(dish)[-1]) == 0:
        new_dishes = dishes[1:]
        new_dishes.append(dish)
        dishes = new_dishes
    else:
        pass

time = 0
for i, dish in enumerate(dishes):
    if i == 0:
        time += dish
    else:
        if dish % 10 != 0:
            rest = 10 - (dish % 10)
        else:
            rest = 0
        time += dish + rest

print(time)

Solution (Python):
import numpy as np
import itertools
data = [int(input()) for _ in range(5)]
minimum = 10**15
for orders in itertools.permutations(data):
    current_time = 0
    next_arrival = 0
    for i in range(5):
        next_arrival = current_time + orders[i]
        current_time = np.ceil(next_arrival/10).astype(int) *10

    minimum = min(minimum,next_arrival)
print(minimum)

Solution (Python):
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  
def LF(): return [float(x) for x in sys.stdin.readline().split()]  
def LS(): return sys.stdin.readline().split()  
def MI(): return map(int, sys.stdin.readline().split())  
def II(): return int(sys.stdin.readline())  
def IS(): return input()  
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))





    
    



a = IS()
b = IS()
c = IS()
d = IS()
e = IS()
ryo = [a, b, c, d, e]
ryo = sorted(ryo, key=lambda x:x[-1])[::-1]
least = '10'
for i in ryo:
    if int(least) >= int(i[-1]) and int(i[-1]) != 0:
        least = i[-1]
if least == '10':
    least = '0'
for i in range(len(ryo)):
    if ryo[i][-1] == least:
        number = ryo.pop(i)
        break
for i in range(len(ryo)):
    for j in range(0,140,10):
        if int(ryo[i]) <= j:
            ryo[i] = j
            break
print(sum(ryo) +int(number))

Solution (Python):
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i > 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
if c != []:
  d += a[c[-1][1]]
print(d)

Solution (Python):
input_list=[input() for i in range(5)]
dishes = [int(n) for n in input_list]
s = 0
for n in dishes:
    if n%10 == 0:
        s += n

dishes = [n for n in dishes if n%10 != 0]
if dishes:
    minmod = min([n%10 for n in dishes])

    for n in dishes:
        s += n + 10 - n%10

    s -= 10
    s += minmod
print(s)

Solution (Python):
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve():
    a = makeInt(input())
    b = makeInt(input())
    c = makeInt(input())
    d = makeInt(input())
    e = makeInt(input())
    l = [0, a, b, c, d, e]
    m = 9
    m_i = 1
    for i in range(len(l)):
        if m > l[i] % 10 and l[i] % 10 > 0:
            m = l[i] % 10
            m_i = i
    if m != 0:
        temp = l[-1]
        l[-1] = l[m_i]
        l[m_i] = temp

    
    
    lst = 0
    alst = 0
    i = 1
    
    at = 0
    while(i < 6):
        if at >= l[i-1]:
            
            if i != 5:
                
                alst += at
                
            else:
                
                alst += at
                alst += l[i]
                return alst
            at = 0
            i += 1
            
        else:
            at += 10


def main():
    answer = solve()
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
T = []
for i in range(5):
    T.append(input())
tmp = []
for i in range(5):
    tmp.append(int(T[i][-1]))
T2 = []
for i in range(5):
    if tmp[i] != 0:
        T2.append(int(T[i]) + 10 - tmp[i])
    else:
        T2.append(int(T[i]))
ans = []
for i in range(5):
    if tmp[i] != 0:
        ans.append(sum(T2) - 10 + tmp[i])
    else:
        ans.append(sum(T2))
    
    
    
    

print(min(ans))

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

min_reminder = 10
min_menu = 5
for i in range(5):
    reminder = menu[i]%10
    if reminder < min_reminder and reminder != 0:
        min_reminder = reminder
        min_menu = i
 
total = 0
for i in range(5):
    if min_menu == i or menu[i]%10 == 0:
        total += menu[i]
    else:
        total += menu[i]+10-menu[i]%10
        
print(total)

Solution (Python):
a=[]
for i in range(5):
    a.append(int(input()))
ans=0
min=10
minn=0
for i in range(5):
    if (a[i]%10<=min and a[i]%10!=0):
        min=a[i]%10
        minn=i
for i in range(5):
    if a[i]%10!=0:
        b=(a[i]//10)
        ans=ans+b*10+10
    elif a[i]==0:
        ans+=10
    else:
        ans=ans+a[i]
if min!=10:
    print(ans-(10-a[minn]%10))
else:
    print(ans)

Solution (Python):
cnt = 0
min = 10
li =[]

for i in range(5):
	a = int(input())
	li.append(a)
	if a % 10 == 0:
		cnt += a
	else:
		cnt += a + 10 - a % 10
		if a % 10 < min:
			min = a % 10

cnt = cnt + min - 10

print(cnt)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
last=9
for i in range(5):
    if l[i]%10!=0:
        last=min(last,l[i]%10)
        
g=0
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(l))
else:
    for i in range(5):
        if l[i]%10==0:
            g+=l[i]
        else:
            g+=l[i]+10-l[i]%10
    print(g-10+last)

Solution (Python):
def ceil(v):
	if v % 10 == 0:
		return v
	else:
		return (v // 10+1) *10

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

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

minMod = 9
last = times[0]
for time in times:
	if minMod > (time+9) % 10:
		minMod = (time+9) % 10
		last = time
		
times.remove(last)

for i,time in enumerate(times):
	times[i] = ceil(time)
	
times.append(last)

print(sum(times))

Solution (Python):
import sys
import os
import math
import numpy as np



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

for i in li:
    if i%10 != 0:
        li4.append(10-i%10)
    else:
        li4.append(0)

np.array(li4)

atodetasu = li[np.argmax(li4)]
li.pop(np.argmax(li4))
lli = []
for i in li:
    if i % 10 != 0:
        i = i + (10- i % 10)
    lli.append(i)

print(sum(lli) + atodetasu)

Solution (Python):
import math
a = list(range(5))
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
b = list(range(5))
c = list(range(5))
d = 0
s = 9
e = 0
total = 0
v = 0
for i in range(5):
    if((a[i]%10)==0):
        b[d] = a[i]
        d += 1
        v += 1
    else:
        if((a[i]%10)<s):
            s = a[i]%10
for i in range(5):
    if((a[i]%10)!=0):
        e = a[i]/10
        e = math.ceil(e)
        e = e*10
        b[d] = e
        d += 1
for i in range(5):
    total += b[i]
if(v != 5):
    total -= 10
    total += s
print(total)

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

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

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

n = 10
x = []

for row in list:
    x.append((row + (n - row % n) % n) - row)

x.sort()

print(sum(x[:4]) + a + b + c + d + e)

Solution (Python):
import numpy as np
l = np.zeros(5)
t = np.zeros(5)
k = True
for i in range(5):
    l[i] = int(input())
    t[i] = l[i] - (l[i]//10)*10
    if t[i] != 0 :
        k = False
t.sort()
for i in range(5):
    if t[i] != 0:
        s = t[i]
        break
l = np.ceil(l/10)*10
if k :
    ans = int(np.sum(l))
else :
    ans = int(np.sum(l)+s)-10
print(ans)

Solution (Python):

dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    if inp % 10 != 0:
        d[i] = inp % 10
        d2[i] = inp
        dct[i] = int(inp/10)*10+10
    else:
        dct[i] = inp

if len(d) == 0:
    ans = 0
else:
    last = sorted(d.items(), key=lambda x: x[1])[0][0]
    ll.remove(last)
    ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)

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

D_mod_max = D[0]%10
D_remove = D[0]

for i in range(1,5):
  if D_mod_max==0:
    D_remove = D[i]
    D_mod_max = D[i]%10
    
  elif (D[i]%10 != 0) & (D[i]%10 < D_mod_max):
    D_remove = D[i]
    D_mod_max = D[i]%10
    
D.remove(D_remove)

sum=0
for i in range(len(D)):
  if D[i]%10 !=0:
    sum=sum+D[i]+(10-D[i]%10)
  else:
    sum=sum+D[i]

sum=sum+D_remove

print(sum)

Solution (Python):

import math

list = []
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))

zflist = []
zflist.append(str(list[0]).zfill(3))
zflist.append(str(list[1]).zfill(3))
zflist.append(str(list[2]).zfill(3))
zflist.append(str(list[3]).zfill(3))
zflist.append(str(list[4]).zfill(3))


temp = sorted(zflist, key=lambda x: x[-1])
sortedlist = []
sortedlist.append(int(temp[0]))
sortedlist.append(int(temp[1]))
sortedlist.append(int(temp[2]))
sortedlist.append(int(temp[3]))
sortedlist.append(int(temp[4]))

last = 0
for i in sortedlist:
    if str(i).zfill(3)[-1] != '0':
        
        last = i
        break
    last = i

sortedlist.remove(last)







tenlist = []
tenlist.append(math.ceil(int(sortedlist[0])/10)*10)
tenlist.append(math.ceil(int(sortedlist[1])/10)*10)
tenlist.append(math.ceil(int(sortedlist[2])/10)*10)
tenlist.append(math.ceil(int(sortedlist[3])/10)*10)


print(sum(tenlist) + last)

Solution (Python):
e,*a=sorted(eval('int(input()),'*5),key=lambda x:~-x%10);print(e-sum(-i//10*10for i in a))

Solution (Python):
ls = []
for i in range(5):
    ls.append(int(input()))
def roundup(n):
    if n % 10 <= 5:
        return round(n+5,-1)
    else:
        return round(n,-1)
import itertools
sum = []
for p in list(itertools.permutations(ls)):
    av = 0
    cnt = 0 

    for j in p:
        av += j
        cnt += 1

        if  cnt != 5 and av % 10 != 0:
            av = roundup(av)

    sum.append(av)
print(min(sum))

Solution (Python):
from decimal import Decimal, ROUND_UP
tmp = []
time = 0
for i in range(0,5):
    w = 0
    num = int(input())
    while True:
      if float.is_integer((num + w)/10):
        break
      w += 1
    tmp.append({"num":num, "weight":w})
    
tmp = sorted(tmp, key=lambda x:x['weight'])
for i in range(0,5):
    time += tmp[i]['num']
    if i < 4:
    	time = Decimal(time/10).quantize(Decimal('0'), rounding=ROUND_UP) * 10

print(time)

Solution (Python):
import math
dish = []
mini = 0
for i in range(5):
    d = input()
    dish.append(d)
for j in dish:
    if j[-1] != '0':
        mini = j
if mini == 0:
    mini = dish[0]
for k in dish:
    if (k[-1] <= mini[-1]) and k[-1] != '0':
        mini = k
for i in range(5):
    if dish[i] == mini:
        dish.pop(i)
        break
time = 0
for l in range(4):
    dish[l] = math.ceil((int(dish[l]) / 10)) * 10
    time += int(dish[l])
time += int(mini)
print(time)

Solution (Python):


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

all = 0

all += (a // 10) * 10
if (a % 10) != 0:
    all += 10

all += (b // 10) * 10
if (b % 10) != 0:
    all += 10

all += (c // 10) * 10
if (c % 10) != 0:
    all += 10

all += (d // 10) * 10
if (d % 10) != 0:
    all += 10

all += (e // 10) * 10
if (e % 10) != 0:
    all += 10

l = [(a % 10), (b % 10), (c % 10), (d % 10), (e % 10)]
l = [x for x in l if x != 0]


if len(l) != 0:
    mi = min(l)
    if mi != 0:
        all -= (10 - mi)

print(all)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
times = [A,B,C,D,E]
dif = [(10-(i%10))%10 for i in times]
print(sum(times)+sum(dif)-max(dif))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
if a % 10 == b % 10 == c % 10 == d % 10 == e % 10 == 0:
    print(a + b + c + d + e)
else:
    mm = [10 - i % 10 for i in nums]
    mm = [x for x in mm if x != 10]
    for i in range(5):
        if nums[i] % 10 == 0:
            ans += nums[i]
        else:
            ans += nums[i] + (10 - nums[i] % 10)
    print(ans - max(mm))

Solution (Python):

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
if A!=0:
  ListN.append(A)
if B!=0:
  ListN.append(B)
if C!=0:
  ListN.append(C)
if D!=0:
  ListN.append(D)
if E!=0:
  ListN.append(E)

if len(ListN)==0:
  print(S)
else:
  Listn=[]
  ListN.sort()
  for i in range(1,len(ListN),1):
    q=10-int(ListN[i])
    S+=q
  print(S)

Solution (Python):
def calc_mod(n):
  calc = (10 - n % 10)
  if calc == 10:
    return 0
  else:
    return calc

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

sum_time = sum(t)
mod_t = list(map(calc_mod, t))

print(sum(t)+sum(mod_t)-max(mod_t))

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

Solution (Python):
import sys
from operator import itemgetter
input = sys.stdin.readline
a=[None]*5
b=[None]*5
ab=[]
for i in range(5):
    a[i] = int(input())

for i in range(5):
    for h in range(14):
        h*=10
        abss=h-a[i]
        if (h>=a[i])and(0<=abss<=9):
            b[i]=h-a[i]
for i,j in zip(a,b):
    ab.append([i,j])
ab.sort(key=itemgetter(1))
s=0
for i in range(4):
    s+=sum(ab[i])
print(s+ab[-1][0])

Solution (Python):
import math

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

br = 0
last = 0
for r in range(1, 10):
    for i in range(5):
        if((arr[i] % 10) == r):
            last = i
            br = 1
            break
        pass
    if(br == 1):
        break
    pass

time = 0
for i in range(5):
    time += math.ceil(arr[i]/10) * 10

time += arr[last] - math.ceil(arr[last]/10) * 10

print(time)

Solution (Python):
def main():
  inp = []
  for i in range(5):
    x = int(input())
    if x % 10 == 0:
      inp.append([x, 0])
    else:
      inp.append([x, 10 - (x % 10)])
  inp = sorted(inp, key=lambda x: x[1]) 
  

  result = 0
  for i, n in enumerate(inp):
    
    if (i+1) == len(inp):
      result += n[0]
      continue
    
    result += n[0] + n[1]

  print(result)
    
    
    
    
main()

Solution (Python):


A_E = [input() for _ in range(5)]


unit_place_lst = [int(x[-1]) for x in A_E]
min_except0 = 10
min_index = 0
for i, n in enumerate(unit_place_lst):
    if 0 < n < min_except0:
        min_except0 = n
        min_index = i

ans = 0
for i, x in enumerate(A_E):
    if i == min_index:
        ans += int(x)
    elif (int(x) % 10) == 0:
        ans += int(x)
    else:
        ans += int(x) - (int(x) % 10) + 10

print(ans)

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

pos = [A, B, C, D, E]
wait_time = [10 - x % 10 if x % 10 != 0 else 0 for x in pos]
wait_time.sort()
print(sum(pos) + sum(wait_time[0:4]))

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
count = 0
min_i = 9
min_aa = 0

for i in a:
    ama = i % 10
    if (ama <= min_i) & (ama != 0):
        min_i = ama
        min_aa = i

aaa = 0
for i in a:
    
    
    if ((i == min_aa)&(aaa == 0)):
        
        count += i
        aaa += 1
    elif (i % 10 == 0):
        
        count += i
    else:
        count += (i + (10 - i % 10))
        
print(count)

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

total = 100000
for i1 in range(5):
    for i2 in range(5):
        if i1 == i2: continue
        for i3 in range(5):
            if i1 == i3 or i2 == i3: continue
            for i4 in range(5):
                if i1 == i4 or i2 == i4 or i3 == i4: continue
                for i5 in range(5):
                    if i1 == i5 or i2 == i5 or i3 == i5 or i4 == i5: continue
                    temp = math.ceil(a[i1]/10)*10
                    temp += math.ceil(a[i2]/10)*10
                    temp += math.ceil(a[i3]/10)*10
                    temp += math.ceil(a[i4]/10)*10
                    temp += a[i5]
                    if total > temp:
                        total = temp

print(total)

Solution (Python):
import itertools

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

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

def calc_time(cand):
  tm = 0
  for i in range(len(cand)):
    tm += cand[i]
    if i < 4:
      if tm % 10 != 0:
        tm += 10 - (tm % 10)
  return(tm)

res = 100000
for cand in itertools.permutations(X):
  tm = calc_time(cand)
  if tm < res:
    res = tm

print(res)

Solution (Python):
import math
li =[int(input()) for i in range(5)]
min_t=999
time=0
sum_t=0
for i in range(5):
    sum_t += math.ceil(li[i]*0.1)*10
for i in range(5):
    time = sum_t - (math.ceil(li[i]*0.1)*10-li[i])
    if time<min_t:
        min_t=time
print(min_t)

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

for _ in S:
  if(_%10==0):
    mod.append(10)
  else:
    mod.append((_)%10)

sum=0    

for _ in range(len(S)):
  if _ == mod.index(min(mod)):
	
    sum += S[_]
  else:
    
    if mod[_]==10:
      sum += S[_]
    
    else:
      sum += (S[_]//10+1)*10
      
print(sum)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
import numpy as np
num=[a,b,c,d,e]
resi=[i%10 if i%10 != 0 else 10 for i in num ]
x=np.argsort(resi)
minnum=num[x[0]]
del(num[x[0]])
sumnum=sum([((i//10)+1)*10 if i%10 !=0 else i for i in num])
res=sumnum+minnum
print(res)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
aa = a % 10
bb = b % 10
cc = c % 10
dd = d % 10
ee = e % 10
Ra =0
Rb =0
Rc =0
Rd =0
Re =0

if aa == 0:
    Ra = a//10
    aa = 10
else: Ra = (a //10) + 1

if bb == 0:
    Rb = b//10
    bb = 10
else: Rb = (b //10) + 1

if cc == 0:
    Rc = c//10
    cc = 10
else: Rc = (c //10) + 1

if dd  == 0:
    Rd = d//10
    dd = 10
else: Rd = (d //10) + 1

if ee == 0:
    Re = e//10
    ee = 10
else: Re = (e //10) + 1

xx = min(aa,bb,cc,dd,ee)

print(xx + (Ra +Rb + Rc +Rd + Re -1)*10)

Solution (Python):


import re
a = []
b = []
for i in range(5):
    x = int(input())
    a.append(x)
    x = x%10
    b.append(x)

count = 0
min = 123
k = 0
for i in range(5):
    if(b[i] != 0 and min > b[i]):
        min = b[i]
        k = i

for i in range(5):
    if(i != k and b[i] != 0):
        count += a[i] + 10 - b[i]
    elif(i == k or b[i] == 0):
        count += a[i]
print(count)

Solution (Python):
import sys
import itertools

input = sys.stdin.readline

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

combi_list = list(itertools.permutations(consume_times))

ans = 650
for comb in combi_list:
    time = 0
    res = 0
    for x in comb:
        time += x
        if time % 10 != 0:
            res = (10 - x%10)
            time += res
    time -= res
    if time < ans:
        ans = time

print(ans)

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


a_1=(int(str(a)[-1]))
b_1=(int(str(b)[-1]))
c_1=(int(str(c)[-1]))
d_1=(int(str(d)[-1]))
e_1=(int(str(e)[-1]))

if a_1==0:
    a_1=10
if b_1==0:
    b_1=10
if c_1==0:
    c_1=10
if d_1==0:
    d_1=10
if e_1==0:
    e_1=10

a_2=10-a_1
b_2=10-b_1
c_2=10-c_1
d_2=10-d_1
e_2=10-e_1

A=a+a_2
B=b+b_2
C=c+c_2
D=d+d_2
E=e+e_2
print(A+B+C+D+E-10+min(a_1,b_1,c_1,d_1,e_1))

Solution (Python):
import math
li=[]
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a2 = math.ceil(a/10)*10
b2 = math.ceil(b/10)*10
c2 = math.ceil(c/10)*10
d2 = math.ceil(d/10)*10
e2 = math.ceil(e/10)*10
s = a2+b2+c2+d2+e2
a = str(a)
b = str(b)
c = str(c)
d = str(d)
e = str(e)
li.append(int(a[-1]))
li.append(int(b[-1]))
li.append(int(c[-1]))
li.append(int(d[-1]))
li.append(int(e[-1]))
li.sort()
i=0
ans=0
while ans==0 and i!=5:
  ans=li[i]
  i+=1
if ans != 0:
  ans = 10 - ans
print(s-ans)

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

for i in range(5):
  ra.append(a[i]%10)

tot=0
for i in range(5):
  if ra[i]==0:
    tot+=a[i]

  else:
    tot+=a[i]+10-ra[i]
    

ra.sort()
for i in range(5):
  if ra[i]==0:
    continue
  else:
    tot-=10-ra[i]
    break
print(tot)

Solution (Python):
n = [int(input()) for _ in range(5)]
nplus = [[0,10-n[i] % 10][n[i] % 10 != 0] for i in range(5)]
nm = max(nplus)
ans, mc = 0, 0
for i in range(5):
    if nplus[i] != nm:
        ans += nplus[i] + n[i]
    else:
        mc += 1

while mc:
    for i in range(5):
        if nplus[i] == nm:
            if mc != 1:
                ans += nplus[i] + n[i]
            else:
                ans += n[i]
            mc -= 1
print(ans)

Solution (Python):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a_num = list(map(int, str(a)))
b_num = list(map(int, str(b)))
c_num = list(map(int, str(c)))
d_num = list(map(int, str(d)))
e_num = list(map(int, str(e)))
x = a
x_num = list(map(int, str(x)))
if b_num[-1] != 0 and b_num[-1] < x_num[-1]:
    x = b
x_num = list(map(int, str(x)))
if c_num[-1] != 0 and c_num[-1] < x_num[-1]:
    x = c
x_num = list(map(int, str(x)))
if d_num[-1] != 0 and d_num[-1] < x_num[-1]:
    x = d
x_num = list(map(int, str(x)))
if e_num[-1] != 0 and e_num[-1] < x_num[-1]:
    x = e
x_num = list(map(int, str(x)))
A = math.ceil(a / 10) * 10
B = math.ceil(b / 10) * 10
C = math.ceil(c / 10) * 10
D = math.ceil(d / 10) * 10
E = math.ceil(e / 10) * 10
X = math.ceil(x / 10) * 10
print(A + B + C + D + E - (X - x))