Problem: 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.

Submission attempts (in order):
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)


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

sum = 0
f = 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)
    f = 1
A = sorted(A)
for i in range(len(A)):
    y,x = A[len(A)-1-i]
    if i == len(A)-1:
        if f == 1:
            sum += y
        else:
            sum += x
    else:
        if f == 1:
            sum += y + (10-x)
        else:
            sum += x + (10-y)

print(sum)


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

B = sorted(A)
sum = 0

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

print(sum)


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

sum = 0
f = 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)
    f = 1
A = sorted(A)
for i in range(len(A)):
    y,x = A[len(A)-1-i]
    if i == len(A)-1:
        if f == 1:
            sum += y
        else:
            sum += x
    else:
        if f == 1:
            sum += y + (10-x)
        else:
            sum += x + (10-y)

print(sum)


A=[]

for i in range(5):
    x = int(input())
    y = x % 10
    A.append((y,x))

A = sorted(A)
sum = 0
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)


A=[]
Y = []
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0

for i in range(len(B)):
    y,x = B[i]
    sum += x
    if i == 0:
        if y != 0:
            sum -= 10-y

print(sum)


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

B = sorted(A)
sum = 0

for i in range(len(B)):
    y,x = B[i]
    sum += x
    if i == 0:
        sum -= 10-y

print(sum)


A=[]

for i in range(5):
    x = int(input())
    y = x % 10
    A.append((x,y))

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

print(sum)


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

B = sorted(A)
sum = 0

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

print(sum)


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

B = sorted(A):
sum = 0

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

print(sum)


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

B = sorted(A)
sum = 0

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

print(sum)


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

sum = 0
f = 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)
    f = 1
A = sorted(A)
for i in range(len(A)):
    y,x = A[len(A)-1-i]
    if i == len(A)-1:
        if f == 1:
            sum += y
        else:
            sum += x
    else:
        if f == 1:
            sum += y + (10-x)
        else:
            sum += x + (10-y)

print(sum)


A=[]

for i in range(5):
    x = int(input())
    y = x % 10
    A.append((x,y))

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

print(sum)


A=[]

for i in range(5):
    x = int(input())
    y = x % 10
    A.append((x,y))

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

print(sum)


A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0
print(B)
for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)


A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0

for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted