Getting correct answer for sample test case but not for main cases

link: https://ide.codingblocks.com/s/235698