Help with error

code: https://ide.codingblocks.com/s/426122

problem: https://hack.codingblocks.com/app/contests/2022/708/problem

getting tle but getting the correct answer for sample tc

Hello @raghav007 when you are printing the element and popping put that in else statement otherwise while the stack is empty it will try to pop out for it as well.