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

#include <bits/stdc++h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
stack<int> st;
string S;
int cul(string s){
  int b=st.top();st.pop();
  int a=st.top();st.pop();
  if(s=="+"){
    return a+b;
  }else if(S=="-"){
    return a-b;
  }else if(S=="*"){
    return a*b;
  }else{
    return a/b;
  }
}
int main(){
  while(cin>>S){
    if(S=="+"||S=="-"||S=="*"||S=="/"){
      st.push(cul(S));
    }else{
      st.push(stoi(S));
    }
    if(getchar()=='\n'){
      cout<<st.top()<<endl;
      return 0;
    }
  }
  return 0;
}


Compiler output:
a.cc:1:10: fatal error: bits/stdc++h: No such file or directory
    1 | #include <bits/stdc++h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
int main(){
	
	std::string str;
	int stack[101];
	int count=-1;

	while(std::cin >> str){
		count++;

		if(str=="+"){
			stack[count-2]=stack[count-2]+stack[count-1];
			stack[count]=0;
			stack[count-1]=0;
			count=count-2;
		}else if(str=="-"){
			stack[count-2]=stack[count-2]-stack[count-1];
			stack[count]=0;
			stack[count-1]=0;
			count=count-2;
		}else if(str=="*"){
			stack[count-2]=stack[count-2]*stack[count-1];
			stack[count]=0;
			stack[count-1]=0;
			count=count-2;
		}else if(str==" "){
			count--;
		}else{
			stack[count]=std::atoi(str);
		}
		
	}
	std::cout<<stack[0]<<"\n";
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:48: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   30 |                         stack[count]=std::atoi(str);
      |                                                ^~~
      |                                                |
      |                                                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<string>
#include<cstdio>
#include<stdlib>
int main(){
	
	std::string str;
	int stack[101];
	int count=-1;

	while(std::cin >> str){
		count++;

		if(str=="+"){
			stack[count-2]=stack[count-2]+stack[count-1];
			stack[count]=0;
			stack[count-1]=0;
			count=count-2;
		}else if(str=="-"){
			stack[count-2]=stack[count-2]-stack[count-1];
			stack[count]=0;
			stack[count-1]=0;
			count=count-2;
		}else if(str=="*"){
			stack[count-2]=stack[count-2]*stack[count-1];
			stack[count]=0;
			stack[count-1]=0;
			count=count-2;
		}else if(str==" "){
			count--;
		}else{
			
			stack[count]=atoi(str.c_str());
		}
		
	}
	
	std::cout<<stack[0]<<"\n";
	return 0;
}


Compiler output:
a.cc:4:9: fatal error: stdlib: No such file or directory
    4 | #include<stdlib>
      |         ^~~~~~~~
compilation terminated.
Language: C++

l=list(input().split())  ##文字も数字も入る
stack=[]

for x in l: ##リストの長さ文だけ繰り返し
    if x in ['+','-','*']: ##←知らなかった判定方法
        t=str(stack.pop()) ##末尾取り出し
        r=str(stack.pop())
        c=r+x+t
        stack+=[int(eval(c))] ##eval:入力した式の入力

    else:
        stack+=[int(x)] ##[]の意味?>リストに追加

print(stack.pop())



Compiler output:
a.cc:1:26: error: stray '##' in program
    1 | l=list(input().split())  ##文字も数字も入る
      |                          ^~
a.cc:4:13: error: stray '##' in program
    4 | for x in l: ##リストの長さ文だけ繰り返し
      |             ^~
a.cc:5:28: error: stray '##' in program
    5 |     if x in ['+','-','*']: ##←知らなかった判定方法
      |                            ^~
a.cc:5:30: error: extended character ← is not valid in an identifier
    5 |     if x in ['+','-','*']: ##←知らなかった判定方法
      |                              ^
a.cc:6:28: error: stray '##' in program
    6 |         t=str(stack.pop()) ##末尾取り出し
      |                            ^~
a.cc:9:31: error: stray '##' in program
    9 |         stack+=[int(eval(c))] ##eval:入力した式の入力
      |                               ^~
a.cc:12:25: error: stray '##' in program
   12 |         stack+=[int(x)] ##[]の意味?>リストに追加
      |                         ^~
a.cc:1:1: error: 'l' does not name a type
    1 | l=list(input().split())  ##文字も数字も入る
      | ^
Language: C++

#include <cstdio>
#include <stack>
using namespace std;

void calculate(stack<int> &st, char c) {
    int b = st.top();
    st.pop();
    int a = st.top();
    st.pop();
    switch (c) {
        case '+':
            st.push(a + b);
            break;
        case '-':
            st.push(a - b);
            break;
        case '*':
            st.push(a * b);
            break;
    }
};

int main() {
    stack<int> st;        
    char s[10];

    while(scanf("%s", s) != EOF) {
        printf("s: %s\n", s);
        if (s[0] == '+' || s[0] == '-' || s[0] == '*') {
            calculate(st, s[0]);
        } else {
            st.push(atoi(s));
        }
    }
    printf("%d\n", st.top());
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'atoi' was not declared in this scope
   32 |             st.push(atoi(s));
      |                     ^~~~
Language: C++

#include <cstdio>
#include <stack>
using namespace std;

void calculate(stack<int> &st, char c) {
    int b = st.top();
    st.pop();
    int a = st.top();
    st.pop();
    switch (c) {
        case '+':
            st.push(a + b);
            break;
        case '-':
            st.push(a - b);
            break;
        case '*':
            st.push(a * b);
            break;
    }
};

int main() {
    stack<int> st;        
    char s[10];

    while(scanf("%s", s) != EOF) {
        if (s[0] == '+' || s[0] == '-' || s[0] == '*') {
            calculate(st, s[0]);
        } else {
            st.push(atoi(s));
        }
    }
    printf("%d\n", st.top());
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:21: error: 'atoi' was not declared in this scope
   31 |             st.push(atoi(s));
      |                     ^~~~
Language: C++

class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1]


def main():
    e = input().split()
    s = Stack(101)

    for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

    print(s.pop())


if __name__ == '__main__':
    main()



Compiler output:
a.cc:48:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   48 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:2:9: error: expected class-name before '__init__'
    2 |     def __init__(self, full_idx=10):
      |         ^~~~~~~~
a.cc:2:9: error: expected '{' before '__init__'
a.cc:2:18: error: 'self' was not declared in this scope
    2 |     def __init__(self, full_idx=10):
      |                  ^~~~
a.cc:2:24: error: 'full_idx' was not declared in this scope
    2 |     def __init__(self, full_idx=10):
      |                        ^~~~~~~~
a.cc:2:35: error: expression list treated as compound expression in initializer [-fpermissive]
    2 |     def __init__(self, full_idx=10):
      |                                   ^
Language: C++

#include<iostream>
#include<vector>
#include<ctype>
#include<algorithm>
using namespase std;

String st;
vector<String> not_num[99];
int<int> num[100];

for(int i=0; i<200; i++){
	st = cin;
		
	if( all_of(string.cbegin(), string.cend(), isdigit() ){
		num.push_back( int(st) );
	}else{
		not_num = st;
		size = num_size;
		
		if( st == "+" ){
			num[size-2] = num[size-2] + num[size-1];
		}else if( st == "-" ){
			num[size-2] = num[size-2] - num[size-1];
		}else if( st == "*" ){
			num[size-2] = num[size-2] * num[size-1];
		}
	}
	if( num_size == 1 ) break;
}
	cout( num[0] );


Compiler output:
a.cc:3:9: fatal error: ctype: No such file or directory
    3 | #include<ctype>
      |         ^~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<ctype>
#include<algorithm>
using namespase std;

String st;
vector<String> not_num[99];
vector<int> num[100];

for(int i=0; i<200; i++){
	st = cin;
		
	if( all_of(string.cbegin(), string.cend(), isdigit() ){
		num.push_back( stoi(st) );
	}else{
		not_num = st;
		size = num_size;
		
		if( st == "+" ){
			num[size-2] = num[size-2] + num[size-1];
		}else if( st == "-" ){
			num[size-2] = num[size-2] - num[size-1];
		}else if( st == "*" ){
			num[size-2] = num[size-2] * num[size-1];
		}
	}
	if( num_size == 1 ) break;
}
	cout( num[0] );


Compiler output:
a.cc:3:9: fatal error: ctype: No such file or directory
    3 | #include<ctype>
      |         ^~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<cstdlib>
#include<vector>
#include<string>

void push(int n,std::vector<int>& Stack){
  Stack.push_back(n);
}

int pop(std::vector<int>& Stack){
  int top=Stack.size();
  int x;

  x=Stack[top];
  Stack.pop_back();

  return x;
}

int main(){
  int x,y;
  std::vector<int> Stack;
  std::string c;

  while(std::cin>>c){
    if(c[0]=='+'){
      x=pop(Stack);
      y=pop(Stack);
      push(x+y,Stack);
    }else if(c[0]=='*'){
      x=pop(Stack);
      y=pop(Stack);
      push(x*y,Stack);
    }else if(c[0]=='-'){
      x=pop(Stack);
      y=pop(Stack);
      push(y-x,Stack);
    }else{
      push(std::atoi(c),Stack);
    }
  }

  std::cout<<Stack[0]<<'\n';

  return 0;
}

  



Compiler output:
a.cc: In function 'int main()':
a.cc:39:22: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   39 |       push(std::atoi(c),Stack);
      |                      ^
      |                      |
      |                      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>
using namespace std;
 
static string tasu = "+";
static string hiku = "-";
static string kakeru = "*";
 
int top = 0;
int S[200];
 
void push(int x) {
    S[++top] = x;
}
 
int usiro() {
    return S[top--];
}
 
int main () {
    string s;
    while (cin >> s) {
        if (s == tasu) {
            int a = usiro();
            int b = usiro();
            push(a + b);
        } else if (s == hiku) {
            int a = usiro();
            int b = usiro();
            push(b - a);
        } else if (s == kakeru) {
            int a = usiro();
            int b = usiro();
            push(a * b);
        } else {
            push(atoi(s.c_str()));
        }
    }
    cout << pop() << endl;
 
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:13: error: 'pop' was not declared in this scope; did you mean 'top'?
   39 |     cout << pop() << endl;
      |             ^~~
      |             top
Language: C++

#include <iostream>
#include <cstdlib>
using namespace std;
 
static string tasu = "+";
static string hiku = "-";
static string kakeru = "*";
 
int top = 0;
int S[200];
 
void push(int x) {
    S[++top] = x;
}
 
int usiro() {
    return S[top--];
}
 
int main () {
    string s;
    while (cin >> s) {
        if (s == tasu) {
            int a = usiro();
            int b = usiro();
            push(a + b);
        } else if (s == hiku) {
            int a = usiro();
            int b = usiro();
            push(b - a);
        } else if (s == kakeru) {
            int a = usiro();
            int b = usiro();
            push(a * b);
        } else {
            push(atoi(s.c_str()));
        }
    }
    cout << usiro() << endl;
 
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:41:14: error: expected '}' at end of input
   41 |     return 0;
      |              ^
a.cc:20:13: note: to match this '{'
   20 | int main () {
      |             ^
Language: C++

#include<iostream>
#include<string>

using namespace std;
int main()
{
	int a[100] = { 0 };
	int i = 0;
	string str;
	while (getline(cin,str)) {
		if (i > 1) {
			if (str == "+") {
				a[i - 2] = a[i - 2] + a[i - 1];
				i = i - 1;
			}
			else if (str == "-") {
				a[i - 2] = a[i - 2] - a[i - 1];
				i = i - 1;
			}
			else if (str == "*") {
				a[i - 2] = a[i - 2] * a[i - 1];
				i = i - 1;
			}
			else if (str == "/") {
				a[i - 2] = a[i - 2] / a[i - 1];
				i = i - 1;
			}
		}
		else {
			a[i] = stoi(str);
			i++;
		}
	}
	cout << a[0]<<endl;
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:35:14: error: expected '}' at end of input
   35 |     return 0;
      |              ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

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

int value[100];
int sp = 0;

void push(const int val)
{
    value[sp++] = val;
}

int pop()
{
    return value[--sp];
}

void operand(const char operand)
{
    int ch, val = operand - '0';
    while( (ch = getchar()) != ' ' ){
        val = val * 10 + (ch - '0'); 
    }
    push(val);
}

void operator(const char operator)
{
    int tmp1 = pop(), tmp2 = pop();

    switch( operator ){
    case '+': push(tmp2 + tmp1); break;
    case '-': push(tmp2 - tmp1); break;
    case '*': push(tmp2 * tmp1); break;
    default : break;
    }
}

int main()
{
    while( 1 ){
        int ch = getchar();
        if( ch == ' ' || ch == '\n' ) continue;
        if( ch == EOF ) break;
        
        switch( ch ){
        case '+': case '-': case '*': operator(ch); break;
        default : operand(ch); break;
        }
    }

    printf("%d\n", pop());

    return 0;
}


Compiler output:
a.cc:26:14: error: expected type-specifier before '(' token
   26 | void operator(const char operator)
      |              ^
a.cc: In function 'int main()':
a.cc:46:47: error: expected type-specifier before '(' token
   46 |         case '+': case '-': case '*': operator(ch); break;
      |                                               ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
 
int value[100];
int sp = 0;
 
void push(const int val)
{
    value[sp++] = val;
}
 
int pop()
{
    return value[--sp];
}
 
void operand(const char operand)
{
    int ch, val = operand - '0';
    while( (ch = getchar()) != ' ' ){
        val = val * 10 + (ch - '0'); 
    }
    push(val);
}
 
void operator(const char operator)
{
    int tmp1 = pop(), tmp2 = pop();
 
    switch( operator ){
    case '+': push(tmp2 + tmp1); break;
    case '-': push(tmp2 - tmp1); break;
    case '*': push(tmp2 * tmp1); break;
    default : break;
    }
}
 
int main()
{
    while( 1 ){
        int ch = getchar();
        if( ch == ' ' || ch == '\n' ) continue;
        if( ch == EOF ) break;
 
        switch( ch ){
        case '+': case '-': case '*': operator(ch); break;
        default : operand(ch); break;
        }
    }
 
    printf("%d\n", pop());
 
    return 0;
}


Compiler output:
a.cc:26:14: error: expected type-specifier before '(' token
   26 | void operator(const char operator)
      |              ^
a.cc: In function 'int main()':
a.cc:46:47: error: expected type-specifier before '(' token
   46 |         case '+': case '-': case '*': operator(ch); break;
      |                                               ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
 
struct Stack{
    std::vector<int> nums;
    int stackn,nmax;
};
 
void push(int a,Stack &s){
    if(s.stackn<=s.nmax){
        s.nums[s.stackn++]=a;
    }else{
        s.nums.push_back(a);
        s.stackn++;
        s.ptrn++;
    }
}
 
int pop(Stack &s){
    s.stackn--;
    return s.nums[s.stack_ptr];
}
 
int main(){
    Stack s;
    s.stackn=0;
    s.nmax=-1;
    std::string str;
    while(std::cin>>str){
        if(str=="+"){
            push(pop(s)+pop(s),s);
        }else if(str=="-"){
            int a=-pop(s),b=pop(s);
            push(a+b,s);
        }else if(str=="*"){
            push(pop(s)*pop(s),s);
        }else{
            int a=0,size=ch.size();
            for(int i=0;i<size;i++){
                a*=10;
                a+=str[i]-'0';
            }
            push(a,s);
        }
    }
    std::cout<<s.nums[s.stackn]<<'\n';
    return 0;
     
}


Compiler output:
a.cc: In function 'void push(int, Stack&)':
a.cc:16:11: error: 'struct Stack' has no member named 'ptrn'
   16 |         s.ptrn++;
      |           ^~~~
a.cc: In function 'int pop(Stack&)':
a.cc:22:21: error: 'struct Stack' has no member named 'stack_ptr'
   22 |     return s.nums[s.stack_ptr];
      |                     ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:39:26: error: 'ch' was not declared in this scope
   39 |             int a=0,size=ch.size();
      |                          ^~
Language: C++

#include<iostream>
#include<string>
#include<vector>
 
struct Stack{
    std::vector<int> nums;
    int stackn,nmax;
};
 
void push(int a,Stack &s){
    if(s.stackn<=s.nmax){
        s.nums[s.stackn++]=a;
    }else{
        s.nums.push_back(a);
        s.stackn++;
        s.ptrn++;
    }
}
 
int pop(Stack &s){
    s.stackn--;
    return s.nums[s.stack_ptr];
}
 
int main(){
    Stack s;
    s.stackn=0;
    s.nmax=-1;
    std::string str;
    while(std::cin>>str){
        if(str=="+"){
            push(pop(s)+pop(s),s);
        }else if(str=="-"){
            int a=-pop(s),b=pop(s);
            push(a+b,s);
        }else if(str=="*"){
            push(pop(s)*pop(s),s);
        }else{
            int x=0,size=ch.size();
            for(int i=0;i<size;i++){
                x*=10;
                x+=str[i]-'0';
            }
            push(x,s);
        }
    }
    std::cout<<s.nums[s.stackn]<<'\n';
    return 0;
     
}


Compiler output:
a.cc: In function 'void push(int, Stack&)':
a.cc:16:11: error: 'struct Stack' has no member named 'ptrn'
   16 |         s.ptrn++;
      |           ^~~~
a.cc: In function 'int pop(Stack&)':
a.cc:22:21: error: 'struct Stack' has no member named 'stack_ptr'
   22 |     return s.nums[s.stack_ptr];
      |                     ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:39:26: error: 'ch' was not declared in this scope
   39 |             int x=0,size=ch.size();
      |                          ^~
Language: C++

#include<iostream>
#include<string>
#include<vector>
 
struct Stack{
    std::vector<int> nums;
    int stackn,nmax;
};
 
void push(int a,Stack &s){
    if(s.stackn<=s.nmax){
        s.nums[s.stackn++]=a;
    }else{
        s.nums.push_back(a);
        s.stackn++;
        s.nmax++;
    }
}
 
int pop(Stack &s){
    s.stackn--;
    return s.nums[s.stack_ptr];
}
 
int main(){
    Stack s;
    s.stackn=0;
    s.nmax=-1;
    std::string str;
    while(std::cin>>str){
        if(str=="+"){
            push(pop(s)+pop(s),s);
        }else if(str=="-"){
            int a=-pop(s),b=pop(s);
            push(a+b,s);
        }else if(str=="*"){
            push(pop(s)*pop(s),s);
        }else{
            int x=0,size=ch.size();
            for(int i=0;i<size;i++){
                x*=10;
                x+=str[i]-'0';
            }
            push(x,s);
        }
    }
    std::cout<<s.nums[s.stackn]<<'\n';
    return 0;
     
}


Compiler output:
a.cc: In function 'int pop(Stack&)':
a.cc:22:21: error: 'struct Stack' has no member named 'stack_ptr'
   22 |     return s.nums[s.stack_ptr];
      |                     ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:39:26: error: 'ch' was not declared in this scope
   39 |             int x=0,size=ch.size();
      |                          ^~
Language: C++

#include<iostream>
#include<string>
#include<vector>
 
struct Stack{
    std::vector<int> nums;
    int stackn,nmax;
};
 
void push(int a,Stack &s){
    if(s.stackn<=s.nmax){
        s.nums[s.stackn++]=a;
    }else{
        s.nums.push_back(a);
        s.stackn++;
        s.nmax++;
    }
}
 
int pop(Stack &s){
    s.stackn--;
    return s.nums[s.stackn];
}
 
int main(){
    Stack s;
    s.stackn=0;
    s.nmax=-1;
    std::string str;
    while(std::cin>>str){
        if(str=="+"){
            push(pop(s)+pop(s),s);
        }else if(str=="-"){
            int a=-pop(s),b=pop(s);
            push(a+b,s);
        }else if(str=="*"){
            push(pop(s)*pop(s),s);
        }else{
            int x=0,size=ch.size();
            for(int i=0;i<size;i++){
                x*=10;
                x+=str[i]-'0';
            }
            push(x,s);
        }
    }
    std::cout<<s.nums[s.stackn]<<'\n';
    return 0;
     
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:26: error: 'ch' was not declared in this scope
   39 |             int x=0,size=ch.size();
      |                          ^~
Language: C++

//16D8103012G 三品海渡 C++ momora347
#include "stdafx.h"
#include<iostream>
using namespace std;
#include<iostream>
#include<string>
#include<vector>

struct Stack {
	std::vector<int> nums;
	int stackn, nmax;
};

void push(int a, Stack &s) {
	if (s.stackn <= s.nmax) {
		s.nums[s.stackn++] = a;
	}
	else {
		s.nums.push_back(a);
		s.stackn++;
		s.nmax++;
	}
}

int pop(Stack &s) {
	s.stackn--;
	return s.nums[s.stackn];
}

int main() {
	Stack s;
	s.stackn = 0;
	s.nmax = -1;
	std::string str;
	while (std::cin >> str) {
		if (str == "+") {
			push(pop(s) + pop(s), s);
		}
		else if (str == "-") {
			int a = -pop(s), b = pop(s);
			push(a + b, s);
		}
		else if (str == "*") {
			push(pop(s)*pop(s), s);
		}
		else {
			int x = 0, size = str.size();
			for (int i = 0; i<size; i++) {
				x *= 10;
				x += str[i] - '0';
			}
			push(x, s);
		}
	}
	std::cout << s.nums[s.stackn] << '\n';
	return 0;

}



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

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

struct Stack {
	std::vector<int> nums;
	int stackn, nmax;
};

void push(int a, Stack &s) {
	if (s.stackn <= s.nmax) {
		s.nums[s.stackn++] = a;
	}
	else {
		s.nums.push_back(a);
		s.stackn++;
		s.nmax++;
	}
}

int pop(Stack &s) {
	s.stackn--;
	return s.nums[s.stackn];
}

int main() {
	Stack s;
	s.stackn = 0;
	s.nmax = -1;
	string str;
	while (cin >> str) {
		if (str == "+") {
			push(pop(s) + pop(s), s);
		}
		else if (str == "-") {
			int a = -pop(s), b = pop(s);
			push(a + b, s);
		}
		else if (str == "*") {
			push(pop(s)*pop(s), s);
		}
		else {
			int x = 0, size = str.size();
			for (int i = 0; i<size; i++) {
				x *= 10;
				x += str[i] - '0';
			}
			push(x, s);
		}
	}
	cout << s.nums[s.stackn] << '\n';
	return 0;



Compiler output:
a.cc: In function 'int main()':
a.cc:53:18: error: expected '}' at end of input
   53 |         return 0;
      |                  ^
a.cc:27:12: note: to match this '{'
   27 | int main() {
      |            ^
Language: C++

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long ll;
const int MAXN = 200;

int top = 0;
int S[MAXN];

void initialize() {
	top = 0;
}

bool isEmpty() {
	if (top == 0)return true;
	else false;
}

void push(int x) {
	if (top == MAXN - 1)return;
	else {
		S[top + 1] = x;
		top++;
	}
}

int pop() {
	if (top == 0)return 0;
	else {
		int ans = S[top];
		top--;
		return ans;
	}
}

int main() {
	string s;
	int a, b;
	while (cin >>s) {
		if (s == "+") {
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (s == "-") {
			a = pop();
			b = pop();
			push(a - b);
		}
		else if (s == "*") {
			a = pop();
			b = pop();
			push(a * b);
		}
		else {
			push(atoi(s.c_str));
		}
	}
	cout << pop() << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:37: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   62 |                         push(atoi(s.c_str));
      |                                   ~~^~~~~
In file included 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/c++/14/bits/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc: In function 'bool isEmpty()':
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
Language: C++

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


typedef long long ll;
const int MAXN = 200;

int top = 0;
int S[MAXN];

void initialize() {
	top = 0;
}

bool isEmpty() {
	if (top == 0)return true;
	else false;
}

void push(int x) {
	if (top == MAXN - 1)return;
	else {
		S[top + 1] = x;
		top++;
	}
}

int pop() {
	if (top == 0)return 0;
	else {
		int ans = S[top];
		top--;
		return ans;
	}
}

int main() {
	std::string s;
	int a, b;
	while (std::cin >>s) {
		if (s == "+") {
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (s == "-") {
			a = pop();
			b = pop();
			push(a - b);
		}
		else if (s == "*") {
			a = pop();
			b = pop();
			push(a * b);
		}
		else {
			push(atoi(s.c_str));
		}
	}
	std::cout << pop() << std::endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:37: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   62 |                         push(atoi(s.c_str));
      |                                   ~~^~~~~
In file included 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/c++/14/bits/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc: In function 'bool isEmpty()':
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
Language: C++

#include <iostream>
#include <sstream>
#include <cstdlib>


using namespace std;

int main() {

  string op;
  stack<int> st;  
  int sec,fir;

  while(cin >> op){
    if(op=="+"||op=="-"||op=="*"){
      fir = st.top();
      st.pop();
      sec = st.top();
      st.pop();
      if(op=="+") st.push(fir+sec);
      if(op=="-") st.push(sec-fir);
      if(op=="*") st.push(fir*sec);
    }
    else st.push(atoi(op.c_str()));
  }
  cout << st.top() << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'stack' was not declared in this scope
   11 |   stack<int> st;
      |   ^~~~~
a.cc:4:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
    3 | #include <cstdlib>
  +++ |+#include <stack>
    4 | 
a.cc:11:9: error: expected primary-expression before 'int'
   11 |   stack<int> st;
      |         ^~~
a.cc:16:13: error: 'st' was not declared in this scope; did you mean 'std'?
   16 |       fir = st.top();
      |             ^~
      |             std
a.cc:24:10: error: 'st' was not declared in this scope; did you mean 'std'?
   24 |     else st.push(atoi(op.c_str()));
      |          ^~
      |          std
a.cc:26:11: error: 'st' was not declared in this scope; did you mean 'std'?
   26 |   cout << st.top() << endl;
      |           ^~
      |           std
Language: C++

#include<iostream>
#include<stack>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
 
int main()
{
  stack<int> S;
  char c[10];
  int x,y;
  while((cin("%s",&c))!=EOF){
    if(c[0]=='+'){
      x=S.top();S.pop();
      y=S.top();S.pop();
      S.push(x+y);
    }
    else if(c[0]=='-'){
      x=S.top();S.pop();
      y=S.top();S.pop();
      S.push(y-x);
    }
    else if(c[0]=='*'){
      x=S.top();S.pop();
      y=S.top();S.pop();
      S.push(x*y);
    }
    else{
      S.push(atoi(c));
    }
  }
  cout<<S.top()<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: no match for call to '(std::istream {aka std::basic_istream<char>}) (const char [3], char (*)[10])'
   12 |   while((cin("%s",&c))!=EOF){
      |          ~~~^~~~~~~~~
Language: C++

#include<iostream>
#include<stack>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
 
int main()
{
  stack<int> S;
  char c[10];
  int x,y;
  while((cin>>)!=EOF){
    if(c[0]=='+'){
      x=S.top();S.pop();
      y=S.top();S.pop();
      S.push(x+y);
    }
    else if(c[0]=='-'){
      x=S.top();S.pop();
      y=S.top();S.pop();
      S.push(y-x);
    }
    else if(c[0]=='*'){
      x=S.top();S.pop();
      y=S.top();S.pop();
      S.push(x*y);
    }
    else{
      S.push(atoi(c));
    }
  }
  cout<<S.top()<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected primary-expression before ')' token
   12 |   while((cin>>)!=EOF){
      |               ^
Language: C++

#include<iostream>
#include<stack>
#include<algorithm>

using namespace std;


bool stackDigit(string s){
    return (all_of(s.cbegin(), s.cend(), isdigit));
}


int main(){
    string s;
    int i1, i2;
    stack<int> st;
    while(cin >>s){
        if(stackDigit(s)){
            st.push(stoi(s));
        }else{
            i1 = st.top();
            st.pop();
            i2 = st.top();
            st.pop();
            if(s == "+")st.push(i2 + i1);
            else if(s == "-")st.push(i2 - i1);
            else if(s == "*")st.push(i2 * i1);
            else if(s == "/")st.push(i2 / i1);
        }
    }
    cout << st.top() << endl;

}


Compiler output:
a.cc: In function 'bool stackDigit(std::string)':
a.cc:9:19: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::const_iterator, std::__cxx11::basic_string<char>::const_iterator, <unresolved overloaded function type>)'
    9 |     return (all_of(s.cbegin(), s.cend(), isdigit));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:9:19: note:   couldn't deduce template parameter '_Predicate'
    9 |     return (all_of(s.cbegin(), s.cend(), isdigit));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

#include<iostream>
#include<stack>
#include<algorithm>
#include<cctype>

using namespace std;


bool stackDigit(string s){
    return (all_of(s.cbegin(), s.cend(), isdigit));
}


int main(){
    string s;
    int i1, i2;
    stack<int> st;
    while(cin >>s){
        if(stackDigit(s)){
            st.push(stoi(s));
        }else{
            i1 = st.top();
            st.pop();
            i2 = st.top();
            st.pop();
            if(s == "+")st.push(i2 + i1);
            else if(s == "-")st.push(i2 - i1);
            else if(s == "*")st.push(i2 * i1);
            else if(s == "/")st.push(i2 / i1);
        }
    }
    cout << st.top() << endl;

}


Compiler output:
a.cc: In function 'bool stackDigit(std::string)':
a.cc:10:19: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::const_iterator, std::__cxx11::basic_string<char>::const_iterator, <unresolved overloaded function type>)'
   10 |     return (all_of(s.cbegin(), s.cend(), isdigit));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:10:19: note:   couldn't deduce template parameter '_Predicate'
   10 |     return (all_of(s.cbegin(), s.cend(), isdigit));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

#include<iostream>
#include<stack>
#include<algorithm>
#include<cctype>

using namespace std;


bool stackDigit(string s){
    return (all_of(s.begin(), s.end(), isdigit));
}


int main(){
    string s;
    int i1, i2;
    stack<int> st;
    while(cin >>s){
        if(stackDigit(s)){
            st.push(stoi(s));
        }else{
            i1 = st.top();
            st.pop();
            i2 = st.top();
            st.pop();
            if(s == "+")st.push(i2 + i1);
            else if(s == "-")st.push(i2 - i1);
            else if(s == "*")st.push(i2 * i1);
            else if(s == "/")st.push(i2 / i1);
        }
    }
    cout << st.top() << endl;

}


Compiler output:
a.cc: In function 'bool stackDigit(std::string)':
a.cc:10:19: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)'
   10 |     return (all_of(s.begin(), s.end(), isdigit));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:10:19: note:   couldn't deduce template parameter '_Predicate'
   10 |     return (all_of(s.begin(), s.end(), isdigit));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

#include<iostream>
#include<stack>
#include<algorithm>
#include<cctype>

using namespace std;


bool stackDigit(string s){
    return (std::all_of(s.begin(), s.end(), isdigit));
}


int main(){
    string s;
    int i1, i2;
    stack<int> st;
    while(cin >>s){
        if(stackDigit(s)){
            st.push(stoi(s));
        }else{
            i1 = st.top();
            st.pop();
            i2 = st.top();
            st.pop();
            if(s == "+")st.push(i2 + i1);
            else if(s == "-")st.push(i2 - i1);
            else if(s == "*")st.push(i2 * i1);
            else if(s == "/")st.push(i2 / i1);
        }
    }
    cout << st.top() << endl;

}


Compiler output:
a.cc: In function 'bool stackDigit(std::string)':
a.cc:10:24: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)'
   10 |     return (std::all_of(s.begin(), s.end(), isdigit));
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:10:24: note:   couldn't deduce template parameter '_Predicate'
   10 |     return (std::all_of(s.begin(), s.end(), isdigit));
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

#include<iostream>
#include<stack>
#include<algorithm>
#include<cctype>

using namespace std;


int main(){
    string s;
    int i1, i2;
    stack<int> st;
    while(cin >>s){
        if(all_of(s.begin(), s.end(), isdigit)){
            st.push(stoi(s));
        }else{
            i1 = st.top();
            st.pop();
            i2 = st.top();
            st.pop();
            if(s == "+")st.push(i2 + i1);
            else if(s == "-")st.push(i2 - i1);
            else if(s == "*")st.push(i2 * i1);
            else if(s == "/")st.push(i2 / i1);
        }
    }
    cout << st.top() << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)'
   14 |         if(all_of(s.begin(), s.end(), isdigit)){
      |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:14:18: note:   couldn't deduce template parameter '_Predicate'
   14 |         if(all_of(s.begin(), s.end(), isdigit)){
      |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

#include<iostream>
#include<stack>
#include<algorithm>

using namespace std;


int main(){
    string s;
    int i1, i2;
    stack<int> st;
    while(cin >>s){
        if(all_of(s.begin(), s.end(), isdigit)){
            st.push(stoi(s));
        }else{
            i1 = st.top();
            st.pop();
            i2 = st.top();
            st.pop();
            if(s == "+")st.push(i2 + i1);
            else if(s == "-")st.push(i2 - i1);
            else if(s == "*")st.push(i2 * i1);
            else if(s == "/")st.push(i2 / i1);
        }
    }
    cout << st.top() << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: no matching function for call to 'all_of(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)'
   13 |         if(all_of(s.begin(), s.end(), isdigit)){
      |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:410:5: note: candidate: 'template<class _IIter, class _Predicate> bool std::all_of(_IIter, _IIter, _Predicate)'
  410 |     all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:410:5: note:   template argument deduction/substitution failed:
a.cc:13:18: note:   couldn't deduce template parameter '_Predicate'
   13 |         if(all_of(s.begin(), s.end(), isdigit)){
      |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Predicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::all_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate)'
   30 | all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:30:1: note:   candidate expects 4 arguments, 3 provided
Language: C++

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

using namespace std;

stack<int> st;
int solve(string);
int main(){
    string str;
    while(cin >>str){
        if(str == "+" || str == "-" || str == "*" || str == "/")
            st.push(solve(str));
        else st.push(atoi(str.c_str()));
        if(getchar()=='\n'){
            cout << st.top() << endl;
            return 0;
        }
    }
}

int solve(string str){
    int b = st.top(); st.pop();
    int b = st.top(); st.pop();
    if(str=="+")return a + b;
    else if(str=="-")return a - b;
    else if(str=="*")return a * b;
    else if(str=="/")return a / b;
}


Compiler output:
a.cc: In function 'int solve(std::string)':
a.cc:26:9: error: redeclaration of 'int b'
   26 |     int b = st.top(); st.pop();
      |         ^
a.cc:25:9: note: 'int b' previously declared here
   25 |     int b = st.top(); st.pop();
      |         ^
a.cc:27:24: error: 'a' was not declared in this scope
   27 |     if(str=="+")return a + b;
      |                        ^
a.cc:28:29: error: 'a' was not declared in this scope
   28 |     else if(str=="-")return a - b;
      |                             ^
a.cc:29:29: error: 'a' was not declared in this scope
   29 |     else if(str=="*")return a * b;
      |                             ^
a.cc:30:29: error: 'a' was not declared in this scope
   30 |     else if(str=="/")return a / b;
      |                             ^
Language: C++

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

type Stack struct {
	s [10000]int
	top int
}

func GenStack() Stack {
	return Stack{top: 0}
}

func (stack *Stack) Push(value int) {
	stack.top++
	stack.s[stack.top] = value
}

func (stack *Stack) Pop() int {
	v := stack.s[stack.top]
	stack.top--
	return v
}

func main() {
	var s string
	sc.Scan()
	s = sc.Text()

	a := strings.Split(s, " ")

	stack := GenStack()

	for _, v := range a {
		if v == "+" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v1 + v2)
		} else if v == "-" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v2 - v1)
		} else if v == "*" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v1 * v2)
		} else if v == "/" {
			v1 := stack.Pop()
			v2 := stack.Pop()
			stack.Push(v2 / v1)
		} else {
			vv, _ := strconv.Atoi(v)
			stack.Push(vv)
		}
	}

	fmt.Println(stack.Pop())
}



Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:18:1: error: 'func' does not name a type
   18 | func GenStack() Stack {
      | ^~~~
a.cc:22:6: error: expected constructor, destructor, or type conversion before '(' token
   22 | func (stack *Stack) Push(value int) {
      |      ^
a.cc:27:6: error: expected constructor, destructor, or type conversion before '(' token
   27 | func (stack *Stack) Pop() int {
      |      ^
a.cc:33:1: error: 'func' does not name a type
   33 | func main() {
      | ^~~~
Language: C++

#include<cstdio>
#include<string.h>
#include<stack>
using namespace std;
stack<int> s1;
stack<char> s2;

int main(){
	char ch[300];
	gets(ch);
	int len=strlen(ch);
	int num=0;
	int m=10;
	for(int i=0;i<len;i++){
		if(ch[i]>='0'&&ch[i]<='9'){
			if(num==0){
				num=ch[i]-'0';
			}else if(num/m==0){
				num=m*num+(ch[i]-'0');
				m*=10;
			}
			continue;
		}
		
		if(num!=0){
			s1.push(num);	
			num=0;
			m=10;
		}
		if(ch[i]=='+'||ch[i]=='-'||ch[i]=='/'||ch[i]=='*'){
			s2.push(ch[i]);
		}
		if(s1.size()>=2&&s2.size()==1){
			int num1=s1.top();s1.pop();
			int num2=s1.top();s1.pop();
			char op=s2.top();s2.pop();
			int ans;
			switch(op){
				case '+':ans=num1+num2;s1.push(ans);break;
				case '-':ans=num2-num1;s1.push(ans);break;
				case '*':ans=num1*num2;s1.push(ans);break;
				case '/':ans=num2/num1;s1.push(ans);break;
			}
		}
	}
	
	int res=s1.top();
	printf("%d\n",res);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |         gets(ch);
      |         ^~~~
      |         getw