# what did I do wrong and how can I improve

why did they put this challenge on hold?

How could I have made it clearer?

Benjamin has N boxes in his garden with dimension xiyizi each. Because he does not want to let them out and get wet, he wants to put them in the warehouse with a capacity of V. To solve this problem, Benjamin bought a machine which, with the cost of 1 buck, gets a box and increases or decreases all its dimensions by one unit. The box will not change at all if the box change leads to some of its dimensions are zero or negative.

Your task is to help Benjamin put the boxes in his warehouse with the least possible cost, making the total box volume equal to V.

Input Format

The first entry line will contain the integers N and V, the total number of Benjamin's boxes and the volume of the warehouse. The following N lines contain 3 integers xi, yi, zi, the original dimensions of the ith box.

Output data

The only line of output must contain the minimum cost which Benjamin will have to pay the machine, to convert the volume of his boxes to exactly V, or return -1, if this is not possible.

Sample Input 1

4 9

1 1 2

1 1 2

1 1 1

2 2 1

Sample Output 1

0

Sample Input 2

3 123

10 1 10

2 5 6

5 3 3

Sample Output 2

3

Explanation

observe that in the first sample input the volume of the boxes is already 2+2+1+4=9, so Benjamin does not have to change the boxes at all.

Moreover, observe that in the first box, the second boxes dimensions need to be reduced by 1 unit and the dimensions of the third box need to be reduced by 2 units. So the total volume will be 100+20+3=123.

• (note: the two * are interpreted as markdown format. Escape them.) May 22, 2019 at 3:28

• This community also dislikes language specific challenges, so unless there is a reason why it must be in c++, consider opening it up for all languages to participate