Problem calc
User JoshJuice
Submission Time 2025-08-29 18:38:06
Score 0
Max Time N/A
Max Memory N/A

Compile Error

calc.cpp: In function ‘int main()’:
calc.cpp:3:117: error: expected ‘;’ before ‘}’ token
3 | int main(){int n;cin>>n;vector<int> a;while(n--){string x;int y;cin>>x>>y;if(x[0]=='A'){if(!a.empty())a.push_back(y)};else a.pop_back();}cout<<accumulate(a.begin(),a.end(),0);}
| ^
| ;
calc.cpp:3:119: error: ‘else’ without a previous ‘if’
3 | int main(){int n;cin>>n;vector<int> a;while(n--){string x;int y;cin>>x>>y;if(x[0]=='A'){if(!a.empty())a.push_back(y)};else a.pop_back();}cout<<accumulate(a.begin(),a.end(),0);}
| ^~~~