I’ve not been able to find any test case where your code gives the wrong answer. You do have a mix of data types - long long int when you push something onto the stack, and only int when you pop it off, but I wasn’t able to create a test case where this caused a problem.
I’m sorry I’ve not been able to help.