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 sys
input = sys.stdin.readline

T=[int(input().strip()) for x in range(5)]
mini=0
nonmini=[]
for t in T:
  if mini==0:
    mini=t
  elif t%10!=0 and t%10<mini%10:
    nonmini.append(mini)
    mini=t
  else:
    nonmini.append(t)

T=0
for t in nonmini:
  T+=t
  if T%10!=0:
    T+=10-T%10

print(T+mini)

Submission status: Accepted

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

for x in range(0,4):
    if orderlist[x] % 10 == 0:
        continue
    time = orderlist[x] % 10
    maxtime = min(time,maxtime) 

Sum = 0

for x in range(0,5):
    if orderlist[x] % 10 ==0:
        Sum += orderlist[x]
    else:
        Sum += orderlist[x] + 10 - (orderlist[x] % 10)

Sum += maxtime -10

print(Sum)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
input = sys.stdin.readline

# bisect_left(lists, 3)
# bisect_right(lists, 3)

def main():
	me = []
	for i in range(5):
		tmp = int(input())
		me.append(tmp)

	aa = 999999999
	ii = 0
	for i, vol in enumerate(me):
		tt = vol % 10
		if tt != 0 and tt < aa:
			aa = tt
			ii = i

	for i, vol in enumerate(me):
		if ii == i:
			continue
		tt = vol % 10
		if tt != 0:
			aa = 10 - tt
			me[i] += aa

	ans = 0
	for i, vol in enumerate(me):
		ans += vol
	print(ans)
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
r = [x%10 for x in t]
if all(x==0 for x in r):
  print(sum(t))
else:
  y = min(set(r)-{0})
  print(sum(x if x%10==0 else 10*(1+x//10) for x in t) -10+y)

Submission status: Accepted

Solution code:
a = int(input())
aa = a % 10
if aa == 0:
    aa = 10**10
    aaa = a
else:
    aaa = (a // 10) * 10 + 10
    
b = int(input())
bb = b % 10
if bb == 0:
    bb = 10**10
    bbb = b
else:
    bbb = (b // 10) * 10 + 10

c = int(input())
cc = c % 10
if cc == 0:
    cc = 10**10
    ccc = c
else:
    ccc = (c // 10) * 10 + 10

d = int(input())
dd = d % 10
if dd == 0:
    dd = 10**10
    ddd = d
else:
    ddd = (d // 10) * 10 + 10


e = int(input())
ee = e % 10
if ee == 0:
    ee = 10**10
    eee = e
else:
    eee = (e // 10) * 10 + 10


t = [a,b,c,d,e]
tt = [aa,bb,cc,dd,ee]
ttt = [aaa,bbb,ccc,ddd,eee]

ans = sum(ttt) - ttt[tt.index(min(tt))] + t[tt.index(min(tt))]
#print(t)
#print(tt)
#print(ttt)



print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
import math
a_1=a-math.floor((a-1)/10)*10
b_1=b-math.floor((b-1)/10)*10
c_1=c-math.floor((c-1)/10)*10
d_1=d-math.floor((d-1)/10)*10
e_1=e-math.floor((e-1)/10)*10
a_1n=math.ceil(a/10)*10
b_1n=math.ceil(b/10)*10
c_1n=math.ceil(c/10)*10
d_1n=math.ceil(d/10)*10
e_1n=math.ceil(e/10)*10
lists=[]
lists.append(a_1)
lists.append(b_1)
lists.append(c_1)
lists.append(d_1)
lists.append(e_1)
lists.sort()
print(a_1n+b_1n+c_1n+d_1n+e_1n-10+lists[0])

Submission status: Accepted

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

mind = 124
mini = 0
for i in range(len(dishlist)):
    d = (dishlist[i]-1) % 10
    if (d < mind):
        mind = d
        mini = i

dishlist[mini], dishlist[-1] = dishlist[-1], dishlist[mini]

ans = 0
for i in range(len(dishlist)):
    p = 0
    if (i < len(dishlist)-1):
        if (dishlist[i] % 10 != 0):
            p = 10 - (dishlist[i] % 10)
    ans += dishlist[i] + p 

print(ans)

Submission status: Accepted

Solution code:
import math

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

a = (A // 10 + math.ceil((A % 10) / 10)) * 10
b = (B // 10 + math.ceil((B % 10) / 10)) * 10
c = (C // 10 + math.ceil((C % 10) / 10)) * 10
d = (D // 10 + math.ceil((D % 10) / 10)) * 10
e = (E // 10 + math.ceil((E % 10) / 10)) * 10

X = a + b + c + d + e

Y = [A % 10, B % 10, C % 10, D % 10, E % 10]
Y = [i for i in Y if i > 0]

if len(Y) >= 1:
    X = X - 10 + min(Y)

print(X)

Submission status: Accepted

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

def calc_taple(x):
    if x % 10 == 0:
        num = 10
    else:
        num = x % 10
    return(num, x)

lst = []
lst.append(calc_taple(a))
lst.append(calc_taple(b))
lst.append(calc_taple(c))
lst.append(calc_taple(d))
lst.append(calc_taple(e))
lst = sorted(lst)
res = 0
for elem1, elem2 in lst[1:]:
    res += elem2 + (10 - elem1)
res += lst[0][1]
print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import functools

a = [int(input()) for _ in range(5)]
def e(x):
    if x % 10:
        return x % 10
    else:
        return 10
a.sort(key=functools.cmp_to_key(lambda x,y: e(x) - e(y)), reverse=True)
ans = 0
for x in a[:-1]:
    d,m = divmod(x, 10)
    ans += (d + (m != 0)) * 10
ans += a[-1]
print(ans)

Submission status: Accepted

Solution code:
total = 0
c = []
for i in range(5):
    a = input()
    b = int(a)
    if int(a[-1]) != 0:
        c.append(int(a[-1]))
        total += b - int(a[-1]) + 10
    else:
        total += b

if c:
    total += min(c)
    total -= 10
print(total)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
tmp = 9
last = 0
for i in [A, B, C, D, E]:
    if i % 10 == 0:
        continue
    else:
        if i % 10 <= tmp:
            tmp = i % 10
            last = i

ans = 0
for i in [A, B, C, D, E]:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10-i%10)

print(ans-(10-last%10) if last != 0 else ans)

Submission status: Accepted

Solution code:
import sys
# import bisect
# import math
# import itertools
import numpy as np
# import collections

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e, p = range, enumerate, print
    ip = IP()
    id = Idea()
    mod = 10 ** 9 + 7

    """この下から書いてね"""
    li = np.array(ip.ILS(5))
    li_m = li % 10
    m = max(li_m)
    res = 0
    ans = sum(li // 10)
    for x in li_m:
        if x != 0:
            m = min(m, x)
            res += 1

    if res == 0:
        res += 1
    p(ans * 10 + (res - 1) * 10 + m)


main()

Submission status: Accepted

Solution code:
import math
n = 5
t = [int(input()) for i in range(n)]
l = 0
ans = 0
min = 10
l = 0
index = 0
for i in t:
    s = str(i)
    if int(s[len(s)-1]) != 0 and int(s[len(s)-1]) < min:
        min = int(s[len(s)-1])
        index = l
    l += 1
l = 0
for i in t:
    if l == index:
        ans += i
    else:
        ans += math.ceil(i/10) * 10
    #print(ans)
    l += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
a=[0,0,0,0,0]
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
a10=[0,0,0,0,0]
for i in range(5):
    a10[i] = (10-a[i]%10)%10
k = np.argmax(a10)
l = [0,0,0,0,0]
for i in range(5):
    if a[i]%10 == 0:
        l[i]=0
    else:
        l[i]=10-a[i]%10
ans = sum(a)+sum(l)-l[k]
print(ans)

Submission status: Accepted

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

res_ = min([x%10 if x%10!=0 else 10 for x in [a,b,c,d,e]])
sum_ = sum([10*(1+x//10) if (x%10!=0) else x for x in [a,b,c,d,e]])

print(sum_ + res_ - 10)

Submission status: Accepted

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

tmp = 999
minidx = 0
for idx, i in enumerate(inputs):
    if tmp > (i % 10) and (i % 10) > 0:
        minidx = idx
        tmp = i % 10

ans = 0
for idx, i in enumerate(inputs):
    if idx == minidx:
        ans += i
    else:
        if i % 10 != 0:
            ans += i + (10 - (i % 10))
        else:
            ans += i
        
print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
cook_time = [A,B,C,D,E]
muda = [10-i%10 if i%10!=0 else 0 for i in cook_time]
cook_time_muda = list(zip(cook_time,muda))
cook_time_muda.sort(key=lambda x:x[1])
time = 0
for i in cook_time_muda:
    time = time + i[0]+i[1]
time = time - i[1]
print(time)

Submission status: Accepted

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

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]
ll = []
ans = []
for i in range(5):
    if l[i] % 10 == 0:
        ll.append(11)
        ans.append(l[i])
    else:
        ll.append(l[i] % 10)
        ans.append(l[i] + (10 - l[i] % 10))

p = ll.index(min(ll))


if p == 11:
    print(sum(l))
else:
    print(sum(ans) - ans[p] + l[p])

Submission status: Accepted

Solution code:
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
min_t = float('inf')
for order in list(itertools.permutations([a,b,c,d,e],5)):
    t = 0
    for i in range(len(order)):
        t += order[i]
        if t % 10 != 0 and i != len(order) - 1:
            t = 10 * int(((t / 10) + 1))
    min_t = min(t, min_t)
print(min_t)

Submission status: Accepted

Solution code:
import numpy as np

A = []
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))
A.append(int(input()))

A = np.array(A)
tmp = (A-1) % 10 + 1
idx = np.argmin(tmp)

res = A[idx]
A = np.delete(A, idx)
res += (np.sum(np.ceil(A/10)*10))
print(int(res))

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
l.sort(key=lambda x: (x-1)%10)

print(l[0]+sum( t if t%10==0 else t-(t%10)+10 for t in l[1:] ))

Submission status: Accepted

Solution code:
a = []
ans = 0
mmin = 10
for i in range(5):
    a.append(int(input()))
for i in range(5):
    m = a[i] % 10
    if m > 0:
        mmin = min(mmin, m)
    for j in range(1, 14):
        if a[i] <= 10 * j:
            ans += 10 * j
            break

ans -= 10
ans += mmin
print(ans)

Submission status: Accepted

Solution code:
import math
import copy
from collections import Counter
from _ast import Or
 
 
 
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:
 
            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
 

a=nCast(inputArr(5))


                   
   

def func():
    min=10
    for k in a:
        if k%10!=0 and k%10<min:
            min=k%10
    sum=0
    for k in a:
        if k%10==0:
            sum+=k
        elif min==-1 or k%10!=min:
            sum+=(int(k/10)+1)*10
        else:
    
            sum+=k
            min=-1
    return sum
print(func())

Submission status: Accepted

Solution code:
a=[0]*5
index=0
index_0=0
count=9
s=0
j=0
for i in range(5):
    a[i]=int(input())
    if a[i]%10==0:
        index_0+=1
    else:
        count=min(a[i]%10,count)
        j+=1
    s+=a[i]//10
if j!=0:
    print(s*10+count+(4-index_0)*10)
else:
    print(sum(a))

Submission status: Accepted

Solution code:
time = [int(input()) for _ in range(5)]
sub = [0]*5
time = sorted(time, key=lambda x:10-(x%10) if x % 10 != 0 else 0)
total = 0
for n, i in enumerate(time):
    total += i
    if i % 10 != 0 and n != 4:
        total += 10 - (i % 10)
print(total)

Submission status: Accepted

Solution code:
import numpy as np


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

b = []
for item in a:
    b.append(item%10)

c = []
for i in range(5):
    c.append(a[i] - b[i])

ans = sum(c)
b.sort()

flg = True
for i in range(5):
    if b[i] != 0:
        if flg:
            ans = ans + b[i]
            flg = False
        else:
            ans = ans + 10
print(ans)

Submission status: Accepted

Solution code:
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lis = [a, b, c, d, e]
l = list(itertools.permutations(lis))
count = 10 ** 9
for ll in l:
    ans = 0
    c = 0
    for seq in ll:
        c += 1
        ans += seq
        mod = seq % 10
        if mod != 0 and c != 5:
            ans += 10 - mod
    count = min(count, ans)
print(count)

Submission status: Accepted

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

total = 0
for e in l:
    if e % 10 == 0:
        total += e
    else:
        total += (int(e / 10)) * 10 + 10

mi = 10
for e in l:
    if e % 10 == 0:
        continue
    mi = min( mi, e % 10 )

print(total - 10 + mi)

Submission status: Accepted

Solution code:
fin = 10
ans = 0
for i in range(5):
    tmp = int(input())

    if tmp%10 != 0:
        fin = min(tmp%10, fin)
        tmp = tmp - tmp%10 + 10
    ans += tmp

ans = ans - (10-fin)
print(ans)

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(5)]
ans=0
m=10
for i in l:
    mod=i%10
    if mod!=0:
        m=min(m,mod)
        ans+=i+(10-mod)
    else:
        ans+=i
print(ans-(10-m))

Submission status: Accepted

Solution code:
menu = [int(input()) for i in range(5)]
time = 0
final = 10
for i in menu:
    a = int((i+9)/10)
    final = min(final,((i-1)%10)+1)
    time += a*10
time -= 10-final
print(time)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = a+b+c+d+e
l = []
l.append((10-a%10)%10)
l.append((10-b%10)%10)
l.append((10-c%10)%10)
l.append((10-d%10)%10)
l.append((10-e%10)%10)
l.sort()
print(s+sum(l[:-1]))

Submission status: Accepted

Solution code:
import numpy as np

dish = []
for _ in range(5):
    tmp = int(input())
    dish.append([tmp, (10-tmp%10)%10])

dish = np.array(dish)
dish = dish[np.argsort(dish[:, 1])]

count = 0
print(np.sum(dish) - dish[4, 1])

Submission status: Accepted

Solution code:
A=[int(input()) for i in range(5)]
A.sort(key=lambda x:10-(x%10) if x%10!=0 else 0,reverse=True)
ans=0
for i in A[1:]:
  ans+=i+(10-i%10 if i%10!=0 else 0)
print(ans+A[0])

Submission status: Accepted

Solution code:
def m():
    A = []
    for _ in range(5):
        a = int(input())
        A.append(a)

    amari = 10
    tmp = 0
    for i in range(5):
        if A[i] % 10 == 0:
            continue
        if (A[i] % 10) < amari:
            tmp = i
            amari = A[i] % 10
    if amari == 10:
        return sum(A)
    ans = []
    for i in range(5):
        if i == tmp:
            ans.append(A[tmp])
            continue
        if A[i] % 10 == 0:
            ans.append(A[i])
            continue
        ans.append(A[i] + (10 - A[i]%10))
    return sum(ans)
print(m())

Submission status: Accepted

Solution code:
a=[int(input()) for _ in range(5)]
ar=[[i,a[i]%10] for i in range(5)]
ar.sort(key=lambda x:x[1])
i=0
while ar[i][1]==0:
    i+=1
    if i==4:
        break
k=ar[i][0]
time=0
for i in range(5):
    if i!=k:
        time+=a[i]
        if a[i]%10!=0:
            time+=10-a[i]%10
time+=a[k]
print(time)

Submission status: Accepted

Solution code:
import itertools

L=[ input() for i in range(5)]

P=list(itertools.permutations( range(5) ))
ans=float("inf")

for p in P:
	t=0
	for idx, x in enumerate(p):
		t+=L[x]
		if t%10!=0 and idx!=4 :
			t+=10- (t%10)
	ans=min(ans,t)

print ans

Submission status: Accepted

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

a = []

for i in range(5):
    a.append(int(dish[i][-1]))

r = []

for i in range(5):
    r.append(int(dish[i]))
    
for i in range(5):
    if a[i] == 0:
        a[i] += 10

for i in range(5):
    if i != a.index(min(a)):
            r[i] += 10 - a[i]

print(sum(r))

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    A = []
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))


    max_idx = 0
    max_mod = 0
    for i in range(5):
        if abs(10 - A[i] % 10)% 10> max_mod:
            max_mod = abs(10 - A[i] % 10) % 10
            max_idx = i
    time = 0
    for i in range(5):
        if i != max_idx:
            time += A[i] + (abs(10 - A[i] % 10)% 10)
    time += A[max_idx]
    print time


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:52:46 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

"""

A = [0]*5

A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

A1 = [0]*5
for i in range(len(A)):
    A1[i] = A[i]%10
    if A1[i] == 0:
        A1[i] = 10

last_menu = find_index(A1, min(A1), default=False)
time = 0
for i in range(len(A)):
    if i == last_menu:
        time += A[i]
    else:
        time += A[i] - A1[i] +10 
print(time)

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]
A_=10-A%10
B_=10-B%10
C_=10-C%10
D_=10-D%10
E_=10-E%10

mlist = [A_,B_,C_,D_,E_]
for i,m in enumerate(mlist):
    if m==10:
        mlist[i]=0
min_index = mlist.index(max(mlist))

for i in range(5):
    if i!=min_index:
        alist[i]+=mlist[i]
print(sum(alist))

Submission status: Accepted

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

sum_num = 0

delta = 10

for num in a:
    if num % 10 != 0 and num % 10 < delta:
        delta = num % 10
    sum_num += math.ceil(num / 10) * 10

print(sum_num - 10 + delta)

Submission status: Accepted

Solution code:
a = []
while True:
    try:
        a.append(int(input()))
    except:
        break

def time(at):
    t = 0
    while t < at:
        t += 10
    return t, t - at

st = 0
max_d = 0
for i in a:
    t, d = time(i)
    st += t
    if max_d < d:
        max_d = d

print(st - max_d)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 20:39:40 2019

@author: Yamazaki Kenichi
"""
import math

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

a = 10
if A%x != 0:
    a = min(a,A%x)
if B%x != 0:
    a = min(a,B%x)
if C%x != 0:
    a = min(a,C%x)
if D%x != 0:
    a = min(a,D%x)
if E%x != 0:
    a = min(a,E%x)
if 0 == max(A%x,B%x,C%x,D%x,E%x):
    a = 10
b = math.ceil(A/x) + math.ceil(B/x) + math.ceil(C/x) + math.ceil(D/x) + math.ceil(E/x)

print((b-1)*10 + a)

Submission status: Accepted

Solution code:
info = [int(input()) for _ in range(5)]
degit_1 = [(10-e % 10) % 10 for e in info]
ans = sum(info) + sum(degit_1) - max(degit_1)
print(ans)

Submission status: Accepted

Solution code:
lst = [int(input()) for i in range(5)]
ans=0
tmpl=[]
for i in range(5):
    ans+=lst[i]
    if(lst[i]%10!=0):
        ans+=10-lst[i]%10
for i in lst:
    if(i%10==0):
        tmpl+=[10]
    else:
        tmpl+=[i%10]
ans-=10-min(tmpl)
print(ans)

Submission status: Accepted

Solution code:
*a,=map(int,open(0).read().split())
b=[i%10 if i%10!=0 else 99 for i in a ]
c=a.pop(b.index(min(b)))
ans=0
#print(a)
for i in a:
    #print((i//10*10+(i%10>0)*10))
    ans+=(i//10*10+(i%10>0)*10)
print(ans+c)

Submission status: Accepted

Solution code:
import sys
import itertools
atn = []
for i in range(5):
    atn.append(int(input()))

seq = list(itertools.permutations(atn))
ans = 10**10
for s in seq:
    tmp_ans = 0
    for i in s:
        #print(tmp_ans,(10-(tmp_ans %10)))
        div = (10-(tmp_ans %10))
        div = div if div <10 else 0
        tmp_ans += div
        #print(tmp_ans)
        tmp_ans += i
        #print(tmp_ans)
    if tmp_ans < ans:
        ans = tmp_ans
print(ans)

Submission status: Accepted

Solution code:
ans = 0
used = False
mins = [int(input()) for _ in range(5)]
maa = list(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
m = (0,0) if len(maa) == 0 else sorted(maa)[0]
for menu in mins:
  if used==False and menu==m[1]:
    used=True
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])

Submission status: Accepted

Solution code:
n=list(map(int,open(0).read().split()))
n.sort(key=lambda x:-((x-1)%10))
print(sum([((x-1)//10+1)*10 for x in n[:-1]]+[n[-1]]))

Submission status: Accepted

Solution code:
import math


nums = list(map(int, [input() for _ in range(5)]))
s = sum(math.ceil(num / 10) * 10 for num in nums)
m = min([int(str(num)[-1]) for num in nums if num % 10 != 0], default=0)
if m != 0:
  s -= (10-m)
print(s)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
alpha = 0
m = str(A)[-1]
menu = [[A, int(str(A)[-1])], [B, int(str(B)[-1])],
        [C, int(str(C)[-1])], [D, int(str(D)[-1])],
        [E, int(str(E)[-1])]]
menu.sort(key = lambda x:x[1])
f = False
ans = 0
for time, i in menu:
    if i != 0 and not f:
        ans += time
        f = True
    else:
        ans += (time + 9) // 10 * 10
print(ans)

Submission status: Accepted

Solution code:
x = [[int(input()) , 0]  for _ in range(5)]
m = 0
s = 0
for i in range(5):
    x[i][1] = x[i][0] % 10
    if x[i][1] != 0:
        x[i][1] = 10 - x[i][1]
    m = max(m , x[i][1])
    s += x[i][0] + x[i][1]
print(s-m)

Submission status: Accepted

Solution code:
#coding:utf-8
import math
A = [0] * 5
B = [0] * 5
for i in range(len(A)):
    A[i] = int(input())
    B[i] = ((A[i] - 1) % 10) + 1
    A[i] = math.ceil(A[i]/10)*10
min_b = min(B)
print(sum(A)-10+min_b)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
List = [a,b,c,d,e]
wait = []
for i in List:
    tmp = 10-i%10
    if tmp ==10:
        tmp = 0
    wait.append(tmp)

for i in range(5):
    ans += List[i]+wait[i]
print(ans-max(wait))

Submission status: Accepted

Solution code:
LIST=[int(input()) for i in range(5)]
LIST.sort(key=lambda x:10-(x-1)%10)

ANS=0
for i in range(4):
    ANS+=-(-LIST[i]//10)*10

print(ANS+LIST[-1])

Submission status: Accepted

Solution code:
ipt=[int(input()) for x in [0]*5]
ans=10**10
for i in range(5):
    tmpans=0
    for j in range(5):
        if i==j:
            tmpans+=ipt[j]
        else:
            if ipt[j]%10!=0:
                tmpans+=(ipt[j]//10 +1)*10
            else:
                tmpans+=ipt[j]
    ans=min(ans,tmpans)
print(ans)

Submission status: Accepted

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

nums = [A, B, C, D, E]
max_num = max(nums)

rest_time = [(10 - num % 10) % 10 for num in nums]

print(sum(nums) + sum(rest_time) - max(rest_time))

Submission status: Accepted

Solution code:
a = list()
b = list()
for i in range(0,5):
    a.append(int(input()))
    b.append(a[i] % 10)

while True:
    if 0 in b:
        b.remove(0)
        b.append(10)
    else:
        break

print(sum(a)-sum(b)+40+min(b))

Submission status: Accepted

Solution code:
A = []
min_res = 11

for i in range(5):
  a = int(input())
  A.append(a)
  tmp = a%10
  if(tmp == 0): 
    tmp = 10
  if(min_res > tmp):
    min_res = tmp
    min_index = i

ans = 0
for i in range(5):
  a = A[i]
  if(i != min_index):
    if(a%10 == 0):
      ans += a
    else:
      tmp = 10 - a%10
      ans += a + tmp
  else:
    ans += a
print(ans)