Why my code is working on test case but wrong answer on other test case

Code https://ide.codingblocks.com/s/214626

@the.shubham.sri Your code submission is showing AC now, i think you have solved it or do you need any help in it.
Please mark this doubt as resolved if you have solved it.