Issue with code submission for problem code : CNOTE

I have two solutions listed below for problem : https://www.codechef.com/problems/CNOTE

AC : https://www.codechef.com/viewsolution/37920496
WA : https://www.codechef.com/viewsolution/37920442

Bot the solutions are identical except for one thing :
If i try to break the inner loop if a suitable notebook is found then the solution is stated as Wrong.
I am not able to understand why is this happening.
As per the problem statement, if a suitable notebook is found it should be good enough. I don’t see why we need to iterate through all the notebooks.
Can someone please help with what i am missing here ?