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: Wrong Answer

Solution code:
import math
from collections import deque
from collections import defaultdict

import bisect

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

time = []
minValue = 10
minIndex = -1
for i in range(5):
	x = readInt()
	time.append(x)
	if int(str(x)[-1])<minValue and int(str(x)[-1]) != 0:
		minValue = int(str(x)[-1])
		minIndex = i

ans = 0

for i in time:
	tar = i-1
	if tar<11:
		x = 10
	else:
		x = int(str(int(str(tar)[:-1])+1)+"0")
	ans+=x

print(ans-(10-int(str(time[minIndex])[-1])))

Submission status: Wrong Answer

Solution code:
import math
from collections import deque
from collections import defaultdict

import bisect

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

time = []
minValue = 10
minIndex = -1
for i in range(5):
	x = readInt()
	time.append(x)
	if int(str(x)[-1])<minValue and int(str(x)[-1]) != 0:
		minValue = int(str(x)[-1])
		minIndex = i

print(minValue,minIndex)
ans = 0

for i in time:
	tar = i-1
	if tar<11:
		x = 10
	else:
		x = int(str(int(str(tar)[:-1])+1)+"0")
	ans+=x

print(ans-(10-int(str(time[minIndex])[-1])))

Submission status: Wrong Answer

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

def time(n):
  t = 0
  if n % 10 == 0:
    t = 0
  else:
    t = 10 - n % 10
  return t

dic = {a: time(a), b:time(b), c:time(c), d:time(d), e:time(e)}
dic = sorted(dic.items(), key=lambda x:x[1])
dic = list(itertools.chain.from_iterable(dic))
print(sum(dic[:-1]))

Submission status: Wrong Answer

Solution code:
a = [int(input())for i in range(5)]
ans = 0
min_a=10000
for i in a:
    if i%10==0:
        ans+=i
    else:
        min_a = min(min_a, i%10)
        ans+=(i//10+1)*10
        
    
    
print(ans-(10-min_a))

Submission status: Wrong Answer

Solution code:
a = [int(input())for i in range(5)]
ans = 0
min_a=10000
for i in a:
    if i%10==0:
        ans+=i
    else:
        ans+=(i//10+1)*10
        min_a = min(min_a, i%10)
    
    
print(ans-(10-min_a))

Submission status: Wrong Answer

Solution code:
a = [int(input())for i in range(5)]
ans = 0
min_a=10000
for i in a:
    if i%10==0:
        ans+=i
    else:
        ans+=(i//10+1)*10
        min_a = min(min_a, i%10)
    
    print(ans-(10-min_a))

Submission status: Wrong Answer

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

l = [a, b, c, d, e]
k = []
for i in l:
    k.append(i - ((i - 1) //10) * 10)
m = 10 - min(k)
for i in l:
    i = (i // 10 + 1) * 10
print(sum(l) - m)

Submission status: Wrong Answer

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

l = [a % 10, b % 10, c % 10, d % 10, e % 10]
print((a // 10) * 10 + (b // 10) * 10 + (c // 10) * 10 + (d // 10) * 10 + (d // 10) * 10 + min(l) - 10)

Submission status: Wrong Answer

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

l = [a % 10, b % 10, c % 10, d % 10, e % 10]
print((a // 10) * 10 + (b // 10) * 10 + (c // 10) * 10 + (d // 10) * 10 + (d // 10) * 10 + max(l) - 10)

Submission status: Wrong Answer

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

l = [a % 10, b % 10, c % 10, d % 10, e % 10]
print((a // 10) * 10 + (b // 10) * 10 + (c // 10) * 10 + (d // 10) * 10 + (d // 10) * 10 - max(l))

Submission status: Wrong Answer

Solution code:
a = [int(input()) for i in range(5)]
ans = 9
ch = {}
b = {}
num = 0
for i in range(5):
    b[i] = a[i]
    while True:
        a[i] = a[i]%10
        if a[i] == 0:
            a[i] = 10
        if a[i] <= 10:
            ch[i] = a[i]
            break
    ans = min(ch[i],ans)
for i in range(5):
    #print("b[",i,"]=",b[i])
    if b[i] <= 99:
        if b[i] %10 == 0:
            ans -= 10
        num += b[i] - b[i]%10
        #print("num",num)
    else:
        if b[i] %10 == 0:
            ans -= 10
        num += b[i] - (b[i] - 100)%10
print(ans + num + 40)

Submission status: Wrong Answer

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

sec_time = {}
sec_time[A] = A % 10 if A % 10 != 0 else 10
sec_time[B] = B % 10 if B % 10 != 0 else 10
sec_time[C] = C % 10 if C % 10 != 0 else 10
sec_time[D] = D % 10 if D % 10 != 0 else 10
sec_time[E] = E % 10 if E % 10 != 0 else 10

sorted_sec_time = sorted(sec_time.items(), key=lambda x:x[1], reverse=True) 

result = 0
i = 0
for time in sorted_sec_time:
    result += time[0]
    i += 1
    if result % 10 != 0 and i != 5:
        result += 10 - result % 10
    
print(result)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
menu=[a,b,c,d,e]
time=0
for i in ["1","2","3","4","5","6","7","8","9","0"]:
    if i in [str(a)[-1],str(b)[-1],str(c)[-1],str(d)[-1],str(e)[-1]]:
        mi=[str(a)[-1],str(b)[-1],str(c)[-1],str(d)[-1],str(e)[-1]].index(i)
        break
minu=menu[mi]
for i in menu:
    if i!=minu:
        time+=i
        while time%10!=0:
            time+=1
time+=minu
print(time)

Submission status: Wrong Answer

Solution code:
x = [int(input()) for i in range(5)]
y = [0,0,0,0,0]
for i in range(5):
    if x[i] % 10 ==0:
        y[i] = 9
    else:
        y[i] = x[i] % 10 

m = y.index(min(y))
import math
ans = 0
for i in range(5):
    if i != m:
        ans = ans + 10*math.ceil(x[i]/10)
        print(ans)
    else:
        ans = ans + x[i]

print(ans)

Submission status: Wrong Answer

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

mi = 10
sm = 0
min_r = 0
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10

	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	#print(min_r,min_d,i,sm)


print(sm - (10-min_r))

Submission status: Wrong Answer

Solution code:
a=[0]*5
b=[10]*5
for i in range(5):
    a[i]=int(input())
    if a[i]%10!=0:
        b[i]=a[i]%10
    a[i]=int((a[i]/10)+1)*10
ans=sum(a)+min(b)-10
print(ans)

Submission status: Wrong Answer

Solution code:
l=[input() for _ in range(5)]
m=9
for s in l:
    s=int(s[-1])
    if s==0:
        continue
    m=min(m,s)
a=0
for s in l:
    a+=(int(s)+9)//10*10
print(a-10+m)

Submission status: Wrong Answer

Solution code:
import math

x=0
y=9
for _ in range(5):
  i=int(input())
  x+=math.ceil(i/10)*10
  if i%10<y:
    y=i%10
print(x+y-10)

Submission status: Wrong Answer

Solution code:
import math

x=0
y=0
for _ in range(5):
  i=int(input())
  x+=math.ceil(i/10)*10
  if i%10>y:
    y=i%10
print(x+y-10)

Submission status: Wrong Answer

Solution code:
import math

x=0
y=0
for _ in range(5):
  i=int(input())
  x+=math.ceil(i)
  if i%10>y:
    y=i%10
print(x+y-10)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
mino=10
ans=0
for i in range(5):
  x=int(input())
  if x%10==0:
    ans+=x
  else:
    if mino > x%10:
      mino = x%10
      ans+=x+x%10
ans=ans-(10-mino)
print(ans)

Submission status: Wrong Answer

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

# sum_ae = 0
# g = 9
# cnt = 0  
# for i in ae:
#     if i % 10 != 0:
#         g = min(g, i % 10)
#         sum_ae += (i//10 + 1) * 10
#         cnt += 1
#     else:
#         sum_ae += i
# if cnt != 0:
#     print(sum_ae - (10-g))
# else:
#     print(sum_ae)

nxt_time = [0]*5
for i in range(5):
    if ae[i] % 10 == 0:
        nxt_time[i] = ae[i]
    else:
        nxt_time[i] = ae[i] - ae[i] % 10 + 10
    # nxt_time[i] = (ae[i]+9) // 10 * 10
best_time = 99999999
for i in range(5):
    sumtime = 0
    for j in range(5):
        if i == j:
            sumtime += ae[i]
        else:
            sumtime += nxt_time[i]
    
    best_time = min(best_time, sumtime)

print(best_time)

Submission status: Wrong Answer

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

sum_ae = 0
g = 9
for i in ae:
    if i % 10 != 0:
        g = min(g, i % 10)
        sum_ae += (i//10 + 1) * 10
    else:
        sum_ae += i

print(sum_ae - (10-g))

Submission status: Wrong Answer

Solution code:
a=[int(input()) for i in range(5)]
result=0
ans=0
x=9
for i in a:
    if i%10!=0:
        result+=(i//10+1)*10
    elif i==0:
        result+=i
    else:
        result+=i
for i in a:
    if i%10!=0:
        ans=i%10
        if ans<x:
            x=ans
print(result+x-10)

Submission status: Wrong Answer

Solution code:
a=[int(input()) for i in range(5)]
result=0
ans=0
x=9
for i in a:
    if i%10!=0:
        result+=(i//10+1)*10
    else:
        result+=i
for i in a:
    if i%10!=0:
        ans=i%10
        if ans<x:
            x=ans
print(result+x-10)

Submission status: Wrong Answer

Solution code:
a=[int(input()) for i in range(5)]
result=0
ans=0
x=9
for i in a:
    if i%10!=0:
        result+=(i//10+1)*10
    else:
        result+=i
for i in a:
    if i%10!=0:
        ans=i%10
        if ans<x:
            x=ans
print(result-x)

Submission status: Wrong Answer

Solution code:
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
minimum=min(li)
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)

Submission status: Wrong Answer

Solution code:
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
minimum=min(li)
ans=0
for i in l:
  if i != l[li.index(minimum)]:
    ans+=math.ceil(i/10)*10
  else:
    ans+=i
print(ans)

Submission status: Wrong Answer

Solution code:
food = [input() for _ in range(5)]
if len(set(food)) == 1:
  food_check1 = [int(10-int(food[i][-1])) for i in range(1, len(food))]
  food_check2 = [int(i) for i in food]
  print(sum(food_check1) + sum(food_check2))
else:
  check = [int(i[-1]) for i in food if i[-1] != '0']
  food_check1 = [int(i) for i in food if i[-1] != '0']
  food_check2 = [10-int(str(i)[-1]) for i in food_check1 if int(str(i)[-1]) != min(check)]
  food = [int(i) for i in food]
  print(sum(food)+sum(food_check2))

Submission status: Wrong Answer

Solution code:
ae = [int(input()) for i in range(5)]

mm = ae[0]%10
for i in range(5):
    mm = min(mm, ae[i]%10)
    if ae[i]%10 != 0:
        ae[i] = ((ae[i]//10)+1)*10
if mm != 0:
    print(sum(ae)-(10-mm))
else:
    print(sum(ae))

Submission status: Wrong Answer

Solution code:
ae = [int(input()) for i in range(5)]

mm = ae[0]%10
for i in range(5):
    mm = min(mm, ae[i]%10)
    ae[i] = ((ae[i]//10)+1)*10
if mm != 0:
    print(sum(ae)-(10-mm))
else:
    print(sum(ae))

Submission status: Wrong Answer

Solution code:
ae = [int(input()) for i in range(5)]

mm = ae[0]%10
for i in range(5):
    mm = min(mm, ae[i]%10)
    ae[i] = ((ae[i]//10)+1)*10

print(sum(ae)-(10-mm))

Submission status: Wrong Answer

Solution code:
li,lia = [],[]
total = 0
for i in range(5):
    a = input()
    li.append(a)
for i in range(5):
    lia.append(li[i][-1])
lib = [int(s) for s in lia]
b = lib.count(0)
for i in range(b):
    lib.remove(0)
for i in range(5):
    total += (int(li[i])//10+1)*10
total -= 10*(1+b)
if len(lib) >= 1:
    total += min(lib)
if total <= 0:
    print(0)
else:
    print(total)

Submission status: Wrong Answer

Solution code:
li,lia = [],[]
total = 0
for i in range(5):
    a = input()
    li.append(a)
for i in range(5):
    lia.append(li[i][-1])
lib = [int(s) for s in lia]
b = lib.count(0)
for i in range(b):
    lib.remove(0)
for i in range(5):
    total += (int(li[i])//10+1)*10
total -= 10*(1+b)
if len(lib) >= 1:
    total += min(lib)
print(min(abs(total),0))

Submission status: Wrong Answer

Solution code:
N = [int(input()) for _ in range(5)]
A = []
B = []
C = []
for n in N:
    n = list(str(n))
    n.reverse()
    A.append(int(n[0]))
for a in A:
  if a == 0:
    B.append(100)
  else:
    B.append(a)
    C.append(10-a)
b = min(B)
if b == 100:
  b = 0
print(sum(N)+sum(C)-(10-b))

Submission status: Wrong Answer

Solution code:
N = [int(input()) for _ in range(5)]
A = []
B = []
C = []
for n in N:
    n = list(str(n))
    n.reverse()
    A.append(int(n[0]))
for a in A:
  if a == 0:
    B.append(100)
  else:
    B.append(a)
    C.append(10-a)
print(sum(N)+sum(C)-(10-min(B)))

Submission status: Wrong Answer

Solution code:
l=sorted(list(map(int,open(0))),key=lambda x:x%10)
print(sum([i+10-i%10*(i%10!=0) for i in l])-l[-1]%10*(l[-1]%10!=0))

Submission status: Wrong Answer

Solution code:
l=sorted(list(map(int,open(0))),key=lambda x:x%10)
print(sum([i+10-i%10 for i in l])-l[-1]%10)

Submission status: Wrong Answer

Solution code:
tt = [int(input()) for i in range(5)]
ll = [10*i for i in range(14)]
ans = []
at = bt = ct = dt = et = 0
for t in tt:
    i = 0
    while t > ll[i]:
        print(t, ll[i])
        i+=1
    ans.append(ll[i])

max = 0
dex = 0
for i in range(5):
    if ans[i] - tt[i] > max:
        dex = i
        max = ans[i]-tt[i]
at = 0
for j in range(5):
    if j != dex:
        at += ans[j]
    if j == dex:
        at += tt[j]

print(at)

Submission status: Wrong Answer

Solution code:
A = [int(input()) for i in range(5)]

ans = 0
remain = 9
for a in A:
  if a%10 == 0:
    ans += a//10
  else:
    ans += (a+10)//10
    remain = min(remain, a%10)
    
print(ans * 10 + remain)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal, ROUND_HALF_UP

# input
cook_time = []
append = cook_time.append

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

# check
cook_time.sort(key=lambda x: int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_HALF_UP)) - x)
res = 0
for c in cook_time:

    if res % 10 != 0:
        res = int(Decimal(res).quantize(Decimal("1E1"), rounding=ROUND_HALF_UP))

    res += c

print(res)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal, ROUND_HALF_UP

# input
cook_time = []
append = cook_time.append

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

# check
cook_time.sort(key=lambda x: int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_HALF_UP)) - x)
res = 0
for c in cook_time:

    if res % 10 != 0:
        res = int(Decimal(res).quantize(Decimal("1E1"), rounding=ROUND_HALF_UP))

    print(c, res)

    res += c

print(res)

Submission status: Wrong Answer

Solution code:
# input
cook_time = []
append = cook_time.append

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

# check
cook_time.sort(key=lambda x: round(x, -1) - x)
res = 0
for c in cook_time:

    if res % 10 != 0:
        res = round(res, -1)

    res += c

print(res)

Submission status: Wrong Answer

Solution code:
import itertools
import math
import fractions
import functools
import copy

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

sum = 0
minimum = 10
index = 0
for i in range(len(original)):
    if original[i] % 10 != 0:
        sum += original[i]//10 * 10 + 10
        if original[i]%10 < minimum:
            index = i
            minimum = original[i]%10
    else:
        sum += original[i]

print(sum-(original[index]//10 * 10 + 10)+original[index])

Submission status: Wrong Answer

Solution code:
import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))


def key_func(x):
    if x < 100:  # 2桁 or 1桁の場合
        if x % 10 == 0:
            return 10
        return x % 10  # ex: 19の場合は9を返す
    else:
        if x % 100 == 0:
            return 10
        return x % 100  # ex: 123の場合は3を返す


time_list.sort(key=key_func, reverse=True)

# print(time_list)

ans = 0
for i, time in enumerate(time_list):
    if i < len(time_list) - 1:
        ans += math.ceil(time / 10) * 10
    else:
        ans += time

print(ans)

Submission status: Wrong Answer

Solution code:
import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))


def key_func(x):
    if x < 99:
        if x % 10 == 0:
            return 10
        return x % 10  # ex: 19の場合は9を返す
    else:
        if x % 100 == 0:
            return 10
        return x % 100  # ex: 123の場合は3を返す


time_list.sort(key=key_func, reverse=True)

# print(time_list)

ans = 0
for i, time in enumerate(time_list):
    if i < len(time_list) - 1:
        ans += math.ceil(time / 10) * 10
    else:
        ans += time

print(ans)

Submission status: Wrong Answer

Solution code:
import math
a = []
mini = 9
flag = False
for i in range(5):
    x = int(input())
    if x%10==0:
        a.append(x)
    else:
        flag = True
        if x%10<mini :
            mini = x%10
        a.append(math.ceil(x/10)*10)

if flag:
    print(sum(a)-mini)
else:
    print(sum(a))

Submission status: Wrong Answer

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]

#1の位
A1 = int(str(A)[-1])
B1 = int(str(B)[-1])
C1 = int(str(C)[-1])
D1 = int(str(D)[-1])
E1 = int(str(E)[-1])

ls1 = [A1,B1,C1,D1,E1]
j=0
for i in ls1:
    if i==0:
        ls1[j]=9
    j+=1

j=0
last = min(ls1)
for i in  ls1:
    #print(i)
    if i == last:
        las = j  #最後に注文するやつのindex
    j+=1

k=0
for i in ls:
    for j in range(1,14):
        if i <= j*10:
            ls[k] = j*10
            break
    k+=1

ls[las] -= (10 - last)
#print(ls)
print(sum(ls))

Submission status: Wrong Answer

Solution code:
inp = [int(input()) for _ in range(5)]
rem = [p % 10 if p % 10 != 0 else 10 for p in inp]
idx = rem.index(min(rem))
min_rem = inp[idx]
res = 0
inp.remove(min_rem)
for a in inp:
    print(res)
    if a % 10 == 0:
        res += a
    else:
        res += a + (10 - a % 10)

print(res + min_rem)

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print((math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10))*10)

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print(math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10))

Submission status: Wrong Answer

Solution code:
x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
tmp = 9
ans = 0


def a(b):
    c = str(b)
    if c[-1] == "0":
        return b
    else:
        return b - int(c[-1]) + 10


for i in x:
    ans += a(i)
    d = str(i)
    if int(d[-1]) != 0:
        tmp = min(tmp, int(d[-1]))

print(ans - (10 - tmp))

Submission status: Wrong Answer

Solution code:
x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
tmp = 0
ans = 0


def a(b):
    c = str(b)
    if c[-1] == 0:
        return b
    else:
        return b - int(c[-1]) + 10


def b(a):
    if a - 4 > 0:
        return a
    else:
        return a * -1


for i in x:
    ans += a(i)
    d = str(i)
    if tmp < b(int(d[-1])):
        tmp = int(d[-1])

print(ans - tmp)

Submission status: Wrong Answer

Solution code:
x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
tmp = 0
ans = 0


def a(b):
    c = str(b)
    if c[-1] == 0:
        return b
    else:
        return b - int(c[-1]) + 10


for i in x:
    ans += a(i)
    d = str(i)
    tmp = max(tmp, 10 - int(d[-1]))

print(ans - tmp)

Submission status: Wrong Answer

Solution code:
ss = [int(input()) for i in range(5)]
import itertools
mm = list(itertools.permutations(ss))
ans = 0
anss = 10**9
for sc in mm:
    ans = 0
    for i in range(len(sc)):
        if i == 4:
            ans += sc[i]
        else:
            ans += round(sc[i],-1)
    anss = min(anss , ans)
print(anss)

Submission status: Wrong Answer

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return (round(N // 10)+1) * 10


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    ABCDE = itertools.permutations([ii() for _ in range(5)])

    ret = MAX
    for a, b, c, d, e in ABCDE:
        ret = min(ret, f(a) + f(b) + f(c) + f(d) + e)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools

l = [int(input()) for i in range(5)]
l2 = list(itertools.permutations(l))
min = float("INF")
for i in range(120):
    ans = 0
    for j in range(4):
        if l2[i][j] % 10 == 0:
            ans += l2[i][j]
        else:
            ans += (l2[i][j] // 10 + 1) * 10
    ans += l2[i][4]
    if min > ans:
        min = ans
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import permutations

D = [int(input()) for _ in range(5)]
ans = 650

for d in list(permutations(D)):
  sum = 0
  for i in range(5):
    sum += d[i]
    if (i != 4):
      if D[i] % 10 > 0:
        sum += 10 - (D[i] % 10)
      else:
        sum += 0
  if sum < ans:    
    ans = sum

print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import permutations

D = [int(input()) for _ in range(5)]
ans = 650

for d in list(permutations(D)):
  sum = 0
  for i in range(5):
    sum += d[i]
    if D[i] % 10 > 0:
      sum += 10 - (D[i] % 10)
    else:
      sum += 0
  if sum < ans:    
    ans = sum

print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import permutations

D = [int(input()) for _ in range(5)]
ans = 650

for d in list(permutations(D)):
  sum = 0
  for i in range(5):
    sum += d[i]
    if (i != 4):
      sum += 10 - (d[i] % 10)
  if sum < ans:    
    ans = sum

print(ans)

Submission status: Wrong Answer

Solution code:
number_list = [input() for _ in range(5)]
last_digit = [int(n[-1]) if int(n[-1]) != 0 else 1000 for n in number_list]
min_last_digit_index = last_digit.index(min(last_digit))
print(sum([int(n) if i == min_last_digit_index else round(int(n), -1)
           for i, n in enumerate(number_list)]))

Submission status: Wrong Answer

Solution code:
import itertools

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

p = itertools.permutations([0, 1, 2, 3, 4])

min_time = 10e9
for orders in p:
    current_time = 0
    orders = [0, 1, 2, 4, 3]
    for idx, order in enumerate(orders):
        t = times[order]
        current_time += t
        if idx < 4 and current_time % 10 != 0:
            current_time += 10 - current_time % 10

    min_time = min(min_time, current_time)

print(min_time)

Submission status: Wrong Answer

Solution code:
arr = [0]*5
for i in range(5):
    arr[i] = int(input())
time = 0
for ar in arr:
    time += (-(-ar//10))*10
amari = []
for i in arr:
    amari.append(i%10)
amari.sort()
for i in range(4):
    if 0 in amari:
        amari.remove(0)
        
print(time - (10-amari[0]))

Submission status: Wrong Answer

Solution code:
arr = [0]*5
for i in range(5):
    arr[i] = int(input())
time = 0
for ar in arr:
    time += (-(-ar//10))*10
amari = []
for i in arr:
    amari.append(i%10)
amari.sort()
print(time - (10-amari[0]))

Submission status: Wrong Answer

Solution code:
import copy
li=[int(input()) for i in range(5)]

ans=10**9
temp=0

for j in li:
    temp = j
    li2 = copy.copy(li)
    li2.remove(j)
    for k in li2:
        temp += k + (10 - (k % 10))
    ans = min(ans, temp)

print(ans)

Submission status: Wrong Answer

Solution code:
foods = [int(input()) for i in range(5)]
time = 0
minmod = 9

for i in foods:
  time += i
  mod = i % 10
  if mod != 0:
    time += 10 - mod
    if mod < minmod:
      minmod = mod  

print(time - 10 + minmod)