Language: C

import java.util.Scanner;
class Main {
public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		Heap priorityQueue = new Heap(10);
		String action = in.next();
		while(!action.equals("end")) {
			if (action.equals("insert")) {
				int key = in.nextInt();
				priorityQueue.insertTopDown(key);
			} else {
				System.out.println(priorityQueue.removeMax());
			}
			action = in.next();
		}
	}

}

class Heap {
	private int[] heap;
	private int insertIndex;
	
	public Heap(int heapSize) {
		this.insertIndex = 1;
		this.heap = new int[heapSize + 1];
		for (int i = 0; i < heapSize + 1; i++) {
			this.heap[i] = -1;
		}
	}
	
	public int findMax() {
		if (this.heap.length > 0) {
			return heap[1];
		} else {
			return -1;
		}
	}
	
	public void swap(int firstIndex, int secondIndex) {
		int temp = this.heap[firstIndex];
		this.heap[firstIndex] = this.heap[secondIndex];
		this.heap[secondIndex] = temp;
	}
	
	private void heapifyBottomUp(int heapifiedIndex) {
		boolean isHeap = false;
		int dadIndex = heapifiedIndex;
		while(!isHeap && 2*dadIndex < this.heap.length) {
			int sonIndex = 2*dadIndex;
			//checks if has 2 sons and sets to the larger one
			if ( (sonIndex + 1) < this.heap.length ) {
				if (this.heap[sonIndex + 1] > this.heap[sonIndex]) {
					sonIndex++;
				}
			}
			if (this.heap[dadIndex] >= this.heap[sonIndex]) {
				isHeap = true;
			} else {
				swap(dadIndex, sonIndex);
				dadIndex = sonIndex;
			}
		}
	}
	
	public void insertBottomUp(int[] insertedKeys) {
		for (int i = 0; i < insertedKeys.length; i++) {
			this.heap[i + 1] = insertedKeys[i];
		}
		this.insertIndex += insertedKeys.length;
		for (int i = 0; i < insertedKeys.length/2; i--) {
			heapifyBottomUp(i);
		}
	}
	
	public void insertTopDown(int key) {
		if (this.insertIndex < this.heap.length) {
			this.heap[this.insertIndex] = key;
			int index = this.insertIndex;
			boolean isHeap = false;
			while(!isHeap && index > 1) {
				if (this.heap[index/2] < key) {
					swap(index, index/2);
					index = index/2;
				} else {
					isHeap = true;
				}
			}
			this.insertIndex++;
		} else {
			int[] temp = new int[this.heap.length*2 - 1];
			for(int i = 1; i < this.heap.length; i++) {
				temp[i] = this.heap[i];
			}
			this.heap = temp;
			temp = null;
			this.heap[this.insertIndex] = key;
			int index = this.insertIndex;
			boolean isHeap = false;
			while(!isHeap && index > 1) {
				if (this.heap[index/2] < key) {
					swap(index, index/2);
					index = index/2;
				} else {
					isHeap = true;
				}
			}
			this.insertIndex++;
		}
	}
	
	public int removeMax() {
		if (this.heap.length > 0) {
			int returnedValue = this.heap[1];
			this.insertIndex--;
			this.heap[1] = this.heap[this.insertIndex];
			this.heap[this.insertIndex] = -1; 
			heapifyBottomUp(1);
			return returnedValue;
		} else {
			return -1;
		}
	}
}



Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Scanner;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Scanner;
      |            ^
main.c:2:1: error: unknown type name 'class'
    2 | class Main {
      | ^~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    2 | class Main {
      |            ^
main.c:21:1: error: unknown type name 'class'
   21 | class Heap {
      | ^~~~~
main.c:21:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   21 | class Heap {
      |            ^