PARTY of spoj; getting WA

The link to my code is
I am unable to understand why my code is giving wrong answer.Please help to find the error.
Thanks in advance.

When non of the entrance fee will be selected.your solution is printing it wrong.
20 2

21 10

21 5

0 0

and also your way of calculating minimum cost is wrong.

Thanks, I understood the case when noone of entrance fee will be selected.
Here is link to modified code
But why my way of calculating minimum cost is wrong?It would be a great help if you could elaborate it.