please look at my code and check why test cases are not getting passed?
#include<bits/stdc++.h>
using namespace std;
int main () {
int t;
cin>>t;
int type,cost;
stack s;
while(t–){
cin>>type;
if(type==2){
cin>>cost;
s.push(cost);
}
if(type==1){
if(!s.empty()){
cout<<s.top()<<"\n";
s.pop();
}
if(s.empty()){
continue;
}
continue;
}
}
return 0;
}