What is the error in my code?

Problem link: https://codeforces.com/problemset/problem/620/E

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

Please tell my what is the error in my code. My code is giving wrong answer for the 2nd test case.