What is the problem in this code? it runs good till first half then it creates problem

hi @yamangoyal100_ff74db54bdf01539 refer https://ide.codingblocks.com/s/666639

please elaborate this condition:–>

please elaborate this condition in this code :->https://ide.codingblocks.com/s/666639

which condition u want to elaborate?