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

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

ans = math.ceil(a / 10)
ans += math.ceil(b / 10)
ans += math.ceil(c / 10)
ans += math.ceil(d / 10)
ans += math.ceil(e / 10)
ans *= 10
ans += min((a-1) % 10, (b-1) % 10, (c-1) % 10, (d-1) % 10, (e-1) % 10) - 10 + 1

print(ans)

Solution (Python):
import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
li = [A, B, C, D, E]
temp = 9
idx = -1
for i in range(len(li)):
    if 0 != li[i] % 10 and temp >= li[i] % 10:
        temp = li[i] % 10
        idx = i

result = 0
for i in range(len(li)):
    if idx == i:
        result += li[i]
    else:
        result += math.ceil(li[i] / 10) * 10
print(result)

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

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

    min_one = 10
    min_in = -1
    for i, val in enumerate(time_list):
        
        un_one = val % 10
        if min_one > un_one and un_one != 0:
            min_one = un_one
            min_in = i

    res_list = []
    for i, val in enumerate(time_list):
        if i == min_in:
            res_list.append(val)
        else:
            dif = val % 10
            if dif == 0:
                res_list.append(val)
            else:
                res_list.append(val - dif + 10)
    res_sum = 0
    for v in res_list:
        res_sum += v

    print(res_sum)


if __name__ == '__main__':
    main()

Solution (Python):
ans=0
a=[0]*5
for i in range(5):
    t=int(input())
    t2=t%10

    if t2==0:
        a[i]=t2+10
        ans=ans+t
    else:
        a[i]=t2
        ans=ans+((t//10)*10)+10
if min(a) !=10 :
    print(ans-10+min(a))
else:
    print(ans)

Solution (Python):
times = [int(input()) for _ in range(5)]
fractions = [10 - t % 10 for t in times if t % 10 != 0]
if fractions:
    fraction = max(fractions)
else:
    fraction = 0
print(sum([(t - t % 10) + ((t % 10 + 9) // 10) * 10 for t in times]) - fraction)

Solution (Python):
A = sorted( [input()[::-1] for i in range(5)] )
c = 0
while (A[0][0] == "0" and c<5):
  tmp = A.pop(0)
  A.append(tmp)
  c+=1

A = [int(a[::-1]) for a in A][::-1]

def roundUp(n):
  return n if n%10==0 else n + (10-n%10)

print(sum([roundUp(A[i]) for i in range(4)]) + A[4])

Solution (Python):
import math
nums=[]
round_nums=[]
for i in range(5):
    k=int(input())
    nums.append(k)
    round_nums.append(math.ceil(k/10.0)*10)

dist=0
for i in range(5):
    if round_nums[i]-nums[i]>dist:
        dist=round_nums[i]-nums[i]


print(int(sum(round_nums)-dist))

Solution (Python):
read = input
a = [read() for i in range(5)]
a = list(map(int, a))
if all(map(lambda x: x%10 == 0, a)):
    print(sum(a))
else :
    g10 = list(filter(lambda x:x%10 > 0 , a))
    l10 = list(filter(lambda x:x%10 == 0 , a))
    m = min(g10, key=lambda x:x%10)
    g100= list(map(lambda x:x//10*10 + 10, g10))
    print(sum(g100)  +sum(l10)- m//10*10 - 10 + m)

Solution (Python):

time = [None] * 5
smallest = 10
smallest_i = -1 
for i in range(5):
    time[i] = int(input())
    if (time[i] - 1) % 10 < smallest:
        
        smallest = (time[i] - 1) % 10 
        smallest_i = i
total = 0
for i, t in enumerate(time):
    if i == smallest_i:
        total += time[i]
    else:
        rem = time[i] % 10
        if rem == 0:
            total += time[i]
        else:
            total += time[i] - rem + 10
print(total)

Solution (Python):
dish, time = [], 0
for i in range(5):
    temp = int(input())
    if temp % 10 == 0:
        time += temp
    else:
        dish.append(temp)
if dish:
    left = 10 - min([x % 10 for x in dish])
    time = time + sum([x + 10 - x % 10 for x in dish]) - left
print(time)

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

loss = list(map(lambda x: (10 - (x % 10)) % 10, p))
last_i = loss.index(max(loss))

print(sum(p) + sum(loss) - loss[last_i])

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=[a,b,c,d,e]
sum=0
for i in range(5):
    if f[i]%10==0:
        sum+=f[i]
    else:sum+=(f[i]//10)*10+10
    f[i]=f[i]%10-1
    if f[i]==-1:f[i]=9
r=min(f)
if r==9:
    print(sum)
else:
    q=9-r
    print(sum-q)

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

rest = []
time = 0
for order in orders:
    if order % 10 == 0:
        time += order
    else:
        rest.append(order)

rest_mods = list(map(lambda x: x % 10, rest))

if len(rest_mods) > 0:
    min_mods_index = rest_mods.index(min(rest_mods))
    for i in range(len(rest)):
        time += rest[i]
        if i != min_mods_index:
            time += 10 - rest[i] % 10
else:
    time += sum(rest)
print(time)

Solution (Python):
def f(n):
    if n%10!=0:
        return 10-(n%10)
    else:
        return 0
A=[int(input()) for i in range(5)]
X=[10*(-((-i)//10)) for i in A]
d=max([f(i) for i in A])
print(sum(X)-d)

Solution (Python):
a=[int(input()) for _ in range(5)]
b=[]
ans=0
for i in a:
    tmp=i
    while tmp>10:
        tmp-=10
    b.append((tmp,i))
b.sort(key=lambda x:x[0])
for i in range(5):
    if i==4:
        ans+=b[4-i][1]
    else:
        ans+=b[4-i][1]+10-b[4-i][0]
print(ans)

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

ans = 0
x = []

for i in [a,b,c,d,e]:
  if i % 10 != 0:
    ans += (i//10)*10 + 10
    x.append(i%10)
  else:
    ans += i

if x != []:
  ans -= 10-min(x)
print(ans)

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

rs = [i if i != 10 else 0 for i in [10 - A%100%10, 10-B%100%10, 10-C%100%10, 10-D%100%10, 10-E%100%10]]
m = max(rs)

s = A + B + C + D + E + sum(rs) - m
print(s)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a, b, c, d, e]
dish_max = []
min_num = 10
min_index = -1
for i in range(len(dish)):
  if (dish[i]-1)%10<min_num:
    min_num = (dish[i]-1)%10
    min_index = i
  else:
    None

time = 0
for i in range(len(dish)):
  if i!=min_index:
    if dish[i]%10!=0:
      time += int(dish[i]/10)*10+10
    else:
      time += dish[i]
  else:
    time += dish[i]
print(time)

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

ans = 0
mini = []
for i in AE:
    if(i%10 == 0):
        ans += i
    else:
        ans += (i//10 + 1)*10
        mini.append(i%10)
if(mini != []):
    print(ans + min(mini) - 10)
else:
    print(ans)

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

Solution (Python):
L = []
for i in range(5):
    L.append(int(input()))
    
s = [0,1,2,3,4]
import itertools
ans_L = []
for i in itertools.permutations(s, 5):
    ans = 0
    for j,k in enumerate(i):
        ans += L[k]
        if ans % 10 != 0 and j != 4:
            for l in range(1,10):
                if (ans + l) % 10 == 0:
                    ans += l
                    break
    ans_L.append(ans)
print(min(ans_L))

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

ans = sum(x)
if len(y) != 0:
    s = 10 - min(y)
    ans -= s

print(ans)

Solution (Python):
from math import ceil
t = 0
a = [int(input()) for _ in range(5)]
m = min(map(lambda x: (x - 1) % 10 + 1, a))
for c in a:
    if (c - 1) % 10 + 1 == m:
        m = c
a.remove(m)
t += sum(map(lambda x: ceil(x / 10), a))
t *= 10
print(t + m)

Solution (Python):

N = 5
order_times = [int(input()) for i in range(N)]
last_times = [(10-(ot%10))%10 for ot in order_times]
last_time = max(last_times)
ans = sum([((ot + 9)//10)*10 for ot in order_times]) - last_time
print(ans)

Solution (Python):
A = [int(input()) for i in range(5)]
min_1 = 10
sum_v = -10

for num in A:
    dig1 = num % 10
    if dig1:
        min_1 = min(min_1, dig1)

    if dig1:
        sum_v += (num // 10) * 10 + 10
    else:
        sum_v += num

if min_1 != 10:
    print(sum_v + min_1)
else:
    print(sum_v + min_1)

Solution (Python):
def ceil10(i):
  z=int(i/10)
  z=z*10
  z=10-(i-z)
  if z==10:
    z=0
  return i+z

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

min1=(-1,9999)
for i,b in enumerate(a):
  c=int(b/10)
  c=c*10
  c=b-c
  if c==0:
    c=10
  if min1[1]>c:
    min1=(i,c)
ans=0

for i,b in enumerate(a):
  if i!=min1[0]:
    ans+=ceil10(b)
  else:
    ans+=b
print(ans)

Solution (Python):
times = []

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

times = sorted(times, key=lambda x: x%10)

ans = 0
for i, t in enumerate(times):
    if t%10==0:
        ans += t
    else:
        ans += t
        break

for j in range(i+1,5):
    ans += (times[j]//10)*10 + 10

print(ans)

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

best = 10**9
import itertools
for pan in itertools.permutations(an):
    s = 0
    for i in range(4):
        q,m=divmod(pan[i],10)
        if m>0:
            q += 1
        s += q*10
    s += pan[4]
    if s < best:
        best = s
print(best)

Solution (Python):
import math


def main():
    items = []

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

    maxi = 0
    for i in range(5):
        if items[i] % 10 < items[maxi] % 10 and items[i] % 10 != 0:
            maxi = i

    ret = 0
    for i in range(5):
        if i != maxi:
            if items[i] % 10 != 0:
                ret += int(math.floor(items[i] / 10) + 1) * 10
            else:
                ret += int(math.floor(items[i] / 10)) * 10
            continue
        ret += items[i]

    print(ret)


main()

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

b = []
for i in range(len(a)):
    k = int(a[i] / 10)
    sel = abs((k+1)*10 -a[i])
    if sel ==10:
        b.append(0)
    else:
        b.append(sel)
    
order_list= sorted(range(len(b)), key=lambda k: b[k])

count = 0
for i in range(len(order_list)):
    count += a[order_list[i]]
    remain = int(count %10)
    if remain != 0 and i != len(order_list)-1:
        count += (10- remain)

print(count)

Solution (Python):
import math

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

div = []
for t in [a,b,c,d,e]:
  div.append(math.ceil(t/10)*10)

m = []
for t in [a,b,c,d,e]:
  if 0 < (t % 10):
    m.append(t%10)

if len(m) == 0:
  print(sum(div))
else:
  print(sum(div)-(10-min(m)))

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

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

ryouri_amari = [x % 10 for x in ryouri]

idx = 0
min_amari = 10

for i, amari in enumerate(ryouri_amari):
    if amari == 0:
        continue
    elif amari < min_amari:
        min_amari = amari
        idx = i

goukei = 0

for i, r in enumerate(ryouri):
    if i == idx:
        goukei += r
    elif r % 10 == 0:
        goukei += r
    else:
        goukei += r + (10 - (r % 10))

print(goukei)

Solution (Python):
import numpy as np







def up(x):
	return x+10*(x%10!=0)-x%10



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

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

m=np.array([i%10+10*(i%10==0) for i in l])
a=np.argmin(m)
out=0
for i in range(5):
	if(i==a):
		out+=l[i]
	else:
		out+=up(l[i])	

print(out)

Solution (Python):
import math

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

menus = [a, b, c, d, e]
ceils = [math.ceil(a/10)*10, math.ceil(b/10)*10, math.ceil(c/10)*10, math.ceil(d/10)*10, math.ceil(e/10)*10]

minIndex = 0
minTime = 10
for i in range(5):
    tmp = menus[i]%10
    if(tmp!=0):
        if(minTime>tmp):
            minTime = tmp
            minIndex = i
ans = 0
for i in range(5):
    if(i==minIndex):
        ans += menus[i]
    else:
        ans += ceils[i]

print(ans)

Solution (Python):
from sys import stdin
import math
import numpy as np




x = []
for i in range(5):
  x.append(int(stdin.readline().rstrip().split()[0]))

x10 = [(int((i-1)/10)+1)*10 for i in x]
y = np.array([j-i for i, j in zip(x10,x)])
mini = np.min(y)
print(sum(x10)+mini)

Solution (Python):
a=input()
b=input()
c=input()
d=input()
e=input()
L=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
M=[int(a),int(b),int(c),int(d),int(e)]
for i in range(5):
  if L[i] != 0:
    M[i] = M[i] + 10 - L[i]
  else:
    L[i] = 10
print(sum(M)+min(L)-10)

Solution (Python):
import sys
def p(*a):
  s=" ".join(map(str,a))
  
  sys.stderr.write(s+"\n")

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

amod= a%10
bmod= b%10
cmod= c%10
dmod= d%10
emod= e%10

p(a,b,c,d,e)
p(amod,bmod,cmod,dmod,emod)

x=9

from math import ceil

if amod==bmod==cmod==dmod==emod==0:
  ans=a+b+c+d+e
else:
  if amod!=0: x=min(x,amod)
  if bmod!=0: x=min(x,bmod)
  if cmod!=0: x=min(x,cmod)
  if dmod!=0: x=min(x,dmod)
  if emod!=0: x=min(x,emod)
  ans= (ceil(a/10)*10)+(ceil(b/10)*10)+(ceil(c/10)*10)+(ceil(d/10)*10)+(ceil(e/10)*10)-10+x

print(ans)

Solution (Python):
hoge=[]
for i in range(5):
  hoge.append(int(input()))
  
ans=0
yobun=[]
for i in range(5):
  if(hoge[i]%10==0):
    yobun.append(10)
    ans+=hoge[i]
  else:
    yobun.append(hoge[i]%10)
    ans+=+10+hoge[i]-hoge[i]%10
    
hiku=min(yobun)
if(min(yobun)==10):
  print(sum(hoge))
else:
  print(ans+hiku -10)

Solution (Python):
from itertools import permutations

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

def calc(perm):
    time = 0
    for p in perm:
        if (time % 10 == 0):
            time += ary[p]
        else:
            time += 10 - time % 10
            time += ary[p]
    return time

times = []
for perm in permutations(range(5)):
    times.append(calc(perm))

print(min(times))

Solution (Python):
import itertools
o = [int(input()) for i in range(5)]
check = 110000000000000000000000000000000000000000000000000000000000000000000000
g = itertools.permutations(o)
for ls in g:
    ans = 0
    for i in range(5):
        if ls[i] % 10 == 0:ans += ls[i]
        else:ans += ls[i] + (10 - ls[i] % 10)
    if ls[-1] % 10 != 0:
        ans -= 10-(ls[-1] % 10)
    check = min(ans,check)
print(check)

Solution (Python):
m=[int(input()) for _ in range(5)]
print(sum([(1+t//10)*10 if t%10>0 else t for t in m])
      -max([(1+t//10)*10-t if t%10>0 else 0 for t in m]))

Solution (Python):
list=[]
ans=10
sum=0
for i in range(5):
    list.append(int(input()))
for i in range(5):
    if list[i]%10<ans and list[i]%10!=0:
        ans=list[i]%10
for j in range(5):
    if list[j]%10!=0:
        sum+=list[j]+(10-list[j]%10)
    else:
        sum+=list[j]
print(sum-(10-ans))

Solution (Python):
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
total = []
for v in itertools.permutations(l):
    nl = list(v)
    t = 0
    for num in range(len(nl)):
        if(num != 4 and nl[num] % 10 != 0):
            t += int(nl[num] / 10) * 10 + 10
        else:
            t += nl[num]
    t = int(t)
    total.append(t)
print(min(total))

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

max_read = 0

def spend(t):
    global max_read
    if t % 10 == 0:
        return t
    else:
        ret = (t // 10 + 1) * 10
        max_read = max(max_read, ret-t)
        return ret
    


result = 0
result += spend(A)
result += spend(B)
result += spend(C)
result += spend(D)
result += spend(E)
print(result - max_read)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
MA = ((A - 1) // 10 + 1) * 10
MB = ((B - 1) // 10 + 1) * 10
MC = ((C - 1) // 10 + 1) * 10
MD = ((D - 1) // 10 + 1) * 10
ME = ((E - 1) // 10 + 1) * 10
ma = (A + 9) % 10 + 1
mb = (B + 9) % 10 + 1
mc = (C + 9) % 10 + 1
md = (D + 9) % 10 + 1
me = (E + 9) % 10 + 1
min = min (ma, mb, mc, md, me)
print(MA + MB + MC + MD + ME - 10 + min)

Solution (Python):
a, b, c, d, e = [int(input()) for _ in range(5)]
l = [0 if str(i)[-1] == '0' else 10 - int(str(i)[-1]) for i in [a, b, c, d, e]]
ll = [a, b, c, d, e]
arr = []
for i in range(5):
    arr.append([l[i], ll[i]])
arr.sort()
ans = 0
for index, (i, j) in enumerate(arr):
    if index == len(arr) - 1:
        ans += j
    else:
        ans += i + j
print(ans)

Solution (Python):
a=[0,0,0,0,0]
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
suma=0
Max=0
for i in range(5):
  if a[i]%10==0:
    suma+=a[i]
  else:
    suma+=a[i]//10*10+10
    if Max<(a[i]//10*10+10)-a[i]:
      Max=(a[i]//10*10+10)-a[i]  
print(suma-Max)

Solution (Python):
times = []
for _ in range(5):
    t = int(input())
    times.append((((t - 1) // 10) * 10, (t - 1) % 10 + 1))
times.sort(key=lambda x: x[1])
ans = 0
for x, r in times[1:]:
    ans += x + 10
ans += sum(times[0])
print(ans)

Solution (Python):

import math

def solve():
    menus = []
    for i in range(0, 5):
        menus.append(int(input()))
    
    
    amari = 10
    last = 0
    for i in range(0, 5):
        if menus[i]%10 < amari and menus[i]%10 != 0:
            last = i
            amari = menus[i]%10
    
    ans = 0
    for i in range(0, 5):
        if i == last:
            continue

        ans += menus[i]
        ans = math.ceil(ans/10) * 10
    
    ans += menus[last]
    print(ans)



if __name__ == "__main__":
    solve()

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A
b=B
c=C
d=D
e=E
a_=0
b_=0
c_=0
d_=0
e_=0
if A%10!=0:
  a=(((A//10)+1)*10)
  a_=10-A%10
if B%10!=0:
  b=(((B//10)+1)*10)
  b_=10-B%10
if C%10!=0:
  c=(((C//10)+1)*10)
  c_=10-C%10
if D%10!=0:
  d=(((D//10)+1)*10)
  d_=10-D%10
if E%10!=0:
  e=(((E//10)+1)*10)
  e_=10-E%10
print(a+b+c+d+e-max(a_,b_,c_,d_,e_))

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

sorted_a = sorted(a,key = lambda x: (x - 1) % 10,reverse = True)
sum_time = 0
for i in range(5):
  while sum_time % 10 != 0:
    sum_time += 1
  sum_time += sorted_a[i]

print(sum_time)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
last=A
for m in (B,C,D,E):
    if m%10<last%10 and m%10!=0:
        last=m
ans=last
l=[A,B,C,D,E]
l.remove(last)
for m in l:
    ans+=((m+9)//10)*10
print(ans)

Solution (Python):


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

gohan = [0]*5
for i in range(5):
    gohan[i] = int(input())
    
ans = 0
for i in range(5):
    ans += ceil(gohan[i])
    gohan[i] = ceil(gohan[i]) - gohan[i]
    
print(ans - max(gohan))

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

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

Solution (Python):
def answer():
    l = []
    l_sub = []
    serving_time = 0
    for _ in range(5):
        l.append(int(input()))  

    for v in l:
        l_sub.append((v-1) % 10 +1)
        serving_time += ((v -1)//10 + 1) *10

    serving_time = serving_time - 10 + min(l_sub)
    return serving_time


def main():
    print(answer())

if __name__ == '__main__':
    main()

Solution (Python):
abc=[]
answer=0
for i in range(5):
    d=int(input())
    if d%10==0:
        answer+=d
    else:
        answer+=(int(d/10+1))*10
        abc.append(d%10)
if len(abc)>0:
    answer-=10-min(abc)
print(answer)

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

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

index = 0
for i in range(1, 5):
    if (l[index] - 1)%10 > (l[i] - 1)%10:
        index = i
        
s = 0
for i in range(5):
    if i == index:
        s += l[i]
    else:
        s += ((l[i]+9) // 10)* 10
        
print(s)

Solution (Python):
lst = [int(input()) for i in range(5)]
mod_lst = [(10-lst[i]%10)%10 for i in range(5)]

ans = sum(lst) + sum(mod_lst) - max(mod_lst)

print(ans)

Solution (Python):
import itertools

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

min_time = 99999
for time_list in list(itertools.permutations([A, B, C, D, E])):
    time = time_list[0]
    time = int((time - 1) / 10) * 10 + 10
    for i, t in enumerate(time_list[1:]):

        if i < 3:
            time += int((t - 1) / 10) * 10 + 10
        else:
            time += t
    min_time = min(min_time, time)

print(min_time)

Solution (Python):
ans = 0
etc = []
for i in range(5):
  a = int(input())
  a10 = a % 10
  if a10 == 0:
    A = a
  else:
    A = a + 10 - a10
    etc.append(a10)
  ans += A
if len(etc) != 0:
  ans += min(etc) - 10
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
li=[a,b,c,d,e]
li=sorted(li,key=lambda x:10 if x%10==0 else x%10)
print(li[0]+sum(map(lambda x:x+((10-x%10)if x%10 else 0),li[1:])))

Solution (Python):






a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
arr = [a, b, c, d, e]

def get_1(n):
    n = n%10
    return n if n!=0 else 10
def ceil(n):
    import math
    n = n/10
    n = math.ceil(n)
    n = n * 10
    return n
last = min(arr, key=get_1)
arr.remove(last)
arr = list(map(ceil, arr))
ans = sum(arr) + last
print(ans)

Solution (Python):
import numpy as np
import sys

A = np.zeros(5)
for i in range(5):
    A[i] = int(input())

A2 = np.ceil(A/10.0).astype(np.int)*10
A3=(A-1)%10+1
print((A3.min()+A2.sum()-10).astype(np.int))

Solution (Python):
time = []
mod_10 = []

for i in range(5):
    t = int(input())
    time.append(t)
    mod_10.append(t % 10)
    if mod_10[i] == 0:
        mod_10[i] = 10

flag = False
min_mod = min(mod_10)

for i in range(5):
    if mod_10[i] == min_mod and not flag:
        flag = True
    else:
        time[i] = ((time[i] + 9) // 10) * 10

print(sum(time))

Solution (Python):


import math

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

good = 10
total = 0

if a%10 < good and a%10 != 0:
    good = a % 10

if b % 10 < good and b%10 != 0:
    good = b % 10

if c % 10 < good and c%10 != 0:
    good = c % 10

if d % 10 < good and d%10 != 0:
    good = d % 10

if e % 10 < good and e%10 != 0:
    good = e % 10

total += math.ceil(a / 10) * 10
total += math.ceil(b / 10) * 10
total += math.ceil(c / 10) * 10
total += math.ceil(d / 10) * 10
total += math.ceil(e / 10) * 10

total -= 10 - good

print(total)

Solution (Python):
def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return list(map(int, ss_raw()))


def ceil(num):
    if int(str(num)[-1]) == 0:
        return num
    return num + 10 - int(str(num)[-1])


total = 0
minus = 0
times = []
for i in xrange(5):
    times.append(int_raw())

for time in times:
    if int(str(time)[-1]) == 0:
        local_minus = 0
    else:
        local_minus = 10 - int(str(time)[-1])
    minus = max(minus, local_minus)
    total += ceil(time)

total -= minus

print(total)

Solution (Python):
import itertools
import math

number = []
for i in range(5):
    number.append(float(int(input())/10))

result = []

for j in itertools.permutations(number,5):
    time = 0.0
    for i,k in enumerate(j):
        if i < 4:
            time = math.ceil(time + k)
        else:
            time += k
    result.append(time)
    
print(int(min(result)*10))

Solution (Python):
l = [int(input()) for _ in range(5)]
mod = 10
sm = 0
for i in l:
    if i % 10 != 0:
        mod = min(mod, i % 10)
    sm += -10*(-i//10)
if mod == 10:
    mod = 0
else:
    sm -= 10
print(mod+sm)

Solution (Python):
import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
raws = [A, B, C, D, E]
residues = []
for num in raws:
    if num % 10 != 0:
        residues.append(num % 10)
    else:
        residues.append(10)

ans = 0
lastDish = residues.index(min(residues))
for i in range(len(raws)):
    if i != lastDish:
        ans += math.ceil(raws[i] / 10) * 10
    else:
        ans += raws[i]
print(ans)

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

for j in range(5):
  if timeList[j] % 10 == 0:
    timeAndRe.append([0, timeList[j]])
  else:
  	timeAndRe.append([10 - timeList[j] % 10 ,timeList[j]])

timeAndRe.sort()

sumTime = 0

for k in range(5):
  if k != 4:
    sumTime += (timeAndRe[k][0] + timeAndRe[k][1])
  else:
    sumTime += timeAndRe[k][1]
    
print(sumTime)

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

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

time_list_upper = [(((time - 1)//10)+1)*10 for time in time_list]

time_list_ones = [(time - 1) % 10 for time in time_list]
smallest_idx = time_list_ones.index(min(time_list_ones))
smallest = time_list.pop(smallest_idx)
time_list_upper.pop(smallest_idx)

print(sum(time_list_upper) + smallest)

Solution (Python):
import sys

if __name__ == "__main__":
    V = [int(sys.stdin.readline()) for i in range(5)]
    ans = 0
    mi = 100
    for v in V:
        if v % 10 == 0:
            ans += v
        else:
            ans += v - (v % 10) + 10
            mi = min(mi, v % 10)

        

    if mi != 100:
        ans -= (10 - mi)

    print(ans)

Solution (Python):
L = [int(input()) for i in range(5)]
M = [l if l % 10 == 0 else (l // 10 + 1) * 10 for l in L]

d = 0
for l, m in zip(L, M):
    d = max(d, m - l)

print(sum(M) - d)

Solution (Python):
import math
a2e_mod = []
for _ in range(5):
  v = input()
  a2e_mod.append([(v + 9) % 10, v])

a2e_mod.sort(reverse=True)
res = 0
for _, v in a2e_mod[:-1]:
  res += math.ceil(v / 10.0) * 10
print int(res + a2e_mod[-1][-1])

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

ans=0
s=a[0]%10
for i in range(1,5):
  if s>a[i]%10 and a[i]%10!=0:
    s=a[i]%10

for i in range(5):
  if a[i]%10 == 0:
    ans+=a[i]
  else:
    ans+= a[i]+(10-a[i]%10)
if s==0:
  print(ans)
else:
	print(ans-10+s)

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    S = []
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    S.append(int(input().rstrip()))
    ans = 0
    min = S[0]
    min_i = 0
    sum = 0
    for i in range(len(S)):
        if min%10 > S[i]%10 and S[i]%10 != 0:
            min = S[i]%10
            min_i = i
    for i in range(len(S)):
        if i != min_i:
            sum += math.ceil(S[i]/10) * 10
        else:
            sum += S[i]
    print(sum)
if __name__ == '__main__':
    main()

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

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

saigo = 199
for ryori in ryoris:
    if ryori % 10 > 0 and ryori % 10 <= saigo % 10:
        saigo = ryori

if saigo == 199:
    saigo = ryoris[0]
    
ryoris.remove(saigo)

time = 0
for ryori in ryoris:
    time += ryori if ryori % 10 == 0 else 10 * (ryori //10) + 10

    
time += saigo
    
print(time)

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

ans = 0
rem = 10
for i in [0] * 5:
    N = input()
    if N % 10 != 0:
        ans += N / 10 * 10 + 10
        rem = min(rem, N % 10)
    else:
        ans += N

ans -= 10
ans += rem
print ans

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

nums = [a, b, c, d, e]
l = [math.ceil(num/10)*10 for num in nums]
l_sub = [l[i] - nums[i] for i in range(5)]
print(sum(l) - max(l_sub))

Solution (Python):
time = []
for i in range(5):
	time.append(int(input()))
remain = [0]
for i in range(5):
	if time[i] % 10 != 0:
		remain.append(10 - time[i] % 10)
sum = 0
for i in range(5):
	if time[i] % 10 == 0:
		sum += time[i]
	else:
		sum += (time[i] // 10 + 1) * 10

print(sum - max(remain))

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

def kiriage(x):
    n = x % 10
    if n == 0:
        return x
    else:
        return x + 10 - n

n = 0
for i in range(5):
    n += kiriage(a[i])

p = 10
for i in range(5):
    if a[i] % 10 != 0:
        p = min(p, a[i] % 10)

print(n - 10 + p)

Solution (Python):
def cal(a):
    a = int(str(a)[-1])
    b = 0
    if not a == 0:
        b = 10 - a
    return b

a = [int(input()) for _ in range(5)]
b = list(map(cal, a))
ans = 0

for i in range(5):
    index = b.index(min(b))
    ans += a[index]
    if not i == 4:
        ans += b[index]
    b[index] = 124

print(ans)