criyle/codenet-compile-errors huggingface dataset:
Language: Java

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

int sento;
int data[1000];

void push(int);
int pop();

int main(){
  int change1;
  int change2;
  char set[100];
  sento = 0;

  while(scanf("%s",set) != EOF){
    if(set[0] == '+'){
      change1 = pop();
      change2 = pop();
      push(change1 + change2);
    }
    else if(set[0] == '-'){
      change2 = pop();
      change1 = pop();
      push(change1 - change2);
    }
    else if(set[0] == '*'){
      change1 = pop();
      change2 = pop();
      push(change1 * change2);
    }
    else{
      push(atoi(set));
    }
  }
  printf("%d\n",pop());
  return 0;
}


void push(int x){
  data[++sento] = x;
}

int pop(){
  sento--;
  return data[sento + 1];
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:3: error: illegal character: '#'
#include<string.h>
^
Main.java:6: error: class, interface, enum, or record expected
int data[1000];
^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
void push(int);
^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: <identifier> expected
void push(int);
             ^
Main.java:14: error: ']' expected
  char set[100];
           ^
8 errors
Language: Java

import java.io.BufferedReader;                                                                     
import java.io.IOException;                                                                        
import java.io.InputStreamReader;                                                          
import java.util.ArrayDeque;                                                                     
import java.util.Deque;

public class pop{
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");

	Deque<Integer> box=new ArrayDeque<>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 * tmp1);
                break;
            default:
                box.addFirst(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
}



Compiler output:
Main.java:7: error: class pop is public, should be declared in a file named pop.java
public class pop{
       ^
1 error
Language: Java

import java.io.BufferedReader;                                                                     
import java.io.IOException;                                                                        
import java.io.InputStreamReader;                                                          
import java.util.ArrayDeque;                                                                     
import java.util.Deque;

public class {
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");

	Deque<Integer> box=new ArrayDeque<>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 * tmp1);
                break;
            default:
                box.addFirst(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
}



Compiler output:
Main.java:7: error: <identifier> expected
public class {
            ^
1 error
Language: Java

import java.io.BufferedReader;                                                                     
import java.io.IOException;                                                                        
import java.io.InputStreamReader;                                                          
import java.util.ArrayDeque;                                                                     
import java.util.Deque;

//public class pop{
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");

	Deque<Integer> box=new ArrayDeque<>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pollFirst();
                tmp2 = box.pollFirst();
                box.addFirst(tmp2 * tmp1);
                break;
            default:
                box.addFirst(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    //}
 
}



Compiler output:
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
    public static void main(String args[]) throws IOException{
                  ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;


public class pop{
    public static void main(String args[]) throws IOException{
	BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        String[] str=buf.readLine().split("\\s");
	Stack<Integer> box = new Stack<Integer>();
	int tmp1=0;
	int tmp2=0;
	for(int i=0;i<str.length;i++){
	   
	        switch (str[i]) {
            case "+":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 + tmp1);
                break;
            case "-":
                tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 - tmp1);
                break;
            case "*":
                 tmp1 = box.pop();
                tmp2 = box.pop();
                box.add(tmp2 * tmp1);
                break;
            default:
                box.add(Integer.parseInt(str[i]));
            }

	    

						       
	}
	System.out.println(box.pop());
    }
 
}



Compiler output:
Main.java:7: error: class pop is public, should be declared in a file named pop.java
public class pop{
       ^
1 error
Language: Java

package aoj;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;

public class RoundRobinScheduling {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] firstRow = br.readLine().split("\\s");

        // 要素数
        int elementNum = Integer.parseInt(firstRow[0]);
        // 減算する値
        int quantum = Integer.parseInt(firstRow[1]);

       
        Queue<Process> que = new LinkedList<Process>();
        for (int i = 0; i < elementNum; i++) {
            String[] stringArray = br.readLine().split("\\s");
            Process process = new Process(stringArray[0],
                    Integer.parseInt(stringArray[1]));
            que.offer(process);
        }

        // 処理合計時間
        int resultTime = 0;
        while (que.size() > 0) {
            Process process = que.poll();
            // 合計処理時間として加算
            resultTime += quantum;
            // 処理時間を減算する
            if ((process.processTime = process.processTime - quantum) > 0) {
               
                que.offer(process);
                continue; 
            }
           
            resultTime += process.processTime;
           
            System.out.println(process.name + " " + resultTime);
        }

    }  
     // Process管理クラス
     
    private final static class Process {
        // めんどいからpublicに。。。
        public String name = null;
        public int processTime = 0;

        public Process(String name, int processTime) {
            this.name = name;
            this.processTime = processTime;
        }
    }
}



Compiler output:
Main.java:9: error: class RoundRobinScheduling is public, should be declared in a file named RoundRobinScheduling.java
public class RoundRobinScheduling {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class A {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split("\\s");
        Stack<Integer> q = new Stack<Integer>();
        for (int i = 0; i < str.length; i++) {
            if (str[i].equals("+")) {
                q.add(q.pop() + q.pop());
                continue;
            }
            if (str[i].equals("-")) {
		int a1 = q.pop();
		int a2 = q.pop();
                q.add(a2 - a1);
                continue;
            }
            if (str[i].equals("*")) {
                q.add(q.pop() * q.pop());
                continue;
            }
            q.push(Integer.parseInt(str[i]));
        }
        System.out.println(q.pop());
    }
}



Compiler output:
Main.java:6: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: Java

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		
	Scanner scan = new Scanner (System.in);
	int [] St = new int[100];
	int index = 0;
	int k;
	
	while(scan.hasNext()){
		String str = scan.next();
		switch(str){
		case '+':
			index--;
			St[index-1] += St[index];
			break;
		case '*':
			index--;
			St[index-1] *= St[index];
			break;
		case '-':
			index--;
			St[index-1] -= St[index];
		default:
			St[index++] = Integer.parseInt(str);
			break;
		}
	}
	for(int i = 0; i < index; i++){
		System.out.println(St[i]);
	}
  }
}

Compiler output:
Main.java:13: error: incompatible types: char cannot be converted to String
		case '+':
		     ^
Main.java:17: error: incompatible types: char cannot be converted to String
		case '*':
		     ^
Main.java:21: error: incompatible types: char cannot be converted to String
		case '-':
		     ^
3 errors
Language: Java

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		
	Scanner scan = new Scanner (System.in);
	int [] St = new int[100];
	int index = 0;
	int k;
	
	while(scan.hasNext()){
		String str = scan.next();
		switch(str){
		case '+':
			index--;
			St[index-1] += St[index];
			break;
		case '*':
			index--;
			St[index-1] *= St[index];
			break;
		case '-':
			index--;
			St[index-1] -= St[index];
                        break;
		default:
			St[index++] = Integer.parseInt(str);
			break;
		}
	}
	for(int i = 0; i < index; i++){
		System.out.println(St[i]);
	}
  }
}

Compiler output:
Main.java:13: error: incompatible types: char cannot be converted to String
		case '+':
		     ^
Main.java:17: error: incompatible types: char cannot be converted to String
		case '*':
		     ^
Main.java:21: error: incompatible types: char cannot be converted to String
		case '-':
		     ^
3 errors
Language: Java

import java.util.Stack;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class ReversePolish {
	public static int pop(int[] data,int sp){
		 return data[--sp];	
	}
	public static void push(int[] data,int sp,int value)
	{
		data[sp++] = value;
	}
	public static void main(String[] args) {
		int[] stack = new int[200];
		int sp = 0;
		Scanner scan = new Scanner(System.in);
		Pattern p = Pattern.compile("^[0-9]*$");
		while(scan.hasNext()){
			String str = scan.next();
			Matcher m = p.matcher(str);
			if(m.find()){
				push(stack,sp,Integer.parseInt(str));
				sp++;
				//System.out.println(sp);
			}else if(str.equals("+")){
				int a = pop(stack,sp);
				sp--;
				int b = pop(stack,sp);
				sp--;
				push(stack,sp,a+b);
				sp++;
			}else if(str.equals("-")){
				int a = pop(stack,sp);
				sp--;
				int b = pop(stack,sp);
				sp--;
				push(stack,sp,a-b);
				sp++;
			}else if(str.equals("*")){
				int a = pop(stack,sp);
				sp--;
				int b = pop(stack,sp);
				sp--;
				push(stack,sp,a*b);
				sp++;
			}else if(str.equals("/")){
				int a = pop(stack,sp);
				sp--;
				int b = pop(stack,sp);
				sp--;
				push(stack,sp,a/b);
				sp++;
			}
		}
		System.out.println("Ans:"+stack[0]);
		
	}
}

Compiler output:
Main.java:5: error: class ReversePolish is public, should be declared in a file named ReversePolish.java
public class ReversePolish {
       ^
1 error
Language: C

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



int main()
{
	char buffer[20];
	int stac[100], stac_num = 0;
	while (1)
	{
		if (!(cin >> buffer))
			break;
		else if (buffer[0] >= '1' && buffer[0] <= '9')
		{
			stac[stac_num] = atoi(buffer);
			stac_num++;
		}
		else
		{
			switch (buffer[0])
			{
			case '+':
				stac[stac_num - 2] += stac[stac_num - 1];
				break;
			case '*':
				stac[stac_num - 2] *= stac[stac_num - 1];
				break;
			case '-':
				stac[stac_num - 2] -= stac[stac_num - 1];
				break;
			}
			stac_num--;
		}
	}

	cout << stac[0] << endl;
	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

int MAX=1000;
int top,S[1000];

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

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

  int isFull(){
    return top>=MAX-1;
  }

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

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

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

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

    }
return 0;
  }


Compiler output:
main.c:8:3: error: expected identifier or '(' before '}' token
    8 |   }
      |   ^
main.c: In function 'main':
main.c:33:7: error: implicit declaration of function 'show' [-Wimplicit-function-declaration]
   33 |       show(S);
      |       ^~~~
Language: C

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

int MAX=1000;
int top,S[1000];
/*void show (int A[]){
    for (int i = 0; i < top+1; i++) {
      printf("stats " );
          printf("%d\t",A[i]);
    }

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

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

  int isFull(){
    return top>=MAX-1;
  }
*/

  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));
      }
    }
  printf("%d\n",pop());
return 0;
  }


Compiler output:
main.c: In function 'main':
main.c:41:10: error: implicit declaration of function 'push' [-Wimplicit-function-declaration]
   41 |          push(a+b);
      |          ^~~~
Language: C

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

int main()
{
    char op[200]={};
    int k[100],t=0,a,b;
    while(scanf("%c",&op[i])!=EOF){
        if(op[i]=='\0') break;
        if ( isdigit((unsigned char)op[i]) ) {
            k[t] = op[i]-'0';
            t++;
            printf(",%d t=%d\n",op[i]-'0',t);
        }else {
            switch (op[i]){
                case '+':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a + b;
                    break;
                case '-':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a - b;
                    break;
                case '*':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a * b;
                    break;
                case '/':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a / b;
                    break;
                default:
                    flg += 1;
                    break;
            }
        }
        printf("回数=%d\n",i);
        i++;
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:26: error: 'i' undeclared (first use in this function)
    9 |     while(scanf("%c",&op[i])!=EOF){
      |                          ^
main.c:9:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:38:21: error: 'flg' undeclared (first use in this function)
   38 |                     flg += 1;
      |                     ^~~
Language: C

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

int main()
{
    char op[200]={};
    int k[100],t=0,a,b;
    while(scanf("%c",&op[i])!=EOF){
        if(op[i]=='\0') break;
        if ( isdigit((unsigned char)op[i]) ) {
            k[t] = op[i]-'0';
            t++;
            printf(",%d t=%d\n",op[i]-'0',t);
        }else {
            switch (op[i]){
                case '+':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a + b;
                    break;
                case '-':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a - b;
                    break;
                case '*':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a * b;
                    break;
                case '/':
                    a = k[t--]-'0';
                    b = k[t]-'0';
                    k[t] = a / b;
                    break;
                default:
                    break;
            }
        }
        printf("回数=%d\n",i);
        i++;
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:26: error: 'i' undeclared (first use in this function)
    9 |     while(scanf("%c",&op[i])!=EOF){
      |                          ^
main.c:9:26: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int thw(int,int);
void chng(char*,int*,int,int);

int thw(int s,int b)
{
    for(int i=1;i<s;i++) b = b * 10;
    return b;
}

void chng(char *box,int *A,int s,int cnt)
{
    int tmp,bt=0;
    for(int i=s-1;i>=0;i--)
    {
        tmp = box[i]-'0';
        bt += thw(s-i,tmp);
    }
    A[cnt] = bt;
}

int main()
{
    char box[10],tmp;
    int A[101],s=0,cnt=0,flg=0;
    while((tmp = getchar()) != EOF)
    {
        if('0' <= tmp && tmp <= '9'){
            box[s] = tmp;
            s += 1;
            flg=0;
        }else {
            switch(tmp){
                case '+':
                    cnt -=1;
                    A[cnt-1]=A[cnt-1]+A[cnt];
                    flg = 1;
                    break;
                case '-':
                    cnt -=1;
                    A[cnt-1]=A[cnt-1]-A[cnt];
                    flg = 1;
                    break;
                case '*':
                    cnt -=1;
                     A[cnt-1]=A[cnt-1]*A[cnt];
                    flg = 1;
                    break;
                case '/':                    cnt -=1;
                     A[cnt-1]=A[cnt-1]/A[cnt];
                    flg = 1;
                    break;
                default :
                if(flg == 0){
                    chng(box,A,s,cnt);
                    break;
                }
            }
            if(flg == 0)    cnt +=1
            s = 0;
            }
        }
    printf("%d\n",A[0]);
}


Compiler output:
main.c: In function 'main':
main.c:60:36: error: expected ';' before 's'
   60 |             if(flg == 0)    cnt +=1
      |                                    ^
      |                                    ;
   61 |             s = 0;
      |             ~
Language: C

#include<stdio.h>
#define MAX 1000

int top;
int S[MAX];

void initialize(){
       return top=0;
       }

void isempty(){
       if(top==0)return;
       }

void isfull(){
       return top>MAX-1;
       }

void push(int n){
       if isfull(){return;}

       top++;
       S[top]=n;
       }

int pop(){
       if isempty(){return;}

       top--;
       return S[top+1];
       }

int main(){
       int i,j,x,y,z;
       char op;
       initialize();
       for(i=0;i != EOF ;i++){
                   scanf("%c",&op);
                   if(op=='+'){
                               x=pop();
                               y=pop();
                               z=x+y;
                               push(z);
                               }
                   else if(op=='-'){
                               x=pop();
                               y=pop();
                               z=x-y;
                               push(z);
                               }
                   else if(op=='*'){
                               x=pop();
                               y=pop();
                               z=x*y;
                               push(z);
                               }
                   else {push(atoi(op));}
                   }
          printf("%d\n",pop());
          return 0;
          }




Compiler output:
main.c: In function 'initialize':
main.c:8:18: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
    8 |        return top=0;
      |               ~~~^~
main.c:7:6: note: declared here
    7 | void initialize(){
      |      ^~~~~~~~~~
main.c: In function 'isfull':
main.c:16:18: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   16 |        return top>MAX-1;
      |               ~~~^~~~~~
main.c:15:6: note: declared here
   15 | void isfull(){
      |      ^~~~~~
main.c: In function 'push':
main.c:20:11: error: expected '(' before 'isfull'
   20 |        if isfull(){return;}
      |           ^~~~~~
      |           (
main.c: In function 'pop':
main.c:27:11: error: expected '(' before 'isempty'
   27 |        if isempty(){return;}
      |           ^~~~~~~
      |           (
main.c: In function 'main':
main.c:57:31: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
   57 |                    else {push(atoi(op));}
      |                               ^~~~
Language: C

#include<stdio.h>
#define MAX 1000

int top;
int S[MAX];

void initialize(){
       return top=0;
       }

void isempty(){
       return top==0;
       }

void isfull(){
       return top>=MAX-1;
       }

void push(int n){
       if (isfull()){printf("overflow\n");}

       top++;
       S[top]=n;
       }

int pop(){
       if (isempty()){printf("overflow\n");}

       top--;
       return S[top+1];
       }

int main(){
       int i,j,x,y,z;
       char op[MAX];
       initialize();
       while(scanf("%s",&op) != EOF){
                   if(op=='+'){
                               x=pop();
                               y=pop();
                               z=x+y;
                               push(z);
                               }
                   else if(op=='-'){
                               x=pop();
                               y=pop();
                               z=x-y;
                               push(z);
                               }
                   else if(op=='*'){
                               x=pop();
                               y=pop();
                               z=x*y;
                               push(z);
                               }
                   else {push(atoi(op));}
                   }
          printf("%d\n",pop());
          return 0;
          }




Compiler output:
main.c: In function 'initialize':
main.c:8:18: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
    8 |        return top=0;
      |               ~~~^~
main.c:7:6: note: declared here
    7 | void initialize(){
      |      ^~~~~~~~~~
main.c: In function 'isempty':
main.c:12:18: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   12 |        return top==0;
      |               ~~~^~~
main.c:11:6: note: declared here
   11 | void isempty(){
      |      ^~~~~~~
main.c: In function 'isfull':
main.c:16:18: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   16 |        return top>=MAX-1;
      |               ~~~^~~~~~~
main.c:15:6: note: declared here
   15 | void isfull(){
      |      ^~~~~~
main.c: In function 'push':
main.c:20:12: error: void value not ignored as it ought to be
   20 |        if (isfull()){printf("overflow\n");}
      |            ^~~~~~
main.c: In function 'pop':
main.c:27:12: error: void value not ignored as it ought to be
   27 |        if (isempty()){printf("overflow\n");}
      |            ^~~~~~~
main.c: In function 'main':
main.c:38:25: warning: comparison between pointer and integer
   38 |                    if(op=='+'){
      |                         ^~
main.c:44:30: warning: comparison between pointer and integer
   44 |                    else if(op=='-'){
      |                              ^~
main.c:50:30: warning: comparison between pointer and integer
   50 |                    else if(op=='*'){
      |                              ^~
main.c:56:31: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
   56 |                    else {push(atoi(op));}
      |                               ^~~~
Language: C

#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int top, S[100];

void push(int x){
    // topを加算してからその位置へ挿入
    top++;
    S[top] = x;
}

int pop(){
    top--;
    // 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));  // 文字列を数字に変える関数atoi
        }
    }

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


Compiler output:
main.c:1:10: fatal error: algorithm: No such file or directory
    1 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C

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

void add(int num[],int *pa){
	*pa=(*pa)-1;
	num[(*pa)-1]+=num[*pa];
	num[*pa]=0;
	
}

void minus(int num[],int *pa){
	*pa=(*pa)-1;
	num[(*pa)-1]-=num[*pa];
	num[*pa]=0;
}

void multiply(int num[],int *pa){
	*pa=(*pa)-1;
	num[(*pa)-1]*=num[*pa];
	num[*pa]=0;
}

int main(){
	int i,n,j,k,num[200];
	char s[1000];
	gets(s);
	char *p=s;
	int curnum=0;
	for(i=0;i<strlen(s);i++){
		if(*(p+i)=='+'){
			add(num,&curnum);
		}
		if(*(p+i)=='-'){
			minus(num,&curnum);
		}
		if(*(p+i)=='*'){
			multiply(num,&curnum);
		}
		int ans = 0;
		if(*(p+i)<='9' && *(p+i)>='0'){
			while(*(p+i)!=' '){
				ans = ans*10 + *(p+i) - '0';
				i++;
			}
			num[curnum] = ans;
			curnum++;
		}
	}
	printf("%d\n",num[0]);
}


Compiler output:
main.c: In function 'main':
main.c:27:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   27 |         gets(s);
      |         ^~~~
      |         fgets
Language: C

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

void add(int num[],int *pa){
	*pa=(*pa)-1;
	num[(*pa)-1]+=num[*pa];
	num[*pa]=0;
	
}

void minus(int num[],int *pa){
	*pa=(*pa)-1;
	num[(*pa)-1]-=num[*pa];
	num[*pa]=0;
}

void multiply(int num[],int *pa){
	*pa=(*pa)-1;
	num[(*pa)-1]*=num[*pa];
	num[*pa]=0;
}

int main(){
	int i,n,j,k,num[200];
	char s[1000];
	scanf("%d",&k);
	getchar()
	while(k--){
		gets(s);
		char *p=s;
		int curnum=0;
		for(i=0;i<strlen(s);i++){
			if(*(p+i)=='+'){
				add(num,&curnum);
			}
			if(*(p+i)=='-'){
				minus(num,&curnum);
			}
			if(*(p+i)=='*'){
				multiply(num,&curnum);
			}
			int ans = 0;
			if(*(p+i)<='9' && *(p+i)>='0'){
				while(*(p+i)!=' '){
					ans = ans*10 + *(p+i) - '0';
					i++;
				}
				num[curnum] = ans;
				curnum++;
			}
		}
		printf("%d\n",num[0]);
	}
}


Compiler output:
main.c: In function 'main':
main.c:28:18: error: expected ';' before 'while'
   28 |         getchar()
      |                  ^
      |                  ;
   29 |         while(k--){
      |         ~~~~~
Language: C

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

int main()
{
    stack <long> number;
    char op;
    long num;
    bool flag=true;
    while(scanf("%c",&op)!=EOF)
    {

        if(op>='0'&&op<='9')
        {
            if(flag==true)
            {
                num=op-'0';
                number.push(num);
                flag=false;
            }
            else
            {
                num=number.top();
                number.pop();
                num=num*10+op-'0';
                number.push(num);
                flag=false;
            }
        }
        else if(op=='*')
        {
            num=number.top();
            number.pop();
            num*=number.top();
            number.pop();
            number.push(num);
            flag=true;
        }
        else if(op=='+')
        {
            num=number.top();
            number.pop();
            num+=number.top();
            number.pop();
            number.push(num);
            flag=true;
        }
        else if(op=='-')
        {
            num=number.top();
            number.pop();
            num=number.top()-num;
            number.pop();
            number.push(num);
            flag=true;
        }
        else if(op=='\n')
            break;
        else    (flag=true);
    }
    num=number.top();
    cout<<num<<endl;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

#define MAX 100;
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;
	char s[200];
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		if ( s[top] == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		else if ( s[top] == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		else if ( s[top] == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		else {
			x = atoi(s);
			push(x);
		}
	}
	return 0;
}



Compiler output:
main.c:3:9: error: #include expects "FILENAME" or <FILENAME>
    3 | #include
      |         ^
main.c:5:16: error: expected ']' before ';' token
    5 | #define MAX 100;
      |                ^
main.c:8:12: note: in expansion of macro 'MAX'
    8 | long int a[MAX];
      |            ^~~
main.c: In function 'isFull':
main.c:5:16: error: expected ')' before ';' token
    5 | #define MAX 100;
      |                ^
main.c:27:19: note: in expansion of macro 'MAX'
   27 |         if(top >= MAX - 1){
      |                   ^~~
main.c:27:11: note: to match this '('
   27 |         if(top >= MAX - 1){
      |           ^
main.c: In function 'push':
main.c:39:17: error: 'a' undeclared (first use in this function)
   39 |                 a[top] = ope;
      |                 ^
main.c:39:17: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'pop':
main.c:47:24: error: 'a' undeclared (first use in this function)
   47 |                 return a[top];
      |                        ^
Language: C

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

#define MAX 100;
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;
	char s[200];
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		if ( s[top] == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		else if ( s[top] == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		else if ( s[top] == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		else {
			x = atoi(s);
			push(x);
		}
	}
	return 0;
}



Compiler output:
main.c:4:16: error: expected ']' before ';' token
    4 | #define MAX 100;
      |                ^
main.c:7:12: note: in expansion of macro 'MAX'
    7 | long int a[MAX];
      |            ^~~
main.c: In function 'isFull':
main.c:4:16: error: expected ')' before ';' token
    4 | #define MAX 100;
      |                ^
main.c:26:19: note: in expansion of macro 'MAX'
   26 |         if(top >= MAX - 1){
      |                   ^~~
main.c:26:11: note: to match this '('
   26 |         if(top >= MAX - 1){
      |           ^
main.c: In function 'push':
main.c:38:17: error: 'a' undeclared (first use in this function)
   38 |                 a[top] = ope;
      |                 ^
main.c:38:17: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'pop':
main.c:46:24: error: 'a' undeclared (first use in this function)
   46 |                 return a[top];
      |                        ^
Language: C

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

#define MAX 100
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;
	char s[200];
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		if ( s == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		else if ( s == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		else if ( s == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		else {
			x = 0;
			while(getchar(s) != ' '){
				x = x * 10 + atoi(s);
			}
			push(x);
		}
	}
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:56:24: warning: comparison between pointer and integer
   56 |                 if ( s == '+' ){
      |                        ^~
main.c:62:29: warning: comparison between pointer and integer
   62 |                 else if ( s == '-' ){
      |                             ^~
main.c:68:29: warning: comparison between pointer and integer
   68 |                 else if ( s == '*' ){
      |                             ^~
main.c:76:31: error: too many arguments to function 'getchar'
   76 |                         while(getchar(s) != ' '){
      |                               ^~~~~~~
In file included from main.c:1:
/usr/include/stdio.h:582:12: note: declared here
  582 | extern int getchar (void);
      |            ^~~~~~~
Language: C

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

#define MAX 100
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;	//計算用変数
	char s[200];	//数式
	int i = 0;		//インクリメント用変数
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		//足し算
		if ( s[i] == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		//引き算
		else if ( s[i] == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		//掛け算
		else if ( s[i] == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		//数字を配列に挿入
		else {
			x = 0;
			while(getchar(s[i]) != ' '){
				x = x * 10 + atoi(s[i]);
			}
			push(x);
		}
		i++;
	}
	//出力
	printf("%d\n",a[1]);
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:81:31: error: too many arguments to function 'getchar'
   81 |                         while(getchar(s[i]) != ' '){
      |                               ^~~~~~~
In file included from main.c:1:
/usr/include/stdio.h:582:12: note: declared here
  582 | extern int getchar (void);
      |            ^~~~~~~
main.c:82:52: error: passing argument 1 of 'atoi' makes pointer from integer without a cast [-Wint-conversion]
   82 |                                 x = x * 10 + atoi(s[i]);
      |                                                   ~^~~
      |                                                    |
      |                                                    char
In file included from main.c:2:
/usr/include/stdlib.h:105:30: note: expected 'const char *' but argument is of type 'char'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C

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

#define MAX 100
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;	//計算用変数
	char s[200];	//数式
	int i = 0;		//インクリメント用変数
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		//足し算
		if ( s[i] == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		//引き算
		else if ( s[i] == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		//掛け算
		else if ( s[i] == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		//数字を配列に挿入
		else {
			x = 0;
			while(getchar(s[i]) != ' '){
				x = x * 10 + atoi(s[i]);
			}
			push(x);
			i++;
		}
		i++;
	}
	//出力
	printf("%d\n",a[1]);
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:81:31: error: too many arguments to function 'getchar'
   81 |                         while(getchar(s[i]) != ' '){
      |                               ^~~~~~~
In file included from main.c:1:
/usr/include/stdio.h:582:12: note: declared here
  582 | extern int getchar (void);
      |            ^~~~~~~
main.c:82:52: error: passing argument 1 of 'atoi' makes pointer from integer without a cast [-Wint-conversion]
   82 |                                 x = x * 10 + atoi(s[i]);
      |                                                   ~^~~
      |                                                    |
      |                                                    char
In file included from main.c:2:
/usr/include/stdlib.h:105:30: note: expected 'const char *' but argument is of type 'char'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C

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

#define MAX 100
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;	//計算用変数
	char s[200];	//数式
	int i = 0;		//インクリメント用変数
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		//足し算
		if ( s[i] == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		//引き算
		else if ( s[i] == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		//掛け算
		else if ( s[i] == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		//数字を配列に挿入
		else {
			x = 0;
			while(getchar(s[i]) != ' '){
				x = x * 10 + atoi(s[i]);
				i++;
			}
			push(x);
		}
		i++;
	}
	//出力
	printf("%d\n",a[1]);
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:81:31: error: too many arguments to function 'getchar'
   81 |                         while(getchar(s[i]) != ' '){
      |                               ^~~~~~~
In file included from main.c:1:
/usr/include/stdio.h:582:12: note: declared here
  582 | extern int getchar (void);
      |            ^~~~~~~
main.c:82:52: error: passing argument 1 of 'atoi' makes pointer from integer without a cast [-Wint-conversion]
   82 |                                 x = x * 10 + atoi(s[i]);
      |                                                   ~^~~
      |                                                    |
      |                                                    char
In file included from main.c:2:
/usr/include/stdlib.h:105:30: note: expected 'const char *' but argument is of type 'char'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C

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

typedef	   long	   ELEM;	   /* スタックの要素の型 */

#define	   STACK_SIZE  100	   /* スタックの大きさ */

ELEM   stack[STACK_SIZE];	   /* スタックの定義 */
int    n;			  　　　 /* スタックポインタ */


/* エラーメッセージをプリントしてexitする */
void   error(char *s)
{
    fprintf(stderr, s);
    exit(1);
}

/* スタックを初期化する */
void   init()
{
    n = 0;
}

/* スタックにデータを積む */
void   push(ELEM x)
{
    if (n >= STACK_SIZE)
	error("stack overflow\n");
    stack[n++] = x;
}

/* スタックからデータを降ろす */
ELEM   pop()
{
    if (n <= 0)
	error("stack underflow\n");
    return  stack[--n];
}

/* スタックが空かどうかを調べる */
/* 空なら１、空でなければ０を返す */
int    empty()
{
    return  n == 0;
}

/**********************************************************/

/* 逆ポーランド算卓プログラム */

main()
{
    int c;
    long    x, a, b;

    init();
    while ((c = getchar()) != EOF) {
	if (isdigit(c)) {
	    ungetc(c, stdin);
	    scanf("%ld", &x);
	    push(x);
	} else {
	    switch (c) {
	    case '+':
		b = pop(); a = pop();
		push(a + b);
		break;
	    case '-':
		b = pop(); a = pop();
		push(a - b);
		break;
	    case '*':
		b = pop(); a = pop();
		push(a * b);
		break;
	    case '/':
		b = pop(); a = pop();
		push(a / b);
		break;
	    case '\n':
		if (! empty())
		    printf("答えは%ldです\n", pop());
		init();
		break;
	    case ' ':
	    case '\t':
		/* 何もしないで読みとばす */
		break;
	    default:
		printf("不正な文字がありました。\n");
		printf("入力しなおして下さい。\n");
		while ((c = getchar()) != EOF && c != '\n')
		    ;
		break;
	    }
	}
    }
}


Compiler output:
main.c:10:35: error: stray '\343' in program
   10 | int    n;                         <U+3000><U+3000><U+3000> /* <U+30B9><U+30BF><U+30C3><U+30AF><U+30DD><U+30A4><U+30F3><U+30BF> */
      |                                   ^~~~~~~~
main.c:10:37: error: stray '\343' in program
   10 | int    n;                         <U+3000><U+3000><U+3000> /* <U+30B9><U+30BF><U+30C3><U+30AF><U+30DD><U+30A4><U+30F3><U+30BF> */
      |                                           ^~~~~~~~
main.c:10:39: error: stray '\343' in program
   10 | int    n;                         <U+3000><U+3000><U+3000> /* <U+30B9><U+30BF><U+30C3><U+30AF><U+30DD><U+30A4><U+30F3><U+30BF> */
      |                                                   ^~~~~~~~
main.c:53:1: error: return type defaults to 'int' [-Wimplicit-int]
   53 | main()
      | ^~~~
Language: C

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

int top, S[1000];

void push(int x) {
	/*topを加算してからその位置に値を挿入*/
	S[++top] = x;
}

int pop() {
	top--;
	/*topが指していた要素を返す*/
	return S[top + 1];
}

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

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

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

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:16: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   23 |         while (scanf_s("%s", s, 100) != EOF) {
      |                ^~~~~~~
      |                scanf
Language: C

#include<stdio.h>
#include<assert.h>
#include<math.h>
#include<string.h>

int stack[100];
int top = 0;

void push(int v){
    stack[top++] = v;
}

int pop(){
    return stack[--top];
}

int getInt(char *s){
    int i
    int ret=0;
    int size = strlen(s);
    
    for(i=0;i<size;i++){
        ret += (s[i]-'0')*pow(10,size-i-1);
    }
    return ret;
}

int main(){
    
    char s[1000];
    while(scanf("%s",s)!=EOF){
      if('0' <= s[0] && s[0] <= '9'){
          int v = getInt(s);
          push(v);
          continue;
          
      }
      
	  int a,b;
	  b = pop();
	  a = pop();
	  
	  if(s[0] == '+'){
	      push(a+b);
	  }
	  else if(s[0] == '-'){
	      push(a-b);
	  }
	  else if(s[0] == '*'){
	      push(a*b);
	  }
	  else{
	      assert(0);
	  }
	  
	  printf("%d\n",pop());
	  return 0;
}



Compiler output:
main.c: In function 'getInt':
main.c:18:10: error: expected ';' before 'int'
   18 |     int i
      |          ^
      |          ;
   19 |     int ret=0;
      |     ~~~   
main.c:22:9: error: 'i' undeclared (first use in this function)
   22 |     for(i=0;i<size;i++){
      |         ^
main.c:22:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:58:1: error: expected declaration or statement at end of input
   58 | }
      | ^