https://www.codechef.com/COOK110B/problems/TWOGRS

i have wrote a code for this problem which checks all the possible cases for this problem .my solution.
https://www.codechef.com/viewsolution/26774748
please check and tell me what’s wrong in my logic or code.
i am new on code chef and could use some help over here.