Prateek Sir and Coding(runs fine on my laptop screen shot is attached)

#include
#include
using namespace std;

int main()
{
stack s;
int n,q,j; //query-q
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>q;
if(q==2)
{
cin>>j;
s.push(j);
}
if(q==1){
cout<<s.top()<<endl;
s.pop();
}
}

return 0;

}

Hey rishabh, you have not considered the case when the pile is empty and you have to print “No Code” in that case