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 itertools import permutations


L = [int(input())for _ in range(5)]
P = []
for _ in range(5):
    P.append(_)

ans = float('inf')
for p in permutations(P):
    now = 0
    for i, a in enumerate(p):
        if i == 4:
            now += L[a]
        else:
            now += ((L[a]-1)//10)*10 + 10

    ans = min(ans, now)

print(ans)

Submission status: Accepted

Solution code:
ans = 0
arr = [int(input()) for _ in range(5)]
ans = float('inf')
maxsum = 0
for i in range(5):
    maxsum += -(-arr[i] // 10) * 10
for i in range(5):
    if maxsum - -(-arr[i] // 10) * 10 + arr[i] < ans:
        ans = maxsum - -(-arr[i] // 10) * 10 + arr[i]
print(ans)

Submission status: Accepted

Solution code:
import math
a = input()
b = input()
c = input()
d = input()
e = input()
l = []
if a[-1] != '0': l.append(a[-1])
if b[-1] != '0': l.append(b[-1])
if c[-1] != '0': l.append(c[-1])
if d[-1] != '0': l.append(d[-1])
if e[-1] != '0': l.append(e[-1])
if l == []:
  print(int(a)+int(b)+int(c)+int(d)+int(e))
else:
  min_l = min(l)
  p = [ a,b,c,d,e ]
  o = []
  len_p = len(p)
  tmp_p = ''
  for i in range(0, len_p):
    if p[i][-1] == min_l:
      tmp_p = int(p.pop(i))
      break
  new_p = 0
  for i in p:
    new_p += math.ceil(int(i)/10)*10
  print(new_p+tmp_p)

Submission status: Accepted

Solution code:
def resolve():
    import itertools
    AE = [int(input()) for _ in range(5)]
    minA = float("inf")
    for ae in itertools.permutations(AE):
        sumA = 0
        for dish in ae:
            if sumA % 10 != 0:
                sumA += 10 - (sumA % 10)
            sumA += dish
        minA = min(minA, sumA)
    print(minA)


resolve()

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
result=0
ans=0
x=10
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: Accepted

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

li=[math.ceil(i/10)*10 for i in l]
temp=[]
for i,j in zip(li,l):
  temp.append(i-j)

print(sum(li)-max(temp))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math
a=[int(input()) for i in range(5)]
aa=[int(math.ceil(i/10)*10) for i in a]
b=0
c=10**5

for i in range(5):
	b=sum(aa)-aa[i]+a[i]
	if b<c:
		c=b
print(c)

Submission status: Accepted

Solution code:
import math

a = [float(input()) for _ in range(5)]
a_ceil = [math.ceil(0.1*a[n])*10 for n in range(len(a))]
a_p10 = [a[n] % 10 for n in range(len(a))]

for i in range(len(a)):
    if a_p10[i] == 0:
        a_p10[i] += 10
last = a_p10.index(min(a_p10))
total = int(sum(a_ceil) - a_ceil[last] + a[last])
print(total)

Submission status: Accepted

Solution code:
import numpy as np

a = list(int(input()) for i in range(5))
b = np.array(a)
c = np.ceil(b/10)*10
d = max(c-b)

print(int(sum(c)-d))

Submission status: Accepted

Solution code:
from itertools import permutations
x = (int(input()) for _ in range(5))
ans = 650
for p in permutations(x, 5):
  tmp = 0
  for i, v in enumerate(p):
    if i != len(p) - 1:
      tmp += (v // 10 + 1) * 10 if v % 10 else v
    else:
      tmp += v
  ans = min(ans, tmp)
  
print(ans)

Submission status: Accepted

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
if len(lib) >= 1:
    total -= 10*(1+b)
else:
    total -= 10*(b)
if len(lib) >= 1:
    total += min(lib)
if total <= 0:
    print(0)
else:
    print(total)

Submission status: Accepted

Solution code:
import math
a=[[0,0] for i in range(5)]
for i in range(5):
    a[i][0]=int(input())
    a[i][1]=abs(10*math.ceil(a[i][0]/10)-a[i][0])
a2=sorted(a,key=lambda x:x[1])
ans=0
for i in range(4):
    ans+=10*math.ceil(a2[i][0]/10)
ans+=a2[4][0]
print(ans)

Submission status: Accepted

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 = 10
print(sum(N)+sum(C)-(10-b))

Submission status: Accepted

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

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

ans = 0
# 時間の合計
total = a+b+c+d+e
# 待機時間
a1 = 10 - a1
b1 = 10 - b1
c1 = 10 - c1
d1 = 10 - d1
e1 = 10 - e1

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

wait = a1+b1+c1+d1+e1 - max(a1,b1,c1,d1,e1)

ans = total + wait
print(ans)

Submission status: Accepted

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

import itertools

ansl=[]

for tup in itertools.permutations(tl):
    t=list(tup)
    c=0
    for i in range(4):
        c+=t[i]
        if c%10!=0:
            c=(c//10 +1)*10
    ansl.append(c+t[-1])

print(min(ansl))

Submission status: Accepted

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

Submission status: Accepted

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]:
        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: Accepted

Solution code:
import math
from itertools import permutations

l=[int(input()) for i in range(5)]
result=sum(math.ceil(l[i]/10)*10 for i in range(5))
orders=list(permutations(l,5))

for order in orders:
  tmp=order[0]
  for i in range(1,5):
    tmp+=math.ceil(order[i]/10)*10
  result=min(result,tmp)

print(result)

Submission status: Accepted

Solution code:
a = [0]*5
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
b = 10**10
t = 0
for i in range(5):
    c = a[i]%10
    t += -1*(-1*a[i]//10)*10
    if c == 0:
        pass
    else:
        b = min(b,c)
if b == 10**10:
    print(t)
else:
    print(t+b-10)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A=int(input())
ans=0

for i in range(4):
    B=int(input())
    if A%10>B%10>0: A,B=B,A
    ans+=-(-B//10)*10

print(A+ans)

Submission status: Accepted

Solution code:
A=int(input())
lis=[]

for i in range(4):
    B=int(input())
    if A%10>B%10>0:
        lis.append(-(-A//10)*10)
        A=B
    else:
        lis.append(-(-B//10)*10)

print(A+sum(lis))

Submission status: Accepted

Solution code:
import math

time = [0]*5
time_ = [0]*5
for i in range(5):
  time[i] = int(input())
  time_[i] = (time[i]-1)%10

ans = 0
tmin = min(time_)
flag = True
for i in range(5):
  if (time[i]-1)%10==tmin and flag:
    ans += time[i]
    flag = False
  else:
    ans += math.ceil(time[i]*0.1)*10
print(int(ans))

Submission status: Accepted

Solution code:
import math
l=[int(input()) for i in range(5)]
t=[]
for ll in l:
  t.append(math.ceil(ll/10))
lis=[]
for i in range(5):
  lis.append(t[i]*10-l[i])
m=max(lis)
sum=0
for i in range(5):
  sum+=t[i]*10
print(sum-m)

Submission status: Accepted

Solution code:
from decimal import Decimal, ROUND_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_UP)) - x)
res = 0
for c in cook_time:

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

    res += c

print(res)

Submission status: Accepted

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


D = []

for i in range(5):
    D.append(inp())

D = sorted(D, key=lambda d: 0 if d % 10 == 0 else ((d//10)+1)*10-d)

res = 0
for d in D[:4]:
    if d % 10 != 0:
        res += d + (((d//10)+1)*10-d)
    else:
        res += d
print(res+D[4])

Submission status: Accepted

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

for i in range(len(li)-1):
    if li[i] % 10 < li[i+1] % 10 or li[i+1] % 10 == 0:
        x = li[i]
        li[i] = li[i+1]
        li[i+1] = x
for i in range(len(li)):
    if i == len(li)-1:
        break
    d10 = li.pop(i)
    if d10 % 10 != 0:
        li.insert(i, (d10//10+1) * 10)
    else:
        li.insert(i, (d10//10+0) * 10)
print(sum(li))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math

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

for i in itertools.permutations(l, 5):
    time = 0
    for j in range(5):
        time += i[j]
        if j != 4:
            time = math.ceil(time / 10) * 10
    ans = (min(ans, time))

print(ans)

Submission status: Accepted

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

# import fractions

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)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

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


def f(N):
    return math.ceil(N/10)*10


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

    R = [ii() for _ in range(5)]

    ret = MAX
    for r in itertools.permutations(R, 5):
        tmp = 0
        for i in range(len(r)):
            if i == 4:
                tmp += r[i]
            else:
                tmp += f(r[i])
        ret = min(tmp, ret)

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    K = [int(input()) for _ in range(5)]
    ans = []
    A = [0]
    for k in K:
        a = k % 10
        if a == 0:
            ans.append(k)
        else:
            ans.append(k + (10 - a))
            A.append(10 - a)
    print(sum(ans) - max(A))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

most_fast = 10**5

for i in itertools.permutations(t,5):
    time = 0
    for j in range(4):
        time += i[j]
        if time % 10 != 0:
            time += 10 - (time % 10)
    time += i[4]
    if time <= most_fast:
        most_fast = time

print(most_fast)

Submission status: Accepted

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

def solve():
    min_mod = min(map(lambda x:(x-1)%10+1,A))
    ceil_A = sum(map(lambda x:(x+9)//10*10,A))
    ans = ceil_A - 10 + min_mod
    return ans
print(solve())

Submission status: Accepted

Solution code:
L = [int(input()) for _ in range(5)]
S = [10*(L[j]//10) if L[j]%10==0 else 10*((L[j]//10)+1) for j in range(5)]
M = [S[i]-L[i] for i in range(5)]
print(sum(S)-(max(M)))

Submission status: Accepted

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

m = 11
index = 0
for i,a in enumerate(A):
   if a%10!=0 and m > a%10:
       index = i
       m = a % 10

temp = A[index]
del A[index]

A = list(map(lambda x:math.ceil(x/10)*10,A))

print(sum(A)+temp)

Submission status: Accepted

Solution code:
import math
A = [int(input()) for i in range(5)]
B = [math.ceil(A[i]/10)*10 for i in range(5)]
C = [B[i]-A[i] for i in range(5)]
big = C.index(max(C))
ans = sum(B)-B[big]+A[big]
print(ans)

Submission status: Accepted

Solution code:
l=list()
L=list()
for i in range(5):
  n=int(input())
  if n%10==0:
    l.append(n)
  else:
    L.append(n)
if len(l)==5:
  print(sum(l))
  exit()
    
LL=list()
for n in L:
  N=n%10
  LL.append(N)
key=min(LL)
LL.remove(key)

x=len(LL)*10

M=list()
for n in L:
  nn=n//10*10
  M.append(nn)
  
  
print(sum(l)+sum(M)+x+key)

Submission status: Accepted

Solution code:
import math
from itertools import permutations
menu = 5
times = [int(input()) for _ in  range(menu)]
orders = list(permutations(times, menu))
minimum = sum(math.ceil(time / 10) * 10 for time in times)

for order in orders:
    total = order[0]
    for i in range(1, menu):
        total += math.ceil(order[i]/10)*10
    minimum = min(total, minimum)
print(minimum)

Submission status: Accepted

Solution code:
# coding: utf-8
A = [int(input()) for i in range(5)]
B = [10 if i % 10 == 0 else i % 10 for i in A]
minB = A.pop(B.index(min(B)))
A = [i if i % 10 == 0 else i + 10 - (i % 10) for i in A]
A.append(minB)
print(sum(A))

Submission status: Accepted

Solution code:
ans = 0
s = 9
flag = True
for i in range(5):
    n = int(input())
    if n%10 != 0:
        s = min(s,n%10)
        ans += n//10+1
        flag = False
    else:
        ans += n//10
else:
    if flag:
        print(ans*10)
    else:
        print((ans-1)*10+s)

Submission status: Accepted

Solution code:
ans = 0
s = 100
for i in range(5):
    a = int(input())
    r = a % 10
    if r > 0:
        s = min(s, r)
    ans += a // 10 * 10 + (10 if r > 0 else 0)
if s == 100:
    print(ans)
else:
    print(ans + s - 10)

Submission status: Accepted

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]
if minimum != 10:
    print(sum-(original[index]//10 * 10 + 10)+original[index])
else: print(a+b+c+d+e)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
count=0 
max_i=0
for i in A:
    if i%10!=0:
        max_i = max(max_i,10-i%10)
        count += i//10*10+10
    else:
        count += i
print(count-max_i)

Submission status: Accepted

Solution code:
A = []
for i in range(5):
  a = int(input())
  A.append(a)
B = []
for i in range(5):
  b = A[i]%10
  B.append(b)
C =[]
for i in range(5):
  if B[i] != 0:
    c = A[i]+10-B[i]
  else:
    c = A[i]
  C.append(c)
t = 0  
for i in range(5):
  t += C[i]
B.sort()
z = set(B)
if min(z) == 0:
  z.remove(0)
if len(z) ==0:
  print(t)
else:
  print(t-10+min(z))

Submission status: Accepted

Solution code:
A = []
for i in range(5):
  a = int(input())
  A.append(a)
B = []
for i in range(5):
  b = A[i]%10
  B.append(b)
C =[]
for i in range(5):
  if B[i] != 0:
    c = A[i]+10-B[i]
  else:
    c = A[i]
  C.append(c)
t = 0  
for i in range(5):
  t += C[i]
B.sort()
z = set(B)
if min(z) == 0:
  z.remove(0)
if len(z) ==0:
  print(t)
else:
  print(t-10+min(z))

Submission status: Accepted

Solution code:
from itertools import permutations

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

res = 10 ** 9
for s in permutations(range(5), 5):
    cnt = T[s[0]]
    for i in s[1:]:
        if cnt % 10 != 0:
            cnt += 10 - cnt % 10
        cnt += T[i]
    res = min(res, cnt)

print(res)

Submission status: Accepted

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

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

sub = [(10 - i%10)%10 for i in m]

x = sub.index(max(sub))

ans = 0

for i in range(5):
    if i == x:
        ans += m[i]
    else:
        ans += m[i] + (10 - m[i]%10)%10

print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
t = max(map(lambda x: (10-x%10)%10, l))
print(sum(map(lambda x: (x+9)//10*10, l))-t)

Submission status: Accepted

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


def solve(A: int, B: int, C: int, D: int, E: int):
    def func(n):
        return 0 if n % 10 == 0  else 10 - n % 10
    F = [A, B, C, D, E]
    G = list(map(func, F))
    H = [f+g for f, g in zip(F, G)]
    return sum(H) - max(G)

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    print(solve(A, B, C, D, E))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

Solution code:
X = [int(input()) for _ in range(5)]
m = 10
mi = 10
rX = []
for i, x in enumerate(X):
    y = int(str(x)[-1])
    if y != 0 and y < m:
        m = y
        mi = i
    if len(str(x)) == 1:
        rX.append(10)
    else:
        z = int(''.join(str(x)[:-1]))
        if y == 0:
            rX.append(z * 10)
        else:
            rX.append((z + 1) * 10)
if m == 10:
    print(sum(rX))
else:
    print(sum([x if i != mi else X[mi] for i, x in enumerate(rX)]))

Submission status: Accepted

Solution code:
import math
A = [int(input()) for _ in range(5)]
print(sum([math.ceil(i/10)*10 for i in A])  -max([10-i for i in [ (i % 10) for i in A] if i != 0] +[0]))

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]
ans=[]
mm=0
for i in l:
    k=(10-i%10)%10
    ans.append(k)
print(sum(l)+sum(ans)-max(ans))

Submission status: Accepted

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

import sys
import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    L = [ii() for _ in range(5)]
    diff = [math.ceil(elm / 10) * 10 - elm for elm in L]
    max_ind = 0
    maximum = -1
    for i, elm in enumerate(diff):
        if elm > maximum:
            max_ind, maximum = i, elm
    # print(diff)
    ans = 0
    for i in range(5):
        if i != max_ind:
            ans += math.ceil(L[i] / 10) * 10
        else:
            ans += L[i]
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

odr=[]
ans=0
for x in l:
    if int(x)%10==0:
        ans+=int(x)
    else:
        odr.append(x)
odr=sorted(odr,key=lambda x:x[-1],reverse=True)

for i in range(len(odr)):
    if i==len(odr)-1:
        ans+=int(odr[i])
    else:
        ans += int(odr[i]) + (10-int(odr[i])%10)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
time=[]
ans=0
for i in range(5):
    A=int(input())
    a=10-A%10
    ans+=A+a%10
    time.append(a%10)
time.sort()
ans-=time[-1]
print(ans)

Submission status: Accepted

Solution code:
import math

time_list = list()

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

# 全探索
ans = 1e6
for i in range(len(time_list)):
    tmp = 0
    for j in range(len(time_list)):
        if i == j:
            tmp += time_list[i]
            continue
        tmp += math.ceil(time_list[j] / 10) * 10
    ans = min(tmp, ans)

print(ans)

Submission status: Accepted

Solution code:
time=[]
ans=0
for i in range(5):
    A=int(input())
    a=10-A%10
    ans+=A+a%10
    time.append(a%10)
time.sort()
ans-=time[-1]
print(ans)

Submission status: Accepted

Solution code:
foods=[]

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

from itertools import permutations

l = [0,1,2,3,4]

p = permutations(l,5)

time=pow(10,9)
for v in p:
    order = v

    tmp_time=0

    for i in range(5):

        tmp_time+=foods[order[i]]

        if tmp_time%10!=0 and i<4:

            tmp_time = ((tmp_time//10)+1) * 10

    
    time= min(time,tmp_time)

print(time)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
import bisect
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def bit_count(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#############
# Main Code #
#############

l = inputILs(5)

SUM = sum(-(-i//10)*10 for i in l)
R = [i%10 for i in l]

if max(R) == 0:
  print(SUM)
else:
  R.sort()
  print(SUM-10+R[bisect.bisect(R,0)])

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
def main():
    lis=[I(),I(),I(),I(),I()]
    dig1=[i%10 if i%10!=0 else 10 for i in lis]
    sum=0
    while len(lis)!=0:
        nex=0
        ind=0
        for i in range(len(lis)):
            if dig1[i]>nex:
                nex=dig1[i]
                ind=i
        
        #print(sum,lis[ind],10-nex)
        if len(lis)!=1:
            sum+=lis.pop(ind)+(10-nex)%10
            dig1.pop(ind)
        else:
            sum+=lis.pop()
    
    print(sum)
    

if __name__ == '__main__':
    main()

Submission status: Accepted

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)-(10-mini))
else:
    print(sum(a))

Submission status: Accepted

Solution code:
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nuko = 10

n = []
for i in range(5):
    n.append(iin())
    if (n[i]%10 < nuko)and(n[i]%10 != 0):
        nuko = n[i]%10
    n[i] = math.ceil(n[i]/10)*10
print(sum(n)-10+nuko)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def time(x):
    return (x+9)//10*10
def last(x):
    return time(x)-x
sum_time=time(a)+time(b)+time(c)+time(d)+time(e)
ans=sum_time-max(last(a),last(b),last(c),last(d),last(e))
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
A, B, C, D, E = [int(input()) for i in range(5)]

x = np.array([A, B, C, D, E])
ans = int((np.ceil((x / 10)) * 10).sum())
x = x %10

if x.sum()==0:
    tmp = 0
else:
    tmp = 10 - x[np.where(x>0)].min()

ans = ans - tmp

print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    ex = []
    for _ in range(5):
        t = int(input())
        e = 10 - t%10
        if e != 10:
          ex.append(e)
        ans += t
    ex.sort()
    ans += sum(ex[:-1])

    print(ans)

if __name__ == '__main__':
    main()