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.

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

a.sort(key = lambda x:x % 10)
su = 0
c = 0
for i in range(5):
    if a[i] % 10 == 0:
        su += a[i]
    else:
        if c == 0:
            su += a[i]
            c += 1
        else:
            su += (a[i]//10 + 1)*10
print(su)

Solution (Python):
x = [int(input()) for _ in range(5)]
x = sorted(x, key=lambda x: (x - 1) % 10 + 1)
print(x[0] + sum([(xi + 9) // 10 * 10 for xi in x[1:]]))

Solution (Python):
ans=0
hiku=0
for i in range(5):
    x=int(input())
    if x%10!=0:
        hiku=max(hiku,10-x%10)
    ans+=((x+9)//10)*10
print(ans-hiku)

Solution (Python):
l = [10]
s = 0
for i in range(5):
  t = input()
  if t[-1] =="0":s += int(t)
  else:
    s+=(int(t)//10)*10+10
    l.append(int(t[-1]))
if min(l) == 10:
  print(s)
else:
  print(s-10+min(l))

Solution (Python):
import itertools

a = [int(input()) for i in range(5)]
ans = float("inf")
for i in itertools.permutations(a, 5):
    time = 0
    for j in i:
        while time % 10:
            time += 1
        time += j
    ans = min(ans, time)
print(ans)

Solution (Python):
from math import ceil
a=[]
m=0
for _ in range(5):
    x=int(input())
    y=ceil(x/10)*10
    a.append(y)
    m=max(m,y-x)
print(sum(a)-m)

Solution (Python):
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

A=rr(5)
x = 10
for a in A:
    x = min(x,a%10 if a%10 !=0 else 10)

s = 0
for a in A:
    s += (a//10)*10
    s += 10 if a%10 != 0 else 0

print(s-10+x)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    s = IR(5)
    k = I()
    if max(s)-min(s) > k:
        print(":(")
    else:
        print("Yay!")
    return


def B():
    s = IR(5)
    s.sort(key = lambda x:-x%10)
    ans = 0
    i = 0
    k = 0
    while 1:
        if i%10 == 0:
            ans = i+s[k]
            i += s[k]-1
            k += 1
            if k == 5:break
        i += 1
    print(ans)
    return


def C():
    n = I()
    return


def D():
    n = I()
    return


if __name__ == "__main__":
    B()

Solution (Python):
import math
def solve():
  ans = 0
  ex = 10
  for i in range(5):
    tp = int(input())
    ans += 10*math.ceil(tp/10)
    if tp%10 == 0:
      continue
    else:
      ex = min(tp%10,ex)
  if not ex == 10:
    print(ans-10+ex)
  else:
    print(ans)
solve()

Solution (Python):
time=[]
back=0
for i in range(5):
    A=int(input())
    if A%10==0:
        pass
    else:
        back=max(back,10-A%10)
        A=(A//10)*10 +10

    time.append(A)

print(sum(time)-back)

Solution (Python):
A = str(input())
B = str(input())
C = str(input())
D = str(input())
E = str(input())

num = sorted([A, B, C, D, E], key=lambda x: x[-1])
ans = 0
flag = 0
for i in num:
    if i[-1] == '0':
        ans += int(i)
    elif flag == 0:
        flag = 1
        ans += int(i)
    else:
        j = int(i) // 10 + 1
        ans += 10 * j

print(ans)

Solution (Python):

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

print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))

Solution (Python):
import math

dishes = [int(input()) for _ in range(5)]
ans = 10 ** 18
for i in range(5):
    ans = min(ans, sum(int(math.ceil(f / 10)) * 10 for j, f in enumerate(dishes) if i != j) + dishes[i])
print(ans)

Solution (Python):
q = [int(input()) for _ in range(5)]
ans = sum(q) + 10000
for i in range(5):
    m = 0
    for j in range(5):
        if i == j:
            m += q[i]
        else:
            if q[j]%10 == 0:
                m += q[j]
            else:
                m += (q[j]//10+1)*10
    ans = min(ans,m)

print(ans)

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

m = 0
res = 0
for x in a:
    if x%10 != 0:
        t = 10 - x%10
    else:
        t = 0
    res += x+t

    m = max(m,t)


print(res-m)

Solution (Python):
A = [input() for _ in range(5)]
print sum((a+9)/10*10 for a in A) - max((a+9)/10*10-a for a in A)