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: Wrong Answer

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

A = list(str(a))
B = list(str(b))
C = list(str(c))
D = list(str(d))
E = list(str(e))
if max([A[-1], B[-1], C[-1], D[-1], E[-1]]) != 0:
  k = np.argmin([A[-1], B[-1], C[-1], D[-1], E[-1]])

sum = 0
if A[-1] == 0:
  sum += a
else:
  sum += a + (10 - int(A[-1]))
if B[-1] == 0:
  sum += b
else:
  sum += b + (10 - int(B[-1]))
if C[-1] == 0:
  sum += c
else:
  sum += c + (10 - int(C[-1]))
if D[-1] == 0:
  sum += d
else:
  sum += d + (10 - int(D[-1]))
if E[-1] == 0:
  sum += e
else:
  sum += e + (10 - int(E[-1]))
if max([A[-1], B[-1], C[-1], D[-1], E[-1]]) != 0:
  sum -= 10 - int([A[-1], B[-1], C[-1], D[-1], E[-1]][k])
print(sum)

Submission status: Wrong Answer

Solution code:
import itertools

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

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

def calc_time(cand):
  tm = 0
  for i in range(len(cand)):
    tm += cand[i]
    if i < 4:
      if tm % 10 != 0:
        tm += 10 - tm % 10
  return(tm)

res = 100000
for cand in itertools.permutations(X):
  tm = calc_time(cand)
  if tm < res:
    res = tm

print(int(tm))

Submission status: Wrong Answer

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ALL = [A,B,C,D,E]
G=[[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(len(ALL)):
  G[i][1] = ALL[i]
  G[i][0] = 10-(ALL[i] %10)
G.sort()
total = 0
for j in range(4):
  total = total+G[j][1]+G[j][0]
total = total + G[4][1]
print(total)

Submission status: Wrong Answer

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


from sys import stdin


############################################
def Combination(n,r):
    tmp_list = []
    for cmb in cmb_list:
        tmp_list.append(cmb)
    for first_data in data_list:
        for second_data in tmp_list:
            split_tmp_list = second_data.split(",")
            obj_list = []
            for split_data in split_tmp_list:
                obj_list.append(split_data)
            if obj_list.count(first_data) == 0:
                obj_list.append(first_data)
                join_data = ",".join(sorted(obj_list))
                if join_data not in cmb_list:
                    cmb_list.append(join_data)
    if r > 2:
        Combination(n,r-1)
    return(cmb_list)

def cal_time(cmb):
    time = 0
    for i in cmb:
        time += i
#        print(time)
        if time%10!=0 and i!=cmb[4]:
            time += 10 - time % 10
#        print(time)
    return time
    
# read data for n sequences.
input=[]
for _ in range(5):
    input.append(int(stdin.readline().split()[0]))

cmb_list = []

import itertools
cmb = list(itertools.permutations(input))


prev = 10e6
for x in cmb:
    t = cal_time(x)
#    print(x)
    prev = min(t, prev)
print(prev)

Submission status: Wrong Answer

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

f=0
g=[a%10,b%10,c%10,d%10,e%10]
saisyo=10

f+=math.ceil(a/10)*10
f+=math.ceil(b/10)*10
f+=math.ceil(c/10)*10
f+=math.ceil(d/10)*10
f+=math.ceil(e/10)*10

for i in g:
    if 0<i<saisyo:
        saisyo=i

if saisyo==10:
    saisyo=0
        

print(f-10+saisyo)

Submission status: Wrong Answer

Solution code:
import math

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

last = 0
best_mod = 10
for time in times:
    mod = time % 10
    if mod == 0:
        mod = 10
    if mod <= best_mod:
        last = time
        best_mod = mod

all_time = 0
for time in times:
    if time == last:
        all_time += time
    else:
        all_time += math.ceil(time/10.0) * 10

print(all_time)

Submission status: Wrong Answer

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

t =0
for m in a:
    t += int(m/10) * 10
    if m%10 != 0:
        t = t + 10

b = [10 - (x%10) for x in a]
print(t - max(b))

Submission status: Wrong Answer

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

# 1のくらいが最も小さいものを最後に注文する

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

times = [a,b,c,d,e]
ones = [a1,b1,c1,d1,e1]

ones = [10 if i==0 else i for i in ones]

sum = 0

min_index = ones.index(min(ones))
sum += times[min_index]
del times[min_index]
for i in times:
	sum += round(i, -1)

print(sum)

Submission status: Wrong Answer

Solution code:
def rest(num):
    return num % 10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Foods = [A,B,C,D,E]
res = 0

for idx, f in enumerate(Foods):
    if f%10==0:
        res += f
        Foods.pop(idx)

while len(Foods) > 0:
    idx = Foods.index(max(Foods, key=rest))
    if len(Foods)>1:
        res += (Foods[idx]//10)*10+10
    else:
        res += Foods[idx]
    Foods.pop(idx)



print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np
T = np.array([int(input()) for i in range(5)])
T_1 = T % 10
T_s = np.sort(T_1)

D = T + 10 - T_1

S = np.sum(D)

A = S - 10 + T_s[0]
print(A)

Submission status: Wrong Answer

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

last = min(l,key = lambda x:x%10)
l.remove(last)

sum = 0

for i in l:
    if i%10==0:
        sum+=i
    else:
        sum+=i-1%10+10
        
print(sum+last)

Submission status: Wrong Answer

Solution code:
s = []
for i in range(5):
    s.append(int(input()))
s1 = [str(e)[-1] for e in s]
s2 = [int(e) if e != '0' else 10 for e in s1]
time_min = s2.index(min(s2))
s_min = s.pop(time_min)
s3 = [-(-e//10)*10 for e in s]
result = sum(s3) + s_min
print(s2, s_min)
print(result)

Submission status: Wrong Answer

Solution code:
def f(x):
    return x + 10 - (x%10)

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

res = f(a) + f(b) + f(c) + f(d) + f(e)

l = [a, b, c, d, e]
l = list(map(lambda x: (x-1)%10, l))
res -= (10-(min(l)+1))
print(res)

Submission status: Wrong Answer

Solution code:
t = [int(input()) for i in range(5)]
t.sort()
count = 0
min_list = [t[0]%10,t[1]%10,t[2]%10,t[3]%10,t[4]%10]
for i in range(5):
    x = min_list[i]
    if x != 0:
        break
f =min([t[0]%10,t[1]%10,t[2]%10,t[3]%10,t[4]%10])
for i in range(5):
    if t[i]%10 == 0 :
        t[i] = t[i]-1
        count = 1
a =(t[4]//10+1)*10
b =(t[3]//10+1)*10
c =(t[2]//10+1)*10
d =(t[1]//10+1)*10
e =(t[0]//10+1)*10
if count == 0:
    print(a+b+c+d+e+f-10)
else:
    print(a+b+c+d+e+x-10)

Submission status: Wrong Answer

Solution code:
nums = []
flg = True
for _ in range(5):
    nums.append(int(input()))
amaris = [i%10 for i in nums]
amaris_ = [abs(i%10-1) for i in nums]
minnum = min(amaris_)+1

count = 0
amari_count = 0
for num,amari in zip(nums,amaris):
    if amari == 0:
        count += num
        amari_count += 1
    else:
        count += (num//10+1)*10
if amari_count == 5:
    print(sum(nums))
else:  
    print(count+minnum-10)

Submission status: Wrong Answer

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ALL = [A,B,C,D,E]
G=[[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(len(ALL)):
  G[i][1] = ALL[i]
  G[i][0] = 10-ALL[i] %10
G.sort()
total = 0
for j in range(4):
  total = total+G[j][1]+G[j][0]
total = total + G[4][1]

Submission status: Wrong Answer

Solution code:
import numpy as np

i = 0
j = 0

nums = []
first_digits = []
min_first_digit = 9
index = 0
sum = 0

while i < 5:
  x = int(input())
  nums.append(x)
  
  if x % 10 < min_first_digit and x % 10 != 0:
    min_first_digit = x % 10
    index = i
  i += 1
  
while j < 5:
  if j == index:
    sum += nums[j]
  else:
    sum += round(nums[j], -1)
  j += 1
    
print(sum)

Submission status: Wrong Answer

Solution code:
li = []
l = []
for i in range(5):
    a = int(input())
    li.append(a)
    l.append(a%10)
ind = l.index(min(l))
ans = 0
for i in range(5):
    if i != ind:
        ans += (li[i] + 10- l[i]) 
print(ans+li[ind])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    dct[i] = int(inp/10)*10+10
    d[i] = inp % 10
    d2[i] = inp

last = sorted(d.items(), key=lambda x: x[1])[0][0]

ll.remove(last)

ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)

Submission status: Wrong Answer

Solution code:
dishes = []
for i in range(5):
    tmp = int(input())
    dishes.append([tmp % 10, tmp])
s_dished = sorted(dishes, reverse=True)

time = 0
for idx,item in enumerate(s_dished):
    time += item[1] + 10 - item[0]

time -= 10 - s_dished[4][0]

print(time)

Submission status: Wrong Answer

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
if m >= 10:
    m = 0
print((sum(a) - (10 - m)))

Submission status: Wrong Answer

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

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

list3 = []

time = 0

for a in list:
    if a % 10 == 0:
        time += a
    else: list3.append(a)

#list3の並び替え
max = 0
key = 0
for a in list3:
    v = 10-(a%10)
    if v > max:
        max = v
        key = a


for a in list3[0:len(list3)]:
    if key==a: continue
    v = 10-(a%10)
    time += v + a

print(time+key)

Submission status: Wrong Answer

Solution code:
l = input().split()
max = 10
maxi = l[0]
for i in l:
    if 0<int(i)%10 < max:
        max = int(i)%10
        maxi = i
l.remove(maxi)
time =0
for i in l:
    if int(i)%10==0:
        time+=int(i)
    else:
        time += (int(int(i)/10)+1)*10
time = time + int(maxi)
print(time)

Submission status: Wrong Answer

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])

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

Submission status: Wrong Answer

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

A = list(str(a))
B = list(str(b))
C = list(str(c))
D = list(str(d))
E = list(str(e))

k = np.argmin([A[-1], B[-1], C[-1], D[-1], E[-1]])
sum = 0
if A[-1] == 0:
  sum += a
else:
  sum += a + (10 - int(A[-1]))
if B[-1] == 0:
  sum += b
else:
  sum += b + (10 - int(B[-1]))
if C[-1] == 0:
  sum += c
else:
  sum += c + (10 - int(C[-1]))
if D[-1] == 0:
  sum += d
else:
  sum += d + (10 - int(D[-1]))
if E[-1] == 0:
  sum += e
else:
  sum += e + (10 - int(E[-1]))
sum -= 10 - int([A[-1], B[-1], C[-1], D[-1], E[-1]][k])
print(sum)

Submission status: Wrong Answer

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

f=0
g=[a%10,b%10,c%10,d%10,e%10]
saisyo=10

f+=math.ceil(a/10)*10
f+=math.ceil(b/10)*10
f+=math.ceil(c/10)*10
f+=math.ceil(d/10)*10
f+=math.ceil(e/10)*10

for i in g:
    if 0<i<saisyo:
        saisyo=i

if saisyo==10:
    saisyo=0
        

print(f+saisyo)

Submission status: Wrong Answer

Solution code:
def amari(num):
  return num % 10
def jikann(a,b,c,d,e):
    an=0
    for i in [a,b,c,d,e]:
        an+=i // 10 * 10
    an=an + 40 + min(a,b,c,d,e,key=amari) % 10
    return an
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print(jikann(a,b,c,d,e))

Submission status: Wrong Answer

Solution code:
import itertools
import math

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

B = list(itertools.permutations(A))
M = 123 * 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: Wrong Answer

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 = 0
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: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    dct[i] = int(inp/10)*10+10
    d[i] = inp % 10
    d2[i] = inp

last = sorted(d.items(), key=lambda x: x[1])[0][0]

ll.remove(last)

ans = d2[last]

for i in ll:
    print(dct[i])
    ans += dct[i]

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

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

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

def calc_time(cand):
  tm = 0
  for i in range(len(cand)):
    tm += cand[i]
    if i < 4:
      if tm % 10 != 0:
        tm += 10 - tm % 10
  return(tm)

res = 10000
for cand in itertools.permutations(X):
  tm = calc_time(cand)
  if tm < res:
    res = tm
print(tm)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = []
l = l + [a % 10]
l = l + [b % 10]
l = l + [c % 10]
l = l + [d % 10]
l = l + [e % 10]
m = min(l)
ma = 10 - m
ls =[]
ls = ls + [-(-a // 10) * 10]
ls = ls + [-(-b // 10) * 10]
ls = ls + [-(-c // 10) * 10]
ls = ls + [-(-d // 10) * 10]
ls = ls + [-(-e // 10) * 10]
s = sum(ls)
print(s -ma)

Submission status: Wrong Answer

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 % 10
ans = sum(f(i) for i in [a,b,c,d,e])
mo = min(g(i) for i in [a,b,c,d,e])
if mo:
  ans += mo - 10
print(ans)

Submission status: Wrong Answer

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
print(sum(nl)-10+ctr)

Submission status: Wrong Answer

Solution code:
ts = [int(input()) for _ in range(5)]
a = [t % 10 for t in ts]
min = 10
for i in range(5):
    if a[i] != 0 and min > a[i]:
        b = i
if min == 10:
    b = 0
c = True
end = 0
for i in range(5):
    if c and b == i:
        end += ts[i]
        c = False
    elif a[i] != 0:
        end += (ts[i] // 10 + 1) * 10
    else:
        end += ts[i]
print(end)

Submission status: Wrong Answer

Solution code:
import itertools
import math

list = [int(input()) for _ in range(5)]
time = 2*sum(list)

for i in itertools.permutations(list):
    a, b, c, d, e = i
    a = math.ceil(a/10)
    b = math.ceil(b/10)
    c = math.ceil(c/10)
    d = math.ceil(d/10)
    if time > (a + b + c + d)*10 + e:
        time = (a + b + c + d)*10 + e
print(time)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a1 = 10 - a%10
b1 = 10 - b%10
c1 = 10 - c%10
d1 = 10 - d%10
e1 = 10 - e%10
def max(x,y):
  if x <= y:
    return y
  else:
    return x
f = max(max(max(max(a1,b1),c1),d1),e1)

ans = (a+b+c+d+e) + (a1+b1+c1+d1+e1) - f
print(ans)

Submission status: Wrong Answer

Solution code:
from math import *
plate = [int(input()) for i in range(5)]
amari = [plate[i]%10 for i in range(5)]
ans = 0

def kiriage(n):
    return n + (10 - n%10)

for i in range(5):
    ans += kiriage(plate[i])

ans -= max(amari)
print(ans)

Submission status: Wrong Answer

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

l = [A, B, C, D, E]
min = 129
count = 0

for ll in l:
    if ll % 10 <= min % 10 and ll % 10 != 0:
        if min != 129:
            count += (int(min / 10) + 1) * 10
        
        min = ll
    
    else:
        if ll % 10 == 0:
            count += ll
        else:
            count += (int(ll / 10) + 1) * 10
    

print(count + min)

Submission status: Wrong Answer

Solution code:
a=[0,0,0,0,0]
b=[0,0,0,0,0]
time=0
cnt=0
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
for i in range(5):
  b[i]=a[i]%10
for i in range(10):
  for j in range(5):
    if b[j]==0:
      time=time+a[j]
      a[j]=0
      cnt=cnt+1
    elif b[j]==(10-i):
      time=time+a[j]+i
      cnt=cnt+1
      a[j]=0
      if cnt==5:
        time=time-i
print(time)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
a=[int(input()) for _ in range(5)]
d=[]
for j in a:
  while j%10!=0:
    j+=1
  d.append(j)
b=[]
c=0
for i in range(5):
  c=a[i]%10
  b.append(c)
e=b.index(min(b))
d.pop(e)
print(sum(d)+a[e])

Submission status: Wrong Answer

Solution code:
import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
li = [A, B, C, D, E]
print(li)
temp = 9
idx = -1
for i in range(len(li)):
    if 0 != li[i] % 10 and temp >= li[i] % 10:
        temp = li[i] % 10
        idx = i

result = 0
for i in range(len(li)):
    if idx == i:
        result += li[i]
    else:
        result += math.ceil(li[i] / 10) * 10
print(result)

Submission status: Wrong Answer

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 = 9
for i in mod:
    if i != 0 and i <=m:
        m = i
print((sum(a) - (10 - m)))

Submission status: Wrong Answer

Solution code:
A=[]
Y = []
for i in range(5):
    x = int(input())
    y = x % 10
    A.append((y,x))
    Y.append(y)

A = sorted(A)
sum = 0
if Y[0] == Y[1] and Y[1] == Y[2] and Y[2] == Y[3] and Y[3] == Y[4] :
    for i in range(len(A)):
        y,x = A[i]
        A[i] = (x,y)

for i in range(len(A)):
    y,x = A[len(A)-1-i]
    if i == len(A)-1:
        sum += x
    else:
        sum += x + (10-y)

print(sum)

Submission status: Wrong Answer

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 % 10
ans = sum(f(i) for i in [a,b,c,d,e])
ans += min(g(i) for i in [a,b,c,d,e])

Submission status: Wrong Answer

Solution code:
from math import ceil
t = 0
a = [int(input()) for _ in range(5)]
m = min(map(lambda x: (x - 1) % 10 + 1, a))
for c in a:
    print((c + 1) % 10 + 1)
    if (c - 1) % 10 + 1 == m:
        m = c
a.remove(m)
t += sum(map(lambda x: ceil(x / 10), a))
t *= 10
print(t + m)

Submission status: Wrong Answer

Solution code:
import math


def main():
    items = []

    for i in range(5):
        items.append(int(input()))

    maxi = 0
    for i in range(5):
        if items[i] % 10 < items[maxi] % 10 and items[i] % 10 != 0:
            maxi = i

    ret = 0
    for i in range(5):
        if i != maxi:
            if items[i] % 10 != 0:
                ret += int(math.floor(items[i] / 10) + 1) * 10
            else:
                ret += int(math.floor(items[i] / 10)) * 10
            print(items[i], int(math.floor(items[i] / 10) + 1) * 10)
            continue
        ret += items[i]

    print(ret)


main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as ddic
from collections import deque
from itertools import combinations, permutations, product
import bisect
import heapq
import math
import sys

stdout = sys.stdout
rr = lambda: input().strip()
rri = lambda: int(rr())
rrm = lambda: list(map(int, rr().split()))

a = rri()
b = rri()
c = rri()
d = rri()
e = rri()

lst = [[a,-1],[b,-1],[c,-1],[d,-1],[e,-1]]

lst2 = []

for i, num in enumerate(lst):
    lst[i][1] = num[0] % 10

lst.sort(key=lambda arr: arr[1])

for i, l in enumerate(lst):
    if l[1] != 0:
        if i == 4:
            d1 = [item[0] for item in lst]
            print(sum(d1))
            break
        else:
            for j, k in enumerate(lst[i+1:]):
                lst[i+j+1][0] += (10 - lst[i+j+1][1])

            d2 = [item[0] for item in lst]
            print(sum(d2))
            break

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
p=10
ix=0
for i in range(len(l)):
  x=l[i]
  q=x%10
  if q!=0 and q<p:
    p=q
    ix=i
r=l[ix]
l.remove(r)
s=0
for x in l:
  s+=x
  if x%10!=0:
    s+=10-(x%10)
  print(s)
print(s+r)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
count = 10
num = 0
num1 = 0

list1 = [a,b,c,d,e]
for i in range(5):
    if count > list1[i] % 10 and list1[i]%10!=0:
        count = list1[i]%10
        num = i

for j in range(5):
    if j ==num:
        num1 += list1[j]
    else:
        num1 += round(list1[j], -1)

print(num1)

Submission status: Wrong Answer

Solution code:
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
total = []
for v in itertools.permutations(l):
    print(v)
    nl = list(v)
    t = 0
    for num in range(len(nl)):
        if(num != 4 and nl[num] % 10 != 0):
            print(int(nl[num] / 10) * 10 + 10)
            t += int(nl[num] / 10) * 10 + 10
        else:
            print(nl[num])
            t += nl[num]
    t = int(t)
    print(t)
    total.append(t)
print(total)
print(min(total))

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
lastamari=min(tenmod)
lastban=tenmod.index(lastamari)
alltime=0
if lastamari==0:
  print(sum(l))
else:
  for i in range(5):
    if i==lastban:
      alltime+=l[i]
    else:
      if l[i]%10==0:
        alltime+=l[i]
      else:
        alltime+=int(l[i]/10)*10+10
  print(alltime)

Submission status: Wrong Answer

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())
ans = 0
min1 = 10
for i in range(0,5):
    m = A[i] % 10
    if ((m > 0) and (m < min1)):
        min1 = m        
    ans += ((A[i] + 10) // 10) * 10
print(ans - (10 - min1))

Submission status: Wrong Answer

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
    
print(sum(li) - 10 + a)

Submission status: Wrong Answer

Solution code:
list=[]
ans=10
sum=0
for i in range(5):
    list.append(int(input()))
for i in range(5):
    if list[i]%10<ans and list[i]%10!=0:
        ans=list[i]%10
for j in range(5):
    if list[j]%10!=0:
        sum+=list[j]+(10-list[j]%10)
    else:
        sum+=list[j]
    print(sum)
print(sum-(10-ans))

Submission status: Wrong Answer

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


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

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

print(ans-10)

Submission status: Wrong Answer

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

import math

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

ans = math.ceil(a / 10)
ans += math.ceil(b / 10)
ans += math.ceil(c / 10)
ans += math.ceil(d / 10)
ans += math.ceil(e / 10)
ans *= 10
ans += min(a % 10, b % 10, c % 10, d % 10, e % 10) - 10

print(ans)

Submission status: Wrong Answer

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(12):
        if j*10< a[i] <=( j+1)*10:
            a[i] = (j+1) *10

m = 9
for i in mod:
    if i != 0 and i <=m:
        m = i
print((sum(a) - (10 - m)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = []
for i in range(5):
    a.append(input())
minn = 9
flag = 1
sumtime = 0
for i in range(5):
	if(minn > a[i]%10 & a[i]%10 > 0):
		minn = a[i]%10
		flag = 0
	if(a[i]%10 == 0):
		sumtime += a[i]
	else:
		a[i] = a[i] + 10 - a[i]%10
		sumtime += a[i]
if(flag == 1):
	print(sumtime)
else:
	print(sumtime - 10 + minn)

Submission status: Wrong Answer

Solution code:
ans = 0
a = []
for _ in range(5):
    x = int(input())
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10
        a.append(x%10)

ans += (len(a)-1)*10
if a != []:
    ans += min(a)

print(ans)

Submission status: Wrong Answer

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 + m
    
print(sum(data) - a)

Submission status: Wrong Answer

Solution code:
a = (input())
b = (input())
c = (input())
d = (input())
e = (input())
ary = [a,b,c,d,e]
ary_simo = []
for s in ary:
    if int(s[-1]) != 0:
        ary_simo.append(int(s[-1]))
ary_2 = []
for s in ary:
    ary_2.append(round(int(s) + 5, -1))
try:
    print(sum(ary_2) - 10 + min(ary_simo))
except:
    print(sum(ary_2))

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
count = 10
num = 0
num1 = 0

list1 = [a,b,c,d,e]
for i in range(5):
    if count > list1[i] % 10 and list1[i]%10!=0:
        count = list1[i]
        num = i

for j in range(5):
    if j ==num:
        num1 += list1[j]
    else:
        num1 += round(list1[j], -1)

print(num1)

Submission status: Wrong Answer

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

ans=0
for i in range(5):
  ans+=max((((menu[i]-1)//10)+1)*10,10)

tmp=[]
for i in range(5):
  s=str(menu[i])
  tmp.append(int(s[-1]))
tmp.sort()

hiku=0
for i in range(5):
  if not tmp[i]==0:
    hiku=tmp[i]
    break

ans = ans-(10-hiku)
print(ans)

Submission status: Wrong Answer

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

ans = 0
mini = []
for i in AE:
    if(i%10 == 0):
        ans += i
    else:
        ans += (i//10 + 1)*10
        mini.append(i%10)
if(mini is None):
    print(ans + min(mini) - 10)
else:
    print(ans)

Submission status: Wrong Answer

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

a = [(x//10)*10 for x in li]
b = [x%10 for x in li]

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
lastamari=min(tenmod)
lastban=tenmod.index(lastamari)
alltime=0
if lastamari==0:
  print(sum(l))
else:
  for i in range(5):
    if i==lastban:
      alltime+=l[i]
    else:
      alltime+=int(l[i]/10)*10+10
  print(alltime)

Submission status: Wrong Answer

Solution code:
# 2019/04/06
# AtCoder Beginner Contest 123 - B

# Input
sum = 0
cl = list()
hmin = 99
minidx = -1

for i in range(5):
    wt = int(input())
    t = int((wt + 9) / 10) * 10
    sum += t
    cl.append(wt)
    wh = wt % 10
    if wh > 0 and wh < hmin:
        hmin = wt % 10
        minidx = i

print(hmin)
if hmin < 99:
    sum = sum - (10 - hmin)

# Output
print(sum)

Submission status: Wrong Answer

Solution code:
ans = 0
temp = -1
for i in range(5):
    cur = int(input())
    if cur%10==0:
        ans += cur
    else:
        ans += cur+10-cur%10
        if temp<10-cur%10:
            temp = 10-cur%10

ans -= temp

print(ans)