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:
import math
import itertools

def imagine_time(order):
    time = 0
    for o in order[:-1]:
        time += math.ceil(dishes[o] / 10 ) * 10
    time += dishes[order[-1]]
    return time

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
dishes = [A, B, C, D, E]

ans = 99999
orders = list(itertools.permutations([0, 1, 2, 3, 4]))
for order in orders:
    ans = min(ans, imagine_time(order))
print(ans)

Submission status: Accepted

Solution code:
import itertools

def hoge(lst):
    n = 0
    for x in list(lst[0:4]):
        n += x
        if n % 10 != 0:
            n = n + (10 - (n % 10))
    return n + lst[4]

lst = [int(input()) for _ in range(5)]
lst = list(itertools.permutations(lst))
ret = 100000000
for x in lst:
    ret = min(ret, hoge(x))

print(ret)

Submission status: Accepted

Solution code:
cooktimes = [int(input()) for i in range(5)]
intervals = [0 if x % 10 == 0 else 10 - (x % 10) for x in cooktimes]
alist = []
for i in range(5):
    alist.append(tuple([cooktimes[i], intervals[i]]))
alist.sort(key=lambda x: x[1])
ans = 0
for i in range(4):
    ans += alist[i][0] + alist[i][1]
ans += alist[4][0]
print(ans)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
num = [a,b,c,d,e]
def rou(num):
    return math.ceil(num/10) * 10
RR = list(map(rou, num))
def ama(num):
    t = num % 10
    if t == 0:
        return 10
    else:
        return t
tmp = list(map(ama, num))
ind = tmp.index(min(tmp))
RR.remove(RR[ind])
print(num[ind] + sum(RR))

Submission status: Accepted

Solution code:
li2 = []
c = 0
for i in range(5):
  a = int(input())
  li2.append((a-1)%10+1)
  c += (a-1)//10+1
li2.sort()        
print(c*10+li2[0]-10)

Submission status: Accepted

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

menu = sorted(menu, key = lambda x: x%10 if x%10 != 0 else 10, reverse = True)
#print(menu)
time = 0
for i in range(4):
  time +=  menu[i] if menu[i]%10 == 0 else 10 * (menu[i] // 10 + 1)

time += menu[4]

print(time)

Submission status: Accepted

Solution code:
listA = [int(input()) for _ in range(5)]
listB = [(10 - (_ % 10)) % 10 for _ in listA]

idx = listB.index(max(listB))
time = 0

for i, data in enumerate(listA):
    if i == idx:
        continue
    else:
        if data % 10 == 0:
            time += data
        else:
            time += ((data // 10) + 1) * 10

time += listA[idx]
print(time)

Submission status: Accepted

Solution code:
a=[]
for i in range(5):
    a.append(int(input()))
b=set(map(lambda x: x%10,a))
if 0 in b:
    b.remove(0)
    if len(b) == 0:
        b.add(10)
print(sum(map(lambda x:(x/10+1)*10 if x%10 != 0 else (x/10)*10,a))+min(b)-10)

Submission status: Accepted

Solution code:
import itertools as it
l = []
for i in range(5):
    l.append(int(input()))
anss = []
def calcTime(ls):
    time = 0
    count = 0
    for i in ls:
        count += 1
        time += l[i]
        if count == 5:
            break
        if time % 10 != 0:
            time += 10 - (time % 10)
    anss.append(time)
perm = it.permutations(range(5),5)
lperm = list(perm)
for tup in lperm:
    calcTime(list(tup))
print(min(anss))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
import itertools
menu=[a,b,c,d,e]
menu_p = list(itertools.permutations(menu))

min = 10000000000
for list in menu_p:
    total = 0
    for i in range(len(list)):
        if i == len(list)-1 or list[i] % 10 == 0:
            total += list[i]
        else:
            total += list[i] + (10 - list[i]%10)
    if min > total:
        min = total
print(min)

Submission status: Accepted

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

a=10-(A%10)
b=10-(B%10)
c=10-(C%10)
d=10-(D%10)
e=10-(E%10)
if a==10:
  a=0
if b==10:
  b=0
if c==10:
  c=0
if d==10:
  d=0
if e==10:
  e=0
SUM=max(a,b,c,d,e)
print(A+B+C+D+E+a+b+c+d+e-SUM)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
b = [n for n in a if n % 10 == 0]  # 余り0
c = [n for n in a if n % 10 > 0]  # 余り0でない

res = sum(b)
if c:  # not empty
    r = min(n % 10 for n in c)
    res += sum((n // 10 + 1) * 10 for n in c) - 10 + r

print(res)

Submission status: Accepted

Solution code:
import numpy as np

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

list_ = np.array([a, b, c, d, e])

list_mod = (list_-1) % 10

min_factor = np.argmin(list_mod)
Total =  0

for i, var in enumerate(list_):
  if i == min_factor or var % 10 == 0:
    Total += var
  else:
    Total += var + 10 - (var % 10)
    
print(Total)

Submission status: Accepted

Solution code:
time = []
iti = 10
idx = -1
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        if y < iti:
            iti = y
            idx = i
    time.append(x)

sum = 0


for i in range(5):

    if i != idx and time[i] % 10 != 0:
        sum += time[i] + (10 - time[i]%10)
    else:
        sum += time[i]

print(sum)

Submission status: Accepted

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

aa = a % 10
bb = b % 10
cc = c % 10
dd = d % 10
ee = e % 10

cnt = 0

aaa = 10
bbb = 10
ccc = 10
ddd = 10
eee = 10
if aa != 0:
    cnt += 10
    aaa = aa
if bb != 0:
    cnt += 10
    bbb = bb
if cc != 0:
    cnt += 10
    ccc = cc
if dd != 0:
    cnt += 10
    ddd = dd
if ee != 0:
    cnt += 10
    eee = ee

if cnt > 0:
    cnt = cnt - 10
mmm = min([aaa, bbb, ccc, ddd, eee])
if mmm == 10:
    mmm = 0

print(a - aa + b - bb + c - cc + d - dd + e - ee + cnt + mmm)

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(5)]
a = 0
s = 0
for l in A:
  b = -(-l // 10) * 10
  s += b
  c = b - l
  if a < c:
    a = c
print(s-a)

Submission status: Accepted

Solution code:
arr=[]
for i in range(5):
	t=int(input())
	arr.append(t)
ans=0
arr2=[]
for i in range(5):
	if(arr[i]%10==0):
		ans+=arr[i]
	else:
		ans+=((arr[i]//10)+1)*10
		arr2.append(arr[i]%10)
if(len(arr2)>0):
	ans-=10
	ans+=min(arr2)
print(ans)

Submission status: Accepted

Solution code:
li = list()
for i in range(5):
  li.append(int(input()))

lili = list()
  
for i in li:
  num = list(map(int, str(i)))
  if num[-1] == 0:
    num[-1] = 10
  lili.append(num[-1])

index = lili.index(min(lili))
ans = 0
for i, l in enumerate(li):
  if i == index:
    ans += l
  else:
    ans += l
    ans += 10-lili[i]

print(ans)

Submission status: Accepted

Solution code:
X = [input() for _ in range(5)]
endzero = 0
elesnum = []
for x in X:
  if x[-1] == "0":
    endzero += int(x)
  else:
    elesnum.append(x)
if elesnum:
  elesnum.sort(key = lambda x: x[-1])
  min_ = int(elesnum[0])
  for e in elesnum[1:]:
    endzero += (int(e)//10+1)*10
  print(endzero+min_)
else:
  print(endzero)

Submission status: Accepted

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

dish_list = [a, b, c, d, e]
min_val = 100
idx = 0
for i, x in enumerate(dish_list):
    if x%10 == 0:
        continue
    val = x % 10
    if val < min_val:
        min_val = val
        idx = i

ans = 0
for i, dish in enumerate(dish_list):
    if i == idx:
        continue

    wait_order =  10 - dish_list[i]%10 if dish_list[i]%10 != 0 else 0

    ans += dish_list[i] + wait_order

print(ans + dish_list[idx])

Submission status: Accepted

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

a1 = a % 10
b1 = b % 10
c1 = c % 10
d1 = d % 10
e1 = e % 10

if a1 == 0:
  a1 = 10
if b1 == 0:
  b1 = 10
if c1 == 0:
  c1 = 10
if d1 == 0:
  d1 = 10
if e1 == 0:
  e1 = 10

a2 = a - a1 + 10
b2 = b - b1 + 10
c2 = c - c1 + 10
d2 = d - d1 + 10
e2 = e - e1 + 10

ans = a2 + b2 + c2 + d2 + e2 - 10 + min(a1, b1, c1, d1, e1)

print(ans)

Submission status: Accepted

Solution code:
time_list=[]
rest_time_list=[]
rest_time=0
rest_mene=0
for i in range(5):
    time = int(input())
    time_list.append(time)
    iti=str(time)[-1]
    if int(iti)!=0:
        rest_time_list.append(10-int(iti))
        if rest_time<10-int(iti):
            rest_time=10-int(iti)
            rest_mene=i
    else:
        rest_time_list.append(0)
print(sum(time_list)+sum(rest_time_list)-rest_time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list()
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
sum = 0
min = 10
for i in range(0, 5):
	if a[i] % 10 == 0:
		a[i] = a[i] - 10
	else:
		if a[i] % 10 < min:
			min = a[i] % 10
	a[i] = a[i] - a[i] % 10
	sum = sum + a[i]
sum = sum + min + 40
print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8

def main():
    time = []
    time_zero = []
    for i in range(5):
        temp = int(input())
        if temp%10 == 0:
            time_zero.append(temp)
        else:
            time.append([temp,temp%10])
    sort_list = sorted(time, key=lambda x:x[1],reverse=True)

    # print(sort_list)
    ans = 0
    
    for i in time_zero:
        ans += i    
    for i in sort_list:
        if ans > 0 and ans%10 > 0:
            ans +=  (10 - ans%10)
        ans += i[0]
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math


def solve(lines):
    lines = [int(x) for x in lines]

    rem = [l % 10 if l % 10 != 0 else 10 for l in lines]
    rem_min = min(rem)
    idx = None
    for i, l in enumerate(rem):
        if l == rem_min:
            idx = i

    last = lines.pop(idx)

    lines = [math.ceil(l / 10) * 10 for l in lines]
    result = sum(lines) + last
    print(result)


if __name__ == '__main__':
    lines = sys.stdin.read()
    lines = lines.strip().split('\n')
    solve(lines)

Submission status: Accepted

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

dec = 0
m = 10
for a in A:
    dec += a // 10
    if a % 10 > 0:
        dec += 1
        m = min(m, a % 10)
print(10 * (dec - 1) + m)

Submission status: Accepted

Solution code:
from sys import stdin
import itertools
#print('permutations(range(4))   : ', list(itertools.permutations(range(4) ) ) )

foods = [int(input()) for i in range(5)]
orders = list(itertools.permutations(range(5)))
mintime = 1111111111
ordertime = 0
nowtime = 0
for i in orders:
    ordertime = 0
    l = list(i)
    #print(l)
    ordertime += foods[l[0]]
    for j in range(1, 5):
        #print(ordertime)
        if ordertime%10 == 0:
            ordertime+= foods[l[j]]
        else:
            while ordertime%10 !=0:
                ordertime += 1
            ordertime+=foods[l[j]]
    if mintime > ordertime:
        mintime = ordertime

print(mintime)

Submission status: Accepted

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

at = -(-a//10)*10
bt = -(-b//10)*10
ct = -(-c//10)*10
dt = -(-d//10)*10
et = -(-e//10)*10

aa = a % 10
ba = b % 10
ca = c % 10
da = d % 10
ea = e % 10

array = (aa, ba, ca, da, ea)
minn = aa
for i in array:
    if (i != 0 and minn > i):
        minn = i
test = array.index(minn)

if (test == 0):
    time = a + bt + ct + dt + et
elif (test == 1):
    time = at + b + ct + dt + et
elif (test == 2):
    time = at + bt + c + dt + et
elif (test == 3):
    time = at + bt + ct + d + et
elif (test == 4):
    time = at + bt + ct + dt + e

print(time)

Submission status: Accepted

Solution code:
T = []
for i in range(5):
  t = int(input())
  T.append([t % 10, t])
T.sort()
ans = 0
flag = 0
for i in range(5):
  if T[i][0] == 0:
    ans += T[i][1]
  else:
    if flag == 0:
      ans += T[i][1]
      flag =1
    else:
      ans += ((T[i][1] // 10) + 1) * 10
print(ans)

Submission status: Accepted

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

last = min([10 if x % 10 == 0 else x % 10 for x in i])
s = 0
for x in i:
    if x % 10 == 0:
        s += x
    else:
        s += (int(x / 10) + 1) * 10
s = s + last - 10
print(str(s))

Submission status: Accepted

Solution code:
# coding: utf-8
d=sorted([int(input()) for i in range(5)],key=lambda x:(x-1)%10)
m=0
for i in range(1,5):
    d[i]=d[i] if d[i]%10==0 else int((d[i]+10)//10*10)
print(sum(d))

Submission status: Accepted

Solution code:
import itertools
import math

A = []
for i in range(5):
    A.append(float(input()))

B = list(itertools.permutations(A))
M = 500 * 5
for i in range(120):
    c = 0
    for j in range(4):
        c += math.ceil(B[i][j]/10) * 10
    c += B[i][4]
    M = min(M, c)
print(int(M))

Submission status: Accepted

Solution code:
import math
import sys

def main():
    a = []
    s = 0
    for _ in range(5):
        n = int(input())
        a.append(n)
        s += math.ceil(n/10)*10
    ans = sys.maxsize
    for n in a:
        ans = min(ans,s - math.ceil(n/10)*10 + n)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

last = F[0]
for i in F:
    if i % 10 < last % 10 and i % 10 != 0:
        last = i
ans = 0
for i in F:
    ans = ans + math.ceil(i/10)*10

ans = ans - math.ceil(last/10)*10 + last

print(ans)

Submission status: Accepted

Solution code:

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

count=0
if A%10!=0:
    A1=A-A%10+10
else:
    A1=A
if B%10!=0:
    B1=B-B%10+10
else:
    B1=B
if C%10!=0:
    C1=C-C%10+10
else:
    C1=C
if D%10!=0:
    D1=D-D%10+10
else:
    D1=D
if E%10!=0:
    E1=E-E%10+10
else:
    E1=E


total=[]

total+=[A1+B1+C1+D1+E]
total+=[A1+B1+C1+E1+D]
total+=[A1+B1+D1+E1+C]
total+=[A1+C1+D1+E1+B]
total+=[B1+C1+D1+E1+A]


print(min(total))

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())
oreder_time = np.array([a,b,c,d,e])
next_oreder_time = np.ceil(oreder_time/10)*10

print(int(np.sum(next_oreder_time)-np.max(next_oreder_time-oreder_time)))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def f(x):
  return -(-x // 10) * 10
def g(x):
  return (x-1) % 10 + 1
ans = sum(f(i) for i in [a,b,c,d,e])
mi = min(g(i) for i in [a,b,c,d,e])
ans += mi - 10
print(ans)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
mod = []
for d in a:
    mod.append(d %10)
for i in range(5):
    for j in range(13):
        if j*10< a[i] <=( j+1)*10:
            a[i] = (j+1) *10

m = 10
for i in mod:
    if i != 0 and i <=m:
        m = i

print((sum(a) - (10 - m)))

Submission status: Accepted

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

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

sum = 0

f = 0
for i in range(1,10):
    if f == 0:
        for j in list:
            if j%10 == i:
                sum += j
                list.remove(j)
                f = 1
                break
        
for i in list:
    if i % 10 == 0:
        sum += i
    else:
        sum += i + 10 - (i % 10)

print(sum)

Submission status: Accepted

Solution code:
l=[]
for i in range(5):
    l.append(int(input()))
tl=[]
for i in range(5):
    tl.append(l[i]%10)
nl=[]
for i in range(5):
    if l[i]%10==0:
        nl.append(l[i])
    else:
        nl.append((l[i]//10+1)*10)
ctr=0
a=tl[:]
a.sort()
for i in range(5):
    if a[i]>0:
        ctr=a[i]
        break
if a==[0,0,0,0,0]:
    print(sum(nl))
else:
    print(sum(nl)-10+ctr)

Submission status: Accepted

Solution code:
L=[]
L2=[]
for i in range(5):
    I=int(input())
    L.append(I)
    L2.append(I%10)

result=0
for i in L:
    result+=i
    if result%10==0:
        continue
    for j in range(10):
        result+=1
        if result%10==0:
            break

if max(L2)==0:
    print(sum(L))
else:
    if min(L2)==0:
        for t in sorted(L2):
            if t==0:
                pass
            else:
                mn=t
                break
    else:
        mn=min(L2)

    print(result-(10-mn))

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
A = [[] for i in range(10)]
ans = 0
for i in range(len(L)) :
    A[L[i] % 10].append(L[i])
cnt = 0
ans = 0
ans += sum(A[0])
cnt += len(A[0])
A.pop(0)
A = list(reversed(A))
for i in range(len(A)) :
    for j in range(len(A[i])) :
        ans += A[i][j]
        if cnt != 4 :
            ans += 10 - (A[i][j] % 10)
            cnt += 1
print(ans)

Submission status: Accepted

Solution code:
li = []

a = 10

for i in range(5):
    x = input()
    if int(x[-1]) == 0:
        li.append(int(x))
    else:
        if int(x[-1]) < a:
            a = int(x[-1])
        x = x[:-1] + "0"
        x = int(x) + 10
        li.append(x)

if a == 10:
    a = 0

if a:
    print(sum(li) - 10 + a)
else:
    print(sum(li))

Submission status: Accepted

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

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

l = [a,b,c,d,e]
if len([i for i in l if i != 0]) == 0:
    m = 10
    
else:
    m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10 -10
print(ans)

Submission status: Accepted

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

def cost(min):
    if min % 10 == 0:
        return min
    else:
        return min - (min % 10) + 10

def min_extra(t, now):
    e = t % 10
    if e == 0:
        return now
    if e < now:
        return e
    else:
        return now

extra = A % 10
extra = min_extra(B, extra)
extra = min_extra(C, extra)
extra = min_extra(D, extra)
extra = min_extra(E, extra)

sum = cost(A)
sum += cost(B)
sum += cost(C)
sum += cost(D)
sum += cost(E)
if extra != 0:
    sum -= (10 - extra)

print(sum)

Submission status: Accepted

Solution code:
import math

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

last_order_index = None
last_order_time = 10
for i, cooking_time in enumerate(cooking_times):
    ones_place = int(str(cooking_time)[-1])
    if last_order_time > ones_place != 0:
        last_order_time = ones_place
        last_order_index = i

time = 0
for i, cooking_time in enumerate(cooking_times):
    if i == last_order_index:
        time += cooking_time
    else:
        time += int(math.ceil(cooking_time / 10) * 10)

print(time)

Submission status: Accepted

Solution code:
a = [0] * 5
a_kuriage = [0] * 5
min_waste = 10
for i in range(5):
    a[i] = int(input())
    if a[i] % 10 != 0:
        a_kuriage[i] = a[i] + 10 - a[i] % 10
        if a[i] % 10 < min_waste:
            min_waste = a[i] % 10
    else:
        a_kuriage[i] = a[i]

print(sum(a_kuriage) - 10 + min_waste)

Submission status: Accepted

Solution code:
"""
python3 main.py < input.txt
"""
import math
a=float(input())
b=float(input())
c=float(input())
d=float(input())
e=float(input())
l=[a, b, c, d, e]
l.sort(key=lambda x: (x+9)%10)
t=0
for x in l[1:]:
    t += math.ceil(x/10)*10
print(int(t+l[0]))

Submission status: Accepted

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

b = 0
d = 0
C = []
for i in range(5):
    if A[i]%10 != 0:
        C.append(10-(A[i]%10))
        if b < 10-(A[i]%10):
            b = 10-(A[i]%10)
            d = i

ans = sum(A)+sum(C)-b



print(ans)

Submission status: Accepted

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

for x in lis:
    if x%10 == 0:
        ans_fla_lis.append(0)
    else:
        ans_fla_lis.append(10-(x%10))
axo = ans_fla_lis.pop(ans_fla_lis.index(max(ans_fla_lis)))
print(sum(lis) + sum(ans_fla_lis))

Submission status: Accepted

Solution code:
min_ = 10
ans = 0

for _ in range(5):
    t = int(input())
    a = t // 10
    b = t % 10
    if b == 0:
        ans += a * 10
    else:
        ans += (a + 1) * 10
        min_ = min(min_, b)

print(ans - 10 + min_)

Submission status: Accepted

Solution code:
func = lambda x: x if x != 0 else 10 

ct_list = [int(input()) for _ in range(5)]
ct_surp = [func(ct%10) for ct in ct_list]

argmin = sorted(list(enumerate(ct_surp)),key=lambda x:x[1])[0][0]

total_time = 0

for i,ct in enumerate(ct_list):
  if i == argmin:
    continue
  total_time += ct + (10-ct_surp[i]) if ct_surp[i] < 10 else ct

total_time += ct_list[argmin]

print(total_time)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
mod_list = []
for i in l:
  mod_list.append((i-1)%10)
last = l.pop(mod_list.index(min(mod_list)))
s = 0
for i in l:
  s += ((i-1)//10 + 1) * 10
s += last
print(s)

Submission status: Accepted

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

l = [a,b,c,d,e]
cost = [(10 - (i%10))%10 for i in l]
time = []
idx = cost.index(max(cost))
for i in range(len(l)):
    if i == idx:
        time.append(l[i])
    else:
        time.append(l[i]+cost[i])
print(sum(time))

Submission status: Accepted

Solution code:
costs = []
for i in range(5):
    costs.append(int(input()))
    
waits = []
for cost in costs:
    waits.append((10 - (cost % 10))%10)

time = 0
for i in range(5):
    time += (costs[i] + waits[i])

print(time - max(waits))

Submission status: Accepted

Solution code:

times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)

if len(tmp) == 0:
    tmp = [0]

yobun = min(tmp)
if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)

Submission status: Accepted

Solution code:
L= list(map(int,[input() for i in range(5)]))
res = 10
res2 = 0
M = []
ans = 0
for i in range(5):
    if L[i] % 10 != 0:
        M.append(10 - L[i] % 10)
        if res > L[i] % 10:
            res = L[i] % 10
            res2 = 10 - L[i] % 10
    else:
         M.append(0)
for i in range(5):
    ans += L[i]+M[i]

ans -= res2
print(ans)

Submission status: Accepted

Solution code:
import math
A=[int(input()) for _ in range(5)]
# A=sum([math.ceil(float(input()) / 10) * 10 for _ in range(5)])
K=0
V=0
for z in A:
  j = math.ceil(float(z) / 10) * 10
  V += j
  if K <= j - z:
    K = j - z
print(V - K)

Submission status: Accepted

Solution code:
x = []
for _ in range(5):
    x.append(int(input()))
t = 0
wt = []
for a in x:
    t += a
    m = a % 10
    if m > 0:
      wt.append(10-m)
if len(wt) > 1:
    wt.sort()
    wt.pop()
    for x in wt:
        t += x
print(t)

Submission status: Accepted

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

A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10

if A == 0:
    A = 10
if B == 0:
    B = 10
if C == 0:
    C = 10
if D == 0:
    D = 10
if E ==0:
    E = 10

MIN = min(A,B,C,D,E)

Af = (a - A) + 10
Bf = (b - B) + 10
Cf = (c - C) + 10
Df = (d - D) + 10
Ef = (e - E) + 10

if A == MIN:
    print( Bf + Cf + Df + Ef + a)
elif B == MIN:
    print(Af + Cf + Df + Ef + b)
elif C == MIN:
    print(Af + Bf + Df + Ef + c)
elif D == MIN:
    print(Af + Bf + Cf + Ef + d)
else:
    print(Af + Bf + Cf + Df + e)

Submission status: Accepted

Solution code:
m = 0
s = 0
for i in range(5):
    t = int(input())
    if t % 10 != 0:
        m = max(10 - (t % 10), m)
        t = ((t // 10) + 1) * 10
    s += t

print(s - m)

Submission status: Accepted

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

m = 0
for i, d in enumerate(data):
    a = 10 - d % 10
    if a == 10:
        a = 0
    m = max(a, m)
    data[i] = d + a
    
print(sum(data) - m)

Submission status: Accepted

Solution code:
import math

array = []
for i in range(5):
    array.append(int(input()))
res = 0
round_array = []
for j in array:
    round_array.append(math.ceil(j /10) * 10)
tmp = 0
for k, l in zip(array, round_array):
    if abs(tmp) < abs(k - l):
        tmp = k - l
res = sum(round_array)
print(res + tmp)

Submission status: Accepted

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

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

least = 100
dish = [A, B, C, D, E]
kiri = []
ans = 1000
for i in dish:
    kiri.append(kiriage(i))
for i in range(5):
    time = sum(kiri) - kiri[i] + dish[i]
    ans = min(ans, time)

print(ans)

Submission status: Accepted

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

A=a % 10
B=b % 10
C=c % 10
D=d % 10
E=e % 10
s=a // 10
t=b // 10
u=c // 10
v=d // 10
w=e // 10

if A == 0:
	A = A + 10
else:
	a = (s + 1) * 10

if B == 0:
	B = B + 10
else:
	b = (t + 1) * 10

if C == 0:
	C = C + 10
else:
	c = (u + 1) * 10

if D == 0:
	D = D + 10
else:
	d = (v + 1) * 10

if E == 0:
	E = E + 10
else:
	e = (w + 1) * 10

m = min([A,B,C,D,E])

if m == 10:
	X = a+b+c+d+e
elif m == A:
	X = b+c+d+e+(s*10+A)
elif m == B:
	X = a+c+d+e+(t*10+B)
elif m == C:
	X = a+b+d+e+(u*10+C)
elif m == D:
	X = a+b+c+e+(v*10+D)
else:
	X = a+b+c+d+(w*10+E)

print(X)

Submission status: Accepted

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

l = []
s = []

for i in range(5):
    l.append(int(input()))
    if l[-1] % 10 > 0:
        s.append( (l[-1] // 10 + 1) * 10 )
    else:
        s.append(l[-1])
        
idx = 0
min_ = 10
for i in range(5):
    x = l[i] % 10
    if min_ > x and x != 0:
        min_ = x
        idx = i

print(sum(s)-s[idx]+l[idx])

Submission status: Accepted

Solution code:
a=[];b=[]
for i in range(5):
    a1 = int(input())
    a.append(a1)
    b.append(a1%10)
sum = 0
for i in range(5):
    if a[i]%10 ==0:
        sum += a[i]
    else:
        sum += a[i] +10 -a[i]%10
c = [i for i in b if not i ==0 ]
if c == []:
    print(sum)
else:
    print(sum-10+min(c))

Submission status: Accepted

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

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

time = 0

for i in ae:
    if i % 10 == 0:
        time += i

ae = [i for i in ae if i % 10 != 0]

if ae:
    idx = 0
    for i in ae:
        time += i
        time += 10 - (i % 10)

    one = []
    for i in ae:
        i = [j for j in str(i)]
        one.append(int(i[-1]))

    print(time-10+min(one))

else:
    print(time)

Submission status: Accepted

Solution code:
dishes = []
for _ in range(5):
    x = int(input())
    dishes.append(x)
        
min_d = dishes[0]
other_dishes = []
for d in dishes[1:]:
    if min_d % 10 > d % 10 and d % 10 != 0:
        other_dishes.append(min_d)
        min_d = d
    else:
        other_dishes.append(d)

ans = 0
for d in other_dishes:
    if d % 10 == 0:
        ans += d
    else:
        ans += (d // 10) * 10
        ans += 10

ans += min_d
print(ans)

Submission status: Accepted

Solution code:
num = []
m = 10
for _ in range(5) :
    n = int(input())
    if n % 10 == 0 :
        num.append(n)
        continue
    num.append(n + 10 - (n % 10))
    m = min(m, n % 10)

print(sum(num) - 10 + m)

Submission status: Accepted

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


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


T = read_col(5, 1)[0]

# 10に丸め込んで、一番最後に小さい値を求めれば良い

ans = 0

for t in T:
    if t % 10 == 0:
        ans += t
    else:
        ans += (t // 10 + 1) * 10

# print(ans)

tmp = [x % 10 for x in T if x % 10 != 0]

if tmp == []:
    ans += 10
else:
    ans += min(tmp)

print(ans-10)

Submission status: Accepted

Solution code:
ans=chk=0
d=[]
for i in range(5):
    x=int(input())
    if x%10:
        d.append((x%10,x))
    else:
        ans+=x
d.sort(reverse=True)
for i in d:
    ans+=((i[1]+10)//10)*10
if len(d): ans-=10-d[-1][1]%10

print(ans)

Submission status: Accepted

Solution code:
import math 

all_list = []

for i in range(5):
  a = int(input())

  all_list.append(a)
  
last_list = [x % 10 for x in all_list if x % 10 > 0]
last_list2 = [x for x in all_list if x % 10 > 0]

if len(last_list) > 0:
  last_x = last_list2[last_list.index(min(last_list))]
  all_list.remove(last_x)
else:
  last_x = 0

sum_list = [math.ceil(x / 10) * 10 for x in all_list]

m = sum(sum_list) + last_x
print(m)