With reference to the problem named "Strange List" in codeforces following is my code
But the problem is All test case is passing but the last