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

int main(){
  int A[H];
  int i;

  scanf("%d",&n);
  for(i = 1; i <= n; i++)
    scanf("%d",&A[i]);
  buildMaxHeap(A);
  for(i = 1; i <= n; i++) 
    printf(" %d",A[i]);
  printf("\n");
  return 0;
}

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

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

Compiler output:
main.c: In function 'main':
main.c:2:9: error: 'H' undeclared (first use in this function)
    2 |   int A[H];
      |         ^
main.c:2:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:5:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:15: error: 'n' undeclared (first use in this function)
    5 |   scanf("%d",&n);
      |               ^
main.c:8:3: error: implicit declaration of function 'buildMaxHeap' [-Wimplicit-function-declaration]
    8 |   buildMaxHeap(A);
      |   ^~~~~~~~~~~~
main.c:10:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   10 |     printf(" %d",A[i]);
      |     ^~~~~~
main.c:10:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:10:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:10:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:11:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   11 |   printf("\n");
      |   ^~~~~~
main.c:11:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'maxHeapify':
main.c:20:11: error: 'n' undeclared (first use in this function)
   20 |   if(l <= n && A[l] > A[i])
      |           ^
main.c: At top level:
main.c:34:6: warning: conflicting types for 'buildMaxHeap'; have 'void(int *)'
   34 | void buildMaxHeap(int A[])
      |      ^~~~~~~~~~~~
main.c:8:3: note: previous implicit declaration of 'buildMaxHeap' with type 'void(int *)'
    8 |   buildMaxHeap(A);
      |   ^~~~~~~~~~~~
main.c: In function 'buildMaxHeap':
main.c:37:11: error: 'n' undeclared (first use in this function)
   37 |   for(i = n/2; i >= 1; i--)
      |           ^
Language: C

#include<stdio.h>

int A[50001];
int H;

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

int main(){

int n,i;
  
  scanf("%d",&H);

  for(i=1; i<=H; i++)
    scanf("%d",&A[i]);
  un
  buildMaxHeap();
    
  for(i=1; i<=H; i++)
    printf(" %d",A[i]);

  printf("\n");

  return 0;
}

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

void maxHeapify(int *A, int i){
  int l,r,N,largest;
  
  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(A,largest);
  }
}

Compiler output:
main.c: In function 'main':
main.c:17:3: error: unknown type name 'un'
   17 |   un
      |   ^~
main.c:18:3: error: conflicting types for 'buildMaxHeap'; have 'int()'
   18 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
main.c:6:6: note: previous declaration of 'buildMaxHeap' with type 'void()'
    6 | void buildMaxHeap();
      |      ^~~~~~~~~~~~
main.c: At top level:
main.c:28:6: error: conflicting types for 'buildMaxHeap'; have 'void()'
   28 | void buildMaxHeap(){
      |      ^~~~~~~~~~~~
main.c:18:3: note: previous declaration of 'buildMaxHeap' with type 'int()'
   18 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
Language: C

#include<stdio.h>

int A[500001];
int H;

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

int main(){

int n,i;
  
  scanf("%d",&H);

  for(i=1; i<=H; i++)
    scanf("%d",&A[i]);
  un
  buildMaxHeap();
    
  for(i=1; i<=H; i++)
    printf(" %d",A[i]);

  printf("\n");

  return 0;
}

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

void maxHeapify(int *A, int i){
  int l,r,N,largest;
  
  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(A,largest);
  }
}

Compiler output:
main.c: In function 'main':
main.c:17:3: error: unknown type name 'un'
   17 |   un
      |   ^~
main.c:18:3: error: conflicting types for 'buildMaxHeap'; have 'int()'
   18 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
main.c:6:6: note: previous declaration of 'buildMaxHeap' with type 'void()'
    6 | void buildMaxHeap();
      |      ^~~~~~~~~~~~
main.c: At top level:
main.c:28:6: error: conflicting types for 'buildMaxHeap'; have 'void()'
   28 | void buildMaxHeap(){
      |      ^~~~~~~~~~~~
main.c:18:3: note: previous declaration of 'buildMaxHeap' with type 'int()'
   18 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
Language: C

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

int N;
int T[500010] ={0};

int main()
{
    int i, j;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &T[i]);
    }
    for (i = N/2+1; i >= 0; i--) {
        maxHeapify(T, i);
    }
    for (i = 0; i < N; i++) {
        printf(" %d", T[i]);
    }
    puts("");
  
    return 0;
}

void maxHeapify(int T[], int i)
{
    int parent = i;
    int left = (i+1)*2 - 1;
    int right = (i+1)*2;
     
    int largest;
    if (right <= N && T[parent] < T[right]) {
        largest = right;
    }
    else {
        largest = parent;
    }
     
    if (left <= N && T[largest] < T[left]) {
        largest = left;
    }
     
     
    /*
    int j;
    printf("p:%d -- ", i);
    for (j = 0; j < 10; j++) {
        printf(" %d", T[j]);
    }puts("");
    */
     
    if (largest != parent) {
        swap(T, largest, parent);
        maxHeapify(T, largest);
    }    
     
    return;
}
 

Compiler output:
main.c: In function 'main':
main.c:16:9: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   16 |         maxHeapify(T, i);
      |         ^~~~~~~~~~
main.c: At top level:
main.c:26:6: warning: conflicting types for 'maxHeapify'; have 'void(int *, int)'
   26 | void maxHeapify(int T[], int i)
      |      ^~~~~~~~~~
main.c:16:9: note: previous implicit declaration of 'maxHeapify' with type 'void(int *, int)'
   16 |         maxHeapify(T, i);
      |         ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:54:9: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   54 |         swap(T, largest, parent);
      |         ^~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 100000


void maxHeapify(int i);
int H,A[MAX+1];

int main(){
  int i;
  scanf("%d",&H);

  for ( i = 1; i <= H; i++){
    scanf("%d",A[i]);
  }
  for ( i = H/2;i >= H; i--){
    maxHeapify(i);
  }
  for ( i = 1; i <= H; i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;



  
}
void maxHeapify(int i){
  int largest,r,l,tmp;
  l = i*2;
  r = i*2+1;
  // ????????????????????????????????§???????????§????????????????????¶
  if(l <= H && A[l] > A[i]){
    largest = l;
  }
  else {
    largest = i;
  }
  if (r <= H and A[r] > A[largest]){
    largest = r;
  }

  if (largest != i){// i ???????????????????????§????????´???
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest) // ?????°??????????????????
      }
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:40:13: error: expected ')' before 'and'
   40 |   if (r <= H and A[r] > A[largest]){
      |      ~      ^~~~
      |             )
main.c:48:24: error: expected ';' before '}' token
   48 |     maxHeapify(largest) // ?????°??????????????????
      |                        ^
      |                        ;
   49 |       }
      |       ~
Language: C

#include<stdio.h>
#define MAX 2000000

int size, A[MAX+1];
void maxHeapify(int)


  main(){
  int i;
  scanf("%d", &size);

  for ( i = 1; i <= size; i++ ) scanf("%d", &A[i]);
  
  for ( i = size/2; i >= 1; i-- ) maxHeapify(i);

  for ( i = 1; i <= size; i++ ) {

    printf(" %d", A[i]);

  }

  printf("\n");
  

  
  return 0;
}
void maxHeapify(int i){
  int l, r, largest, t;
  l = 2*i;
  r = 2*i+1;
  if ( l <= size && A[l] > A[i] ) largest = l;

  else largest = i;

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

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

  }

}

Compiler output:
main.c: In function 'maxHeapify':
main.c:8:3: error: expected declaration specifiers before 'main'
    8 |   main(){
      |   ^~~~
main.c:28:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   28 | void maxHeapify(int i){
      |                       ^
main.c:47: error: expected '{' at end of input
Language: C

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

#define H 500000

int A[N],n;

void maxHeapify(int A[],int i);
void buildMaxHeap(int A[]);



int main()
{
int i;
scanf("%d",&h);
for(i=0;i<h;i++)
{
scanf("%d",&A[i]);
}

buildMaxHeap(A);

for(i=0;i<h;i++)
{
printf("%d ",A[i]);
}

return 0;

}










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




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




}

Compiler output:
main.c:6:7: error: 'N' undeclared here (not in a function)
    6 | int A[N],n;
      |       ^
main.c: In function 'main':
main.c:16:13: error: 'h' undeclared (first use in this function)
   16 | scanf("%d",&h);
      |             ^
main.c:16:13: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'buildMaxHeap':
main.c:45:7: error: 'h' undeclared (first use in this function)
   45 | for(i=h/2;i>=0;i--)
      |       ^
main.c: In function 'maxHeapify':
main.c:59:7: error: 'h' undeclared (first use in this function)
   59 | if(l<=h&&A[l]>A[i])
      |       ^
main.c:74:8: error: 'Largest' undeclared (first use in this function); did you mean 'largest'?
   74 | A[i]=A[Largest];
      |        ^~~~~~~
      |        largest
Language: C

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

int A[500000],n;

void maxHeapify(int A[],int i);
void buildMaxHeap(int A[]);



int main()
{
int i;
scanf("%d",&h);
for(i=0;i<h;i++)
{
scanf("%d",&A[i]);
}

buildMaxHeap(A);

for(i=0;i<h;i++)
{
printf("%d ",A[i]);
}

return 0;

}










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




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




}

Compiler output:
main.c: In function 'main':
main.c:14:13: error: 'h' undeclared (first use in this function)
   14 | scanf("%d",&h);
      |             ^
main.c:14:13: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'buildMaxHeap':
main.c:43:7: error: 'h' undeclared (first use in this function)
   43 | for(i=h/2;i>=0;i--)
      |       ^
main.c: In function 'maxHeapify':
main.c:57:7: error: 'h' undeclared (first use in this function)
   57 | if(l<=h&&A[l]>A[i])
      |       ^
main.c:72:8: error: 'Largest' undeclared (first use in this function); did you mean 'largest'?
   72 | A[i]=A[Largest];
      |        ^~~~~~~
      |        largest
Language: C

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

int A[500000],h;

void maxHeapify(int A[],int i);
void buildMaxHeap(int A[]);



int main()
{
int i;
scanf("%d",&h);
for(i=0;i<h;i++)
{
scanf("%d",&A[i]);
}

buildMaxHeap(A);

for(i=0;i<h;i++)
{
printf("%d ",A[i]);
}

return 0;

}










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




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




}

Compiler output:
main.c: In function 'maxHeapify':
main.c:72:8: error: 'Largest' undeclared (first use in this function); did you mean 'largest'?
   72 | A[i]=A[Largest];
      |        ^~~~~~~
      |        largest
main.c:72:8: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

void maxHeapify(int A[],int i);
void buildMaxHeap(int A[]);
 
 
 
int main()
{
int A[500000],h;
int i;
scanf("%d",&h);
for(i=0;i<h;i++)
{
scanf("%d",&A[i]);
}
 
buildMaxHeap(A);
 
for(i=0;i<h;i++)
{
printf(" %d",A[i]);
}
printf("\n");
return 0;
 
}
 
 
 
 
 
 
 
 
 
 
void buildMaxHeap(int A[])
{
int i;
for(i=h/2;i>=0;i--)
{
maxHeapify(A,i);
}
}
 
 
 
 
void maxHeapify(int A[],int i)
{
int l,r,largest,temp;
l=2*1;
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)
{
temp=A[i];
A[i]=A[largest];
A[largest]=temp;
maxHeapify(A,largest);
}
 
 
 
 
}

Compiler output:
main.c: In function 'buildMaxHeap':
main.c:43:7: error: 'h' undeclared (first use in this function)
   43 | for(i=h/2;i>=0;i--)
      |       ^
main.c:43:7: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'maxHeapify':
main.c:57:7: error: 'h' undeclared (first use in this function)
   57 | if(l<=h&&A[l]>A[i])
      |       ^
Language: C

    scanf("%d",&key[i]);
  }

  buildMaxHeap(H,key);

  for(i=0;i<H;i++) printf(" %d",key[i]);
  printf("\n");

  free(key);
			       

  return 0;
}


void maxHeapify(int i,int H,int *key){
  int l,r,large,tmp;

  l=2*(i+1)-1;
  r=2*(i+1);

  if(l<=H && key[l]>key[i]){
    large=l;
  } 
  else large=i;

  if(r<=H && key[r]>key[large]){
    large=r;
  } 
  if(large!=i){
    tmp=key[i];
    key[i]=key[large];
    key[large]=tmp;
    maxHeapify(large,H,key);
  }
}

void buildMaxHeap(int H,int *key){
  int i;

  for(i=H/2-1;i>=0;i--){
    maxHeapify(i,H,key);
  }
}

Compiler output:
main.c:1:11: error: expected declaration specifiers or '...' before string constant
    1 |     scanf("%d",&key[i]);
      |           ^~~~
main.c:1:16: error: expected declaration specifiers or '...' before '&' token
    1 |     scanf("%d",&key[i]);
      |                ^
main.c:2:3: error: expected identifier or '(' before '}' token
    2 |   }
      |   ^
main.c:4:3: warning: data definition has no type or storage class
    4 |   buildMaxHeap(H,key);
      |   ^~~~~~~~~~~~
main.c:4:3: error: type defaults to 'int' in declaration of 'buildMaxHeap' [-Wimplicit-int]
main.c:4:3: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
main.c:6:3: error: expected identifier or '(' before 'for'
    6 |   for(i=0;i<H;i++) printf(" %d",key[i]);
      |   ^~~
main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    6 |   for(i=0;i<H;i++) printf(" %d",key[i]);
      |            ^
main.c:6:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    6 |   for(i=0;i<H;i++) printf(" %d",key[i]);
      |                ^~
main.c:7:10: error: expected declaration specifiers or '...' before string constant
    7 |   printf("\n");
      |          ^~~~
main.c:9:3: warning: data definition has no type or storage class
    9 |   free(key);
      |   ^~~~
main.c:9:3: error: type defaults to 'int' in declaration of 'free' [-Wimplicit-int]
main.c:9:3: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
main.c:9:3: warning: conflicting types for built-in function 'free'; expected 'void(void *)' [-Wbuiltin-declaration-mismatch]
main.c:1:1: note: 'free' is declared in header '<stdlib.h>'
  +++ |+#include <stdlib.h>
    1 |     scanf("%d",&key[i]);
main.c:12:3: error: expected identifier or '(' before 'return'
   12 |   return 0;
      |   ^~~~~~
main.c:13:1: error: expected identifier or '(' before '}' token
   13 | }
      | ^
main.c:38:6: error: conflicting types for 'buildMaxHeap'; have 'void(int,  int *)'
   38 | void buildMaxHeap(int H,int *key){
      |      ^~~~~~~~~~~~
main.c:4:3: note: previous declaration of 'buildMaxHeap' with type 'int()'
    4 |   buildMaxHeap(H,key);
      |   ^~~~~~~~~~~~
Language: C

#include<stdio.h>
int T[500000];
int size;

void maxheap(int i)
{
  int l,r,max=0,tmp;
  l=left(i);
  r=right(i);
  if(l<=size&&T[l]>T[i])
     {
    
      max=l;
    }
  else
    {
      max=i;
    }
  if(r<=size && T[r]>T[max])
    {
      max = r;
    }
  if(max != i){
    tmp=T[i];
    T[i]=T[max];
    T[max]=tmp;
    maxheap(max);
  }
}

void buildmax(void)
{
  int i;
  for(i=size/2;i>=1;i--)
    {
      maxheap(i);
    }
}

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

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

main(){
  int i;
  scanf("%d",&size);
  for(i=1;i<=size;i++)
    {
      scanf("%d",&T[i]);
    }
  buildmax();
  for(i=1;i<=size;i++)
    {
      print(" %d",T[i]);
    }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'maxheap':
main.c:8:5: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
    8 |   l=left(i);
      |     ^~~~
main.c:9:5: error: implicit declaration of function 'right' [-Wimplicit-function-declaration]
    9 |   r=right(i);
      |     ^~~~~
main.c: At top level:
main.c:49:1: error: return type defaults to 'int' [-Wimplicit-int]
   49 | main(){
      | ^~~~
main.c: In function 'main':
main.c:59:7: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   59 |       print(" %d",T[i]);
      |       ^~~~~
      |       printf
Language: C

#include<stdio.h>
#define MAX 2000000

int H,A[MAX+1];

void maxH(int i){
  int l,r,larg;
  l=2*i;
  r=2*i+1;

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

  if(larg!=i){
    swap(A[i],A[larg]);
    maxH(larg);
  }
}

int main(){
  int i;
  scanf("%d",H)
  for(i=1;i<=H;i++)scanf("%d",&A[i]);
  for(i=H/2;i>=1;if--)maxH(i);
  for(i=1;i<=H;i++)printf(" %d",A[i]);

  printf("\n");

  return 0;
  
}

Compiler output:
main.c: In function 'maxH':
main.c:16:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   16 |     swap(A[i],A[larg]);
      |     ^~~~
main.c: In function 'main':
main.c:23:16: error: expected ';' before 'for'
   23 |   scanf("%d",H)
      |                ^
      |                ;
   24 |   for(i=1;i<=H;i++)scanf("%d",&A[i]);
      |   ~~~           
main.c:25:18: error: expected expression before 'if'
   25 |   for(i=H/2;i>=1;if--)maxH(i);
      |                  ^~
Language: C

#include <stdio.h>
#define MAX 500001
int left(int i){return 2*i;}
int right(int i){return 2*i+1;}
int H;
void maxHeapify(int A[],int i){
  int l=left(i),r=right(i),largest,tmp;
  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);
  }
}
void buildMaxHeap(int A[]){
  for(i=H/2;i>0;i--){
    maxHeapify(A,i);
  }
}
int main(){
  int i,A[MAX];
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&H[i]);
  }
  buildMaxHeap(A);
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'buildMaxHeap':
main.c:19:7: error: 'i' undeclared (first use in this function)
   19 |   for(i=H/2;i>0;i--){
      |       ^
main.c:19:7: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:27:18: error: subscripted value is neither array nor pointer nor vector
   27 |     scanf("%d",&H[i]);
      |                  ^
Language: C

#include<stdio.h>
#define MAX 500000

int H,A[MAX+1];

void swap(int *a ,int *b){
	int	temp;
	temp = *a;
	*a = *b;
	*b = temp;
}
int Left(int i){
  return 2*i;
}
int Right(int i){
  return 2*i+1;
}

}
void maxH(int i){
  int l,r,larg;
  l=Left(i);
  r=Right(i);

  if(l<=H && A[l]>A[i])larg=1;
  else larg=i;
  if(r<=H && A[r]>A[larg])larg=r;
  if(larg!=i){
    swap(&A[i],&A[larg]);
    maxH(larg);
  }
}

int main(){
  int i;
  scanf("%d",&H);
  for(i=1;i<=H;i++)scanf("%d",&A[i]);
  for(i=H/2;i>=1;i--)maxH(i);
  for(i=1;i<=H;i++)printf(" %d",A[i]);

  printf("\n");

  return 0;

}

Compiler output:
main.c:19:1: error: expected identifier or '(' before '}' token
   19 | }
      | ^
Language: C

#include <stdio.h>
#define MAX 500001

int n;
int heap[MAX];
void getmax(int i){
  int l=2*i;
  int r=2*i+1;
  int m,p;

  if(heap[i]< heap[l] && l<=n){
    m=l;
    }
    else {
      m=i;
    }
    if(heap[r] > heap[m] && r<=n){
      m=r;
    }
    if(m!=i){
      p=heap[i];
      heap[i]=heap[m];
      heap[m]=p;
      getmax(m);
    }
}
void build(void){
  for(i=(int)(n/2);i>=1;i--){
  getmax(i);
}
}
int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&heap[i]);
  }
  //printf("agasdfga\n");
/*  for(i=(int)(n/2);i>=1;i--){
    getmax(i);
  }
*/
  build();
  for(i = 1;i <= n;i++){
    printf(" %d",heap[i]);
  }
  printf("\n");

  return 0;

}

Compiler output:
main.c: In function 'build':
main.c:28:7: error: 'i' undeclared (first use in this function)
   28 |   for(i=(int)(n/2);i>=1;i--){
      |       ^
main.c:28:7: 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

int N,S[M+1];

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

void maxHeapify(int i){
  int l,r,lmax,swap;
  l = left(i);
  r = right(i);
  if(l <= N&&S[l]>S[i])
  {
  lmax = l;
  }
  else lmax = i;

  if(r <= N&& S[r]>S[lmax])
  {
    lmax = r;
  }
  if(lmax != i)
  {
    swap = S[i];
    S[i] = S[lmax];
    S[lmax] = swap;
    maxHeapify(lmax);
  }
}

int Extract(){
  int maxvalue;
  if(N<1)return -INFTY;
  maxvalue = S[i];
  S[1] = S[N--];
  maxHeapify(1);
  return maxvalue;
}

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

void insert(int key){
  N++;
  S[N] = -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:37:16: error: 'i' undeclared (first use in this function)
   37 |   maxvalue = S[i];
      |                ^
main.c:37:16: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:73:24: error: implicit declaration of function 'extract'; did you mean 'Extract'? [-Wimplicit-function-declaration]
   73 |     else printf("%d\n",extract());
      |                        ^~~~~~~
      |                        Extract
Language: C

#include <stdio.h>

int left(int);
int right(int);
void maxHeapify(int,int);
void buildMaxHeap(int);

int H;

int main() {
  int i;
  int *A;

  scanf("%d",&H);
  A = (int *)malloc(sizeof(int)*H);
  for(i=1;i<=H;i++) {
    scanf("%d",&A[i]);
  }

  buildMaxHeapify(A,i);

  for(i=1;i<=H;i++) {\printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}


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

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

void    maxHeapify(int A[],int i) {
  int l,r,tmp,largest;
  l = left(i);
  r = right(i);
  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);
  }
}
void buildMaxHeap(int A[]) {
  int i;
  for(i =H/2;i > 0;i--) {
        maxHeapify(A, i)
	  }
}

Compiler output:
main.c: In function 'main':
main.c:15:14: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   15 |   A = (int *)malloc(sizeof(int)*H);
      |              ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:15:14: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   15 |   A = (int *)malloc(sizeof(int)*H);
      |              ^~~~~~
main.c:15:14: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:20:3: error: implicit declaration of function 'buildMaxHeapify'; did you mean 'buildMaxHeap'? [-Wimplicit-function-declaration]
   20 |   buildMaxHeapify(A,i);
      |   ^~~~~~~~~~~~~~~
      |   buildMaxHeap
main.c:22:22: error: stray '\' in program
   22 |   for(i=1;i<=H;i++) {\printf(" %d",A[i]);
      |                      ^
main.c: At top level:
main.c:38:9: error: conflicting types for 'maxHeapify'; have 'void(int *, int)'
   38 | void    maxHeapify(int A[],int i) {
      |         ^~~~~~~~~~
main.c:5:6: note: previous declaration of 'maxHeapify' with type 'void(int,  int)'
    5 | void maxHeapify(int,int);
      |      ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:45:21: error: expected expression before '?' token
   45 |   if(largest != i) {???
      |                     ^
main.c: At top level:
main.c:52:6: error: conflicting types for 'buildMaxHeap'; have 'void(int *)'
   52 | void buildMaxHeap(int A[]) {
      |      ^~~~~~~~~~~~
main.c:6:6: note: previous declaration of 'buildMaxHeap' with type 'void(int)'
    6 | void buildMaxHeap(int);
      |      ^~~~~~~~~~~~
main.c: In function 'buildMaxHeap':
main.c:55:25: error: expected ';' before '}' token
   55 |         maxHeapify(A, i)
      |                         ^
      |                         ;
   56 |           }
      |           ~
Language: C

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

int H;

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

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

void maxHeapify(int A[],int i) {
  int l,r,tmp,largest;
  l = left(i);
  r = right(i);
  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);
  }
}
void buildMaxHeap(int A[]) {
  int i;
  for(i =H/2;i > 0;i--) {
    maxHeapify(A, i);
	  }
}

int main() {
  int i;
  int *A;

  scanf("%d",&H);
  A = (int *)malloc(sizeof(int)*H);
  for(i=1;i<=H;i++) {
    scanf("%d",&A[i]);
  }

  buildMaxHeap(A);

  for(i=1;i<=H;i++) {
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:21:21: error: expected expression before '?' token
   21 |   if(largest != i) {???
      |                     ^
Language: C

#include <stdio.h>
#define N 500000

void max(int);
void build(void);
void printout(void);
int count, i;
int A[N];

int main() {
  int i;

  scanf("%d", &count);
  for( i=0 ; i< count ; i++) scanf("%d", &A[i]);
  build( );
  printout( );
  return 0;
}

void maz( int j ){
  int largest,small;
  if( 2*j+1 <= count && A[2*j+1] > A[j] ) largest = 2*j+1;
  else largest = j;
  if( 2*j+2 <= count && A[2*j+2] > A[largest] ) largest = 2*j+2;
  if( largest!=j ){
    small = A[largest];
    A[largest] = A[j];
    A[j] = small;
    max( largest );
  }
}

void build() {
  int j;
  for( j=count/2-1 ; j>=0 ; j--) max(j);
}

void printout(){
  for( i=0 ; i<count ; i++ ) printf(" %d",A[i]);
  print("\n");
}

Compiler output:
main.c: In function 'printout':
main.c:40:3: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   40 |   print("\n");
      |   ^~~~~
      |   printf
Language: C

#include <stdio.h>
int H[500000];
int n;
void maxHeapify(int i){

  int l,r;
  int largest,tmp;
  l=left(i);
  r=right(i);

  if(n+1>l && H[l]>H[i]) largest = l;
  else largest=i;
  if(n+1>r && H[r]>H[largest]) largest=r;
  if(largest!=i){
    tmp=H[i];
    H[i]=H[largest];
    H[largest]=tmp;
    maxHeapify(largest);
  }
}
void buildMaxHeap(){
  int i;
  for(i=n/2;i+1=1;i--){
    maxHeapify(i);
  }
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}
int parent(int i){
  return i/2;
}

int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
  }
  buildMaxHeap();
  for(i=1;i<=n;i++){
    printf(" %d",H[i]);
  }
  printf("\n");

  return 0;
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:8:5: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
    8 |   l=left(i);
      |     ^~~~
main.c:9:5: error: implicit declaration of function 'right' [-Wimplicit-function-declaration]
    9 |   r=right(i);
      |     ^~~~~
main.c: In function 'buildMaxHeap':
main.c:23:16: error: lvalue required as left operand of assignment
   23 |   for(i=n/2;i+1=1;i--){
      |                ^
Language: C

#include <stdio.h>
#define MAX 500000
int H[MAX];
int n;
void maxHeapify(int i){

  int l,r;
  int largest,tmp;
  l=left(i);
  r=right(i);

  if(n+1>l && H[l]>H[i]) largest = l;
  else largest=i;
  if(n+1>r && H[r]>H[largest]) largest=r;
  if(largest!=i){
    tmp=H[i];
    H[i]=H[largest];
    H[largest]=tmp;
    maxHeapify(largest);
  }
}
void buildMaxHeap(){
  int i;
  for(i=n/2;i+1=1;i--){
    maxHeapify(i);
  }
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}
int parent(int i){
  return i/2;
}

int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
  }
  buildMaxHeap();
  for(i=1;i<=n;i++){
    printf(" %d",H[i]);
  }
  printf("\n");

  return 0;
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:9:5: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
    9 |   l=left(i);
      |     ^~~~
main.c:10:5: error: implicit declaration of function 'right' [-Wimplicit-function-declaration]
   10 |   r=right(i);
      |     ^~~~~
main.c: In function 'buildMaxHeap':
main.c:24:16: error: lvalue required as left operand of assignment
   24 |   for(i=n/2;i+1=1;i--){
      |                ^
Language: C

#include<stdio.h>
#define MAX 2000000

 int n,A[MAX],a;

void maxHeapify(int i){

  i#include<stdio.h>
#define MAX 2000000

 int n,A[MAX],a;

void maxHeapify(int i){

  int l,r,largest;
  l = 2 * i;
  r = 2 * i +1;

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

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

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

int main(){

  int i;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d",&A[i]);

  for(i=n/2;i>=1;i--) maxHeapify(i);

  for(i=1;i<=n;i++){
    printf("%d ",A[i]);
  }

  printf("\n");
}

    
nt l,r,largest;
  l = 2 * i;
  r = 2 * i +1;

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

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

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

int main(){

  int i;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d",&A[i]);

  for(i=n/2;i>=1;i--) maxHeapify(i);

  for(i=1;i<=n;i++){
    printf("%d ",A[i]);
  }

  printf("\n");
}

Compiler output:
main.c: In function 'maxHeapify':
main.c:8:4: error: stray '#' in program
    8 |   i#include<stdio.h>
      |    ^
main.c:8:4: error: expected ';' before 'include'
    8 |   i#include<stdio.h>
      |    ^~~~~~~~
      |    ;
main.c:49:1: error: unknown type name 'nt'; did you mean 'int'?
   49 | nt l,r,largest;
      | ^~
      | int
Language: C


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

typedef struct{
  int k;
  int pk;
  int lk;
  int rk;
  int h;
  int lh;
  int rh;
}Node;

void buildMaxHeap(Node *);
void maxHeapify(Node *,int);

int heap;

int main(){
  int i,n;
  Node *node;

  scanf("%d",&n);

  heap = n;
  
  node = (Node *)malloc(sizeof(Node) * n+1);

  
  for(i = 1 ; i < n+1 ; i++){
    scanf("%d",&node[i].k);
    node[i].h = i;
  }

  for(i = 0 ;i <= 0 ; i++){
    node[i].k = 0;
    node[i].pk = 0;
    node[i].lk = 0;
    node[i].rk = 0;
    node[i].rk = 0;
    node[i].h = 0;
    node[i].lh = 0;
    node[i].rh = 0;
  for(i = 1 ; i < n+1 ; i++){
      
    node[i].pk = node[i/2].k;
    node[i].lk = node[2 * i].k;
    node[i].rk = node[2 * i + 1].k;
    node[i].lh = 2 * i;
    node[i].rh = 2 * i + 1;
    
      
  }


  buildMaxHeap(node);
  
  for(i = 1 ; i < n+1 ; i++) printf(" %d",node[i].k);

  printf("\n");

  free(node);

  return 0;
}


void buildMaxHeap(Node *node){
  int i;
  for(i = heap/2 ; i >= 1 ; i--){
    printf("a\n");
    maxHeapify(node,i);
  }
}

void maxHeapify(Node *node,int i){
  int l,r,largest,s;

  l = node[i].lh;
  r = node[i].rh;

  if(l <= heap  && node[l].k > node[i].k)
    largest = l;

  else
    largest = i;

  if(r <= heap  && node[r].k > node[largest].k)
    largest = r;


  if(largest != i){
    s = node[i].k;
    node[i].k = node[largest].k;
    node[largest].k = s;
    maxHeapify(node,largest);
  }
}
    

Compiler output:
main.c: In function 'main':
main.c:100:1: error: expected declaration or statement at end of input
  100 | }
      | ^
Language: C

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

int parent(int);
int left(int);
int right(int);
void maxHeapify(int*,int);
void insert(int*,int);
void extract(int*);
void increase(int*,int);

int h=0;

int main(){
  int i,k,*A;
  char s[10];

  A = (int *)malloc(sizeof(int)*2000000);

  while(1){
    scanf("%s",s);
    if(s[0]=='e'){
      if(s[1]=='n') break;
      else if(s[1]=='x') extract(A);
    }
    else if(s[0]=='i'){
      scanf("%d",&k);
      insert(A,k);
    }
    
  }


  return 0;
}

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

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

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

void maxHeapify(int* A,int i){
  int l,r,largest,tmp;
  
  l = left(i);
  r = right(i);

  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);
  }

  return;
}

void insert(int* A,int k){
  h++;
  A[h]=k;
  increase(A,k);
  return;
}

void extract(int* A){
  printf("%d\n",A[1]);
  A[1]=A[h];
  h--;
  maxHeapify(A,1);
  return;
}

Compiler output:
/usr/bin/ld: /tmp/ccVG5G6h.o: in function `insert':
main.c:(.text+0x23f): undefined reference to `increase'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#define N 500000
   
int H;
int A[N+1];
   
void maxHeap(int i){
  int max;
  int r=i*2+1,l=i*2;
  int temp=0;
  
  if(l <= H && A[l] > A[i]){
    max=l;
  }
  else {
    max=i;
  }
  if(r <= H && A[r] > A[max]){
    max=r;
  }  
  if(max != i){
    temp = A[i];
    A[i] = A[max];
    A[max] = temp;
    maxHeap(max);
  }
}
 
void buildMaxHeap(){
  int i=0;
  for(i = H/2; i >= 1; i--){
    maxHeap(i);
  }
}
   
int main(){
  int i,j;
  scanf("%d", &H);
  for(i = 1; i <= H; i++){
    scanf("%d", &A[i]);
  }
  B();
  for(i = 1; i <= H; i++){
    printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
   
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:3: error: implicit declaration of function 'B' [-Wimplicit-function-declaration]
   42 |   B();
      |   ^
Language: C

include<stdio.h>
 
#define MAX 2000000
 
int H,A[MAX+1];
void maxHeapfy(int i){
 
    int  l,r,largest,t;
    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){
        t = A[i];
        A[i] = A[largest];
        A[largest] = t;
        maxHeapfy(largest);
    }
 
}
int main(){
int i;
scanf("%d",&H);
 
for( i = 1 ; i <= H ; i++ ){
 
    scanf("%d",&A[i]);
 
}
for( i = H/2 ; i >= 1 ; i-- ){
    maxHeapfy(i);
}
 
for( i = 1 ; i <= H ; i++){
    printf(" %d",A[i]);
}
printf("\n");
 
return 0;
 
}
 
 
 

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'maxHeapfy':
main.c:12:14: error: 'H' undeclared (first use in this function)
   12 |     if( l <= H && A[l] > A[i]) largest = l;
      |              ^
main.c:12:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:19: error: 'A' undeclared (first use in this function)
   12 |     if( l <= H && A[l] > A[i]) largest = l;
      |                   ^
main.c: In function 'main':
main.c:26:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   26 | scanf("%d",&H);
      | ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:26:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   26 | scanf("%d",&H);
      | ^~~~~
main.c:26:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:26:13: error: 'H' undeclared (first use in this function)
   26 | scanf("%d",&H);
      |             ^
main.c:30:17: error: 'A' undeclared (first use in this function)
   30 |     scanf("%d",&A[i]);
      |                 ^
main.c:38:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   38 |     printf(" %d",A[i]);
      |     ^~~~~~
main.c:38:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:38:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:38:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:40:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   40 | printf("\n");
      | ^~~~~~
main.c:40:1: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
 
int heap;

int Right(int i){
  i=i*2+1;
  
  if(i>heap) return 500002;
  else return i;
  
}

int Left(int i){
  i=i*2;
  
  if(i>heap) return 500002;
  else return i;
  
}
 
void maxHeap(int A[],int i){
  int l = Left(i),r = Right(i);
  int largest,j;
 
  if( l <= h && A[l] > A[i]) largest = l;
  
  else largest = i;
  
  if( r <= h && A[r] > A[largest]) largest = r;
  
  if (largest != i){
    j=A[i];
    A[i]=A[largest];
    A[largest]=j;
    maxHeap(A,largest);
  }
}
 
void buildMHeap(int A[]){
    int i;
    
    for(i=h/2;i>=1;i--){
      maxHeap(A,i);
    }
    
}
 
int main(){
    int i,A[500001];
     
    scanf("%d",&heap);
     
    for(i=1;i<=heap;i++){
      scanf("%d",&A[i]);
    }
 
    buildMHeap(A);
 
    for(i=1;i<=heap;i++){
      printf(" %d",A[i]);
    }
    
    printf("\n");
    return 0;
 }

Compiler output:
main.c: In function 'maxHeap':
main.c:25:12: error: 'h' undeclared (first use in this function)
   25 |   if( l <= h && A[l] > A[i]) largest = l;
      |            ^
main.c:25:12: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'buildMHeap':
main.c:42:11: error: 'h' undeclared (first use in this function)
   42 |     for(i=h/2;i>=1;i--){
      |           ^
Language: C

#include <stdio.h>
 
int heap;

int Right(int i){
  i=i*2+1;
  
  if(i>heap) return 500002;
  else return i;
  
}

int Left(int i){
  i=i*2;
  
  if(i>heap) return 500002;
  else return i;
  
}
 
void maxHeap(int A[],int i){
  int l = Left(i),r = Right(i);
  int largest,j;
 
  if( l <= heap && A[l] > A[i]) largest = l;
  
  else largest = i;
  
  if( r <= h && A[r] > A[largest]) largest = r;
  
  if (largest != i){
    j=A[i];
    A[i]=A[largest];
    A[largest]=j;
    maxHeap(A,largest);
  }
}
 
void buildMHeap(int A[]){
    int i;
    
    for(i=heap/2;i>=1;i--){
      maxHeap(A,i);
    }
    
}
 
int main(){
    int i,A[500001];
     
    scanf("%d",&heap);
     
    for(i=1;i<=heap;i++){
      scanf("%d",&A[i]);
    }
 
    buildMHeap(A);
 
    for(i=1;i<=heap;i++){
      printf(" %d",A[i]);
    }
    
    printf("\n");
    return 0;
 }

Compiler output:
main.c: In function 'maxHeap':
main.c:29:12: error: 'h' undeclared (first use in this function)
   29 |   if( r <= h && A[r] > A[largest]) largest = r;
      |            ^
main.c:29:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define H 200000
void maxHeapify(int,int);
void buildMaxHeap(int);
int x;
int main(){
  int i,A[H];
  scanf("%d",&x);
  for(i = 1;i <= x;i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap(A);
  for(i = 1;i <= x;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}
void maxHeapify(A,i){
  int l,r,largest;
  
  scanf("%d",&x);
  for(i = 1;i <= x;i++){
    scanf("%d",&A[i]);
  }
  
  for(i = 1;i <= x;i++){
    l = 2*i;
    r = 2*i+1;
    if(l <= x || A[l] > A[i]){
      largest = l;
    }
    else largest = i;
    if(r <= x || A[r] > A[largest]){
      largest = r;
    }
    if(largest != i){
      A[i] = A[largest];
      maxHeapify(A,largest);
    }
  }
}

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

Compiler output:
main.c: In function 'main':
main.c:12:16: error: passing argument 1 of 'buildMaxHeap' makes integer from pointer without a cast [-Wint-conversion]
   12 |   buildMaxHeap(A);
      |                ^
      |                |
      |                int *
main.c:4:19: note: expected 'int' but argument is of type 'int *'
    4 | void buildMaxHeap(int);
      |                   ^~~
main.c: In function 'maxHeapify':
main.c:19:6: error: type of 'A' defaults to 'int' [-Wimplicit-int]
   19 | void maxHeapify(A,i){
      |      ^~~~~~~~~~
main.c:19:6: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:24:18: error: subscripted value is neither array nor pointer nor vector
   24 |     scanf("%d",&A[i]);
      |                  ^
main.c:30:19: error: subscripted value is neither array nor pointer nor vector
   30 |     if(l <= x || A[l] > A[i]){
      |                   ^
main.c:30:26: error: subscripted value is neither array nor pointer nor vector
   30 |     if(l <= x || A[l] > A[i]){
      |                          ^
main.c:34:19: error: subscripted value is neither array nor pointer nor vector
   34 |     if(r <= x || A[r] > A[largest]){
      |                   ^
main.c:34:26: error: subscripted value is neither array nor pointer nor vector
   34 |     if(r <= x || A[r] > A[largest]){
      |                          ^
main.c:38:8: error: subscripted value is neither array nor pointer nor vector
   38 |       A[i] = A[largest];
      |        ^
main.c:38:15: error: subscripted value is neither array nor pointer nor vector
   38 |       A[i] = A[largest];
      |               ^
main.c: In function 'buildMaxHeap':
main.c:44:6: error: type of 'A' defaults to 'int' [-Wimplicit-int]
   44 | void buildMaxHeap(A){
      |      ^~~~~~~~~~~~
Language: C

#include <stdio.h>
#define H 200000
void maxHeapify(int,int);
void buildMaxHeap(int);
int x;
int main(){
  int i,A[H];
  scanf("%d",&x);
  for(i = 1;i <= x;i++){
    scanf("%d"  scanf("%d",&x);
  for(i = 1;i <= x;i++){
    scanf("%d",&A[i]);
  }
  ,&A[i]);
  }
  buildMaxHeap(A);
  for(i = 1;i <= x;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}
void maxHeapify(A,i){
  int l,r,largest;
  
  for(i = 1;i <= x;i++){
    l = 2*i;
    r = 2*i+1;
    if(l <= x || A[l] > A[i]){
      largest = l;
    }
    else largest = i;
    if(r <= x || A[r] > A[largest]){
      largest = r;
    }
    if(largest != i){
      A[i] = A[largest];
      maxHeapify(A,largest);
    }
  }
}

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

Compiler output:
main.c: In function 'main':
main.c:10:15: error: expected ')' before 'scanf'
   10 |     scanf("%d"  scanf("%d",&x);
      |          ~    ^ ~~~~~
      |               )
main.c:16:16: error: passing argument 1 of 'buildMaxHeap' makes integer from pointer without a cast [-Wint-conversion]
   16 |   buildMaxHeap(A);
      |                ^
      |                |
      |                int *
main.c:4:19: note: expected 'int' but argument is of type 'int *'
    4 | void buildMaxHeap(int);
      |                   ^~~
main.c: In function 'maxHeapify':
main.c:23:6: error: type of 'A' defaults to 'int' [-Wimplicit-int]
   23 | void maxHeapify(A,i){
      |      ^~~~~~~~~~
main.c:23:6: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:29:19: error: subscripted value is neither array nor pointer nor vector
   29 |     if(l <= x || A[l] > A[i]){
      |                   ^
main.c:29:26: error: subscripted value is neither array nor pointer nor vector
   29 |     if(l <= x || A[l] > A[i]){
      |                          ^
main.c:33:19: error: subscripted value is neither array nor pointer nor vector
   33 |     if(r <= x || A[r] > A[largest]){
      |                   ^
main.c:33:26: error: subscripted value is neither array nor pointer nor vector
   33 |     if(r <= x || A[r] > A[largest]){
      |                          ^
main.c:37:8: error: subscripted value is neither array nor pointer nor vector
   37 |       A[i] = A[largest];
      |        ^
main.c:37:15: error: subscripted value is neither array nor pointer nor vector
   37 |       A[i] = A[largest];
      |               ^
main.c: In function 'buildMaxHeap':
main.c:43:6: error: type of 'A' defaults to 'int' [-Wimplicit-int]
   43 | void buildMaxHeap(A){
      |      ^~~~~~~~~~~~
Language: C

#include <stdio.h>
#define H 20000000
void maxHeapify(int);
void buildMaxHeap();
int x,A[H];
int main(){
  int i;
  scanf("%d",&x);
  for(i = 1;i <= x;i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap();
  for(i = 1;i <= x;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}
void maxHeapify(i){
  int l,r,largest,tmp;
  
  for(i = 1;i <= x;i++){
    l = 2*i;
    r = 2*i+1;
    if(l <= x || A[l] > A[i]){
      largest = l;
    }
    else largest = i;
    if(r <= x || A[r] > A[largest]){
      largest = r;
    }
    if(largest != i){
      tmp = A[i]
      A[i] = A[largest];
      A[largest] = tmp;
      maxHeapify(largest);
    }
  }
}

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

Compiler output:
main.c: In function 'maxHeapify':
main.c:19:6: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   19 | void maxHeapify(i){
      |      ^~~~~~~~~~
main.c:33:17: error: expected ';' before 'A'
   33 |       tmp = A[i]
      |                 ^
      |                 ;
   34 |       A[i] = A[largest];
      |       ~
Language: C

#include <stdio.h>
#define H 200000
void maxHeapify(int);

int x,A[H];
int main(){
  int i;
  scanf("%d",&x);
  for(i = 1;i <= x;i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap();
  for(i = 1;i <= x;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}
void maxHeapify(i){
  int l,r,largest,tmp;
  
  for(i = 1;i <= x;i++){
    l = 2*i;
    r = 2*i+1;
    if(l <= x && A[l] > A[i]){
      largest = l;
    }
    else largest = i;
    if(r <= x && A[r] > A[largest]){
      largest = r;
    }
    if(largest != i){
      tmp = A[i];
      A[i] = A[largest];
      A[largest] = tmp;
      maxHeapify(largest);
    }
  }
}

Compiler output:
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'buildMaxHeap' [-Wimplicit-function-declaration]
   12 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:19:6: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   19 | void maxHeapify(i){
      |      ^~~~~~~~~~