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

#include <stdio.h>

#define SIZE 2000000

int _IO_default_xsputn (FILE *f, const void *data, size_t n)
{
  const char *s = (char *) data;
  size_t more = n;
  if (more <= 0)
    return 0;
  for (;;)
    {
      /* Space available. */
      if (f->_IO_write_ptr < f->_IO_write_end)
        {
          size_t count = f->_IO_write_end - f->_IO_write_ptr;
          if (count > more)
            count = more;
          if (count > 20)
            {
              f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
              s += count;
            }
          else if (count)
            {
              char *p = f->_IO_write_ptr;
              ssize_t i;
              for (i = count; --i >= 0; )
                *p++ = *s++;
              f->_IO_write_ptr = p;
            }
          more -= count;
        }
      if (more == 0 || _IO_OVERFLOW (f, (unsigned char) *s++) == EOF)
        break;
      more--;
    }
  return n - more;
}



int main() {
  int A[SIZE];
  int H=0;
  int i, l, largest, tmp, n;
  char com[21], buf[20];
  buf[19]='\n';
  char *p;
  do {
    fgets(com, 20, stdin);
    if (*com == 'i') {
      A[++H] = 0;
      p = com+7;
      while (*p!='\n') {
        A[H] = A[H]*10+*p-'0';
        p++;
      }

      for (i=H; i>1 && A[i>>1]<A[i];i>>=1) {
        tmp = A[i>>1];
        A[i>>1] = A[i];
        A[i] = tmp;
      }

    } else if (com[1]=='x') { // extract
      n = A[1];
      for (i=18; n>0; n/=10) buf[i--]=(n%10)+'0';
      fputs_unlocked(buf+i+1, stdout);
      A[1] = A[H];
      i = 1;
      while (1) {
        l = i<<1;
        if (l < H && A[l] > A[i])        largest = l;
        else         largest = i;
        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 '_IO_default_xsputn':
main.c:21:34: error: implicit declaration of function '__mempcpy'; did you mean '__mempcpy_chk'? [-Wimplicit-function-declaration]
   21 |               f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
      |                                  ^~~~~~~~~
      |                                  __mempcpy_chk
main.c:21:32: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   21 |               f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
      |                                ^
main.c:34:24: error: implicit declaration of function '_IO_OVERFLOW' [-Wimplicit-function-declaration]
   34 |       if (more == 0 || _IO_OVERFLOW (f, (unsigned char) *s++) == EOF)
      |                        ^~~~~~~~~~~~
main.c: In function 'main':
main.c:69:7: error: implicit declaration of function 'fputs_unlocked' [-Wimplicit-function-declaration]
   69 |       fputs_unlocked(buf+i+1, stdout);
      |       ^~~~~~~~~~~~~~
Language: C

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

using namespace std;

struct HEAP{
    int size;
    int length;
    int* array = new int[100];

    HEAP(){
        this->size = 0;
        this->length = 100;
    }

    void double_array(){
        int* arr =  new int[this->length*2];
        for (int i = 1; i < this->size; i++){
            arr[i] = this->array[i];
        }
        delete (this->array);
        this->array = arr;
    }
};

string print(HEAP* heap){
    string aux = "";
    for (int i = 1; i <= heap->size; i++){
        aux += to_string(heap->array[i]) + " ";
    }
    aux += "\n";
    return aux;
}

void heapify (HEAP* heap){
    int n = heap->size, k, v, j;
    //cout << "--------HEAPIFY-------\n";
    for (int i = n/2; i >= 1; i--){
        //cout << print(heap);
        k = i;
        v = heap->array[k];
        bool isHeap = false;

        while(!isHeap && 2*k <= n){
            j = 2*k;
            if (j < n){
                if(heap->array[j] < heap->array[j+1])
                    j++;
            }
            if (v >= heap->array[j])
                isHeap = true;
            else {
                heap->array[k] = heap->array[j];
                k = j;
            }
        }
        heap->array[k] = v;
        //cout << print(heap);
    }
    //cout << "--------HEAPIFY-------\n";
}

void insert (HEAP* heap, int N){
    heap->size++;
    if(heap->size >= heap->length)
        heap->double_array();
    heap->array[heap->size] = N;
    heapify(heap);
}

int remove(HEAP* heap){
    int removed = heap->array[1], aux = heap->array[heap->size];
    heap->array[heap->size] = removed;
    heap->array[1] = aux;
    heap->size--;
    heapify(heap);
    return removed;
}

int main() {

    HEAP* arr = new HEAP();

    string aux = "", answer = "";
    while (aux != "end"){
        getline(cin, aux);

        if (aux.substr(0, 6) == "insert"){
            insert(arr, stoi(aux.substr(7)));
        }else if (aux == "extract"){
            answer += to_string(remove(arr)) + "\n";
        }
    }

    cout << answer.substr(0, answer.length()-1);
    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>
#define N 2000000

void heapIncreaseKey(int [],int,int);
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

void maxHeapify(int A[], int i){
  int lar;
  int le,ri;
  int tmp;
  le = left(i);
  ri = right(i);
  
  if(n>=le && A[le]>A[i])lar=le;
  else lar=i;
  
  if(n>=ri && A[ri]>A[lar]) lar=ri;
    
    if(lar != i){
      tmp=A[i];
      A[i]=A[lar];
      A[lar]=tmp;
      maxHeapify(A,lar);
    }
    
}

void buildMaxHeap(int A[]){
  int i;
  for(i=n/2;i>=1;i--){
    maxHeapify(A, i);
  }
}

void maxHeapInsert(int A[],int key){
  n=n+1;
  A[n]=-2147483647;
  heapIncreaseKey(A,n,key);
  
}

void heapIncreaseKey(int A[],int i,int key){
  int tmp;
  if(key < A[i])exit(1);
  A[i]=key;
  while(i>1 && A[parent(i)]<A[i]){
    tmp=A[i];
    A[i]=A[parent(i)];
    A[parent(i)]=tmp;
    i=parent(i);
  }
}

int heapExtractMax(int A[]){
  int max;
  if(n<1)exit(5);
  max=A[1];
  A[1]=A[n];
  n=n-1;
  maxHeapify(A,1);
  return max;
}

int main(void){
  int heap[N];
  int k;
  char c[20];
  while(1){
    scanf("%s",c);
    if( c[0] == 'i'){
      scanf("%d",&k);
      maxHeapInsert(heap, k);
    }else if( c[0] == 'e' && c[1] == 'x'){
      printf("%d\n",heapExtractMax(heap));
    }else break;       
  }
  return 0;
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:23:6: error: 'n' undeclared (first use in this function)
   23 |   if(n>=le && A[le]>A[i])lar=le;
      |      ^
main.c:23:6: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'buildMaxHeap':
main.c:39:9: error: 'n' undeclared (first use in this function)
   39 |   for(i=n/2;i>=1;i--){
      |         ^
main.c: In function 'maxHeapInsert':
main.c:45:3: error: 'n' undeclared (first use in this function)
   45 |   n=n+1;
      |   ^
main.c: In function 'heapExtractMax':
main.c:65:6: error: 'n' undeclared (first use in this function)
   65 |   if(n<1)exit(5);
      |      ^
Language: C

#include<stdio.h>
#include<limits.h>
#define MAX 2000001
 
int size=0;
int A[MAX];
 
void MaxHeapInsert(int);
void HeapIncreaseKey(int ,int);
void MaxHeapify(int);
int HeapExtractMax();
int Parent(int);
int Left(int);
int Right(int);
 
int main(){
 
  int n,i,tmp,x;
  char com[20];
 
  while(1){
    scanf("%s",com);
    if(com[0] == 'i'){
      scanf("%d",&x);
      MaxHeapInsert(x);
    }
    else if(com[0] == 'e' && com[1] == 'x'){
      printf("%d\n",HeapExtractMax());
    }
    else if(com[0] == 'e' && com[1] == 'n')
      break;
  }
   
 
  return 0;
}
 
void MaxHeapInsert(int key){
 
  size++;
  heap[size] = INT_MIN;
  heapIncreaseKey(size,key);
}
 
void HeapIncreaseKey(int i, int key){
 
  int tmp;
 
  if(key < heap[i])
    printf("error\n");
  heap[i] = key;
  while(i > 1 && heap[parent(i)] < heap[i]){
    tmp = heap[i];
    heap[i] = heap[parent(i)];
    heap[parent(i)] = tmp;
    i = parent(i);
  }
}
 
int HeapExtractMax(){
 
  int max;
 
  max = heap[1];
  heap[1] = heap[size];
  size--;
  MaxHeapify(1);
  return max;
}
 
int Parent(int i){
  return i / 2;
  }
 
int Left(int i){
    return 2 * i;
}
  
int Right(int i){
    return 2 * i + 1;
}
 
void maxHeapify(int i){
    int left,right,largest,tmp;
  
    left = Left(i);
    right = Right(i);
    if(left <= size && heap[left] > heap[i])
        largest = left;
    else
        largest = i;
    if(right <= size && heap[right] > heap[largest])
        largest = right;
    if(largest != i){
        tmp = heap[i];
        heap[i] = heap[largest];
        heap[largest] = tmp;
        MaxHeapify(largest);
    }
}

Compiler output:
main.c: In function 'MaxHeapInsert':
main.c:41:3: error: 'heap' undeclared (first use in this function)
   41 |   heap[size] = INT_MIN;
      |   ^~~~
main.c:41:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:42:3: error: implicit declaration of function 'heapIncreaseKey'; did you mean 'HeapIncreaseKey'? [-Wimplicit-function-declaration]
   42 |   heapIncreaseKey(size,key);
      |   ^~~~~~~~~~~~~~~
      |   HeapIncreaseKey
main.c: In function 'HeapIncreaseKey':
main.c:49:12: error: 'heap' undeclared (first use in this function)
   49 |   if(key < heap[i])
      |            ^~~~
main.c:52:23: error: implicit declaration of function 'parent'; did you mean 'Parent'? [-Wimplicit-function-declaration]
   52 |   while(i > 1 && heap[parent(i)] < heap[i]){
      |                       ^~~~~~
      |                       Parent
main.c: In function 'HeapExtractMax':
main.c:64:9: error: 'heap' undeclared (first use in this function)
   64 |   max = heap[1];
      |         ^~~~
main.c: In function 'maxHeapify':
main.c:88:24: error: 'heap' undeclared (first use in this function)
   88 |     if(left <= size && heap[left] > heap[i])
      |                        ^~~~
Language: C

#include <stdio.h>
#define MAX 500001


int A[MAX];
char Ch[100];
int heap_size=0;


void maxheapify(int j){
  int largest,leftH,rightH;
    int tmp;
 

    leftH = Left(j);


    rightH = Right(j);

  if(leftH <= heap_size && A[leftH] > A[j]){
    largest=leftH;
  }

  else {
    largest=j;
  }

  if(rightH <= heap_size && A[rightH] > A[largest]){
   
 largest=rightH;

  }
  if(largest != j){

    tmp=A[j];

     A[j]=A[largest];
    A[largest]= tmp;


    maxheapify(largest);
  }
}
 




void heapIncreaseKey(int,int);
 
void maxHeapInsert(int key){
  heap_size = heap_size+1;
  A[heap_size]=-1;
  heapIncreaseKey(heap_size,key);
}
 
void heapIncreaseKey(int i,int key){
  int t;
  if(key < A[i]){
    return ;
  }
  A[i]=key;
  while(i > 1 && A[Parent(i)]<A[i]){
   
    t=A[i];
    A[i]=A[Parent(i)];
    A[Parent(i)]=t;
    i = Parent(i);
  }
}
 
int heapExtractMax(){
  int m;
  if(heap_size < 1){
    return -1;
  }
  m = A[1];
  
  A[1]=A[heap_size];
  heap_size = heap_size -1;
  maxHeapify(1);
  return m;
}
 


int Parent(int i){

  return(i/2);
}


int Left(int i){

  return 2*i;
}

int Right(int i){

  return 2*i+1;
}

int main(){

  int i;


while(1){
    scanf("%s",Ch);
    if(Ch[0]=='i'){

      scanf("%d",&i);

      maxHeapInsert(i);

    } 
    else if(Ch[2]=='d'){
      break;
    } 

    else {
      printf("%d\n",heapExtractMax());
    }
  }
  
  return 0;
}

Compiler output:
main.c: In function 'maxheapify':
main.c:15:13: error: implicit declaration of function 'Left' [-Wimplicit-function-declaration]
   15 |     leftH = Left(j);
      |             ^~~~
main.c:18:14: error: implicit declaration of function 'Right' [-Wimplicit-function-declaration]
   18 |     rightH = Right(j);
      |              ^~~~~
main.c: In function 'heapIncreaseKey':
main.c:63:20: error: implicit declaration of function 'Parent' [-Wimplicit-function-declaration]
   63 |   while(i > 1 && A[Parent(i)]<A[i]){
      |                    ^~~~~~
main.c: In function 'heapExtractMax':
main.c:81:3: error: implicit declaration of function 'maxHeapify'; did you mean 'maxheapify'? [-Wimplicit-function-declaration]
   81 |   maxHeapify(1);
      |   ^~~~~~~~~~
      |   maxheapify
Language: C

 #include<stdio.h>
 #include<limits.h>
  

int A[2000000];
int n;

int parent(int i)
{
  return i/2;
} 
int left(int i)
{
   return 2*i;
}

int right(int i)
{
   return 2*i+1;
} 


void maxHeapify(int i)
{
  int l = left(i);
  int r = right(i);
  int largest,temp;
  if( l <= n && A[l] > A[i])
    {
      largest = l;
    }
  else
    {
      largest = i;
    }
  if(r <= n && A[r] > A[largest])
    {
      largest = r;
    }
  if (largest != i)
    {
      temp = A[i];
      A[i] = A[largest];
      A[largest] = temp;
      maxHeapify(largest);
    }
}

void buildMaxHeap()
{
  int i;
  for( i = n/2;i>0;i--)
    {
      maxHeapify(i);
    }
}

void maxHeapInsert(int key)
{
  n = n + 1;
  A[n] = INT_MIN;
  heapIncreaseKey(n,key);
}


void heapIncreaseKey(int i,int key)
{
  int tmp;
  if (key < A[i])
    {
      return;
    }
  A[i] = key;
  while (i > 1 && A[parent(i)] < A[i])
    {
      tmp = A[i];
      A[i] = A[parent(i)];
      A[parent(i)]= tmp;
      i = parent(i);
    }
}

int heapExtractMax()
{
  int max;
  if ( n < 1)
    {
      return;
    }
  max = A[1];
  A[1] = A[n];
  n = n - 1;
  maxHeapify(1);
  return max;
}


int main()
{
  int t;
  char s[10];
  while(1){
    scanf("%s",s);
    if(s[2]=='s')
      {
	scanf("%d",&t);
	maxHeapInsert(t);
      }
    if(sekine[2]=='t')
      {
	printf("%d\n",heapExtractMax());
      }
    if(s[2]=='d')
      {
	break;
      }
  }
  return 0;
}

Compiler output:
main.c: In function 'maxHeapInsert':
main.c:62:3: error: implicit declaration of function 'heapIncreaseKey' [-Wimplicit-function-declaration]
   62 |   heapIncreaseKey(n,key);
      |   ^~~~~~~~~~~~~~~
main.c: At top level:
main.c:66:6: warning: conflicting types for 'heapIncreaseKey'; have 'void(int,  int)'
   66 | void heapIncreaseKey(int i,int key)
      |      ^~~~~~~~~~~~~~~
main.c:62:3: note: previous implicit declaration of 'heapIncreaseKey' with type 'void(int,  int)'
   62 |   heapIncreaseKey(n,key);
      |   ^~~~~~~~~~~~~~~
main.c: In function 'heapExtractMax':
main.c:88:7: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   88 |       return;
      |       ^~~~~~
main.c:83:5: note: declared here
   83 | int heapExtractMax()
      |     ^~~~~~~~~~~~~~
main.c: In function 'main':
main.c:109:8: error: 'sekine' undeclared (first use in this function)
  109 |     if(sekine[2]=='t')
      |        ^~~~~~
main.c:109:8: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int left(int i){
  return 2 * i;
}

int right(int i){
  return 2 * i + 1;
}

void maxHeapify(int* h, int i, int n){
  
  int l, r, x, largest;
  
  l = left(i);
  r = right(i);
  
  if(l <= n && h[l] > h[i]) largest = l;
  else largest = i;
  
  if(r <= n && h[r] > h[largest]) largest = r;
  
  if(largest != i){
    x = h[i];
    h[i] = h[largest];
    h[largest] = x;
    
    maxHeapify(h, largest, n);
    
  } 
}

void buildMaxHeap(int* h, int n){
  
  int i;
  
  for(i = n / 2; i > 0; i--) maxHeapify(h, i, n);

}


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

Compiler output:
main.c: In function 'main':
main.c:52:20: error: 'x' undeclared (first use in this function)
   52 |       scanf("%d", &x);
      |                    ^
main.c:52:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:53:7: error: implicit declaration of function 'insert' [-Wimplicit-function-declaration]
   53 |       insert(x);
      |       ^~~~~~
Language: C

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

#define NIL -1


void maxHeapify(int *, int, int);
void buildMaxHeap(int *,int);
int extractMax(int *);
void insert(int *, int);

int size = 0;


int main(){

  char op[10];
  int key,i,A[2000];

  while(1){

    scanf("%s",op);
    
    if(op[0] == 'i') {
      scanf("%d",&key);
      insert(A,key);
    }
    
    else if(op[2] == 't') {
      printf("%d\n",extractMax(A));
    }

    else break;
  }    

  return 0;
  
}


void buildMaxHeap(int *A, int h){
  int i;
  for(i = h/2 ; i >= 1 ; i--)
    maxHeapify(A, i, h);
}

void maxHeapify(int *A, int i, int h){
  int l, r, largest,tmp;

  l = i*2;
  r = i*2+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){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(A, largest, h);
  }

}


void insert(int *A, int key){
  int tmp,i;
  size++;
  i = size;

  A[size] = key;
  while(size > 1 && A[i/2]<A[i]){ 
    tmp = A[i];
    A [i] = A[i/2];
    A[i/2] = tmp;
    i = i/2;
  }
}




int extractMax(int *A) { 

  int max;

  max = A[1];
  A[1] = A[size];
  size--;
  maxHeapify(A, 1, size);

  return max;

Compiler output:
main.c: In function 'extractMax':
main.c:95:3: error: expected declaration or statement at end of input
   95 |   return max;
      |   ^~~~~~
Language: C

#include<stdio.h>
#define N 500000
  
int n;
int p(int i){
  return i/2;
}
 
int l(int i){
  return 2*i;
}
  
int r(int i){
  return 2*i+1;
}   
  
  
void maxheapify(int h[],int i){
  int largest=0,aa,le,ri;
  le = l(i);
  ri = r(i);
  if(le <= n && h[le] > h[i]){
    largest = le;
  }
  else{
    largest = i;
   }
  if(ri <= n && h[ri] > h[largest]){
    largest = ri;
  }
  if(largest != i){
    aa = h[i];
    h[i] = h[largest];
    h[largest] = aa;
    maxheapify(h,largest);
  }
}
 
 void buildMaxHeap(int  h[]){
  int i;
  for(i = (n/2); i > 0; i--){
    maxheapify(h,i);
  }
}


void heapIncreaseKey(int A[], int i, int key){
  int tmp;
  if (key < A[i]){
    return; 
  }
 
  A[i] = key;
  while (i > 1 && A[parent(i)] < A[i]){
    tmp = A[i];
    A[i] = A[parent(i)];
    A[parent(i)] = tmp;
    i = parent(i);
  }
}

 
void maxHeapInsert(int A[], int key){
  n = n + 1;
  A[n] = NIL;
  heapIncreaseKey(A, n, key);
}
 


int heapExtractMax(int A[]){
  int max;
  if(n < 1)
    return 0; 
  max = A[1];
  A[1] = A[n];
  n = n - 1;
  maxHeapify(A, 1);
  return max;
}
    
  
int main(){
  int i;
  int S[N];
  char c[30];

  for(i = 1;i < N;i++){
    scanf("%s",c);

  if(strcmp(com,"end")==0){
      break;
    }
 
    if(com[0]=='i'){
      scanf("%d",&x);
      maxHeapInsert(a,x);
    }
 
    else{
      printf("%d\n",heapExtractMax(a));
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'heapIncreaseKey':
main.c:54:21: error: implicit declaration of function 'parent' [-Wimplicit-function-declaration]
   54 |   while (i > 1 && A[parent(i)] < A[i]){
      |                     ^~~~~~
main.c: In function 'maxHeapInsert':
main.c:65:10: error: 'NIL' undeclared (first use in this function)
   65 |   A[n] = NIL;
      |          ^~~
main.c:65:10: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'heapExtractMax':
main.c:78:3: error: implicit declaration of function 'maxHeapify'; did you mean 'maxheapify'? [-Wimplicit-function-declaration]
   78 |   maxHeapify(A, 1);
      |   ^~~~~~~~~~
      |   maxheapify
main.c: In function 'main':
main.c:91:6: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   91 |   if(strcmp(com,"end")==0){
      |      ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | #define N 500000
main.c:91:13: error: 'com' undeclared (first use in this function)
   91 |   if(strcmp(com,"end")==0){
      |             ^~~
main.c:96:19: error: 'x' undeclared (first use in this function)
   96 |       scanf("%d",&x);
      |                   ^
main.c:97:21: error: 'a' undeclared (first use in this function)
   97 |       maxHeapInsert(a,x);
      |                     ^
Language: C

#include<stdio.h>
#define N 500000
  
int n;
int p(int i){
  return i/2;
}
 
int l(int i){
  return 2*i;
}
  
int r(int i){
  return 2*i+1;
}   
  
  
void maxheapify(int h[],int i){
  int largest=0,aa,le,ri;
  le = l(i);
  ri = r(i);
  if(le <= n && h[le] > h[i]){
    largest = le;
  }
  else{
    largest = i;
   }
  if(ri <= n && h[ri] > h[largest]){
    largest = ri;
  }
  if(largest != i){
    aa = h[i];
    h[i] = h[largest];
    h[largest] = aa;
    maxheapify(h,largest);
  }
}
 
 void buildMaxHeap(int  h[]){
  int i;
  for(i = (n/2); i > 0; i--){
    maxheapify(h,i);
  }
}


void heapIncreaseKey(int A[], int i, int key){
  int tmp;
  if (key < A[i]){
    return; 
  }
 
  A[i] = key;
  while (i > 1 && A[parent(i)] < A[i]){
    tmp = A[i];
    A[i] = A[parent(i)];
    A[parent(i)] = tmp;
    i = parent(i);
  }
}

 
void maxHeapInsert(int A[], int key){
  n = n + 1;
  A[n] = NIL;
  heapIncreaseKey(A, n, key);
}
 


int heapExtractMax(int A[]){
  int max;
  if(n < 1)
    return 0; 
  max = A[1];
  A[1] = A[n];
  n = n - 1;
  maxHeapify(A, 1);
  return max;
}
    
  
int main(){
  int i,w;
  int S[N];
  char c[30];

  for(i = 1;i < N;i++){
    scanf("%s",c);

  if(strcmp(c,"end")==0){
      break;
    }
 
    if(c[0]=='i'){
      scanf("%d",&w);
      maxHeapInsert(S,w);
    }
 
    else{
      printf("%d\n",heapExtractMax(S));
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'heapIncreaseKey':
main.c:54:21: error: implicit declaration of function 'parent' [-Wimplicit-function-declaration]
   54 |   while (i > 1 && A[parent(i)] < A[i]){
      |                     ^~~~~~
main.c: In function 'maxHeapInsert':
main.c:65:10: error: 'NIL' undeclared (first use in this function)
   65 |   A[n] = NIL;
      |          ^~~
main.c:65:10: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'heapExtractMax':
main.c:78:3: error: implicit declaration of function 'maxHeapify'; did you mean 'maxheapify'? [-Wimplicit-function-declaration]
   78 |   maxHeapify(A, 1);
      |   ^~~~~~~~~~
      |   maxheapify
main.c: In function 'main':
main.c:91:6: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   91 |   if(strcmp(c,"end")==0){
      |      ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | #define N 500000
Language: C

#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]>N[H[b]]?1:0;
}
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
int hout(){
  int rt=H[1],i=1,j;
  for(C--;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[i/2]=k;
  return rt;
}
int main(){
  int a;
  char s[100];
  while(scanf("%s",s),s[2]-'d'){
    if(s[2]=='s'){
      scanf("%d",&a);
      hin(a);
    }
    else printf("%d\n",N[hout()]);
  }
  return 0;
}

Compiler output:
main.c: In function 'hout':
main.c:16:10: error: 'k' undeclared (first use in this function)
   16 |   H[i/2]=k;
      |          ^
main.c:16:10: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <stdlib.h>
#define H 2000002
#define K -2000000002
 
int left(int i){ return i*2; }
 
int right(int i){ return i*2 + 1; }
 
int parent(int i){ return i/2; }
 
void swap(int *x, int *y){
  int tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
 
int n;
 
void maxHeapify(int *arr, int i){
  int bigger;
  int l = left(i), r = right(i);
 

  if(l <= n && arr[l] > arr[i]) bigger = l;
  else bigger = i;
  if(r <= n && arr[r] > arr[bigger]) bigger = r;
 
  if(largest != i){ // if arr[i]'s parent key larger than arr[i]'s key
    swap(&arr[i], &arr[bigger]);
    maxHeapify(arr, bigger);
  }
}
 
int extractMax(int *heap){
  if(n<1) printf("heap under flow\n");
 
  int max = heap[1];
  heap[1] = heap[n];
  n--;
  maxHeapify(heap,1);
  return max;
}
 
void increseKey(int *arr, int i, int key){
  if(key<arr[i]) printf("New key less than actual key\n");
  arr[i] = key;
  while(i>1 && arr[parent(i)]<arr[i]){
    swap(&arr[i],&arr[parent(i)]);
    i = parent(i);
  }
}
 
void heapInsert(int *heap, int key){
  n++;
  heap[n] = K;
  increseKey(heap,n,key);
}
 
int main(void){
  int k;
  int heap[H];
  char inst[10];
 
  while(1){
    scanf("%s", inst);
    if(inst[0] == 'e'){
      if(inst[1] == 'n') break;
      else printf("%d\n", extractMax(heap));
    }
    if(inst[0] == 'i'){
      scanf("%d", &k);
      heapInsert(heap, k);
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:30:6: error: 'largest' undeclared (first use in this function)
   30 |   if(largest != i){ // if arr[i]'s parent key larger than arr[i]'s key
      |      ^~~~~~~
main.c:30:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int q[2000000];
void Swap(int i, int j){

  int tmp;
  
  tmp=q[i];
  q[i]=q[j];
  q[j]=tmp;

}

int main(){
  int k,s=0;
  int i,pr,l, r;
  char C[2];
  while(1){
    scanf("%s%d",c,&k);
    if(C[0]=='i'){
      i=s;
      q[i]=k;
      while(i>0 && q[i]>q[pr=(i-1)/2]){
          Swap(i,pr);
          i=pr;
        }
        ++s;
    }
    else if(C[1]=='n')
      break;

    else{
      printf("%d\n",q[0]);

      q[i=0]=q[--s];
      --q[s];
      while((l=i*2+1)<s){
        if((r=l+1)<s && q[r] > q[l])l=r;
        if(q[i]<q[l])Swap(i,l);
        i=l;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:18: error: 'c' undeclared (first use in this function)
   18 |     scanf("%s%d",c,&k);
      |                  ^
main.c:18:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int q[2000000];
void swap(int i, int j){

  int tmp;
  tmp=Q[i];
  Q[i]=Q[j];
  Q[j]=tmp;

}

int main(){
  int k,s=0;
  int i,pr,l, r;
  char c[2];
  while(1){
    scanf("%s%d",c,&k);
    if(c[0]=='i'){
      i=s;
      Q[i]=k;
      while(i>0 && Q[i]>q[pr=(i-1)/2]){
          swap(i,pr);
          i=pr;
        }
        ++s;
    }
    else if(c[1]=='n')break;
    else{
      printf("%d\n",q[0]);

      q[i=0]=q[--s];
      --q[s];
      while((l=i*2+1)<s){
        if((r=l+1)<s && q[r] > q[l])l=r;
        if(q[i]<q[l])swap(i,l);
        i=l;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'swap':
main.c:6:7: error: 'Q' undeclared (first use in this function)
    6 |   tmp=Q[i];
      |       ^
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:20:7: error: 'Q' undeclared (first use in this function)
   20 |       Q[i]=k;
      |       ^
Language: C

#include <stdio.h>

#define K 2000000000
#define NIL NULL

typedef struct node{
  int key;
}Node;

void insert(int *, int);
int extractMax(int *);

int main()
{

  int n, i, n;
  char com[20];

  while((scanf("%s", com)) == "end"){

    if(com[0] = 'i'){
      scanf("%d", &n);
      insert(n);
    }

    else if(com[0] = "extract"){
      extractMax(com);
    }

  }

  return 0;
}

void insert(int *S, int k){

  int size;

  size = sizeof(S);
  S[s] = S[s] + 1;  //heap-size??????????????????
  //heap-size??????????¢???????
  S[s] = NIL;
}

int extractMax(int *S){

  int size;

  size = sizeof(S);
//heap-size??????????????????
  if();

  printf("%d\n", );

}

Compiler output:
main.c: In function 'main':
main.c:16:13: error: redeclaration of 'n' with no linkage
   16 |   int n, i, n;
      |             ^
main.c:16:7: note: previous declaration of 'n' with type 'int'
   16 |   int n, i, n;
      |       ^
main.c:19:28: warning: comparison between pointer and integer
   19 |   while((scanf("%s", com)) == "end"){
      |                            ^~
main.c:23:14: error: passing argument 1 of 'insert' makes pointer from integer without a cast [-Wint-conversion]
   23 |       insert(n);
      |              ^
      |              |
      |              int
main.c:10:13: note: expected 'int *' but argument is of type 'int'
   10 | void insert(int *, int);
      |             ^~~~~
main.c:23:7: error: too few arguments to function 'insert'
   23 |       insert(n);
      |       ^~~~~~
main.c:10:6: note: declared here
   10 | void insert(int *, int);
      |      ^~~~~~
main.c:26:20: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
   26 |     else if(com[0] = "extract"){
      |                    ^
main.c:27:18: error: passing argument 1 of 'extractMax' from incompatible pointer type [-Wincompatible-pointer-types]
   27 |       extractMax(com);
      |                  ^~~
      |                  |
      |                  char *
main.c:11:16: note: expected 'int *' but argument is of type 'char *'
   11 | int extractMax(int *);
      |                ^~~~~
main.c: In function 'insert':
main.c:40:5: error: 's' undeclared (first use in this function)
   40 |   S[s] = S[s] + 1;  //heap-size??????????????????
      |     ^
main.c:40:5: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'extractMax':
main.c:51:6: error: expected expression before ')' token
   51 |   if();
      |      ^
main.c:53:18: error: expected expression before ')' token
   53 |   printf("%d\n", );
      |                  ^
Language: C

#include <stdio.h>

int main(){
  int dat[1024];
  int max = 0;
  char str[8];
  int num;
  while(1){
  scanf("%s %d", &str, &num);
  if (strcmp(str, "insert") == 0){
    if (num > max) max = num;
    dat[itr] = num;
  } else if ( strcmp(str, "extract"){
    printf("%d", max);
  } else return 0;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:7: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   10 |   if (strcmp(str, "insert") == 0){
      |       ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:12:9: error: 'itr' undeclared (first use in this function); did you mean 'str'?
   12 |     dat[itr] = num;
      |         ^~~
      |         str
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:37: error: expected ')' before '{' token
   13 |   } else if ( strcmp(str, "extract"){
      |             ~                       ^
      |                                     )
main.c:16:3: error: expected expression before '}' token
   16 |   }
      |   ^
Language: C

#include <stdio.h>

int main(){
  int dat[1024];
  int max = 0;
  int itr;
  int cnt;
  char str[8];
  int num;
  while(1){
    scanf("%s", &str);
    if (strcmp(str, "insert") == 0){
      cnt++;
      scanf("%d", &num);
      if (num > max){
        int i;
        for (i = 0; i < cnt; i++){
          int tmp;
          if(dat[i] < num) continue;
          if(dat[i] >= num){
            tmp = dat[i+1];
            dat[i+1] = num;
            for (j=(i+1);j<=cnt;j++){
              tmp = dat[j];
              dat[j+1] = dat[j];
            }
          }
        }
      }
      dat[itr] = num;
    } else if ( strcmp(str, "extract") == 0){
      printf("%d\n", max);
      cnt --;
    } else return 0;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   12 |     if (strcmp(str, "insert") == 0){
      |         ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:23:18: error: 'j' undeclared (first use in this function)
   23 |             for (j=(i+1);j<=cnt;j++){
      |                  ^
main.c:23:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define N 20000001
#define INFTY (1<<30)

int n,A[N+1];
void swap(int *a, int *b){
  int temp;
  temp = *a;
  *a = *b;
  b* = temp;
}
void maxh(int i){
  int left,right,large;
  left = 2 * i;
  right = 2*i+1;
  if(left <= n && A[left] > A[i]) large = left;
  else large = i;
  if(right <= n && A[right] = A[large])large = right;

  if(large != i){
    swap(&A[i],&A[large])large = right;
    maxh(large);
  }
}
int extra(){
  int max;
  if(n < 1)return -INFTY;
  max = A[1];
  A[1] = A[n--];
  maxh[1];
  return max;
}
void increase(int i,int key){
  if(key < A[i])return ;
  A[i] = key;
  while(i > 1 && A[i/2] < A[i]){
    swap(&A[i],&A[i/2]);
    i = i/2;
  }
}
void insert(int key){
  n++;
  A[n] = -INFTY;
  increase(n,key);
}
int main(){
  int key,x[10];
  while(1){
    scanf("%s",x);
    if(x[0] == 'e' && x[1] == 'n')break;
    if(x[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }
    else printf("%d\n",extra());
  }
  return 0;
}
  

Compiler output:
main.c: In function 'swap':
main.c:10:6: error: expected expression before '=' token
   10 |   b* = temp;
      |      ^
main.c: In function 'maxh':
main.c:18:29: error: lvalue required as left operand of assignment
   18 |   if(right <= n && A[right] = A[large])large = right;
      |                             ^
main.c:21:26: error: expected ';' before 'large'
   21 |     swap(&A[i],&A[large])large = right;
      |                          ^~~~~
      |                          ;
main.c: In function 'extra':
main.c:30:7: error: subscripted value is neither array nor pointer nor vector
   30 |   maxh[1];
      |       ^
Language: C

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

#define MAX 2000000
#define INF 200000000
int H,A[MAX+1];

/*void swap(int x,int y){
  int t;
  t=x;
  x=y;
  y=x;
  }*/

void maxHeapify(int i){
  int l,r,largest,tmp;
  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){
    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(H<1) return -INF;
  maxv=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(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 key){
  H++;
  A[H]=-INF;
  increaseKey(H,key);
}

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

Compiler output:
main.c: In function 'increaseKey':
main.c:43:5: error: 'tmp' undeclared (first use in this function)
   43 |     tmp=A[i];
      |     ^~~
main.c:43:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>
#define M 2000000
#define INFTY (1<<30)

int H,A[M+1];

int left(int i){return i*2;}
int right(int i){return i*2 +1;}

void maxHeapify(int i){
  int l,r,biggest,tmp;
  l=2*i;
  r=2*i+1;
  if(l<=H&&A[l]>A[i])
    biggest=l;
  else
    biggest=i;
  if(r<=H&&A[r]>A[biggest])
    biggest=r;
  if(biggest!=i){
    tmp=A[i];
    A[i]=A[biggest];
    A[biggest]=tmp;
    maxHeapify(biggest);
    }
}

int extract(){
  int maxvalue;
  if(H<1)return -INFTY;
  maxvalue = A[1];
  A[1] = A[N--];
  maxHeapify(1);
  return maxvalue;
}

void increKey(int i,int key){
  int tmp;
  if(key<S[i])return;
  S[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 key){
  H++;
  A[H]=-INFTY;
  increKey(N,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 'extract':
main.c:33:12: error: 'N' undeclared (first use in this function)
   33 |   A[1] = A[N--];
      |            ^
main.c:33:12: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'increKey':
main.c:40:10: error: 'S' undeclared (first use in this function)
   40 |   if(key<S[i])return;
      |          ^
main.c: In function 'insert':
main.c:53:12: error: 'N' undeclared (first use in this function)
   53 |   increKey(N,key);
      |            ^
Language: C

#include<stdio.h>
#include<string.h>
#define M 2000000
#define INFTY (1<<30)

int H,A[M+1];

void maxHeapify(int i){
  int l,r,biggest,tmp;
  l=2*i;
  r=2*i+1;
  if(l<=H&&A[l]>A[i])
    biggest=l;
  else
    biggest=i;
  if(r<=H&&A[r]>A[biggest])
    biggest=r;
  if(biggest!=i){
    tmp=A[i];
    A[i]=A[biggest];
    A[biggest]=tmp;
    maxHeapify(biggest);
    }
}

int extract(){
  int maxvalue;
  if(H<1)return -INFTY;
  maxvalue = A[1];
  A[1] = A[N--];
  maxHeapify(1);
  return maxvalue;
}

void increKey(int i,int key){
  int tmp;
  if(key<S[i])return;
  S[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 key){
  H++;
  A[H]=-INFTY;
  increKey(N,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 'extract':
main.c:30:12: error: 'N' undeclared (first use in this function)
   30 |   A[1] = A[N--];
      |            ^
main.c:30:12: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'increKey':
main.c:37:10: error: 'S' undeclared (first use in this function)
   37 |   if(key<S[i])return;
      |          ^
main.c: In function 'insert':
main.c:50:12: error: 'N' undeclared (first use in this function)
   50 |   increKey(N,key);
      |            ^
Language: C

#include<stdio.h>

#define M 2000001
#define INFTY (1<<30)

int H,A[M];

void maxHeapify(int i){
  int l,r,biggest,tmp;
  l=2*i;
  r=2*i+1;
  if(l<=H&&A[l]>A[i])
    biggest=l;
  else
    biggest=i;
  if(r<=H&&A[r]>A[biggest])
    biggest=r;
  if(biggest!=i){
    tmp=A[i];
    A[i]=A[biggest];
    A[biggest]=tmp;
    maxHeapify(biggest);
    }
}

int extract(){
  int maxv;
  if(H<1)return -INFTY;
  maxv = A[1];
  A[1] = A[N--];
  maxHeapify(1);
  return maxv;
}

void increKey(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 key){
  H++;
  A[H]=-INFTY;
  increKey(N,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 'extract':
main.c:30:12: error: 'N' undeclared (first use in this function)
   30 |   A[1] = A[N--];
      |            ^
main.c:30:12: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'insert':
main.c:50:12: error: 'N' undeclared (first use in this function)
   50 |   increKey(N,key);
      |            ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define INF 100000000;

int heapExtractMax();
void maxHeapify(int);
void buildMaxHeap();
void heapIncreaseKey(int, int);
void maxHeapInsert(int);

int length = 1;
int A[2000001];
 
int main()
{
  char order[8];
  int data, i = 1;
  
  while(order[0] != 'e' || order[1] != 'n')
    {
      scanf("%s", order);
     
      if(order[0] == 'i')
	{
	  scanf("%d", &data);
	  maxHeapInsert(data);
	}
      else if(order[0] == 'e' && order[1] == 'x') printf("%d\n", heapExtractMax());
    }
  return 0;
}
 
void maxHeapify(int i)
{
  int l, r, largest, a;
  
  l = i*2;
  r = i*2+1;
 
  if(l <= length && A[l] > A[i]) largest = l;
  else largest = i;
 
  if(r <= length && A[r] > A[largest]) largest = r;
 
  if(largest! = i)
    {
      a = A[i];
      A[i] = A[largest];
      A[largest] = a;
      maxHeapify(largest);
    } 
}
 
int heapExtractMax()
{
  int max;
  
  if(length < 1) return -INF;
  
  max = A[1];
  A[1] = A[length];
  length--;
  maxHeapify(1);
 
  return max;
}

void maxHeapInsert(int key)
{ 
  length++;
  A[length] =- INF;
  heapIncreaseKey(length, key);
}
 
void heapIncreaseKey(int i, int key)
{
  int a;
  
  if(key < A[i]) return;
  
  A[i] = key;
  
  while(i > 1 && A[i/2] < A[i])
    {
      a = A[i];
      A[i] = A[i/2];
      A[i/2] = a;
      i = i;
    }
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:45:13: error: expected ')' before '!' token
   45 |   if(largest! = i)
      |     ~       ^
      |             )
Language: C

#include<stdio.h>
#include<stdlib.h>
#define INF 100000000;

int heapExtractMax();
void maxHeapify(int);
void buildMaxHeap();
void heapIncreaseKey(int, int);
void maxHeapInsert(int);

int length = 1;
int A[2000001];
 
int main()
{
  char order[8];
  int data, i = 1;
  
  while(order[0] != 'e' || order[1] != 'n')
    {
      scanf("%s", order);
     
      if(order[0] == 'i')
	{
	  scanf("%d", &data);
	  maxHeapInsert(data);
	}
      else if(order[0] == 'e' && order[1] == 'x') printf("%d\n", heapExtractMax());
    }
  return 0;
}
 
void maxHeapify(int i)
{
  int l, r, largest, a;
  
  l = i*2;
  r = i*2+1;
 
  if(l <= length && A[l] > A[i]) largest = l;
  else largest = i;
 
  if(r <= length && A[r] > A[largest]) largest = r;
 
  if(largest! = i)
    {
      a = A[i];
      A[i] = A[largest];
      A[largest] = a;
      maxHeapify(largest);
    } 
}
 
int heapExtractMax()
{
  int max;
  
  if(length < 1) return -INF;
  
  max = A[1];
  A[1] = A[length];
  length--;
  maxHeapify(1);
 
  return max;
}

void maxHeapInsert(int key)
{ 
  length++;
  A[length] =- INF;
  heapIncreaseKey(length, key);
}
 
void heapIncreaseKey(int i, int key)
{
  int a;
  
  if(key < A[i]) return;
  
  A[i] = key;
  
  while(i > 1 && A[i/2] < A[i])
    {
      a = A[i];
      A[i] = A[i/2];
      A[i/2] = a;
      i = i/2;
    }
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:45:13: error: expected ')' before '!' token
   45 |   if(largest! = i)
      |     ~       ^
      |             )
Language: C

#include<stdio.h>
#include<stdlib.h>
#define INF 100000000;

int heapExtractMax();
void maxHeapify(int);
void buildMaxHeap();
void heapIncreaseKey(int, int);
void maxHeapInsert(int);

int length = 1;
int A[2000001];
 
int main()
{
  char order[8];
  int data, i = 1;
  
  while(order[0] != 'e' || order[1] != 'n')
    {
      scanf("%s", order);
     
      if(order[0] == 'i')
	{
	  scanf("%d", &data);
	  maxHeapInsert(data);
	}
      else if(order[0] == 'e' && order[1] == 'x') printf("%d\n", heapExtractMax());
    }
  return 0;
}
 
void maxHeapify(int i)
{
  int l, r, largest, a;
  
  l = i*2;
  r = i*2+1;
 
  if(l <= length && A[l] > A[i]) largest = l;
  else largest = i;
 
  if(r <= length && A[r] > A[largest]) largest = r;
 
  if(largest! = i)
    {
      a = A[i];
      A[i] = A[largest];
      A[largest] = a;
      maxHeapify(largest);
    } 
}
 
int heapExtractMax()
{
  int max;
  
  if(length < 1) return -INF;
  
  max = A[1];
  A[1] = A[length];
  length--;
  maxHeapify(1);
 
  return max;
}

void maxHeapInsert(int key)
{ 
  length++;
  A[length] = -INF;
  heapIncreaseKey(length, key);
}
 
void heapIncreaseKey(int i, int key)
{
  int a;
  
  if(key < A[i]) return;
  
  A[i] = key;
  
  while(i > 1 && A[i/2] < A[i])
    {
      a = A[i];
      A[i] = A[i/2];
      A[i/2] = a;
      i = i/2;
    }
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:45:13: error: expected ')' before '!' token
   45 |   if(largest! = i)
      |     ~       ^
      |             )
Language: C

#include <stdio.h>
#define N 2000001
#define INF 10000000
#define size 20

int H,A[MAX];

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

  //????????????????????????????????§???????????§????????????????????¶
  if(l<=H&&A[l]>A[i]) largest=1;
  else largest = i;
  if(r<=H&&A[r]>A[largest]) largest=r;

  if(largest!=i){
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int max;
  if(H<1) return -INF;
  max=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return max;
}

void Swap(int *a,int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}

void increaseKey(int i, int key){
  if(key<A[i]) return;
  A[i]=key;
  while(i>1&&A[i/2]<A[i]){
    swap(&A[i],A[i/2]);
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INF;
  increaseKey(H,key);
}

int main(){
int key;
char str[size];

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

Compiler output:
main.c:6:9: error: 'MAX' undeclared here (not in a function)
    6 | int H,A[MAX];
      |         ^~~
main.c: In function 'maxHeapify':
main.c:19:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   19 |     swap(A[i],A[largest]);
      |     ^~~~
main.c: In function 'main':
main.c:61:8: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   61 |     if(strcmp("end",str)) break;
      |        ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | #define N 2000001
main.c:62:14: warning: comparison between pointer and integer
   62 |     if(str[0]=="i"){
      |              ^~
Language: C

#include <stdio.h>
#define MAX 2000001
#define INF 10000000
#define size 20

int H,A[MAX];

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

  //????????????????????????????????§???????????§????????????????????¶
  if(l<=H&&A[l]>A[i]) largest=1;
  else largest = i;
  if(r<=H&&A[r]>A[largest]) largest=r;

  if(largest!=i){
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int max;
  if(H<1) return -INF;
  max=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return max;
}

void Swap(int *a,int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}

void increaseKey(int i, int key){
  if(key<A[i]) return;
  A[i]=key;
  while(i>1&&A[i/2]<A[i]){
    swap(&A[i],A[i/2]);
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INF;
  increaseKey(H,key);
}

int main(){
int key;
char str[size];

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

Compiler output:
main.c: In function 'maxHeapify':
main.c:19:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   19 |     swap(A[i],A[largest]);
      |     ^~~~
main.c: In function 'main':
main.c:61:8: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   61 |     if(strcmp("end",str)) break;
      |        ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | #define MAX 2000001
main.c:62:14: warning: comparison between pointer and integer
   62 |     if(str[0]=="i"){
      |              ^~
Language: C

#include<bits/stdc++.h>//
using namespace std;
main()
 {
    // freopen("input","r",stdin);
    long long int t,i,j;
    priority_queue<long long> q;
    char s[15];
    while(scanf("%s",s) && s[2]!='d')
    {
        if(s[0]=='i')
        {
            scanf("%lld",&t;
           q.push(t);
        }
        else if(s[2]=='t')
        {
            i=q.top();
            q.pop();
            printf("%lld\n",i);
        }
    }
    return 0;
 }

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>//
      |         ^~~~~~~~~~~~~~~
compilation terminated.