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

import java.util.*;
// Java program to implement Max Heap 
public class MaxHeap { 
	private int[] Heap; 
	private int size; 
	private int maxsize; 

	// Constructor to initialize an 
	// empty max heap with given maximum 
	// capacity. 
	public MaxHeap(int maxsize) 
	{ 
		this.maxsize = maxsize; 
		this.size = 0; 
		Heap = new int[this.maxsize + 1]; 
		Heap[0] = Integer.MAX_VALUE; 
	} 

	// Returns position of parent 
	private int parent(int pos) 
	{ 
		return pos / 2; 
	} 

	// Below two functions return left and 
	// right children. 
	private int leftChild(int pos) 
	{ 
		return (2 * pos); 
	} 
	private int rightChild(int pos) 
	{ 
		return (2 * pos) + 1; 
	} 

	// Returns true of given node is leaf 
	private boolean isLeaf(int pos) 
	{ 
		if (pos >= (size / 2) && pos <= size) { 
			return true; 
		} 
		return false; 
	} 

	private void swap(int fpos, int spos) 
	{ 
		int tmp; 
		tmp = Heap[fpos]; 
		Heap[fpos] = Heap[spos]; 
		Heap[spos] = tmp; 
	} 

	// A recursive function to max heapify the given 
	// subtree. This function assumes that the left and 
	// right subtrees are already heapified, we only need 
	// to fix the root. 
	private void maxHeapify(int pos) 
	{ 

		if (Heap[pos] < Heap[leftChild(pos)] || 
			Heap[pos] < Heap[rightChild(pos)]) { 

			if (Heap[leftChild(pos)] > Heap[rightChild(pos)]) { 
				swap(pos, leftChild(pos)); 
				maxHeapify(leftChild(pos)); 
			} 
			else { 
				swap(pos, rightChild(pos)); 
				maxHeapify(rightChild(pos)); 
			} 
		} 
	} 

	// Inserts a new element to max heap 
	public void insert(int element) 
	{ 
		Heap[++size] = element; 

		// Traverse up and fix violated property 
		int current = size; 
		while (Heap[current] > Heap[parent(current)]) { 
			swap(current, parent(current)); 
			current = parent(current); 
		} 
	} 

	public void print() 
	{ 
		for (int i = 1; i <= size / 2; i++) { 
			System.out.print(" PARENT : " + Heap[i] + " LEFT CHILD : " + 
					Heap[2 * i] + " RIGHT CHILD :" + Heap[2 * i + 1]); 
			System.out.println(); 
		} 
	} 

	// Remove an element from max heap 
	public int extractMax() 
	{ 
		int popped = Heap[1]; 
		Heap[1] = Heap[size--]; 
		maxHeapify(1); 
		return popped; 
	} 
} 

public Main{
    	public static void main(String[] args) 
	{ 
		Scanner in = new Scanner(System.in);
		MaxHeap maxHeap = new MaxHeap(2000000); 
		String operacao; int valor;
		
		while(in.hasNext()){
			operacao = in.next();
			if(operacao.equals("end")) break;
			else if (operacao.equals("insert")){
				valor = in.nextInt();
				maxHeap.insert(valor); 
			} else {
				System.out.println(maxHeap.extractMax()); 
			}
		}
		//maxHeap.print(); 
		//System.out.println("The max val is " + maxHeap.extractMax()); 
	} 
}


Compiler output:
Main.java:106: error: class, interface, enum, or record expected
public Main{
       ^
Main.java:107: error: unnamed classes are a preview feature and are disabled by default.
    	public static void main(String[] args) 
    	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:126: error: class, interface, enum, or record expected
}
^
3 errors
Language: Java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Heap heap = new Heap();
        int i =0, k;
        String[] actions;
        String action= "";
        while(!(action= in.nextLine()).equals("end")){
            actions = action.split(" ");
            action = actions[0];
            if(action.equals("insert")){
                k = Integer.parseInt(actions[1]);
                heap.insert(k);
            }
            else{
                System.out.println(heap.extract());
            }
        }
    }
}
class Heap {
    private int[] heap;
    private int i;
    Heap(){
        this.heap = new int[2000001];
        this.i =0;
    }
    public void insert(int k){
        this.i++;
        this.heap[this.i]=k;
        int pos = i;
        while(pos>1 && heap[pos]>heap[pos/2]){
            int temp = heap[pos];
            heap[pos] = heap[pos/2];
            heap[pos/2] = temp;
            pos /= 2;
        }
        //System.out.println(i+" "+heap[i]);
    }
    public int extract(){
        int answ;
        if(this.i==1){
            answ = this.heap[1];
            this.i--;
            //System.out.println(i);
        }
        else {
            /*for(int i=1;i<=this.i;i++){
                System.out.print(heap[i]+" ");
            }
            System.out.println("");*/
            /*for(int i=1;i<=this.i;i++){
                System.out.print(heap[i]+" ");
            }
            System.out.println("");*/
            answ = this.heap[1];
            this.heap[1] = this.heap[(this.i)];
            this.i--;
            /*for(int i=1;i<=this.i+1;i++){
                System.out.print(heap[i]+" ");
            }
            System.out.println("");*/
            heapfy();
            /*for(int i=1;i<=this.i+1;i++){
                System.out.print(heap[i]+" ");
            }
            System.out.println("");*/
        }
        return answ;
    }
    private void heapfy(){
        int n = this.i, v, j, k;
        for(int i = 1;i<=n/2;i++){
            boolean heap=false;
            v = this.heap[i];
            k = i;
            while (!heap && 2*k<=n){
                j = 2 *k;
                if(j<n && this.heap[j]<this.heap[j+1]){
                    j++;
                }
                if(v=>this.heap[j]){
                    heap = true;
                }
                else{
                    this.heap[k] = this.heap[j];
                    k = j;
                }
            }
            this.heap[k] = v;
        }
    }
}


Compiler output:
Main.java:85: error: illegal start of expression
                if(v=>this.heap[j]){
                     ^
1 error
Language: Java

import java.util.Scanner;
// Java program to implement Max Heap 
public class MaxHeap { 
	private int[] Heap; 
	private int size; 
	private int maxsize; 

	// Constructor to initialize an 
	// empty max heap with given maximum 
	// capacity. 
	public MaxHeap(int maxsize) 
	{ 
		this.maxsize = maxsize; 
		this.size = 0; 
		Heap = new int[this.maxsize + 1]; 
		Heap[0] = Integer.MAX_VALUE; 
	} 

	// Returns position of parent 
	private int parent(int pos) 
	{ 
		return pos / 2; 
	} 

	// Below two functions return left and 
	// right children. 
	private int leftChild(int pos) 
	{ 
		return (2 * pos); 
	} 
	private int rightChild(int pos) 
	{ 
		return (2 * pos) + 1; 
	} 

	// Returns true of given node is leaf 
	private boolean isLeaf(int pos) 
	{ 
		if (pos >= (size / 2) && pos <= size) { 
			return true; 
		} 
		return false; 
	} 

	private void swap(int fpos, int spos) 
	{ 
		int tmp; 
		tmp = Heap[fpos]; 
		Heap[fpos] = Heap[spos]; 
		Heap[spos] = tmp; 
	} 

	// A recursive function to max heapify the given 
	// subtree. This function assumes that the left and 
	// right subtrees are already heapified, we only need 
	// to fix the root. 
	private void maxHeapify(int pos) 
	{ 
		if (isLeaf(pos)) 
			return; 

		if (Heap[pos] < Heap[leftChild(pos)] || 
			Heap[pos] < Heap[rightChild(pos)]) { 

			if (Heap[leftChild(pos)] > Heap[rightChild(pos)]) { 
				swap(pos, leftChild(pos)); 
				maxHeapify(leftChild(pos)); 
			} 
			else { 
				swap(pos, rightChild(pos)); 
				maxHeapify(rightChild(pos)); 
			} 
		} 
	} 

	// Inserts a new element to max heap 
	public void insert(int element) 
	{ 
		Heap[++size] = element; 

		// Traverse up and fix violated property 
		int current = size; 
		while (Heap[current] > Heap[parent(current)]) { 
			swap(current, parent(current)); 
			current = parent(current); 
		} 
	} 

	public int extractMax() 
	{ 
		int popped = Heap[1]; 
		Heap[1] = Heap[size--]; 
		maxHeapify(1); 
		return popped; 
	}  
} 

public class Main {
	public static void main(String[] arg) 
	{ 
		MaxHeap maxHeap = new MaxHeap(2000000); 
		Scanner in = new Scanner(System.in);
    String operacao; int valor;
    while(in.hasNext()){
      operacao = in.next();
      if (operacao.equals("insert")){
        valor = in.nextInt();
        maxHeap.insert(valor);
      } else if (operacao.equals("extract")){
        System.out.println(maxHeap.extractMax());
      } else {
        break;
      }
    }
	}
}


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

import java.io.*;
import java.util.*;

public class HuxleyCode {
  public static void main(String args[]) {
    Scanner in = new Scanner(System.in);
    
    Vector array = new Vector();
    //Vector<Integer> array = new Vector<>(); 
    
    String string = " ";
    
    while(!string.equals("end")) {
        string = in.next();
        if (string.equals("insert")) { 
            long number = in.nextInt();
            array.add(number);
            if (array.size() > 1 && number < (long) array.get(array.size() - 2)) {
                
                int pos1 = array.size() - 2, pos2 = array.size() - 1;
      
                while (pos1 >= 0 && (long) array.get(pos1) > (long) array.get(pos2)) {
                    long a = (long) array.get(pos1);
                    array.set(pos1,array.get(pos2));
                    array.set(pos2,a);

                    
                    pos1--;
                    pos2--;
                }
                
            }
            in.nextLine();
        } else if (string.equals("extract")){
            System.out.println(array.get(array.size() - 1));
            array.remove(array.size() - 1);
        }
        
    }
    
  }
  
}


Compiler output:
Main.java:4: error: class HuxleyCode is public, should be declared in a file named HuxleyCode.java
public class HuxleyCode {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.*;

public class meh {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Heap heap = new Heap(2000001);
        while(in.hasNext()){
            String input = in.nextLine();
            if(input.equals("end")) {
            	break;
            }
            if(input.equals("extract")){
                int print = heap.extract();
                System.out.println(print);
            }
            else {
                String[] find = input.split(" ");
                int num = Integer.parseInt(find[1]);
                heap.insert(num);
            }
        }
    }

}

class Heap {
    private int[] Heap;
    private int csize;
    private int size;

    public Heap(int size)
    {
        this.size = size;
        this.csize = 0;
        Heap = new int[this.size + 1];
        Heap[0] = Integer.MAX_VALUE;
    }

    private int parent(int posi) {
        return posi / 2;
    }

    private void swap(int a, int b)  {
        int temp;
        temp = Heap[a];
        Heap[a] = Heap[b];
        Heap[b] = temp;
    }

    private void maxHeapify() {
        int i = 1,j; 
        int n=this.csize;
        boolean isHeap = false;
        while(!isHeap && i<=n/2) {
            j= i*2;
            if(j<n && Heap[j+1]>Heap[j]) j++;
            if(Heap[j]>Heap[i]){
               swap(i,j);
               i = j;
            }
            else {
                isHeap=true;
            }
        }
    }

    public void insert(int element) {
        Heap[++csize] = element;
        int current = csize;
        while (current>1 && Heap[current] > Heap[parent(current)]) {
            swap(current, parent(current));
            current = parent(current);
        }
    }

    public int extract() {
        int extracted = Heap[1];
        Heap[1] = Heap[csize];
        Heap[csize] = 0;
        csize--;
        maxHeapify();
        return extracted;
    }
}


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

import java.util.Scanner;
	public class MaxHeap { 
	    private int[] Heap; 
	    private int size; 
	    private int maxsize; 
	  
	    // Construtor para inicializar uma MaxHeap vazia 
	    public MaxHeap(int maxsize) 
	    { 
	        this.maxsize = maxsize; 
	        this.size = 0; 
	        Heap = new int[this.maxsize + 1]; 
	        Heap[0] = 10000; 
	    } 
	  
	    // Posição do pai
	    private int parent(int pos) 
	    { 
	        return pos / 2; 
	    } 
	  
	   //Posicao dos filhos. 
	    private int leftChild(int pos) 
	    { 
	        return (2 * pos); 
	    } 
	    private int rightChild(int pos) 
	    { 
	        return (2 * pos) + 1; 
	    } 
	  
	    private void swap(int pos1, int pos2) 
	    { 
	        int hold; 
	        hold = Heap[pos1]; 
	        Heap[pos1] = Heap[pos2]; 
	        Heap[pos2] = hold; 
	    } 
	  
	    // Função recursiva Heapify para manter a maxHeap
	    private void heapify(int pos) 
	    { 
	    	if (pos >= (size / 2) && pos <= size) //determina se é uma folha
	            return; 
	  
	        if (Heap[pos] < Heap[leftChild(pos)] ||  
	            Heap[pos] < Heap[rightChild(pos)]) { 
	  
	            if (Heap[leftChild(pos)] > Heap[rightChild(pos)]) { 
	                swap(pos, leftChild(pos)); 
	                heapify(leftChild(pos)); 
	            } 
	            else { 
	                swap(pos, rightChild(pos)); 
	                heapify(rightChild(pos)); 
	            } 
	        } 
	    } 
	  
	    // Insere novo elemento na MaxHeap
	    public void insert(int element) 
	    { 
	        Heap[++size] = element; 
	        int current = size; 
	        while (Heap[current] > Heap[parent(current)]) { 
	            swap(current, parent(current)); 
	            current = parent(current); 
	        } 
	    } 
	    
	    // Remove elemento da maxheap 
	    public int extract() 
	    { 
	        int extracted = Heap[1]; 
	        Heap[1] = Heap[size--]; 
	        heapify(1); 
	        return extracted; 
	    } 
	  
	  
	    public static void main(String[] arg) 
	    { 
	    	Scanner input = new Scanner(System.in);
	        MaxHeap priorityQueue = new MaxHeap(99);
	        String enter = "";
	        while (!(enter.equals("end"))) {
	        	enter = input.nextLine();
	        	String arr[] = enter.split(" ");
	        	if (arr[0].equals("insert")) {
	        		int number = Integer.parseInt(arr[1]);
	        		priorityQueue.insert(number);
	        	}
	        	else if (arr[0].equals("extract")) {
	        		System.out.println(priorityQueue.extract());
	        	}
	        } 
	    } 
	}


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


import java.util.Scanner;

public class Class {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		MyHeap heaponga = new MyHeap(1000000);
		String input;
		while (in.hasNext()) {
			input = in.nextLine();
			// Checamos para entrada do tipo "insert"
			if (input.charAt(0) == 'i') {
				String[] number = input.split(" ");
				heaponga.insert(Integer.parseInt(number[1]));
			}
			// Checamos para entrada do tipo "extract"
			else if (input.charAt(1) == 'x') {
				heaponga.remove();
			} else {
				// Caso do "end"
				break;
			}
		}

	}
}

class MyHeap {
	private Integer[] heap;
	private int lastIndex;

	public MyHeap(int heapSize) {
		heap = new Integer[heapSize]; // Usarei Integer ao inves de int para lidar com o problema do elemento ser
										// igual a 0
		lastIndex = 0;
	}

	public void insert(int element) {
		// Insere primeiramente o elemento na ultima posicao livre do array
		heap[lastIndex] = element;
		int aux = lastIndex;
		lastIndex++;
		// Agr vamos corrigir o possivel erro causado na insercao, a partir do novo
		// elemento ate a raiz da heap (mantendo ela uma max heap)
		while (heap[aux] > heap[parent(aux)]) {
			switchPositions(aux, parent(aux));
			aux = parent(aux);
		}
	}

	public void remove() {
		// Trocamos o primeiro com o ultimo elemento e salvamos o item que iremos
		// remover em uma variavel auxiliar e atualizamos o ultimo elemento
		int aux = heap[0];
		switchPositions(0, lastIndex - 1);
		lastIndex--;
		// Agr necessitamos corrigir a heap para mante-la seguindo sua propriedade de
		// ordem (dar um heapify ou bubble up)
		heapify(0);
		System.out.println(aux);
	}

	public int parent(int position) {
		// Funcao simples para retornar a raiz de um determinado elemento
		return (position / 2);
	}

	public void switchPositions(int posA, int posB) {
		// Funcao simples que troca a posicao de dois elementos dentro do array
		int aux = heap[posA];
		heap[posA] = heap[posB];
		heap[posB] = aux;
	}

	public boolean leaf(int index) {
		// Funcao simples que checa se o elemento em questao eh uma folha ou nao
		if (index >= (lastIndex / 2) && index <= lastIndex)
			return true;
		else
			return false;

	}

	public void heapify(int index) {
		// Primeiramente devemos checar se estamos em uma folha, pois devemos para se
		// for o caso
		if (leaf(index)) {
			return;
		}
		// Agr devemos checar nas subheaps a direita e esquerda, consertando-as de forma
		// recursiva
		if (heap[index] != null && heap[index * 2] != null && heap[(index * 2) + 1] != null) {
			if (heap[index] < heap[(2 * index) + 1] || heap[index] < heap[2 * index]) {
				if (heap[2 * index] > heap[(2 * index) + 1]) {
					switchPositions(index, 2 * index);
					heapify(2 * index);
				} else {
					switchPositions(index, (2 * index) + 1);
					heapify((2 * index) + 1);
				}
			}
		}
	}
}


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

import java.io.*;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
public int compare(Integer a,Integer b){
return (a>b)?-1:(a<b)?1:0;
}
});

int num=Integer.parseInt(br.readLine());
while(num-->0){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
int n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else out.println(pque.poll);
}
out.flush();
}
}

Compiler output:
Main.java:11: error: cannot find symbol
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
                                                              ^
  symbol:   class Comparator
  location: class Main
Main.java:25: error: cannot find symbol
else out.println(pque.poll);
                     ^
  symbol:   variable poll
  location: variable pque of type PriorityQueue<Integer>
2 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
public int compare(int a,int b){
return (a>b)?-1:(a<b)?1:0;
}
});
int num=Integer.parseInt(br.readLine());
int n;
while(num-->0){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Integer,Integer) in Comparator
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
                                                                                   ^
1 error
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
public int compare(Object o1,Object o2){
int n1=(int)o1;
int n2=(int)o2;
return (n1>n2)?1:(n1<n2)?-1:0;
});
int num=Integer.parseInt(br.readLine());
int n;
while(num-->0){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: illegal start of expression
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
              ^
Main.java:12: error: illegal start of expression
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
               ^
Main.java:17: error: illegal start of type
});
 ^
Main.java:20: error: illegal start of type
while(num-->0){
^
Main.java:20: error: <identifier> expected
while(num-->0){
         ^
Main.java:29: error: <identifier> expected
out.flush();
         ^
Main.java:30: error: ')' or ',' expected
}
 ^
Main.java:31: error: illegal start of expression
}
^
Main.java:12: error: not a statement
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
             ^
Main.java:31: error: reached end of file while parsing
}
 ^
10 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
public int compare(Object o1,Object o2){
int n1=(int)o1;
int n2=(int)o2;
return (n1>n2)?1:(n1<n2)?-1:0;
}
});
int num=Integer.parseInt(br.readLine());
int n;
while(num-->0){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: illegal start of expression
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
              ^
Main.java:12: error: illegal start of expression
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
               ^
Main.java:18: error: : expected
});
  ^
Main.java:12: error: not a statement
PriorityQueue???pque=new PriorityQueue(10,new Comparator(){
             ^
4 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);

class MyComparator implements Comparator{
public int compare(Object obj1,Object obj2){
int n1=(int)obj1;
int n2=(int)obj2;
return (n1>n2)?1:(n1<n2)?-1:0;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue pque=new PriorityQueue(10,new MyComparator());
int num=Integer.parseInt(br.readLine());
int n;
while(num-->0){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:19: error: non-static variable this cannot be referenced from a static context
PriorityQueue pque=new PriorityQueue(10,new MyComparator());
                                        ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);
 
static class MyComparator implements Comparator<Integer>{
public int compare(int n1,int n2){
return (n1>n2)?1:(n1<n2)?-1:0;
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new MyComparator<Integer>());
int num=Integer.parseInt(br.readLine());
int n;
while(num-->0){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:10: error: MyComparator is not abstract and does not override abstract method compare(Integer,Integer) in Comparator
static class MyComparator implements Comparator<Integer>{
       ^
Main.java:18: error: type MyComparator does not take parameters
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new MyComparator<Integer>());
                                                                          ^
2 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>{
public int compare(int n1,int n2){
return (n1>n2)?1:(n1<n2)?-1:0;
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: '(' or '[' expected
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>{
                                                                                 ^
Main.java:15: error: illegal start of type
});
 ^
Main.java:17: error: illegal start of type
while(true){
^
Main.java:27: error: <identifier> expected
out.flush();
         ^
Main.java:28: error: ';' expected
}
 ^
Main.java:29: error: reached end of file while parsing
}
 ^
6 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>{
public int compare(int n1,int n2){
return (n1>n2)?1:(n1<n2)?-1:0;
}
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: '(' or '[' expected
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>{
                                                                                 ^
Main.java:16: error: ';' expected
});
 ^
2 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>{
public int compare(int n1,int n2){
return n1>n2?1:n1<n2?-1:0;
}
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: '(' or '[' expected
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>{
                                                                                 ^
Main.java:16: error: ';' expected
});
 ^
2 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
public int compare(int n1,int n2){
return n1>n2?1:n1<n2?-1:0;
}
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Integer,Integer) in Comparator
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
                                                                                   ^
1 error
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator(){
public int compare(int n1,int n2){
return n1>n2?1:n1<n2?-1:0;
}
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Object,Object) in Comparator
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator(){
                                                                          ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
@Override
public int compare(int n1,int n2){
return n1>n2?1:n1<n2?-1:0;
}
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Integer,Integer) in Comparator
PriorityQueue<Integer> pque=new PriorityQueue<Integer>(10,new Comparator<Integer>(){
                                                                                   ^
Main.java:13: error: method does not override or implement a method from a supertype
@Override
^
2 errors
Language: Java

import java.io.*;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PriorityQueue pque=new PriorityQueue(10,new Comparator(){
public int compare(int n1,int n2){
return n1>n2?-1:n1<n2?1:0;
}
});
int n;
while(true){
StringTokenizer st=new StringTokenizer(br.readLine());
String command=st.nextToken();
if("insert".equals(command)){
n=Integer.parseInt(st.nextToken());
pque.offer(n);
}
else if("end".equals(command)) break;
else out.println(pque.poll());
}
out.flush();
}
}

Compiler output:
Main.java:12: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Object,Object) in Comparator
PriorityQueue pque=new PriorityQueue(10,new Comparator(){
                                                        ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

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


public class Main2 {
	public static void main(String[] args) throws IOException {
		//ArrayDeque<Integer> deque = new ArrayDeque<Integer>();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();
		//List<Integer> list = new ArrayList<Integer>();
		int[] list = new int[1000000];
		int i = 0;
		
		end: {
			while (true) {
				String str = br.readLine();
				switch (str.substring(0, 2)) {

				case "in":
					// insert????????????
					int insert = Integer.parseInt((String) str.subSequence(7, str.length()));
					//deque.add(insert);
					list[i] = insert;
					i++;
					
					break;

				case "ex":
					// extract????????????
					int max = -1;
					int indicater = 0;
					for(int j = 0; j < list.length; j++){
						if(max < list[j]){
							max = list[j];
							indicater = j;
						}
					}
					sb.append(max + "\n");
					list[indicater] = -1;
					break;
					
				case "en":
					//end??\??????????????????
					break end;
				}
			}
		}
		System.out.print(sb.toString());
	}
}

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

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


public class Main2 {
	public static void main(String[] args) throws IOException {
		//ArrayDeque<Integer> deque = new ArrayDeque<Integer>();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();
		//List<Integer> list = new ArrayList<Integer>();
		int[] list = new int[2000000];
		int i = 0;
		
		end: {
			while (true) {
				String str = br.readLine();
				switch (str.substring(0, 2)) {

				case "in":
					// insert????????????
					int insert = Integer.parseInt((String) str.subSequence(7, str.length()));
					//deque.add(insert);
					list[i] = insert;
					i++;
					break;

				case "ex":
					// extract????????????
					int max = -1;
					int indicater = 0;
					for(int j = 0; j < i; j++){
						if(max < list[j]){
							max = list[j];
							indicater = j;
						}
					}
					sb.append(max + "\n");
					list[indicater] = -1;
					break;
					
				case "en":
					//end??\??????????????????
					break end;
				}
			}
		}
		System.out.print(sb.toString());
	}
}

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


import java.util.*;
public class Main {
    static final int MAX = 2000000;
    static int p = 0;
    static int[] h = new int[MAX + 1];;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        while(true) {
            String order = sc.next();
            if (order.startsWith("i")) {
                insert(sc.nextInt());
                
            } else if (order.startsWith("ex")) {
                System.out.println(heapExtractMax());
                
            } else {
                break;
            }
        }
    }
    
    static void insert(int key) {
        p++;
        h[p] = Integer.MIN_VALUE;
        heapIncreaseKey(p, key);
    }
    
    static void heapIncreaseKey(int i, int key) {
        if (key < h[p]) {
            //error
        }
        h[i] = key;
        while(i > 1 && h[i/2] < h[i]) {
            int temp = h[i];
            h[i] = h[i/2];
            h[i/2] = temp;
            i = i/2;
        }
    }
    
    static int heapExtractMax() {
        if (p < 1) {
            // error
        }
        int max = h[1];
        h[1] = h[p];
        p--;
        ALDS1_9_B_MaximumHeap.maxHeapify(h, 1);  // root以外の節点はヒープ化済み
        return max;
    }
 }



Compiler output:
Main.java:50: error: cannot find symbol
        ALDS1_9_B_MaximumHeap.maxHeapify(h, 1);  // root????????????
        ^
  symbol:   variable ALDS1_9_B_MaximumHeap
  location: class Main
1 error
Language: C

#include<stdio.h>
#include<string.h>
#define Max 2000000
#define Infty (1<<30)

int H,A[Max+1];

void maxheap(int i){
  int l,r,max,tmp;
  l=2*i;
  r=2*i+1;

  if(l <= H && A[l]>A[i])max=l;
  else max=i;
  if(r<=H && A[r]>A[max])max=r;

  if(max!=i){
    tmp=A[i];A[i]=A[max];A[max]=tmp;
    maxheap(max);
  }
}
int extract(){
  int m,tmp;
  if(H<1)return -Infty;
  m=A[1];
  A[1]=A[H--];
  maxheap(1);
  return m;
}
void inckey(int i,int key){
  if(key<A[i])return;
  A[i]=key;
  while(i>1 && A[i/2] < A[i]){
    tmp=A[i];A[i]=A[i/2];A[i/2]=tmp;
    i=i/2;
  }
}
void insert(int k){
  H++;
  A[H]=-Infty;
  inckey(H,key);
}

  
int main(){
  int key;
  char com[10];
  
    while(1)
      {
	scanf("%s",com);
	if(com[0]=='e' && com[1] == 'n')break;
	if(com[0]=='i'){
	  scanf("%d",&key);
	  insert(key);
	}
	else {
	  printf("%d\n",extract());
	}
      }
 
  return 0;
}



Compiler output:
main.c: In function 'inckey':
main.c:34:5: error: 'tmp' undeclared (first use in this function)
   34 |     tmp=A[i];A[i]=A[i/2];A[i/2]=tmp;
      |     ^~~
main.c:34:5: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'insert':
main.c:41:12: error: 'key' undeclared (first use in this function)
   41 |   inckey(H,key);
      |            ^~~
Language: C

#include<stdio.h>
#include<string.h>
#define Max 2000000
#define Infty (1<<30)

int H,A[Max+1];

void maxheap(int i){
  int l,r,max,tmp;
  l=2*i;
  r=2*i+1;

  if(l <= H && A[l]>A[i])max=l;
  else max=i;
  if(r<=H && A[r]>A[max])max=r;

  if(max!=i){
    tmp=A[i];A[i]=A[max];A[max]=tmp;
    maxheap(max);
  }
}
int extract(){
  int m,tmp;
  if(H<1)return -Infty;
  m=A[1];
  A[1]=A[H--];
  maxheap(1);
  return m;
}
void inckey(int i,int key){
  int tmp;
  if(key<A[i])return;
  A[i]=key;
  while(i>1 && A[i/2] < A[i]){
    tmp=A[i];A[i]=A[i/2];A[i/2]=tmp;
    i=i/2;
  }
}
void insert(int k){
  H++;
  A[H]=-Infty;
  inckey(H,key);
}

  
int main(){
  int key;
  char com[10];
  
    while(1)
      {
	scanf("%s",com);
	if(com[0]=='e' && com[1] == 'n')break;
	if(com[0]=='i'){
	  scanf("%d",&key);
	  insert(key);
	}
	else {
	  printf("%d\n",extract());
	}
      }
 
  return 0;
}



Compiler output:
main.c: In function 'insert':
main.c:42:12: error: 'key' undeclared (first use in this function)
   42 |   inckey(H,key);
      |            ^~~
main.c:42:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

def extract(i)
  l = 2*i -1
  r = 2*i
  i -= 1

  if A[l] == nil
    return
  elsif A[r] == nil 
    A[i], A[l] = A[l], A[i]
  elsif A[l] > A[r] && A[l] > A[i]
    A[i], A[l] = A[l], A[i]
    extract(l+1)
  elsif A[l] < A[r] && A[r] > A[i]
    A[i], A[r] = A[r], A[i]
    extract(r+1)
  end
end

def insert(i)
  if i == 1
    return
  end

  parent = i/2 -1
  i -= 1

  if A[i] > A[parent]
    A[i], A[parent] = A[parent], A[i]
    insert(parent+1)
  end
end

A = Array.new

until (str=gets.chomp) == "end"
  if str == "extract"
    puts A.shift
    A.unshift(A.pop)
    extract(1)
  else  # insert
    str = str.split(" ")
    A << str[1].to_i
    insert(A.length)
  end
end



Compiler output:
main.c:1:1: error: unknown type name 'def'
    1 | def extract(i)
      | ^~~
main.c: In function 'extract':
main.c:2:3: error: expected declaration specifiers before 'l'
    2 |   l = 2*i -1
      |   ^
main.c:40:9: error: stray '#' in program
   40 |   else  # insert
      |         ^
main.c:1:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
    1 | def extract(i)
      |     ^~~~~~~
Language: C

A =  Array.new

until (str=gets.chomp) == "end"
  if str == "extract"
    puts A.pop
  else
    str = str.split(" ")
    A << str[1].to_i
    A.sort!
  end
end



Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | A =  Array.new
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'A' [-Wimplicit-int]
main.c:1:6: error: 'Array' undeclared here (not in a function)
    1 | A =  Array.new
      |      ^~~~~
main.c:3:1: error: expected ',' or ';' before 'until'
    3 | until (str=gets.chomp) == "end"
      | ^~~~~
Language: C

def parent(i)
  i/2
end

def left(i)
  i*2
end

def right(i)
  i*2 + 1
end

def extract(i)
  l = left(i)
  r = right(i)
  h = A.length

  # printf "extract %d\n",i
  # p A
  # printf "l %d  r %d  h %d\n",l,r,h

  if l < h && A[l] > A[i]
    @largest = l
  else
    @largest = i
  end

  if r < h && A[r] > A[@largest]
    @largest = r
  end

  if @largest != i
    A[i], A[@largest] = A[@largest], A[i]
    extract(@largest)
  end
end

def insert(i)
  @parent = parent(i)
  if @parent == 0
    return
  end

  if A[i] > A[@parent]
    A[i], A[@parent] = A[@parent], A[i]
    insert(@parent)
  end
end

A = Array.new
A << 0

until (str=gets.chomp) == "end"
  # p A
  if str == "extract"
    puts A[1]
    A[1] = A.pop
    extract(1)
  else
    str = str.split(" ")
    A << str[1].to_i
    insert(A.length-1)
  end
end



Compiler output:
main.c:1:1: error: unknown type name 'def'
    1 | def parent(i)
      | ^~~
main.c: In function 'parent':
main.c:2:3: error: expected declaration specifiers before 'i'
    2 |   i/2
      |   ^
main.c:18:5: error: invalid preprocessing directive #printf
   18 |   # printf "extract %d\n",i
      |     ^~~~~~
main.c:19:5: error: invalid preprocessing directive #p
   19 |   # p A
      |     ^
main.c:20:5: error: invalid preprocessing directive #printf
   20 |   # printf "l %d  r %d  h %d\n",l,r,h
      |     ^~~~~~
main.c:23:5: error: stray '@' in program
   23 |     @largest = l
      |     ^
main.c:25:5: error: stray '@' in program
   25 |     @largest = i
      |     ^
main.c:28:24: error: stray '@' in program
   28 |   if r < h && A[r] > A[@largest]
      |                        ^
main.c:29:5: error: stray '@' in program
   29 |     @largest = r
      |     ^
main.c:32:6: error: stray '@' in program
   32 |   if @largest != i
      |      ^
main.c:33:13: error: stray '@' in program
   33 |     A[i], A[@largest] = A[@largest], A[i]
      |             ^
main.c:33:27: error: stray '@' in program
   33 |     A[i], A[@largest] = A[@largest], A[i]
      |                           ^
main.c:34:13: error: stray '@' in program
   34 |     extract(@largest)
      |             ^
main.c:39:3: error: stray '@' in program
   39 |   @parent = parent(i)
      |   ^
main.c:40:6: error: stray '@' in program
   40 |   if @parent == 0
      |      ^
main.c:44:15: error: stray '@' in program
   44 |   if A[i] > A[@parent]
      |               ^
main.c:45:13: error: stray '@' in program
   45 |     A[i], A[@parent] = A[@parent], A[i]
      |             ^
main.c:45:26: error: stray '@' in program
   45 |     A[i], A[@parent] = A[@parent], A[i]
      |                          ^
main.c:46:12: error: stray '@' in program
   46 |     insert(@parent)
      |            ^
main.c:54:5: error: invalid preprocessing directive #p
   54 |   # p A
      |     ^
main.c:1:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
    1 | def parent(i)
      |     ^~~~~~
Language: C

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

#define Max 2000000
#define Infty (1<<30)

int h, a[Max + 1];

void maxHeapify(int i){
  int l, r, largest, n;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= h && A[l] > A[i]) largest = l;
  else largest = i;

  if(r <= h && A[r] > A[largest]) largest = r;

  if(largest != i){
    n = A[i];
    A[i] = A[largest];
    A[largest] = n;

    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(h < 1) return -Infty;
  maxv = a[1];
  a[1] = a[h--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  int n;

  if(key < a[i]) return;
  a[i] = key;
  while(i > 1 && a[i / 2] < a[i]){
    n = a[i];
    a[i], = a[i / 2];
    a[i / 2] = n;
    i = i / 2;
  }
}

void insert(int key){
  h++;
  a[h] = -Infty;
  increaseKey(h, key);
}


int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s", com);
    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }
    else{
      printf("%d\n", extract());
    }
  }

  return 0;
}


Compiler output:
main.c: In function 'maxHeapify':
main.c:14:16: error: 'A' undeclared (first use in this function)
   14 |   if(l <= h && A[l] > A[i]) largest = l;
      |                ^
main.c:14:16: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'increaseKey':
main.c:44:11: error: expected expression before '=' token
   44 |     a[i], = a[i / 2];
      |           ^
Language: C

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

int main(){

  int A[2000000], i, cnt= 0, Max = 0, c = 0, Max2=0;
  char C[8];

  while(scanf("%s", C)==1){
    if(C[0] == 'i'){
      scanf("%d", &A[cnt]);
      if(Max < A[cnt]) Max = A[cnt];
      cnt++;
    }
    else if(strncmp(C, "ex", 2) == 0){
      printf("%d\n", Max);
      for(i=0; i<cnt; i++){
        if(A[i] == 0) continue;
        if(Max2 < A[i] && A[i] < Max){
          Max2 = A[i];
        }
        if(A[i]==Max && c == 0){
          A[i] = 0;
          c = 1;
        }
        else if(c == 1){
          if(Max == A[i]){
            Max2 = A[i];
            break;
          }
        }
      }
      Max = Max2;
      Max2 = 0;
      c = 0;
    }
    else break;
  }


return 0;
}
so


Compiler output:
main.c:44:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   44 | so
      | ^~
Language: C

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

#define SIZE 2000000

int main() {
  int A[SIZE];
  int H=0;
  int i, l, largest, tmp;
  char com[20];
  do {
    gets(com);
    if (com[0] == 'i') { // insert nn
      A[++H] = atoi(com+7);    
      for (i=H; i>1 && A[i/2]<A[i];i/=2) {
        tmp = A[i/2];
        A[i/2] = A[i];
        A[i] = tmp;
      }

    } else if (com[1]=='x') { // extract
      printf("%d\n", A[1]);
      A[1] = A[H];
      i = 1;
      while (1) {
        l = i*2;
         largest = i;
        if (l < H && A[l] > A[i])        largest = l;
        if (l+1 < H && A[l+1] > A[largest])  largest = l+1;
        if (largest == i) break;
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        i = largest;
      }
      H--;
    }
  } while (com[2]!='d');
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   12 |     gets(com);
      |     ^~~~
      |     fgets