AtCoder ABC167 Problem D failed Testcase

Can anyone please help me figure out where does my code go wrong.
Link to code :

Please provide me with a testcase on which the code fails.