Where my solution is failing? (PEPPERA)

What’s wrong with my solution to the problem

I have taken the difference in the number of 1’s in between the left half and the right half 2-d array for each row. If the difference is negative I am reversing that particular row. Later by using Knapsack, I will pick the rows whose difference sums up to half of the total difference (or near to it if half is not possible) and I will reverse these rows. I am getting right answers for the test cases I tried but I got the wrong answer while submitting my solution in CodeChef.

Please let me know for what test cases my solution is failing.

This is my code.