以下错误代码:
#include<bits/stdc++.h>
#include<stack>
#include<queue>
using namespace std;
stack<int> st1,st2,cz,cz1;
int a[100005],n,y,m,w;
int main()
{
cin>>n>>m;
char x;
for(int i=1;i<=n;i++){
cin>>x;
if(x=='A'){
cin>>y;
int e=y%m;
st1.push(e);
}
if(x=='Q')
{
cin>>w;
int sum=st1.top();
for(int j=1;j<=w;i++){
st2.push(st1.top());
if(sum<st1.top()){
sum=st1.top();
}
st1.pop();
}
for(int j=1;j<=w;i++){
int z=st2.top();
st1.push(z);
st2.pop();
}
cz.push(sum);
}
}
while(cz.empty()==0)
{
cz1.push(cz.top());
cz.pop();
}
while(cz1.empty()==0)
{
cout<<cz1.top()<<endl;
cz1.pop();
}
return 0;
}