can any one help??i m getting wrong answer for snake snaky

here is the link http://www.codechef.com/viewsolution/4978848. Please let me know where is my mistake

In online platforms,there is no need to print “Enter the test cases” ,“Enter value of n m x y l” etc.

Just take input and print the output.