Circular linkedlist problem

https://hack.codingblocks.com/contests/c/537/471

only 1 test case is passing
rest 2 are giving wrong answer
how to rectify??