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.



Sample input:
29
20
7
35
120


Sample output:
215

Submission status: Accepted

Solution code:

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


ten = a//10 + b//10 + c//10 + d//10 + e//10

aa = [a%10,b%10,c%10,d%10,e%10]
zero = aa.count(0)

if zero == 5:
	print(ten*10)
else:
	for i in range(1,10):
		if  i in aa:
			one = i
			break
	print(ten*10 + (4-zero)*10 +one)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a1 = 10 - a%10
b1 = 10 - b%10
c1 = 10 - c%10
d1 = 10 - d%10
e1 = 10 - e%10
l = [a1,b1,c1,d1,e1]

for i in range(5):
  if l[i] == 10:
    l[i] = 0
  
def max(x,y):
  if x <= y:
    return y
  else:
    return x
f = max(max(max(max(l[0],l[1]),l[2]),l[3]),l[4])

ans = (a+b+c+d+e) + (l[0]+l[1]+l[2]+l[3]+l[4]) - f
print(ans)

Submission status: Accepted

Solution code:
l =[int(input()) for i in range(5)]
total=[]
sum=0

for i in l:
    if i%10==0:
        num=10
    else:
        num = i%10
    total.append(num)
min_ind=total.index(min(total))
min_num=l[min_ind]
del l[min_ind]

for i in l:
    if i%10==0:
        sum+=i
    else:
        sum+=(int(i/10)+1)*10
sum+=min_num
print(sum)

Submission status: Accepted

Solution code:
import math
N = []
las = []
dic = {}
_time = 0
for i in range(5):
    n = input()
    diff = 10 - int(n[-1])
    if diff != 10:
        N.append((diff, int(n)))
    else:
        N.append((int(n[-1]), int(n)))
N.sort()
for i, n in enumerate(N):
    _time += n[1]
    if i != len(N) - 1:
        _time = math.ceil(_time / 10) * 10
print(_time)

Submission status: Accepted

Solution code:
def round_up(num, divisor):
    if num % divisor == 0:
        return num - (num%divisor)
    else:
        return num - (num%divisor) + divisor
dishes = []
p = []
for i in range(5):
    dishes.append(int(input()))
for i in range(5):
    if dishes[i]%10 == 0:
        p.append(10)
    else:
        p.append(dishes[i]%10)
sum = dishes.pop(p.index(min(p)))
for i in range(len(dishes)):
    sum += round_up(dishes[i], 10)
print(sum)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def key(n):
    m = n % 10
    if m == 0:
        return 10
    else:
        return m


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


def solv(a, b, c, d, e):
    times = sorted([a, b, c, d, e], key=key)
    ans = times[0]
    for t in times[1:]:
        ans += kiriage(t)
    return ans


if __name__ == '__main__':

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

    ans = solv(a, b, c, d, e)

    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 21:09:02 2019

@author: rubug
"""

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

T = [A,B,C,D,E]
t = [A % 10,B % 10,C % 10,D % 10,E % 10]
for i in range(5):
    if t[i]==0:
        t[i]=10
t.sort()
t.reverse()

sm = 0
for i in range(4):
    sm += T[i]-t[i]+10
sm += T[4]

print(sm)

Submission status: Accepted

Solution code:
a=[int(input()) for _ in range(5)]
b=[]
ans=0
for j in a:
  while j%10!=0:
    j+=1
  b.append(j)
for i in range(5):
  if b[i]-a[i]>ans:
    ans=b[i]-a[i]
    
print(sum(b)-ans)

Submission status: Accepted

Solution code:
a=[0,0,0,0,0]
b=[0,0,0,0,0]
time=0
cnt=0
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
for i in range(5):
  b[i]=a[i]%10
for i in range(10):
  for j in range(5):
    if a[j]==0:
      c=0
    else:
      if b[j]==0:
        time=time+a[j]
        a[j]=0
        cnt=cnt+1
      elif b[j]==(10-i):
        time=time+a[j]+i
        cnt=cnt+1
        a[j]=0
        if cnt==5:
          time=time-i
print(time)

Submission status: Accepted

Solution code:
dish = [int(input()) for _ in range(5)]
min_i = 0
n = 10

for i in range(len(dish)):
  matu = list(str(dish[i]))
  matu = int(matu[-1])
  if n > matu and matu != 0:
    min_i = i
    n = matu
min_ = dish.pop(min_i)
sum_ = 0
for i in dish:
  if i%10 != 0:
    sum_ += (i//10 +1)*10
  else:
    sum_ += (i//10)*10
    
sum_ += min_
print(sum_)

Submission status: Accepted

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

last = min(l,key = lambda x:(x+9)%10)
l.remove(last)

sum = 0
for i in l:
    if i%10==0:
        sum+=i
    else:
        sum+=i-i%10+10
        
print(sum+last)

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
ans = sum(l)
tmp_A = [0]*5
for i in range(5):
  tmp_A[i] = 10 - l[i]%10
tmp = 0
count = 0
for k in range(5):
  if tmp_A[k] != 10 and tmp_A[k] >= tmp:
    tmp = tmp_A[k]
  if tmp_A[k] == 10:
    count += 1
ans += sum(tmp_A)
ans = ans - tmp - 10*count
print(ans)

Submission status: Accepted

Solution code:
a=[int(input()) for _ in range(5)]
one = 10
for i in range(5):
    if a[i] % 10 != 0 and a[i]%10 <one:
        one = a[i]%10
for i in range(5):
    if a[i] % 10 == 0:
        a[i] = a[i] // 10
    else:
        a[i] = a[i] // 10 + 1
print(sum(a)*10 -10 +one)

Submission status: Accepted

Solution code:
x=[int(input()) for i in range(5)]
x.sort()
ans=0
rem=[]
for t in x:
    ans+=(t-t%10)
    rem.append(t%10)
    rem.sort()
f=0
for r in rem:
    if r==0:
        pass
    else:
        if f==0:
            ans+=r
            f=1
        else:
            ans+=10
print(ans)

Submission status: Accepted

Solution code:
li=[0]*5
for i in range(5):
  li[i]=int(input())
  
ans=0
cnt=10
for i in range(5):
  if li[i]%10<cnt:
    if li[i]%10==0:
      ans+=li[i]//10
    else:
      cnt=li[i]%10
      ans+=li[i]//10
      ans+=1
  else:
    if li[i]%10==0:
      ans+=li[i]//10
    else:
      ans+=li[i]//10
      ans+=1
  #print(ans)
  
print(ans*10-10+cnt)

Submission status: Accepted

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

surplus = 0
for n in nums:
    s = 10 - n % 10
    if s != 10 and s > surplus:
        surplus = s
print(sum([(n+9)//10*10 for n in nums]) - surplus)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
last=0
t = 0
for j,i in enumerate([A,B,C,D,E]):
    if not i//10 * 10 ==i and last < (i//10 +1) * 10 -i:
        last = (i//10 +1) * 10 -i
        t=j
ans= 0
for j,i in enumerate([A,B,C,D,E]):
        if i//10 * 10 ==i and j!=t:
            #print((i//10 +1) * 10)
            ans += i
        elif  i//10 * 10 !=i and j!=t:
            ans += (i//10 +1) * 10
print(ans+[A,B,C,D,E][t])

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
A.sort(key=lambda x:10 if x%10==0 else x%10, reverse=True)
ans = 0
for a in A[:4]:
    ans += a + (-a%10)
print(ans + A[-1])

Submission status: Accepted

Solution code:
from math import ceil
from itertools import permutations

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

ans = 643
for m in p:
    t = 0
    for i in range(4):
        t += m[i]
        t = ceil(t / 10) * 10
    t += m[4]
    if ans > t:
        ans = t

print(ans)

Submission status: Accepted

Solution code:
s=0
u=10
for t in [int(input()) for _ in range(5)]:
    m=t%10
    n=1 if m>0 else 0
    s+=(t//10+n)*10
    if n==1 and m<u : u=m

if u<10:s-=10-u
print(s)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
B = [a%10 for a in A]
C = [10 - b for b in B]
while (10 in C):
  C.remove(10)

if (len(C)):
  C.remove(max(C))
print(sum(A) + sum(C))

Submission status: Accepted

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

aa=(10-a%10)%10
bb=(10-b%10)%10
cc=(10-c%10)%10
dd=(10-d%10)%10
ee=(10-e%10)%10
m=max(aa,bb,cc,dd,ee)

import math
T=10*math.ceil(a/10)+10*math.ceil(b/10)+10*math.ceil(c/10)+10*math.ceil(d/10)+10*math.ceil(e/10)-m
print(T)

Submission status: Accepted

Solution code:
#n=int(input())
#li=input().split()
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#li=list(map(int,input().split()))
#S=input()

lis=[[],[]]
for i in range(5):
    s=int(input())
    lis[0].append(s)
    lis[1].append(s%10)
for i in range(5):
    if lis[1][i]!=0:
        m=i
        break
m=0
for i in range(5):
    if lis[1][m]>lis[1][i] and lis[1][i]!=0:
        m=i
ans=0
for i in range(5):
    if i!=m:
        if lis[1][i]!=0:
            ans+=(lis[0][i]-lis[1][i]+10)
        else:
            ans+=lis[0][i]
ans+=lis[0][m]
print(ans)

Submission status: Accepted

Solution code:
import math

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

xs = [a,b,c,d,e]
divs = [10 if x % 10 == 0 else x % 10 for x in xs]
mindiv = min(divs)
result = sum([math.ceil(x/10) * 10 for x in xs]) - 10 + mindiv
print(result)

Submission status: Accepted

Solution code:
from collections import defaultdict as ddic
from collections import deque
from itertools import combinations, permutations, product
import bisect
import heapq
import math
import sys

stdout = sys.stdout
rr = lambda: input().strip()
rri = lambda: int(rr())
rrm = lambda: list(map(int, rr().split()))

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

lst = [[a,-1],[b,-1],[c,-1],[d,-1],[e,-1]]

lst2 = []

for i, num in enumerate(lst):
    lst[i][1] = num[0] % 10

lst.sort(key=lambda arr: arr[1])

for i, l in enumerate(lst):
    if l[1] != 0:
        if i == 4:
            d1 = [item[0] for item in lst]
            print(sum(d1))
            quit()
        else:
            for j, k in enumerate(lst[i+1:]):
                lst[i+j+1][0] += (10 - lst[i+j+1][1])

            d2 = [item[0] for item in lst]
            print(sum(d2))
            quit()

print(sum([a,b,c,d,e]))

Submission status: Accepted

Solution code:
import numpy as np

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

n = np.array(n)

#n=np.sort(n)
m=[]
s=0
for p in n:
	t = p % 10
	if (t == 0):
		m.append(10)
	else:
		m.append(t)
for i in range(len(n)):
	if i==np.argmin(m):
		s += n[i]
	else:
		s += n[i] + (10-m[i])
print(s)

Submission status: Accepted

Solution code:
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
wait_max = max([(130-x)%10 for x in a])
t = sum([(x+9)//10*10 for x in a]) - wait_max
print(str(t))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [10]
if a % 10 > 0:
    l = l + [a % 10]
if b % 10 > 0:
    l = l + [b % 10]
if c % 10 > 0:
    l = l + [c % 10]
if d % 10 > 0:
    l = l + [d % 10]
if e % 10 > 0:
    l = l + [e % 10]
m = min(l)
ma = 10 - m
ls =[]
ls = ls + [-(-a // 10) * 10]
ls = ls + [-(-b // 10) * 10]
ls = ls + [-(-c // 10) * 10]
ls = ls + [-(-d // 10) * 10]
ls = ls + [-(-e // 10) * 10]
s = sum(ls)
print(s -ma)

Submission status: Accepted

Solution code:
#coding:utf-8
import math

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

last_item_index = -1
largest = -1

for i in range(5):
    if math.ceil(times[i] / 10)* 10 - times[i] > largest:
        largest = math.ceil(times[i] / 10)* 10 - times[i]
        last_item_index = i
        
for i in range(5):
    if not i == last_item_index:
        times[i] = math.ceil(times[i] / 10) * 10

print(sum(times))

Submission status: Accepted

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

orders = [A, B, C, D, E]
max_fp = 10
ans = 0
last_order = 0

for i, order in enumerate(orders):
    if order % 10 < max_fp and order % 10 != 0:
        max_fp = order % 10
        last_order = i

for i, order in enumerate(orders):
    if i == last_order or order % 10 == 0:
        ans += order
    else:
        ans += (order // 10 + 1) * 10

print(ans)

Submission status: Accepted

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

arr = [a, b, c, d, e]
m = 0
ans = 0
for i in arr:
    ans += i
    if i % 10:
        ans += 10 - (i % 10)
        m = max(m, 10-(i%10))
print(ans - m)

Submission status: Accepted

Solution code:
from sys import stdin

data = [int(stdin.readline().rstrip()) for _ in range(5)]
data2 = []

for d in data:
    while(True):
        dstr = str(d)
        if int(dstr[-1]) == 0:
            break
        d+=1
    data2.append(d)


mati = -1
mati_index = -1
keta = -1

for i, d in enumerate(data):
    dstr = str(d)
    lastn = int(dstr[-1])
    this_mati = 0
    
    if int(dstr[-1]) == 0:
        this_mati = 0
    else:
        this_mati = 10 - lastn

    if this_mati > mati:
        mati = this_mati
        mati_index = i

res = 0

for i in range(5):
    if i == mati_index:
        continue
    res += data2[i]

res += data[mati_index]

print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

mod = []

for a in list:
    v = 10-(a%10)
    if v == 10: mod.append(0)
    else:mod.append(10-(a%10))

mod = sorted(mod)

time = sum(list)

time += sum(mod[0:len(list)-1])

print(time)

Submission status: Accepted

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

list_inp = [a,b,c,d,e]
min_last = 100
for index, inp in enumerate(list_inp):
  tmp = int(str(inp)[-1])
  if tmp == 0:
    continue
  
  if tmp <= min_last:
    min_last = tmp
    min_last_index = index

# 全部の料理がちょうど１０分単位だった場合
if min_last == 100:
  min_last_index = 0

# 切り上げ
def ceil(src,range):
  if str(src)[-1] == '0':
    return src
  else:
    return ((int)(src / range) + 1 ) * range

ans = 0
for index,value in enumerate(list_inp):
  if index == min_last_index:
    continue
  else:
    ans += ceil(value, 10)


print(ans + list_inp[min_last_index])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


from sys import stdin



############################################
def Combination(n,r):
    tmp_list = []
    for cmb in cmb_list:
        tmp_list.append(cmb)
    for first_data in data_list:
        for second_data in tmp_list:
            split_tmp_list = second_data.split(",")
            obj_list = []
            for split_data in split_tmp_list:
                obj_list.append(split_data)
            if obj_list.count(first_data) == 0:
                obj_list.append(first_data)
                join_data = ",".join(sorted(obj_list))
                if join_data not in cmb_list:
                    cmb_list.append(join_data)
    if r > 2:
        Combination(n,r-1)
    return(cmb_list)

def cal_time(cmb):
    time = 0
    for num,i in enumerate(cmb):
        time += i
#        print(time)
        if time%10!=0 and num!=4:
            time += 10 - time % 10
#        print(time)
    return time
    
# read data for n sequences.
input=[]
for _ in range(5):
    input.append(int(stdin.readline().split()[0]))

cmb_list = []

import itertools
cmb = list(itertools.permutations(input))


prev = 10e6
for x in cmb:
    t = cal_time(x)
#    print(x)
    prev = min(t, prev)
print(prev)

Submission status: Accepted

Solution code:
a = (input())
b = (input())
c = (input())
d = (input())
e = (input())
ary = [a,b,c,d,e]
ary_simo = []
ary_2 = []
for s in ary:
    if int(s[-1]) != 0:
        ary_simo.append(int(s[-1]))
        ary_2.append(int(int(s)/10)*10+10)
    else:
        ary_2.append(int(s))
try:
    print(sum(ary_2) - 10 + min(ary_simo))
except:
    print(sum(ary_2))

Submission status: Accepted

Solution code:
from itertools import permutations
AE = [int(input()) for _ in range(5)]
perm = list(permutations(AE))
minv = 10**5
for p in perm:
    t = 0
    for i in range(len(p)-1):
        if round(p[i], -1) < p[i]:
            t += round(p[i], -1) + 10
        else:
            t += round(p[i], -1)
    t += p[-1]
    minv = min(minv, t)
print(minv)

Submission status: Accepted

Solution code:
list = [int(input()) for _ in range(5)]
list_diff = []

for i in list:
    if i%10 == 0:
        list_diff.append([0,i,i])
    else:
        list_diff.append([10-i%10,i,10*(i//10+1)])

list_diff.sort()
ans = 0

for i in range(5):
    if i == 4:
        ans += list_diff[i][1]
    else:
        ans += list_diff[i][2]

print(ans)

Submission status: Accepted

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

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

s = []

for i in S:
    if i%10 != 0:
        s.append(i%10)

s.sort()

ans = 0

for i in S:
    if i%10 == 0:
        ans += i
    else:
        ans += i + 10 - i%10
if len(s) != 0:
    print(ans - 10 + s[0])
else:
    print(ans)

Submission status: Accepted

Solution code:
import math

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


m = [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]
n = [m[0]-a, m[1]-b, m[2]-c, m[3]-d, m[4]-e]

ans = sum(m) - max(n)
print(ans)

Submission status: Accepted

Solution code:
import math
*A,=[int(input()) for i in range(5)]
B=[i%10 for i in A]
C=[int(math.ceil(i/10)*10) for i in A]
while True:
  x=B.index(min(B))
  if B[x]!=0:
    print(sum(C)-C[x]+A[x])
    break
  B[x]=10

Submission status: Accepted

Solution code:
dishes = []
for i in range(5):
    tmp = int(input())
    rank = 10 if tmp % 10 == 0 else tmp % 10
    dishes.append([rank, tmp])
s_dished = sorted(dishes, reverse=True)

time = 0
for idx,item in enumerate(s_dished):
    time += item[1] + 10 - item[0]

time -= 10 - s_dished[4][0]

print(time)

Submission status: Accepted

Solution code:
a=[]
for i in range(5):
  a.append(int(input()))
bs=[]
cs=[]
cnt=0
for i in range(5):
    if a[i]%10!=0:
        b=int(a[i]/10)*10+10
        c=str(a[i])[-1]
        cs.append(int(c))
    else:
        b=a[i]
        cnt+=1
    bs.append(b)
if cnt==5:
  	print(sum(a))
else:
	print(sum(bs)+min(cs)-10)

Submission status: Accepted

Solution code:
import math
t = []
output = 0
amari = 10
for i in range(0, 5):
    t.append(int(input()))
    output = output+math.ceil(t[i]/10)*10
    if 0<t[i]%10<amari:
        amari = t[i]%10
output = output-10+amari
print("{}".format(output))

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
t = 0
mine = 0
k = [a,b,c,d,e]
for i in k:
  if i % 10 > 0:
    if mine%10 > i%10 or mine == 0:
      mine = i
if mine == 0:
  mine = a
k.remove(mine)
for i in k:
  t += math.ceil(i/10)*10
t += mine
print(t)

Submission status: Accepted

Solution code:
num_list = [int(input()) for _ in range(5)]
res = []
zero = []
one = []
two = []
three = []
four = []
five = []
for n in num_list:
    if n%10 > 5:
        res.append(n)
for n in num_list:
    if n%10 == 0:
        zero.append(n)
    elif n%10 == 1:
        one.append(n)
    elif n%10 == 2:
        two.append(n)
    elif n%10 == 3:
        three.append(n)
    elif n%10 == 4:
        four.append(n)
    elif n%10 == 5:
        five.append(n)
sum = 0
res.extend(zero)
res.extend(five)
res.extend(four)
res.extend(three)
res.extend(two)
res.extend(one)
for i,v in enumerate(res):
    plus = 0
    if v%10==0:
        pass
    else:
        plus = 10-v%10
    if i == 4:
        sum += v
        break
    else:
        sum += v + plus
print(sum)

Submission status: Accepted

Solution code:
import math
import numpy as np

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

for i in s:
    a.append(math.ceil(i/10)*10)

ns = np.array(s)
na = np.array(a)
print(int(np.sum(na)-np.amax(na-ns)))

Submission status: Accepted

Solution code:
import math
a = [[] for i in range(5)]
min_inp = 0
for i in range(5):
    inp = int(input())
    inp_ceil = math.ceil(inp/10)*10
    first = inp - int(inp/10) * 10
    if first == 0:
        first = 10
    a[i].append(inp)
    a[i].append(inp_ceil)
    a[i].append(first)
a = sorted(a, key=lambda x: x[2])
ans = a[0][0]

for i in range(4):
    ans += a[i+1][1]

print(ans)

Submission status: Accepted

Solution code:
import sys

M = []
N = []
for i in range(5):
    l = int(raw_input().split()[0])
    if l % 10 == 0:
        M.append(l)
    else:
        N.append(l)
N = sorted(N,  key=lambda x: 10 - (x % 10))
# print(M, N)

ret = 0
for m in M:
    ret += m
for n in N:
    ret += n
    ret += (10 - (n % 10))
if len(N) != 0:
    ret -= (10 - (N[-1] % 10))
print(ret)

Submission status: Accepted

Solution code:
ans = 0
mod_t = []
for i in range(5):
    t = int(input())
    ans += t
    dif_t = 10 - t % 10
    if dif_t == 10:
      dif_t = 0
    mod_t.append(dif_t)

mod_t.sort()
for i in range(4):
    ans += mod_t[i]
print(ans)

Submission status: Accepted

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

h = [i % 10 for i in nums if i%10 != 0]
min1 = 0 if len(h)==0 else min(h)

amount = 0
last = True
for i in nums:
  if last and i% 10 == min1:
    amount += i
    last = False
  else:
    amount += (i //10 + 1)*10 if i %10 != 0 else (i//10)*10
print(amount)

Submission status: Accepted

Solution code:
import math
menu = list()
for i in range(5):
    menu.append(int(input()))
    
diff_menu = list()
ans_menu = list()
for i in menu:
    amari = i % 10
    if amari == 0:
        amari = 10
    diff_menu.append(i+10-amari-i)
    ans_menu.append(i + 10-amari)
    
print(sum(ans_menu) - max(diff_menu))

Submission status: Accepted

Solution code:
import math
import numpy as np

a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
x = []
s = 0

if a % 10 != 0:
  x.append(a % 10)

if b % 10 != 0:
  x.append(b % 10)

if c % 10 != 0:
  x.append(c % 10)


if d % 10 != 0:
  x.append(d % 10)


if e % 10 != 0:
  x.append(e % 10)

s = 0

if len(x) != 0:
  if np.amin(x) !=0:
    s = 10
  y = np.amin(x)
else:
  s = 0
  y = 0

print(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 +  y -s )

Submission status: Accepted

Solution code:
def f(x):
    if x%10 == 0: return x
    return x + 10 - (x%10)

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

res = f(a) + f(b) + f(c) + f(d) + f(e)

l = [a, b, c, d, e]
l = list(map(lambda x: (x-1)%10, l))
res -= (10-(min(l)+1))
print(res)

Submission status: Accepted

Solution code:
import sys
import io
import math
import re

import sys
import io
import math
import re

menu_num = 5
menu_sum = 0
menu_time_divided = 9
flag_a = 0
flag_b = 0

for num in range(menu_num):
    data_info = input().split()
    menu = int(data_info[0])
    menu_sum += math.ceil(menu / 10) * 10

    if menu % 10 == 0:
        flag_a = 1

    if menu_time_divided >= menu % 10 and menu % 10 != 0:
        menu_time_divided = menu % 10
        flag_b = 1

if flag_a == 0 and flag_b == 1:
    print(menu_sum+menu_time_divided-10)
elif flag_a == 1 and flag_b == 1:
    print(menu_sum+menu_time_divided-10)
else:
    print(menu_sum)

Submission status: Accepted

Solution code:
n = [int(input()) for i in range(5)]
q = []
for i in n:
    if i%10 == 0:
        q.append(10)
    else:
        q.append(i%10)
ans = 0
for i in range(5):
    ans =  ans + n[i] - q[i] + 10
ans = ans - 10 +q[q.index(min(q))]
print(ans)

Submission status: Accepted

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

lastorderval=10
lastorder=0

goukei=0
for i in range(5):
    if S[i]%10!=0:
    
        if S[i]%10<lastorderval:
            lastorderval=S[i]%10
            lastorder=i
            

for i in range(5):
    if i==lastorder:
        goukei+=S[i]
       
    elif S[i]%10==0:
        goukei+=S[i]
        
    else:
        goukei+=S[i]+(10-S[i]%10)
       

print(goukei)

Submission status: Accepted

Solution code:
t=[int(input()) for _ in range(5)]
ans=0
b=[x%10 for x in t]
c=[x%10 for x in t if x%10>0]
if c==[]:
    print(sum(t))
else:
    for i in range(5):
        if b[i]>0:
            ans+=(t[i]//10+1)*10
        else:
            ans+=t[i]
    print(ans-10+min(c))

Submission status: Accepted

Solution code:
# coding: utf-8
ans, lastMinus = 0, 0
for i in range(5):
    try:
        k = int(input())
    except EOFError:
        pass
    
    if k % 10 != 0:
        num = (k // 10 + 1) * 10
        if lastMinus < (num - k):
            lastMinus = num - k
    else:
        num = k
    ans += num

ans -= lastMinus    
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import os
import itertools
from math import *

ctime = []
for i in range(5):
  ctime.append(int(input()))
  
max_diff = 10
max_index = 100
for i in range(5):
  diff_time = (ctime[i]) % 10
  if diff_time < max_diff and diff_time > 0:
    max_index = i
    max_diff = ctime[i] % 10

time = 0
for i in range(5):
  if i != max_index:
    if ctime[i] % 10 == 0:
      time = time + ctime[i]
    else:
      time = time + ((ctime[i] // 10)+1) * 10
  else:
    time = time + ctime[i]
    
print(time)

Submission status: Accepted

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

result = 0
result += a if a % 10 == 0 else a + 10 - a % 10
result += b if b % 10 == 0 else b + 10 - b % 10
result += c if c % 10 == 0 else c + 10 - c % 10
result += d if d % 10 == 0 else d + 10 - d % 10
result += e if e % 10 == 0 else e + 10 - e % 10

# i % 10が0以外で最小のものをみつける
min_mod = 10 if a % 10 == 0 else a % 10
if b % 10 != 0 and b % 10 < min_mod:
  min_mod = b % 10
if c % 10 != 0 and c % 10 < min_mod:
  min_mod = c % 10
if d % 10 != 0 and d % 10 < min_mod:
  min_mod = d % 10
if e % 10 != 0 and e % 10 < min_mod:
  min_mod = e % 10

if min_mod != 10:
  result -= 10 - min_mod
  
print(result)

Submission status: Accepted

Solution code:
def __main__():
    orders = []
    for i in range(5):
        orders.append(int(input()))
    last = min(orders, key=(lambda x: (x-1)%10))
    orders.remove(last)
    print(sum(map((lambda x: (x+9)//10*10), orders)) + last)
if __name__ == "__main__":
    __main__()

Submission status: Accepted

Solution code:
from math import ceil

li = []

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

li_sorted = sorted(li, key=lambda digit: digit % 10)

last_flag = False

ans = 0
for i in li_sorted:
    if i % 10 == 0:
        ans += i
    elif last_flag is False:
        last_flag = True
        ans += i
    else:
        ans += i + 10 - (i % 10)

print(ans)

Submission status: Accepted

Solution code:
import sys

def main(inp):
    food=[int(next(inp).split()[0]) for _ in range(5)]
    
    ichi=[food[i]%10 for i in range(5)]
    for i in range(5):
        if(ichi[i]==0): ichi[i]=10
            
    lastfood=ichi.index(min(ichi))
    
    ans=0
    for i in range(5):
        if(i==lastfood or food[i]%10==0): ans+=food[i]
        else: ans+= (food[i]//10 +1)*10
            
    return ans
  
print(main(sys.stdin))

Submission status: Accepted

Solution code:
a = []
ans = 0
for i in range(5):
  po = int(input())
  a.append(po)

mindiv = 15
for i in range(5):
  div = a[i] % 10
  if div == 0:
    div = 10
  if div < mindiv:
    mindiv = div
    index = i
           
for i in range(5):
  if i != index:
    if a[i]%10 !=0:
      ans = ans + (int(a[i]/10)+1)*10
    else:
      ans = ans + a[i]
  else:
    ans = ans + a[index]
    
print(int(ans))

Submission status: Accepted

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

import math 
aa=math.ceil(a/10)*10
bb=math.ceil(b/10)*10
cc=math.ceil(c/10)*10
dd=math.ceil(d/10)*10
ee=math.ceil(e/10)*10

r = max(aa-a,bb-b,cc-c,dd-d,ee-e)
s = aa+bb+cc+dd+ee-r

print(s)

Submission status: Accepted

Solution code:
import math

li =[]
li2 = []
for i in range(5):
	li.append(int(input()))
	a = li[i]%10
	if a == 0:
		a = 10
	li2.append(a)
    
#print(li)
#print(li2)

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

Submission status: Accepted

Solution code:
rmax = 0
tsum = 0
for i in range(5):
    t = int(input())
    tsum += t
    if(t % 10 != 0):
        r = 10 - (t % 10)
        tsum += r
        if(r > rmax):
            rmax = r
print(tsum - rmax)

Submission status: Accepted

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

min_dish_num = 0
for i in range(1, 5):
    if (dishes[min_dish_num] % 10) == 0:
        min_dish_num = i
    else:
        temp = dishes[i]%10
        if (temp) < (dishes[min_dish_num]%10) and temp != 0:
            min_dish_num = i

cnt = 0
for i in range(5):
    if i == min_dish_num:
        continue
    
    dish = dishes[i]

    cnt += (dish // 10) * 10
    
    if (dish % 10) != 0:
        cnt += 10

cnt += dishes[min_dish_num]

print(cnt)

Submission status: Accepted

Solution code:
li = [int(input()) for i in range(5)]
li_amari = []
time = 0
for i in li:
    if (i % 10 == 0):
        li_amari.append(0)
    else:
        li_amari.append(10 - (int(i % 10)))

a = li_amari.index(max(li_amari))

max_li = li[a]

del li[a]
del li_amari[a]

for j in range(4):
    time += (li[j]+li_amari[j])

print(time + max_li)