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:
from decimal import Decimal, ROUND_UP
 
l = [int(input()) for _ in range(5)]
if len([x%10 for x in l if x%10 > 0]) > 0:
    min_remainder = 10 - min([x%10 for x in l if x%10 > 0])
    print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]) - min_remainder)
else:
    print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]))

Submission status: Accepted

Solution code:
import math

List = list(map(int, [input() for _ in range(5)]))
List_t = list(map(lambda x: math.ceil(x / 10) * 10, List))

ans = sum(List_t)
for i in range(5):
    s = sum(List_t[:i]) + sum(List_t[i+1:]) + List[i]
    if s < ans:
        ans = s

print(ans)

Submission status: Accepted

Solution code:
import math
lists=list(int(input()) for i in range(5))
modlists=list(lists[j]%10 for j in range(5))
x=set(modlists)
if 0 in x :
      x.remove(0)

      
else:
      x=set(modlists)
            
#a=list(set(modlists).remove(0) if 0 in modlists else set(modlists))
k=modlists.index(min(x)) if x else 0


b=0
for m in range(5):
      b+=math.ceil(lists[m]/10)*10
print(b-math.ceil(lists[k]/10)*10+lists[k])

Submission status: Accepted

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

r = [c % 10 for c in cuicine if c % 10 != 0]

r = sorted(r)

# print(r)

rmin = 0

if r != []:
  rmin = r.pop(0)

ans = sum(cuicine)

for i in r:
  ans += 10 - i

print(ans)

Submission status: Accepted

Solution code:
li=[int(input()) for i in range(5)]
lic=[ (10-it%10)%10 for it in li]
print( sum(li)+sum(lic)-max(lic) )

Submission status: Accepted

Solution code:
import math
a = [int(input()) for _ in range(5)]
s = 0
m = 10
for i in range(5):
  s += math.ceil(a[i] / 10) * 10
  if a[i] % 10 > 0 and a[i] % 10 < m:
    m = a[i] % 10
print(s-(10-m))

Submission status: Accepted

Solution code:
###############################################################################

from bisect import bisect_left as binl

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * sy) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


###############################################################################


def main():
    timelist = intinl(5)

    min_broken = 10
    min_i = None

    for i, time in enumerate(timelist):
        broken = time % 10
        if broken and broken < min_broken:
            min_broken = min(broken, min_broken)
            min_i = i

    new_timelist = []
    for time in timelist:
        if time % 10:
            time += (10 - time % 10)
        new_timelist.append(time)


    if min_i is None:
        print(sum(new_timelist))
    else:
        del new_timelist[min_i]
        time = timelist.pop(min_i)
        print(sum(new_timelist) + time)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
T = [a, b, c, d, e]
A = []
max_tt = 0
for i in range(len(T)):
  if T[i]%10 == 0:
    t = T[i]
  else:
    t = (T[i]//10 + 1) * 10
  A.append(t)
  tt = t - T[i]
  if max_tt < tt:
    max_tt = tt
print(sum(A)-max_tt)

Submission status: Accepted

Solution code:
time = 0
l = []
for i in range(5):
    x = int(input())
    time += x
    l += [(130 - x) % 10]

print(time + sum(l) - max(l))

Submission status: Accepted

Solution code:
l = list(map(int, [input() for i in range(5)]))
time = []
for i in range(5):
    last = l[i]
    total = 0
    for j in range(5):
        if j == i:
            continue
        if l[j] % 10 == 0:
            total += l[j]
        else:
            total += l[j] + (10 - l[j] % 10)

    total += last
    time.append(total)

print(min(time))

Submission status: Accepted

Solution code:
import math

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

tmp = -10
li = [a,b,c,d,e]
for i in li:
  tmp += math.ceil(i/10)*10
if a%10 + b%10 + c%10 + d%10 + e%10 == 0:
  print(int(tmp +10))
else:
  li_1 = [a%10,b%10,c%10,d%10,e%10]
  for i in range(5):
    try:
      li_1.remove(0)
    except:
      break
  print(int(tmp + min(li_1)))

Submission status: Accepted

Solution code:
A=[int(input()) for _ in range(5)]
#print(A)
a=min(map(lambda x: (x-1)%10 +1,A))
#print(a)
S=sum(map(lambda x: (x-1)//10+1,A))
#print(S)
print((S-1)*10+a)

Submission status: Accepted

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

import math

unitsPlace = [int(List[i][-1]) for i in range(5) if int(List[i][-1])!=0]

if unitsPlace==[]:
    res = sum([int(List[i]) for i in range(5)])
    print(res)
else:
    minUnitsPlace = min(unitsPlace)
    
    ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]
    res = sum(ceilList) + minUnitsPlace - 10
    print(res)

Submission status: Accepted

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

import math

unitsPlace = []
for i in range(5):
    if int(List[i][-1])!=0:
        unitsPlace.append(int(List[i][-1]))

if unitsPlace==[]:
    res = sum([int(List[i]) for i in range(5)])
    print(res)
else:
    minUnitsPlace = min(unitsPlace)
    
    ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]
    res = sum(ceilList) + minUnitsPlace - 10
    
    print(res)

Submission status: Accepted

Solution code:
#リストの準備
list=[]
for i in range(5):
  list.append(int(input()))
#料理出てくる時間の1の位を切り上げたリストの作成
import math
list2=[]
for i in range(5):
  list2.append(int(math.ceil(list[i]*0.1)*10))

#4つ目までは、list2の要素を単純に足せばいい。
#最後の1つは、切り上げ前後の差が最も大きいものをlistから選ぶようにする。
#つまり、5つ目まで単純に足し、最後に↑の差を引く。

#最大の差を算出：
def d(j):
  return list2[j]-list[j]
max=max(d(0),d(1),d(2),d(3),d(4))

#list2の総和-最大の差
print(sum(list2)-max)

Submission status: Accepted

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

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

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

A_=A+time[1]+time[2]+time[3]+time[4]
B_=time[0]+B+time[2]+time[3]+time[4]
C_=time[0]+time[1]+C+time[3]+time[4]
D_=time[0]+time[1]+time[2]+D+time[4]
E_=time[0]+time[1]+time[2]+time[3]+E

print(min(A_,B_,C_,D_,E_))

Submission status: Accepted

Solution code:
_sum = 0
_maxLoss = 0
for i in range(5):
    a = int(input())
    _maxLoss = max(_maxLoss, (10 - a % 10) % 10)
    _sum += a + (10 - a % 10) % 10
print(_sum - _maxLoss)

Submission status: Accepted

Solution code:
import sys

di = []
for i in range(5):
    a = input()
    j = len(a)
    if a != "0":
        b = a[j-1]
        if b == "0":
            c = 10
        else:
            c = int(b)
    else:
        c = int(a)
    di.append([int(a),c])

di.sort(key=lambda x:x[1],reverse=True)
w4 = 0
for i in range(4):
    w1 = di[i][1]
    w2 = di[i][0]
    if w2 == 0:
        w3 = 0
    else:
        w3 = 10 - w1 + w2
    w4 += w3
w4 += di[4][0]
print(w4)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
inter_A = (A//10)*10 if A%10 == 0 else (A//10)*10 + 10
inter_B = (B//10)*10 if B%10 == 0 else (B//10)*10 + 10
inter_C = (C//10)*10 if C%10 == 0 else (C//10)*10 + 10
inter_D = (D//10)*10 if D%10 == 0 else (D//10)*10 + 10
inter_E = (E//10)*10 if E%10 == 0 else (E//10)*10 + 10
 
first_A = A + inter_B + inter_C + inter_D + inter_E
first_B = inter_A + B + inter_C + inter_D + inter_E
first_C = inter_A + inter_B + C + inter_D + inter_E
first_D = inter_A + inter_B + inter_C + D + inter_E
first_E = inter_A + inter_B + inter_C + inter_D + E
print(min([first_A, first_B, first_C, first_D, first_E]))

Submission status: Accepted

Solution code:
def ti():
    return int(input())

a = [None] * 5
e = [None] * 5
for _ in range(5):
    a[_] = ti()
    e[_] = 10 -(a[_] % 10)

for x in range(5):
    if e[x] == 10:
        e[x] = 0

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

Submission status: Accepted

Solution code:
from math import ceil
times = [int(input()) for i in range(5)]
rem = max([10-t%10 if t%10>0 else -10 for t in times])
rem = 0 if rem<0 else rem
print(sum([ceil(t/10)*10 for t in times])-rem)

Submission status: Accepted

Solution code:
import math

A = []
m = 10
n = 0
for i in range(5):
    x = int(input())
    A.append(x)
    if m > x%10 > 0:
        m = x%10
        n = i

s = 0
for i,a in enumerate(A):
    if i == n:
        s += a
    else:
        s += math.ceil(a/10)*10

print(s)

Submission status: Accepted

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

total = 0
l = 100
for i in range(5):
  total += (a[i] + 9) // 10 * 10
  d = a[i] % 10
  if d > 0 and d < l:
    l = d

ll = 0 if l == 100 else 10 - l

print(total-ll)

Submission status: Accepted

Solution code:
answer = 0
one = 10
for _ in range(5):
    a = int(input())
    if a % 10 != 0:
        one = min(a%10, one)
        answer += 1
    answer += a // 10
answer -= 1
answer *= 10
answer += one
print(answer)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

t = [0] * 5
for i in range(5):
    t[i] = int(input())

t.sort()
l = []
import math
s = 0
for i in range(5):
    if t[i] % 10 == 0:
        s += t[i]
    else:
        l.append(t[i])
        
ll = len(l)
l = sorted(l, key = lambda n: n % 10, reverse = True)

for i in range(ll):
    if i == ll - 1:
        s += l[i]
    else:
        s += math.ceil(l[i] / 10) * 10
print(s)

Submission status: Accepted

Solution code:
A = [0] * 5
for i in range(5):
    A[i] = int(input())
B = [a % 10 for a in A]
Min = 10
for i in range(5):
    if B[i] != 0:
        Min = min([Min,B[i]])
        A[i] += 10 - B[i]
if Min == 10:
    print(sum(A))
else:
    print(sum(A)-10+Min)

Submission status: Accepted

Solution code:
import math

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

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

sumtime = 0
maxAMARI = 10

for i, v in enumerate(numlist):
  if maxAMARI >= (v-1) % 10:
    maxAMARI = (v-1) % 10
    ind = i
  
ans = 0
for i ,v in enumerate(numlist):
  if i != ind:
    ans += math.ceil(v/10)*10
  else:
    ans += v
print(ans)

Submission status: Accepted

Solution code:
A=[]
min=9
Sum=0
for i in range(5):
    tmp=int(input())
    A.append(tmp)


for i in range(5):
    if A[i]%10<min and A[i]%10!=0:
        tmp=A[i]
        min=A[i]%10
        
Sum=tmp
A.remove(tmp)

for i in range(4):
    if not A[i]%10==0:
        Sum+=10-A[i]%10
        
Sum+=sum(A)

print(Sum)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]

print(sum(B) - max(diff))

Submission status: Accepted

Solution code:
X=[int(input()) for _ in range(5)]
ans = sum((x+9)//10*10 for x in X)
mt = 0
for x in X:
  t = 10 - x%10
  if t == 10:
    t = 0
  mt = max(mt, t)
ans -= mt
print(ans)

Submission status: Accepted

Solution code:
import itertools

times = [int(input()) for i in range(5)]
ans = 0

for i in itertools.permutations(times):
        order_times = [t+(10-t%10)%10 for t in i[:-1]] + [i[-1]]
        ans = sum(order_times) if ans==0 else min(ans, sum(order_times))

print(ans)

Submission status: Accepted

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


t = sorted(T, key=lambda x:(x - 1) % 10)

result = sum((x + 9) // 10 * 10 for x in t[1:]) + t[0]

print(result)

Submission status: Accepted

Solution code:
r=[]
a=[]
min_=11
num=-1
for n in range(5):
    temp=int(input())
    r.append(temp)
    amari=temp%10
    if amari==0:
        amari=10
    a.append(amari)
    if amari < min_:
        min_=amari
        num=n
sumtime=0
for i,(j,a_) in enumerate(zip(r,a)):
    if i!=num:
        s=j+(10-a_)
        sumtime+=s
    else:
        sumtime+=j
print(sumtime)

Submission status: Accepted

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

alist=([a]+[b]+[c]+[d]+[e])

rem=[a%10 for a in alist]
remlist=[r for r in rem if r>0]
minrem=0
if remlist:
    minrem=min(remlist)-10
div=[(1+(a//10))*10 for a in alist]
times=[]
for i in range(5):
    if rem[i]==0:
        times.append(alist[i])
    else:
        times.append(div[i])
print(sum(times)+minrem)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
box = []
for i in range(0,5):
    box.append(int(input()))
amari = []
for i in range(0,5):
    amari.append(box[i] % 10)
for i in range(0,5):
    if amari[i] ==0:
        amari[i] = 100
    else:
        pass
sumtime = 0
box4 = box[4]
boxmin = box[amari.index(min(amari))]
box[amari.index(min(amari))] = box4 
box[4] = boxmin
for i in range(0,5):
    if i ==4:
        sumtime += box[i]
    elif box[i]%10==0:
        sumtime +=box[i]
    else:
        sumtime += (box[i] // 10)*10+10
print(sumtime)

Submission status: Accepted

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

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

worst = (0,999)
for i in range(5):
	if 0 < (tlist[i] % 10) < worst[1]:
		worst = (i,tlist[i]%10)
#	print (worst)

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

for j in range(5):
#	print (ans)
	if j != worst[0]:
		ans += kiriage(tlist[j])
	else:
		ans += tlist[j]

print (ans)

Submission status: Accepted

Solution code:
T=[int(input())for i in range(5)]
A=list(map(lambda x:x%10,T))
S=list(map(lambda y:y//10,T))
count=0
B=[]
for j in range(5):
    if A[j]!=0:
        count+=1
        B.append(A[j])
if len(B)==0:
    print(10*(sum(S)+count))
else:
    print(10*(sum(S)+count-1)+min(B))

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
T=[a,b,c,d,e]
A=list(map(lambda x:x%10,T))
S=list(map(lambda y:y//10,T))
count=0
B=[]
for j in range(5):
    if A[j]!=0:
        count+=1
        B.append(A[j])
if len(B)==0:
    print(10*(sum(S)+count))
else:
    print(10*(sum(S)+count-1)+min(B))

Submission status: Accepted

Solution code:
from math import ceil
time_setting = []
for _ in range(5):
    time_setting.append(int(input()))

ones_place = [i % 10 if i % 10 != 0 else 10 for i in time_setting]
ans = 0
for time in time_setting:
        ans += ceil(time / 10) * 10

ans -= 10 - min(ones_place)  
print(ans)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
  a.append(int(input()))
b = [i%10 for i in a]
c = [9 if i == 0 else i for i in b]
last = c.index(min(c))
fin = a[last]
del a[last]
del b[last]
d = [a[i] - b[i] if b[i] == 0 else a[i]-b[i] + 10 for i in range(4)]
print(sum(d)+ fin)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
n=0
ans =0
for x in a:
  if x % 10 !=0:
    t = 10 -x%10
  else:
    t=0
  n=max(n,t)
  ans +=x+t
print(ans-n)

Submission status: Accepted

Solution code:
a,b,c,d,e=[int(input()) for i in range(5)]
import math
A,B,C,D,E=[math.ceil(a/10),math.ceil(b/10),
math.ceil(c/10),math.ceil(d/10),math.ceil(e/10)]
x=[a%10,b%10,c%10,d%10,e%10]
m=0 
while m<=4:
 if x[m]==0:
  x[m]=x[m]+10
  m=m+1
 else:
  x[m]=x[m] 
  m=m+1
d=min(x)

print(int((A+B+C+D+E)*10-10+d))

Submission status: Accepted

Solution code:
import numpy as np

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


a=0
for h in ls:
    if h%10 == 0:
        pass
    else:
        re =(h//10+1)*10-h
        if re>=a:
            a = re


time = 0
for i in ls:
    if i%10 == 0:
        time += i
    else:
        time += (i//10+1)*10

time -= a
print(time)

Submission status: Accepted

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

n = 0
ans = 0

for i in l:
    if i % 10 != 0:
        t = 10 - i % 10
    else:
        t = 0
    ans += i + t
    n = max(n, t)

print(ans - n)

Submission status: Accepted

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

ans = 0
temp = [a,b,c,d,e]
min_list = 1<<50
min_index = 0
judge = True

for i in range(5):
    if (temp[i]%10) != 0:
        min_list = min(temp[i]%10,min_list)
    # print(min_list)
# print()
for i in temp:
    if i % 10 == 0:
        ans += i
    else:
        if (i % 10 == min_list) and judge:
            ans += i
            judge = False
        else:
            ans += ((i//10)+1)*10
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calculation(time_array):
    first_values = [i % 10 if i % 10 != 0 else i for i in time_array]
    minlocation = first_values.index(min(first_values))
    last_order = time_array.pop(minlocation)
    order_time = [i if i % 10 == 0 else int(i /10) * 10 + 10 for i in time_array]
    return sum(order_time) + last_order

if __name__ == "__main__":
    receipe_time = [int(input()) for i in range(5)]
    # receipe_time = [23, 60, 78, 42, 89]
    print(calculation(receipe_time))

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
l = [i*(-1)//10*10*(-1) for i in L]
l1 = [i%10 for i in L]
l2 = sorted(list(set(l1)))
if l2[0] == 0:
  if len(l2) == 1:
    print(sum(L))
  else:
    print(sum(l)-l[l1.index(l2[1])]+L[l1.index(l2[1])])
else:
  print(sum(l)-l[l1.index(l2[0])]+L[l1.index(l2[0])])

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
n = 0
ans = 0
for x in a:
  if x % 10 != 0:
    t = 10 - x % 10
  else:
    t = 0
  ans += x + t
  n = max(n,t)
print(ans-n)

Submission status: Accepted

Solution code:
def firstdigit(i):
    r = i%10
    return 10 if r==0 else r
food = []
for s in range(5):
    food.append(int(input()))
food=sorted(food,key=firstdigit)
sum=food.pop(0)
for s in food:
    sum+=s-s%10+10 if s%10!=0 else s
print(sum)

Submission status: Accepted

Solution code:
import math
def firstdigit(i):
    r = int(round((float(i)/10-math.floor(float(i)/10))*10))
    return 9 if r==0 else r
food = []
for s in range(5):
    food.append(int(input()))
food=sorted(food,key=firstdigit)
sum=food.pop(0)
for s in food:
    sum+=int(round(math.ceil(float(s)/10)*10))
print(sum)

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 123
# https://atcoder.jp/contests/abc123
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    abcde = ii2nn(5)
    n = 0
    modmin = 10
    for t in abcde:
        n += t
        mod = t % 10
        if mod != 0:
            n += 10 - mod
            if mod < modmin:
                modmin = mod
    if modmin != 10:
        n -= 10 - modmin
    print(n)

main()

Submission status: Accepted

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

b = [(10 - (int(a[i]) % 10)) % 10 for i in range(5)]

cnt = b.count(max(b))
pass_cnt = 0
sum = 0
sum2 = 0
del_cnt = 0
for i in range(5):
    if max(b) == b[i]:
        pass_cnt += 1
        sum2 += a[i]+b[i]
        del_cnt = b[i]
    else:
        sum += a[i]+b[i]
#        print("sum:{}".format(sum))

print(sum+sum2-del_cnt)

Submission status: Accepted

Solution code:
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0.append(ceil(time_list[i] / 10) * 10)
for j in range(5):
    if time_list[j] % 10 == 0:
        sum_list.append(sum(time_list_0))
    else:
        sum_list.append(sum(time_list_0) - 10 + (time_list[j] % 10))
print(min(sum_list))

Submission status: Accepted

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

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    ans += x + t
    n = max(n, t)
    
print(ans - n)

Submission status: Accepted

Solution code:
a = 0
c = 9
for i in range(5):
    b = int(input())
    a += ((b - 1) // 10 + 1) * 10
    c = min((b - 1) % 10,c)
print(a - 9 + c)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=[k for k in [a%10,b%10,c%10,d%10,e%10] if k>0]
if s==[]:
  t=0
else:
  t=min(s)
ans = (a//10+(a%10!=0))*10+(b//10+(b%10!=0))*10+(c//10+(c%10!=0))*10+(d//10+(d%10!=0))*10+(e//10+(e%10!=0))*10+(s!=[])*(-10+t)
print(ans)

Submission status: Accepted

Solution code:
x=list(map(int,open(0).read().split()))
y=[i%10 for i in x]
x=[(i+10-1)//10*10 for i in x]

m=10
for i in y:
    if i!=0 and m>i:
        m=i

print(sum(x)-(10-m))

Submission status: Accepted

Solution code:
a=[]
for i in range(0,5):
  a.append(int(input()))
s=0
import math
for i in a:
  s=s+(math.ceil(i/10))*10
x=10
for i in a:
  if i%10==0:
    pass
  elif i%10<x:
    x=i%10
print(s-10+x)

Submission status: Accepted

Solution code:
T = [int(input()) for i in range(5)]
U = [(t+10-1)//10*10 for t in T]
ans = 10000
for i in range(5):
  tmp = sum(U) - U[i] + T[i]
  ans = min(ans,tmp)
print(ans)

Submission status: Accepted

Solution code:
ans = 0
ans2 = 0
min3 = 10
for _ in range(5):
    _num = int(input())
    ans += _num // 10 * 10
    if _num % 10 > 0:
        ans2 += 1
        if min3 > _num % 10:
            min3 = _num % 10
if ans2 > 0:
    ans += (ans2 - 1) * 10 + min3 
print(ans)

Submission status: Accepted

Solution code:
A = input()
B = input()
C = input()
D = input()
E = input()
total = 0
last = 0

for i in [A, B, C, D, E]:
  if i[-1] == '0':
    total += int(i)
  else:
    total += int(i[0:-1] + '0') + 10
    if last < (10 - int(i[-1])):
      last = 10 - int(i[-1])

print(total-last)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a%10==0:
    a_q=a
else:
    a_q=(a//10+1)*10
if b%10==0:
    b_q=b
else:
    b_q=(b//10+1)*10
if c%10==0:
    c_q=c
else:
    c_q=(c//10+1)*10
if d%10==0:
    d_q=d
else:
    d_q=(d//10+1)*10
if e%10==0:
    e_q=e
else:
    e_q=(e//10+1)*10

r=[i for i in [a%10,b%10,c%10,d%10,e%10]  if i%10!=0]
if r==[]:
    r_min=10
else:
    r_min=min(r)

ans=a_q+b_q+c_q+d_q+e_q-10+r_min
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

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

sum = 0
div = 10
for i in l:
    if i % 10 != 0:
        sum += i + 10 - (i % 10)
        if i % 10 < div:
            div = i % 10
    else:
        sum += i

if div != 10:
    sum += div - 10

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

ABCDE.sort(key=lambda x: (int(str(x)[-1])-1)%10)

print(ABCDE[0] + sum(-(-x//10)*10 for x in ABCDE[1:]))

Submission status: Accepted

Solution code:
times=[]
for i in range(5):
  times.append(int(input()))
rem=9
sum=0
count=False
for i in range(5):
  if times[i]%10==0:
    sum+= times[i]
  else:
    sum+= (times[i]//10)*10+10
    rem=min(rem,times[i]%10)
    count=True
if count:
  rem-=10
else:
  rem=0
print(sum+rem)

Submission status: Accepted

Solution code:
abcde = []
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))

min_remainder_index = -1
for i in range(len(abcde)):
    remainder = abcde[i] % 10
    if remainder != 0:
        if min_remainder_index == -1:
            min_remainder_index = i
        elif abcde[min_remainder_index] % 10 > remainder:
            min_remainder_index = i

sum = 0
for i in range(len(abcde)):
    if i == min_remainder_index:
        sum += abcde[i]
    elif abcde[i] % 10 == 0:
        sum += abcde[i]
    else:
        sum += abcde[i] + (10-abcde[i] % 10)
print(sum)

Submission status: Accepted

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

a = []
b = []
time = 0
for i in range(5):
    a.append(int(input()))
for i in range(5):
    b.append(a[i]%10)
    if a[i]%10 != 0:
        a[i] = (a[i]//10 + 1) * 10
    else:
        b[i] = 10
    time += a[i]
b.sort(reverse=True)
time = time - (10-b[4])
print(time)

Submission status: Accepted

Solution code:
from sys import stdin
import math
A = [int(x) for x in stdin.readlines()]
B = [math.ceil(x/10)*10-x for x in A]
print (sum(A+B) - max(B))

Submission status: Accepted

Solution code:
from math import ceil
arr = [int(input()) for _ in range(5)]

tmp = 10
s = 0
for a in arr:
    s += int(ceil(a / 10) * 10) 
    if 0 < a % 10 < tmp:
        tmp = a % 10
print(s - (10 - tmp))

Submission status: Accepted

Solution code:
import numpy as np
l = []
for _ in range(5):
    l.append(int(input()))
l = np.array(l)
l_rem = l%10
l_rem = np.where(l_rem==0, 10, l_rem)
l = l[np.argsort(l_rem)]
j = 0
for i in reversed(l[1:]):
    tmp = i//10
    if i%10 != 0:
        tmp += 1
    j += tmp
print(10*j+l[0])

Submission status: Accepted

Solution code:
dishes_1 = [int(input()) for i in range(5)]
dishes_2 = [i % 10 for i in dishes_1]
dishes_sort = []

min_time = 0

for i in range (5):
    if dishes_2[i] == 0:
       dishes_sort.append(dishes_1[i])

for i in range (9, 0, -1):
    for j in range (5):
        if dishes_2[j] == i:
            dishes_sort.append(dishes_1[j])

for i in range (4):
    for j in range (9):
        if dishes_sort[i] % 10 == 0:
           break
        else:
            dishes_sort[i] += 1
            
print (sum(dishes_sort))

Submission status: Accepted

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

time1 = sum(al)

time2 = list(map(lambda x: (10 - (x % 10)) % 10, al))
time2.sort()

print(time1 + sum(time2[0:4]))

Submission status: Accepted

Solution code:
time = 0
m = 10
for i in range(5):
    i2 = input()
    if m > int(i2[-1]) and int(i2[-1]) != 0:
        m = int(i2[-1])
    time += ((int(int(i2) / 10) + 1) * 10) if int(i2) % 10 != 0 else int(i2) 
time = time - 10 + m
print(time)

Submission status: Accepted

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

q=[] #quotient
r=[] #reminder
count0=0 #余りが0の時を検出
for i in S:
  j, k= divmod(i, 10)
  q.append(j)
  if k==0:
    count0+=1
  else:
    r.append(k)

# sum(q)*10→商をベースに基本値を算出
# 10*(4-count0)→余り分の待ち時間を算出。ただし、余り0の場合には待ち時間なし
# min(r)→最も余りが短い料理を最後に注文する
# 最初、すべてが0になる場合を想定できていなかったので、REになった
if count0==5:
  print(sum(S))
else:
  print(sum(q)*10+10*(4-count0)+min(r))

Submission status: Accepted

Solution code:
def maxtime(x):
    return int(((x + 9) / 10)) * 10
ct = []

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

print(sum([maxtime(i) for i in ct]) - max([maxtime(i) -  i for i in ct]))

Submission status: Accepted

Solution code:
def ceil(x):
    ans = x
    while ans % 10 != 0:
        ans += 1
    return ans

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

time_list = [a, b, c, d, e]
time_list.sort(key=lambda x: ceil(x) - x)

ans = 0
for i in range(len(time_list)-1):
    ans += ceil(time_list[i])
ans += time_list[-1]
print(ans)

Submission status: Accepted

Solution code:
a = input()[::-1]
b = input()[::-1]
c = input()[::-1]
d = input()[::-1]
e = input()[::-1]

total = 0

menu_list = []

menu_list.append(a)
menu_list.append(b)
menu_list.append(c)
menu_list.append(d)
menu_list.append(e)

menu_list2 = []

for i in range(len(menu_list)):
    if menu_list[i][:1] == '0':
        total += int(menu_list[i][::-1])
    else:
        menu_list2.append(menu_list[i])

menu_list2.sort()
menu_list2.reverse()

menu_time = 0

j = 0

for menu2 in menu_list2:
    menu_time = int(menu2[::-1])

    if j == len(menu_list2)-1:
        total += menu_time
    else:
        total += menu_time + 10 - menu_time % 10

    j += 1

print(total)

Submission status: Accepted

Solution code:
import sys
import math

def main():
    input = sys.stdin.readline
    
    L = [int(input()) for i in range(5)]
    
    #最後の注文を決める
    last_orders = [10 - (i % 10) for i in L if i % 10 != 0]
    last_order = 0 if not last_orders else max(last_orders)
    
    #一の位を切り上げ
    all_order = sum([math.ceil(i / 10) * 10 for i in L])
    
    print(all_order - last_order)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
num_list = [int(input()) for i in range(5)]
 
remains = []
divs = []
 
for num in num_list:
    remains.append(num % 10)
    divs.append(num // 10)
 
zeros = remains.count(0)
 
for i in range(remains.count(0)):
    remains.remove(0)
 
if len(remains) == 0:
    print(sum(divs) * 10)
else:
    print(sum(divs) * 10 + 40 - zeros * 10 + min(remains))