Code giving different answer on every execution

I wrote the code but it is giving different answer on every execution. https://ide.codingblocks.com/s/231149 Please anyone help me.

@ayusdas2000 hey thats happen sometime ,just ap ek hi ide pr sahi input pr chalao 4/5 test cases pr.

it is not giving answer in any ide. Tried in 2-3 ides

@ayusdas2000 problem kya arhi hai wrong ans ki ide ki dikkt hai?