BEX-Wrong Answer

Can anyone tell me where am I going wrong in this solution? Have tried it a lot of times but I am not able to figure out my fault. Link: https://www.codechef.com/viewsolution/14513398

Your code fails here-

Input
8
4 english
4 history
1 math
1 math
-1
0 chemistry
-1
-1
Your Output
0 math
1 math
0 history
Expected Output
0 math
0 math
0 history

You are adding that chem book in pile too, when its clearly said that pile has books with NON-ZERO exercises. Books with 0 exercises are ignored.

1 Like
//