criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<cstdlib>
using namespace std;

int main(){
    stack<int> S;
    string s;
    while(cin>>s){
        if(s[0]=='+'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(a+b);
        }
        else if(s[0]=='-'){
            b=S.top();S.pop();
            a=S.top();S.pop();
            S.push(a-b);
        }
        else if(s[0]=='*'){
            a=S.top();S.pop();
            b=S.top();S.pop();
            S.push(a*b);
        }
        else{
            S.push(atoi(s.c_str()));
        }
    }
    cout<<S.top()<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'a' was not declared in this scope
   12 |             a=S.top();S.pop();
      |             ^
a.cc:13:13: error: 'b' was not declared in this scope
   13 |             b=S.top();S.pop();
      |             ^
a.cc:17:13: error: 'b' was not declared in this scope
   17 |             b=S.top();S.pop();
      |             ^
a.cc:18:13: error: 'a' was not declared in this scope
   18 |             a=S.top();S.pop();
      |             ^
a.cc:22:13: error: 'a' was not declared in this scope
   22 |             a=S.top();S.pop();
      |             ^
a.cc:23:13: error: 'b' was not declared in this scope
   23 |             b=S.top();S.pop();
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int popStack(stack<int>* stk){
    int ret = stk->top();
    stk->pop();
    return ret;
}
 
 
int main(){
    string s;
    getline(cin,s);
    stack<int> stk;
    for(int i = 0; i < s.size();i++){
        if(s[i] != ' '){
            if('0' <= s[i] && s[i] <= '9'){
                int val = s[i] - '0';
                i++;
                while(s[i] != ' '){
                    val *= 10;
                    val += s[i] - '0';
                    i++;
                }
                stk.push(val);
            }else{
                int val;
                switch(s[i]){
                    case '+':
                        val = popStack(&stk) + popStack(&stk);      
                        break;
                    case '-':
                        val = popStack(&stk):
                        val = popStack(&stk) - val;
                        break;
                    case '*':
                        val = popStack(&stk) * popStack(&stk);
                        break;
                    case '/':
                        val = popStack(&stk);
                        val = popStack(&stk) / val;
                        break;
                }
                stk.push(val);
            }
        }
    }
    cout << stk.top() << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:45: error: expected ';' before ':' token
   33 |                         val = popStack(&stk):
      |                                             ^
      |                                             ;
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  string word;
  stack<int> S;
  int a,b;
  while(cin >> word){
    if(word=="+"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a+b);
    }
    else if(word=="-"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a-b);
    }
    else if(word=="*"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a*b);
    }
    else{
      S.push(word);
    }
  }
  cout << A.top() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: no matching function for call to 'std::stack<int>::push(std::string&)'
   28 |       S.push(word);
      |       ~~~~~~^~~~~~
In file included from /usr/include/c++/14/stack:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:160,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_stack.h:258:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  258 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_stack.h:258:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::stack<int>::value_type&' {aka 'const int&'}
  258 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_stack.h:263:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(value_type&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  263 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_stack.h:263:25: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::stack<int>::value_type&&' {aka 'int&&'}
  263 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:31:11: error: 'A' was not declared in this scope
   31 |   cout << A.top() << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  string word;
  stack<int> S;
  int a,b;
  while(cin >> word){
    if(word=="+"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a+b);
    }
    else if(word=="-"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a-b);
    }
    else if(word=="*"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a*b);
    }
    else{
      int n=atoi(word.c str())
      S.push(n);
    }
  }
  cout << A.top() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'c'
   28 |       int n=atoi(word.c str())
      |                       ^
a.cc:32:11: error: 'A' was not declared in this scope
   32 |   cout << A.top() << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  string word;
  stack<int> S;
  int a,b;
  while(cin >> word){
    if(word=="+"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a+b);
    }
    else if(word=="-"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a-b);
    }
    else if(word=="*"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a*b);
    }
    else{
      int n=atoi(word)
      S.push(n);
    }
  }
  cout << A.top() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   28 |       int n=atoi(word)
      |                  ^~~~
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:32:11: error: 'A' was not declared in this scope
   32 |   cout << A.top() << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
#include <cstdlib>
using namespace std;

int main(){
  string word;
  stack<int> S;
  int a,b;
  while(cin >> word){
    if(word=="+"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a+b);
    }
    else if(word=="-"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a-b);
    }
    else if(word=="*"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a*b);
    }
    else{
      int n=atoi(word)
      S.push(n);
    }
  }
  cout << A.top() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   29 |       int n=atoi(word)
      |                  ^~~~
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:33:11: error: 'A' was not declared in this scope
   33 |   cout << A.top() << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  string word;
  stack<int> S;
  int a,b;
  while(cin >> word){
    if(word=="+"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a+b);
    }
    else if(word=="-"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a-b);
    }
    else if(word=="*"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a*b);
    }
    else{
      int n=atoi(word.c_word())
      S.push(n);
    }
  }
  cout << S.top() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'c_word'
   28 |       int n=atoi(word.c_word())
      |                       ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  char word;
  stack<int> S;
  int a,b;
  while(cin >> word){
    if(word=="+"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a+b);
    }
    else if(word=="-"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a-b);
    }
    else if(word=="*"){
      a=S.top();
      S.pop();
      b=S.top();
      S.push(a*b);
    }
    else{
      int n=atoi(word);
      S.push(n);
    }
  }
  cout << S.top() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |     if(word=="+"){
      |        ~~~~^~~~~
a.cc:15:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     else if(word=="-"){
      |             ~~~~^~~~~
a.cc:21:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |     else if(word=="*"){
      |             ~~~~^~~~~
a.cc:28:18: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   28 |       int n=atoi(word);
      |                  ^~~~
      |                  |
      |                  char
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include <string>
#include <stack>
#include <iostream>
using namespace std;

int main() {
  string word;
  stack<int> S;
  while (cin >> word) {
    if (word == "+") {
      int a;
      a += int n=stoi(S.top());
      S.pop();
      a += int n=stoi(S.top());
      S.pop();
      S.push(a);
    }
    else if (word == "-") {
      int a;
      a += int n=stoi(S.top());
      S.pop();
      a -= int n=stoi(S.top());
      S.pop();
      S.push(a);
    }
    else if (word == "*") {
      int a;
      a += int n=stoi(S.top());
      S.pop();
      a *= int n=stoi(S.top());
      S.pop();
      S.push(a);
    }
    else {
      int a;
      a += int n=stoi(S.top());
      S.pop();
      a /= int n=stoi(S.top());
      S.pop();
      S.push(a);
    }
  } 
  cout << S.top();
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: expected primary-expression before 'int'
   12 |       a += int n=stoi(S.top());
      |            ^~~
a.cc:14:12: error: expected primary-expression before 'int'
   14 |       a += int n=stoi(S.top());
      |            ^~~
a.cc:20:12: error: expected primary-expression before 'int'
   20 |       a += int n=stoi(S.top());
      |            ^~~
a.cc:22:12: error: expected primary-expression before 'int'
   22 |       a -= int n=stoi(S.top());
      |            ^~~
a.cc:28:12: error: expected primary-expression before 'int'
   28 |       a += int n=stoi(S.top());
      |            ^~~
a.cc:30:12: error: expected primary-expression before 'int'
   30 |       a *= int n=stoi(S.top());
      |            ^~~
a.cc:36:12: error: expected primary-expression before 'int'
   36 |       a += int n=stoi(S.top());
      |            ^~~
a.cc:38:12: error: expected primary-expression before 'int'
   38 |       a /= int n=stoi(S.top());
      |            ^~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){
  S[top++]=x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int a, b;
  top = 0;
  char s[100];

  while(scanf("%s", s)!=EOF){
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
    }else if(s[0]=='-'){
      b=pop();
      a=pop();
      push(a-b);
    }else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }else{
      push(atoi(s));
    }
  }

  prirnf("%d\n", pop());
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:3: error: 'prirnf' was not declared in this scope; did you mean 'printf'?
   39 |   prirnf("%d\n", pop());
      |   ^~~~~~
      |   printf
Language: C++

#include "stack.h"
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
  Stack<int>* s = new Stack<int>(200);
  char c;
  while(cin >> c){
    //printf("%c\n",c);
    if(isdigit(c)){
      s->push(c-48);
    }
    if(c == '+'){
      //fprintf(stderr,"in");
      int op1 = s->pop();
      //printf("%d\n",op1);
      int op2 = s->pop();
      //printf("%d\n",op2);
      s->push(op1+op2);
    }
    if(c == '-'){
      int op1 = s->pop();
      int op2 = s->pop();
      s->push(op1-op2);
    }
  }
  int result = s->pop();
  printf("%d\n",result);
  delete s;
  return 0;
}



Compiler output:
a.cc:1:10: fatal error: stack.h: No such file or directory
    1 | #include "stack.h"
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <stdio.h>
using namespace std;
 
template <class T>
class Stack{
  //メンバ関数
public:
  struct Node{
    Node* prev; //前のノードへのポインタ
    Node* next; //後のノードへのポインタ
    T value; //このノードに格納されているデータ
  };
private:
  Node* top;
  int max;
  int element_num;
public:
  Stack(int num);
  T pop();
  void push(T val);
  bool isEmpty();
  bool isFull();
};
 
template <class T>
Stack<T>::Stack(int num){
  top = 0;
  max = num;
  element_num = 0;
}
 
template <class T>
T Stack<T>::pop(){
  if(isEmpty()){
    printf("This Stack is empty.\n");
    return 0;
  }
  T out = top->value;
  top = top->next;
  if(element_num > 1){
    delete top->prev;
    top->prev = 0;
  }
  element_num--;
  return out;
}
 
template <class T>
void Stack<T>::push(T val){
  if(isFull()){
    printf("This Stack is full.\n");
    return;
  }
  Node* next_top = new Node;
  next_top->value = val;
  next_top->prev = 0;
  next_top->next = top;
  if(element_num > 0)
    top->prev = next_top;
  top = next_top;
  element_num++;
  return;
}
 
template <class T>
bool Stack<T>::isEmpty(){
  if(top == 0) return true;
  return false;
}
 
template <class T>
bool Stack<T>::isFull(){
  if(element_num == max) return true;
  return false;
}
 
int main(){
  Stack<int>* s = new Stack<int>(200);
  char c;
  while(cin >> c){
    //printf("%c\n",c);
    if(isdigit(c)){
      s->push(c-48);
    }
    if(c == '+'){
      //fprintf(stderr,"in");
      int op1 = s->pop();
      //printf("%d\n",op1);
      int op2 = s->pop();
      //printf("%d\n",op2);
      s->push(op1+op2);
    }
    if(c == '-'){
      int op1 = s->pop();
      int op2 = s->pop();
      s->push(op1-op2);
    }
    if(c == '*'){
      int op1 = s->pop();
      int op2 = s->pop();
      s->push(op1*op2);
  }
  int result = s->pop();
  printf("%d\n",result);
  delete s;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:108:2: error: expected '}' at end of input
  108 | }
      |  ^
a.cc:78:11: note: to match this '{'
   78 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>

using namespace std;


int main() {

	std::ifstream in("C:\\Users\\kou\\source\\repos\\AtCoderTest\\Debug\\input.txt");
	std::cin.rdbuf(in.rdbuf());


	vector<string> ary;
	string v;
	while (cin >> v)
	{
		ary.push_back(v);
	}
	stack<int>  stk;

	int sum = 0; int v1 = 0; int v2 = 0;
	for (int i = 0;i < ary.size();i++) {
		string val = ary[i];
		if (val == "+") {

			int v1 = stk.top();
			stk.pop();
			int v2 = stk.top();
			stk.pop();
			stk.push(v1 + v2);
		}
		else if (val == "-") {

			int v1 = stk.top();
			stk.pop();
			int v2 = stk.top();
			stk.pop();
			stk.push(v2 - v1);

		}
		else if (val == "*") {

			int v1 = stk.top();
			stk.pop();
			int v2 = stk.top();
			stk.pop();
			stk.push(v1 * v2);
		}
		else
		{
			stk.push(stoi(val));
		}
	}

	cout << stk.top() << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: variable 'std::ifstream in' has initializer but incomplete type
   12 |         std::ifstream in("C:\\Users\\kou\\source\\repos\\AtCoderTest\\Debug\\input.txt");
      |                         ^
a.cc:6:1: note: 'std::ifstream' is defined in header '<fstream>'; this is probably fixable by adding '#include <fstream>'
    5 | #include <stack>
  +++ |+#include <fstream>
    6 |
Language: C++

#include<iostream>
#include<vector>
using namespace std;

int cnt,l,n;
int A[100];
vector<int> G;

void insertionSort(int A[],int n,int g){
    for(int i=g;i<n;i++){
        int v=A[i];
        int j = i-g;
        while(j>=0 && A[j]>v){
            A[i + g] =A[i];
            j -=g;
            cnt++;
        }
        A[j + g] =v;
    }
}

void shellSort(int A[],int n){
    for(int h=1; ; ){
        if(h>n)break;
        G.push_back(h);
        h=3*h+1;
    }
    for(int i=G.size()-1;i>=0;i--){
        insertionSort(A,n,G[i]);
    }
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>A[i];
    cnt=0;
    
    shellSort(A,n);
    
    cout<<G.size()<<endl;
    for(int i=G.size()-1;i>=0;i--){
        cout<<G[i];
        if(i)cout" ";
    }
    cout<<endl;
    cout<<cnt<<endl;
    for(int i=0;i<n;i++)cout<<A[i]<<endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:18: error: expected ';' before string constant
   43 |         if(i)cout" ";
      |                  ^~~
      |                  ;
Language: C++

#include <iostream>
#include <cstdlib>
#include <stack>

using namespace std;

stack<int>s;
char ch[11];

int main()
{
    while(cin>>ch)
    {
        
        if(ch[0] == '+')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(a+b);
        }
        else if(ch[0] == '-')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b-a);
        }
        else if(ch[0] == '*')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(a*b);
        } else{
            s.push(atoi(ch));
    }
    cout << s.top() << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:2: error: expected '}' at end of input
   43 | }
      |  ^
a.cc:11:1: note: to match this '{'
   11 | {
      | ^
Language: C++

#include <iostream>
#include <cstdlib>
#include <stack>

using namespace std;

stack<int>s;
string ch;

int main()
{
    while(cin>>ch)
    {
        
        if(ch[0] == '+')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(a+b);
        }
        else if(ch[0] == '-')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b-a);
        }
        else if(ch[0] == '*')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(a*b);
        } else{
            s.push(atoi(ch));
        }
    }
    cout << s.top() << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   39 |             s.push(atoi(ch));
      |                         ^~
      |                         |
      |                         std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <stack>

using namespace std;

stack<int>s;
char ch;

int main()
{
    while(cin>>ch)
    {
        
        if(ch[0] == '+')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(a+b);
        }
        else if(ch[0] == '-')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(b-a);
        }
        else if(ch[0] == '*')
        {
            int a = s.top();
            s.pop();
            int b = s.top();
            s.pop();
            s.push(a*b);
        } else{
            s.push(atoi(ch));
        }
    }
    cout << s.top() << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: invalid types 'char[int]' for array subscript
   15 |         if(ch[0] == '+')
      |              ^
a.cc:23:19: error: invalid types 'char[int]' for array subscript
   23 |         else if(ch[0] == '-')
      |                   ^
a.cc:31:19: error: invalid types 'char[int]' for array subscript
   31 |         else if(ch[0] == '*')
      |                   ^
a.cc:39:25: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   39 |             s.push(atoi(ch));
      |                         ^~
      |                         |
      |                         char
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <stack>
#include <list>
#include <boost/algorithm/string.hpp>

using namespace std;

int main() {
  string line;
  getline(cin, line);

  list<string> list_string;
  boost::split(list_string, line, boost::is_space());

  stack<int> stack;
  list<string>::iterator it = list_string.begin();
  while (it != list_string.end() ) {
    string word = *it;
    if (word == "+") {
      int v1 = stack.top();
      stack.pop();
      int v2 = stack.top();
      stack.pop();

      stack.push(v2 + v1);
    } else if (word == "-") {
      int v1 = stack.top();
      stack.pop();
      int v2 = stack.top();
      stack.pop();

      stack.push(v2 - v1);
    } else if (word == "*") {
      int v1 = stack.top();
      stack.pop();
      int v2 = stack.top();
      stack.pop();

      stack.push(v2 * v1);
    } else {
      // operand
      int v = stoi(word);
      stack.push(v);
    }
    
    ++it;
  }
  
  int v = stack.top();
  cout << v << endl;

  return 0;
}

Compiler output:
a.cc:4:10: fatal error: boost/algorithm/string.hpp: No such file or directory
    4 | #include <boost/algorithm/string.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;


int main(){
  stack<int> s;
  string word;
  while(cin >> word){
    if(word=="+"){
      int x1 = s.top();
      s.pop();
      int x2 = s.top();
      s.pop();
      s.push(x1+x2);
    }else  if(word=="-")
    {
      int x1 = s.top();
      s.pop();
      int x2 = s.top();
      s.pop();
      s.push(x1-x2);
    }else if (word=="*")
    {
      int x1 = s.top();
      s.pop();
      int x2 = s.top();
      s.pop();
      s.push(x1 * x2);
    }else
    {
     s.push(atoi(word.c_str()));
    }
  }
   co

Compiler output:
a.cc: In function 'int main()':
a.cc:38:4: error: 'co' was not declared in this scope
   38 |    co
      |    ^~
a.cc:38:6: error: expected '}' at end of input
   38 |    co
      |      ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include<cstdlib>
using namespace std;
#define STACK_MAX 1000

int stack[STACK_MAX];

int stack_top = 0;

void push(int val){
    if (stack_top==STACK_MAX) {
        return;
    }else{
        stack[stack_top++]=val;
    }
}

int pop(){
    if (stack_top==0) {
        return(0);
    }else{
        return stack[--stack_top];
    }
}

void culcu(string cul){
    if (cul == "+") {
        int culc1 = pop();
        int culc2 = pop();
        push(culc1 + culc2);
    }else if (cul == "-") {
        int culc1 = pop();
        int culc2 = pop();
        push(culc2 - culc1);
    }else if (cul == "*") {
        int culc1 = pop();
        int culc2 = pop();
        push(culc1 * culc2);
    }else {
    push(atoi(cul.c str()));
    }

}

int main(){
    string words;
    while(cin >> words){
        culcu(words);
        }
    cout << pop();
}

Compiler output:
a.cc: In function 'void culcu(std::string)':
a.cc:41:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'c'
   41 |     push(atoi(cul.c str()));
      |                   ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <stack>
#include <cstdlib>

using namespace std;

int main()
{
  stack<int> num;
  string s;
  int a, b;
  while(cin >> s){
    if(s >= "0" && s <= "9")
      num.push(atoi(s.c_str()));
    else if(s == "+" || s == "-" || s == "*" || s == "/"){
      a = num.top();
      num.pop();
      b = num.top();
      num.pop();
      if(s == "+")
	num.push(a + b);
      else if(s == "-"){
	num.push(b - a);
      }
      else
	num.push(a * b);
    }
  cout << num.top() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <stack>
#include <cstdlib>
using namespace std;

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
stack<int> s;
int main() {
	char str[8];
	while(1) {
		if(scanf("%s", str) == EOF) break;
		if(!strcmp(str,"*")) {
			int a = s.top();
			s.pop();
			int b = s.top();
			s.pop();
			s.push(a * b);
		} else if(!strcmp(str,"+")) {
			int a = s.top();
			s.pop();
			int b = s.top();
			s.pop();
			s.push(a + b);
		} else if(!strcmp(str,"-")) {
			int a = s.top();
			s.pop();
			int b = s.top();
			s.pop();
			s.push(b - a);
		} else {
			s.push(atoi(str));
		}
		cout << s.top() << endl;
	}
	//cout << s.top() << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: 'strcmp' was not declared in this scope
   16 |                 if(!strcmp(str,"*")) {
      |                     ^~~~~~
a.cc:7:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <cstdlib>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(){
	int stack[200] = { 0 }, idx = 100;
	char input[200],*elem;

	gets_s(input);
	elem = strtok(input, " ");
	while(elem!=NULL){
		if (elem[0] == '+'){
			stack[idx + 1] += stack[idx++];
		}
		else if (elem[0] == '-'){
			stack[idx + 1] -= stack[idx++];
		}
		else if (elem[0] == '*'){
			stack[idx + 1] *= stack[idx++];
		}else{
			stack[--idx] = atoi(elem);
		}
		elem = strtok(NULL, " ");
	}
	printf("%d\n", stack[idx]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'gets_s' was not declared in this scope
    9 |         gets_s(input);
      |         ^~~~~~
Language: C++


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
#define MAX 100
  
int main(){
  int s, sta[MAX], i = 0;
  char st[N];
    
  while(scanf("%s", sta) != EOF){
    if(sta[0] == '+'){
      sta[i - 2] += sta[i - 1];
      i -= 1;
    }
 
    else if(sta[0] == '-'){
      sta[i - 2] -= sta[i - 1];
      i--;
    }
 
    else if(sta[0] == '*'){
      sta[i - 2] *= sta[i - 1];
      i--;
    }
 
    else{
      s = atoi(st);
      sta[i] = s;
      i++;
    }
  }
 
  printf("%d\n",sta[0]);
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'N' was not declared in this scope
   10 |   char st[N];
      |           ^
a.cc:29:16: error: 'st' was not declared in this scope; did you mean 'sta'?
   29 |       s = atoi(st);
      |                ^~
      |                sta
Language: C++

#include <iostream>
#include <string>
#include <stack>

int main(){
	std::stack<int> Stack;//スタック
	std::string lineloader;//行ローダー
	char* ctx;//コンテクスト

	//ロード
	std::getline(std::cin, lineloader);
	char* line = new char[lineloader.size() + 1];
	strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
	char* tokenloader = strtok_s(line, " ", &ctx);

	int x = 0, y = 0;//計算用変数
	while (tokenloader){
		//計算
		if (strcmp(tokenloader, "+") == 0){//演算子+
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x += y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "-") == 0){//演算子-
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x -= y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "*") == 0){//演算子*
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x *= y;
			Stack.push(x);
		} else {//数値
			Stack.push(atoi(tokenloader));
		}
		//順に読み込み
		tokenloader = strtok_s(NULL, " ", &ctx);
	}

	std::cout << Stack.top() << std::endl;//出力

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'strcpy_s' was not declared in this scope
   13 |         strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
      |         ^~~~~~~~
a.cc:14:29: error: 'strtok_s' was not declared in this scope; did you mean 'strtol_l'?
   14 |         char* tokenloader = strtok_s(line, " ", &ctx);
      |                             ^~~~~~~~
      |                             strtol_l
a.cc:19:21: error: 'strcmp' was not declared in this scope
   19 |                 if (strcmp(tokenloader, "+") == 0){//演算子+
      |                     ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <stack>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <string>
#include <stack>
#include <stdlib.h>

int main(){
	std::stack<int> Stack;//スタック
	std::string lineloader;//行ローダー
	char* ctx;//コンテクスト

	//ロード
	std::getline(std::cin, lineloader);
	char* line = new char[lineloader.size() + 1];
	strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
	char* tokenloader = strtok_s(line, " ", &ctx);

	int x = 0, y = 0;//計算用変数
	while (tokenloader){
		//計算
		if (strcmp(tokenloader, "+") == 0){//演算子+
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x += y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "-") == 0){//演算子-
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x -= y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "*") == 0){//演算子*
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x *= y;
			Stack.push(x);
		} else {//数値
			Stack.push(atoi(tokenloader));
		}
		//順に読み込み
		tokenloader = strtok_s(NULL, " ", &ctx);
	}

	std::cout << Stack.top() << std::endl;//出力

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'strcpy_s' was not declared in this scope
   14 |         strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
      |         ^~~~~~~~
a.cc:15:29: error: 'strtok_s' was not declared in this scope; did you mean 'strtol_l'?
   15 |         char* tokenloader = strtok_s(line, " ", &ctx);
      |                             ^~~~~~~~
      |                             strtol_l
a.cc:20:21: error: 'strcmp' was not declared in this scope
   20 |                 if (strcmp(tokenloader, "+") == 0){//演算子+
      |                     ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <stdlib.h>
  +++ |+#include <cstring>
    5 |
Language: C++

#include <iostream>
#include <string>
#include <stack>
#include <stdlib.h>
#include <cstring>

int main(){
	std::stack<int> Stack;//スタック
	std::string lineloader;//行ローダー
	char* ctx;//コンテクスト

	//ロード
	std::getline(std::cin, lineloader);
	char* line = new char[lineloader.size() + 1];
	strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
	char* tokenloader = strtok_s(line, " ", &ctx);

	int x = 0, y = 0;//計算用変数
	while (tokenloader){
		//計算
		if (strcmp(tokenloader, "+") == 0){//演算子+
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x += y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "-") == 0){//演算子-
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x -= y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "*") == 0){//演算子*
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x *= y;
			Stack.push(x);
		} else {//数値
			Stack.push(atoi(tokenloader));
		}
		//順に読み込み
		tokenloader = strtok_s(NULL, " ", &ctx);
	}

	std::cout << Stack.top() << std::endl;//出力

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   15 |         strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
      |         ^~~~~~~~
      |         strcpy
a.cc:16:29: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
   16 |         char* tokenloader = strtok_s(line, " ", &ctx);
      |                             ^~~~~~~~
      |                             strtok_r
Language: C++

#include <iostream>
#include <string>
#include <stack>
#include <stdlib.h>
#include <string.h>

int main(){
	std::stack<int> Stack;//スタック
	std::string lineloader;//行ローダー
	char* ctx;//コンテクスト

	//ロード
	std::getline(std::cin, lineloader);
	char* line = new char[lineloader.size() + 1];
	strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
	char* tokenloader = strtok_s(line, " ", &ctx);

	int x = 0, y = 0;//計算用変数
	while (tokenloader){
		//計算
		if (strcmp(tokenloader, "+") == 0){//演算子+
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x += y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "-") == 0){//演算子-
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x -= y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "*") == 0){//演算子*
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x *= y;
			Stack.push(x);
		} else {//数値
			Stack.push(atoi(tokenloader));
		}
		//順に読み込み
		tokenloader = strtok_s(NULL, " ", &ctx);
	}

	std::cout << Stack.top() << std::endl;//出力

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   15 |         strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
      |         ^~~~~~~~
      |         strcpy
a.cc:16:29: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
   16 |         char* tokenloader = strtok_s(line, " ", &ctx);
      |                             ^~~~~~~~
      |                             strtok_r
Language: C++

#include <iostream>
#include <string>
#include <stack>
#include <string.h>

int main(){
	std::stack<int> Stack;//スタック
	std::string lineloader;//行ローダー
	char* ctx;//コンテクスト

	//ロード
	std::getline(std::cin, lineloader);
	char* line = new char[lineloader.size() + 1];
	strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
	char* tokenloader = strtok_s(line, " ", &ctx);

	int x = 0, y = 0;//計算用変数
	while (tokenloader){
		//計算
		if (strcmp(tokenloader, "+") == 0){//演算子+
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x += y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "-") == 0){//演算子-
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x -= y;
			Stack.push(x);
		} else if (strcmp(tokenloader, "*") == 0){//演算子*
			y = Stack.top(); Stack.pop();
			x = Stack.top(); Stack.pop();
			x *= y;
			Stack.push(x);
		} else {//数値
			Stack.push(atoi(tokenloader));
		}
		//順に読み込み
		tokenloader = strtok_s(NULL, " ", &ctx);
	}

	std::cout << Stack.top() << std::endl;//出力

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   14 |         strcpy_s(line, lineloader.size() + 1, lineloader.c_str());
      |         ^~~~~~~~
      |         strcpy
a.cc:15:29: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
   15 |         char* tokenloader = strtok_s(line, " ", &ctx);
      |                             ^~~~~~~~
      |                             strtok_r
Language: C++

#include "stdafx.h"
#include<stack>
#include<iostream>
#include<string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	stack<int>st;

	string a;

	while(cin >> a){
		if(a[0] == '+'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b+c);
		}
		if(a[0] == '-'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b-c);
		}
		if(a[0] == '*'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b*c);
		}
		st.push(atoi(a.c_str()));
	}

	cout<<st.top()<<endl;

	return 0;
} 

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include "stdafx.h"
#include<stack>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(void)
{
	stack<int>st;

	string a;

	while(cin >> a){
		if(a[0] == '+'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b+c);
		}else if(a[0] == '-'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b-c);
		}else if(a[0] == '*'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b*c);
		}else if(a[0] = ' '){
		}else{
		st.push(atoi(a.c_str()));
		}
	}

	cout << st.top() << endl;


	return 0;
} 

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include "stdafx.h"
#include<stack>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(void)
{
	stack<int>str;

	string a;

	while(cin >> str){
		if(a[0] == '+'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b+c);
		}else if(str[0] == '-'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b-c);
		}else if(str[0] == '*'){
			int b = st.top();
             st.pop();
			int c = st.top();
			 st.pop();
			 st.push(b*c);
		}else if(str[0] = ' '){
		}else{
		st.push(atoi(str.c_str()));
		}
	}

	cout << st.top() << endl;


	return 0;
} 

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include "stdafx.h"
#include<stack>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(void)
{
	stack<int>str;

	string a;

	int b,c,d,e,f,g;

	while(cin >> str){
		if(str[0] == '+'){
			 b = st.top();
             st.pop();
			 c = st.top();
			 st.pop();
			 st.push(b+c);
		}else if(str[0] == '-'){
			 d = st.top();
             st.pop();
			 e = st.top();
			 st.pop();
			 st.push(d-e);
		}else if(str[0] == '*'){
			 f = st.top();
             st.pop();
			 g = st.top();
			 st.pop();
			 st.push(f*g);
		}else if(str[0] = ' '){
		}else{
		st.push(atoi(str.c_str()));
		}
	}

	cout << st.top() << endl;


	return 0;
} 

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include "stdafx.h"
#include<stack>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(void)
{
	stack<int>str;

	string a;

	int b,c,d,e,f,g;

	while(cin >> str){
		if(str[0] == '+'){
			 b = st.top();
             st.pop();
			 c = st.top();
			 st.pop();
			 st.push(b+c);
		}else if(str[0] == '-'){
			 d = st.top();
             st.pop();
			 e = st.top();
			 st.pop();
			 st.push(e-d);
		}else if(str[0] == '*'){
			 f = st.top();
             st.pop();
			 g = st.top();
			 st.pop();
			 st.push(f*g);
		}else if(str[0] = ' '){
		}else{
		st.push(atoi(str.c_str()));
		}
	}

	cout << st.top() << endl;


	return 0;
} 

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <stack>
using namespace std;
stack<int> S;
int main() {
  char s;
  int a, b;
  while (cin >> s) {
    switch (s) {
      case '+':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a + b); break;
      case '-':
        b = S.top(); S.pop();
        a = S.top(); S.pop();
        S.push(a - b); break;
      case '*':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a * b); break;
      case'/':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a / b); break;
      default:
        S.push(atoi(&s));
    }
  }
  cout << S.top() << endl;
  return 0;
}#include <iostream>
#include <stack>
using namespace std;
stack<int> S;
int main() {
  char s;
  int a, b;
  while (cin >> s) {
    switch (s) {
      case '+':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a + b); break;
      case '-':
        b = S.top(); S.pop();
        a = S.top(); S.pop();
        S.push(a - b); break;
      case '*':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a * b); break;
      case'/':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a / b); break;
      default:
        S.push(atoi(&s));
    }
  }
  cout << S.top() << endl;
  return 0;
}

Compiler output:
a.cc:32:2: error: stray '#' in program
   32 | }#include <iostream>
      |  ^
a.cc:32:3: error: 'include' does not name a type
   32 | }#include <iostream>
      |   ^~~~~~~
a.cc:35:12: error: redefinition of 'std::stack<int> S'
   35 | stack<int> S;
      |            ^
a.cc:4:12: note: 'std::stack<int> S' previously declared here
    4 | stack<int> S;
      |            ^
a.cc:36:5: error: redefinition of 'int main()'
   36 | int main() {
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main() {
      |     ^~~~
Language: C++

#include <cstdio>
#include <cstdlib>
 
template <typename T>
class stack{
  T a[101];
  unsigned n;
public:
  stack():a(),n(0){}
  T& top(){return a[n-1];}
  void pop(){return a[n--];}
  void push(T in){a[n++]=in;}
};
 
int main(){
  stack<int> s;
  char buf[100];
 
  while(scanf("%s",buf) != EOF){
    int a;
    switch(buf[0]){
      case '+' : a = s.pop(); s.top() += a; break;
      case '-' : a = s.pop(); s.top() -= a; break;
      case '*' : a = s.pop(); s.top() *= a; break;
      default  : s.push(atoi(buf));
    }
  }
  printf("%d\n",s.top());
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:27: error: void value not ignored as it ought to be
   22 |       case '+' : a = s.pop(); s.top() += a; break;
      |                      ~~~~~^~
a.cc:23:27: error: void value not ignored as it ought to be
   23 |       case '-' : a = s.pop(); s.top() -= a; break;
      |                      ~~~~~^~
a.cc:24:27: error: void value not ignored as it ought to be
   24 |       case '*' : a = s.pop(); s.top() *= a; break;
      |                      ~~~~~^~
a.cc: In instantiation of 'void stack<T>::pop() [with T = int]':
a.cc:22:27:   required from here
   22 |       case '+' : a = s.pop(); s.top() += a; break;
      |                      ~~~~~^~
a.cc:11:22: error: return-statement with a value, in function returning 'void' [-fpermissive]
   11 |   void pop(){return a[n--];}
      |                     ~^
Language: C++

#include <cstdio>
#include <cstdlib>

struct stack{
  int a[101];
  unsigned n;
  stack():a(),n(0){}
  int& top(){return a[n-1];}
  int pop(){return a[--n];}
  void push(int in){a[n++]=in;}
};

int main(){
  std::ios::sync_with_stdio(false);
  stack s;
  char buf[100];

  while(scanf("%s",buf) != EOF){
    int a;
    switch(buf[0]){
      case '+' : a = s.pop(); s.top() += a; break;
      case '-' : a = s.pop(); s.top() -= a; break;
      case '*' : a = s.pop(); s.top() *= a; break;
      default  : s.push(atoi(buf));
    }
  }
  printf("%d\n",s.top());
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:8: error: 'std::ios' has not been declared
   14 |   std::ios::sync_with_stdio(false);
      |        ^~~
Language: C++

/* last edited at 29/8/2015 by charis
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

class stack{
public:
int top;
int S[];

	void initialize(){
		top = 0;
	}

	int isEmpty(){
		return top == 0;
	}

	int isFull(){
		return top>=100;
	}

	void push(int x){
		if(isFull()) cout << "Error" << endl;
		else {
			top++;
			S[top]=x;		
		}	
	}

	int pop(){
		if(isEmpty()) cout << "Error" << endl;
		top--;		
		return S[top+1];
	}
};
/*
void addition(){
	stack s;
	int a = s.pop();
	int b = s.pop();
	int r =  a + b;
	s.push(r);
}

void subtraction(){
	stack s;
	int r = s.pop() - s.pop();	
	s.push(r);	
}

void multiplication(){
	stack s;
	int r = s.pop() * s.pop();	
	s.push(r);	
}
*/
int main(){
	stack s;
	char C[100];
	s.initialize();
	while(scanf("%s", C) != EOF ){
		if ( C[0] == '+' ){
			int a = s.pop();
			int b = s.pop();	
			s.push(a+b); 
		}	
		else if ( C[0] == '-' ) {
			int a = s.pop();
			int b = s.pop();	
			s.push(a-b); 			
		}
		else if ( C[0] == '*' ) {
			int a = s.pop();
			int b = s.pop();	
			s.push(a*b); 			
		}
		else {
			int x = atoi(C);
			s.push(x);
		}
		cout << C << " ";
	} 
    while (s.size()) {
        cout << stk.pop() << endl;
    }
	
	return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:89:14: error: 'class stack' has no member named 'size'
   89 |     while (s.size()) {
      |              ^~~~
a.cc:90:17: error: 'stk' was not declared in this scope; did you mean 'std'?
   90 |         cout << stk.pop() << endl;
      |                 ^~~
      |                 std