Problem SPP Spoj

My 2 test cases are passed out of 5. I am unable to figure out where I am wrong.Please Help.
Link to my code

Hello @Devforlife07,

You ca refer to the following code i have written.
It is passing all the test cases:

The approach of your code and mine is similar.
So, it will be easier for you to debug your code.