Showing wrong answer in question Code: FFL but my output is correct?

this is my submission link: CodeChef: Practical coding for everyone
please check this solution.
this is the problem link:
FFL Problem - CodeChef

“Doesn’t exceed” means less than or equal to, whereas you have used less than.

i tried it also but still it is showing Wrong answer

You’re printing the answer outside the testcase loop.

this is my recent submission i had done all the corrections you have suggested, still it is showing wrong anser
submission link: CodeChef: Practical coding for everyone

and I am using python 3.7.3

thanks @everule1
your corrections made it correct answer…