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

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

Compiler output:
main.c: In function 'main':
main.c:14:22: error: stray '#' in program
   14 |     scanf("%d",&A[i])#include <stdio.h>
      |                      ^
main.c:14:22: error: expected ';' before 'include'
   14 |     scanf("%d",&A[i])#include <stdio.h>
      |                      ^~~~~~~~
      |                      ;
Language: C

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

Compiler output:
main.c: In function 'maxHeapify':
main.c:35:11: error: 'n' undeclared (first use in this function)
   35 |   if(l <= n && A[l] > A[i]){
      |           ^
main.c:35:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
 
  
void maxH(int *node, int i, int g){
  int l, r, large, s;
   
  l = i*2;
  r = i*2+1;
     
  if(l <= g && node[l] > node[i]) large = l;
1  else large = i;
  if(r <= g && node[r] > node[large])large = r;
  
  if(large != i){
    s = node[i];
    node[i] = node[large];
    node[large] = s;
    maxH(node, large, g);
  }
}
  
main(){
  int i, g;
  int node[500001];
  
  scanf("%d", &g);
  
  for(i=1;i<=g;i++) scanf("%d", &node[i]);
  
  for(i =g/2;i>0;i--) maxH(node,i,g);
  
  
  for(i=1;i<=g;i++) printf(" %d",node[i]);
  
  printf("\n");
  return 0; 
}

Compiler output:
main.c: In function 'maxH':
main.c:11:2: error: expected ';' before 'else'
   11 | 1  else large = i;
      |  ^ ~~~~
      |  ;
main.c: At top level:
main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int]
   22 | main(){
      | ^~~~
Language: C

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

Compiler output:
main.c: In function 'heap':
main.c:22:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   22 |     swap(A[i],A[largest]);
      |     ^~~~
Language: C

#include<stdio.h>
#define N 500000

int data[N+1], n;

void swap(int* a, int* b){
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

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

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

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


Compiler output:
main.c: In function 'maxHeapify':
main.c:12:6: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   12 | void maxHeapify(i){
      |      ^~~~~~~~~~
main.c: In function 'buildMaxHeap':
main.c:27:25: error: implicit declaration of function 'maxHeapfy'; did you mean 'maxHeapify'? [-Wimplicit-function-declaration]
   27 |     for(i=n/2; i>0; i--)maxHeapfy(i);
      |                         ^~~~~~~~~
      |                         maxHeapify
Language: C

#include <stdio.h>
#define MAX 200000

int n, A[MAX + 1];

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

  // 左の子、自分、右の子で値が最大のノードを選ぶ
  if(l <= n && A[l] > A[i]) largest = l;
  else largest = i;
  if (r <= n && A[r] > A[largest]) largest = r;

  if (largest != i) {
    //swap
    int x = A[i];
    A[i] = A[largest];
    A[largest] = x;
    maxHeapify(largest);
  }

}

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

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

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

  return 0;
}



Compiler output:
main.c: In function 'maxHeapify':
main.c:10:7: error: redeclaration of 'largest' with no linkage
   10 |   int largest = 0;
      |       ^~~~~~~
main.c:7:13: note: previous declaration of 'largest' with type 'int'
    7 |   int l, r, largest;
      |             ^~~~~~~
Language: C

#include <stdio.h>
#define M 500000
 
int heap[M+1];
int n;
 
void maxheap(int *,int);
void(int *);
 
int main(int argc char *argv[])
{
    int i;
    scanf("%d", &n);
    for(i=1; i<=n; i++) {
        scanf("%d", heap+i);
    }
     
    bmaxheap(heap);
     
    for(i=1; i<=n; i++) {
        printf(" %d", heap[i]);
    }
    printf("\n");
    return 0;
}

void maxheap(int A[], int i)
{
    int tmp;
    int l=i+i;
    int r=l+1;
    int large=i;
 
    if(l<=n && A[l]>A[i])
        large=l;
    if(r<=n && A[r] > A[large])
        large=r;
     
    if(large!=i) {
        tmp=A[i]; A[i]=A[large]; A[large]=tmp;
            maxheap(A, large);
    }
 
}
 
void bmaxheap(int A[])
{
    int i;
    for(i=n/2; i>0; i--) {
        maxheap(A, i);
    }
}

Compiler output:
main.c:8:6: error: expected identifier or '(' before 'int'
    8 | void(int *);
      |      ^~~
main.c:10:19: error: expected ';', ',' or ')' before 'char'
   10 | int main(int argc char *argv[])
      |                   ^~~~
Language: C

#include <stdio.h>
#define M 500000
 
int heap[M+1];
int n;
 
void maxheap(int *,int);
void(int *);
 
int main(int argc, char *argv[])
{
    int i;
    scanf("%d", &n);
    for(i=1; i<=n; i++) {
        scanf("%d", heap+i);
    }
     
    bmaxheap(heap);
     
    for(i=1; i<=n; i++) {
        printf(" %d", heap[i]);
    }
    printf("\n");
    return 0;
}

void maxheap(int A[], int i)
{
    int tmp;
    int l=i+i;
    int r=l+1;
    int large=i;
 
    if(l<=n && A[l]>A[i])
        large=l;
    if(r<=n && A[r] > A[large])
        large=r;
     
    if(large!=i) {
        tmp=A[i]; A[i]=A[large]; A[large]=tmp;
            maxheap(A, large);
    }
 
}
 
void bmaxheap(int A[])
{
    int i;
    for(i=n/2; i>0; i--) {
        maxheap(A, i);
    }
}

Compiler output:
main.c:8:6: error: expected identifier or '(' before 'int'
    8 | void(int *);
      |      ^~~
main.c: In function 'main':
main.c:18:5: error: implicit declaration of function 'bmaxheap'; did you mean 'maxheap'? [-Wimplicit-function-declaration]
   18 |     bmaxheap(heap);
      |     ^~~~~~~~
      |     maxheap
main.c: At top level:
main.c:46:6: warning: conflicting types for 'bmaxheap'; have 'void(int *)'
   46 | void bmaxheap(int A[])
      |      ^~~~~~~~
main.c:18:5: note: previous implicit declaration of 'bmaxheap' with type 'void(int *)'
   18 |     bmaxheap(heap);
      |     ^~~~~~~~
Language: C

#include <stdio.h>
#define M 500000
 
int heap[M+1];
int n;
 
void maxheap(int [],int);
void(int []);
 
int main(int argc, char *argv[])
{
    int i;
    scanf("%d", &n);
    for(i=1; i<=n; i++) {
        scanf("%d", heap+i);
    }
     
    bmaxheap(heap);
     
    for(i=1; i<=n; i++) {
        printf(" %d", heap[i]);
    }
    printf("\n");
    return 0;
}

void maxheap(int A[], int i)
{
    int tmp;
    int l=i+i;
    int r=l+1;
    int large=i;
 
    if(l<=n && A[l]>A[i])
        large=l;
    if(r<=n && A[r] > A[large])
        large=r;
     
    if(large!=i) {
        tmp=A[i]; A[i]=A[large]; A[large]=tmp;
            maxheap(A, large);
    }
 
}
 
void bmaxheap(int A[])
{
    int i;
    for(i=n/2; i>0; i--) {
        maxheap(A, i);
    }
}

Compiler output:
main.c:8:6: error: expected identifier or '(' before 'int'
    8 | void(int []);
      |      ^~~
main.c: In function 'main':
main.c:18:5: error: implicit declaration of function 'bmaxheap'; did you mean 'maxheap'? [-Wimplicit-function-declaration]
   18 |     bmaxheap(heap);
      |     ^~~~~~~~
      |     maxheap
main.c: At top level:
main.c:46:6: warning: conflicting types for 'bmaxheap'; have 'void(int *)'
   46 | void bmaxheap(int A[])
      |      ^~~~~~~~
main.c:18:5: note: previous implicit declaration of 'bmaxheap' with type 'void(int *)'
   18 |     bmaxheap(heap);
      |     ^~~~~~~~
Language: C

#include <stdio.h>
#define M 500000
 
int heap[M+1];
int n;
 
void maxheap(int *,int);
void(int *);
 
int main(int argc, char *argv[])
{
    int i;
    scanf("%d", &n);
    for(i=1; i<=n; i++) {
        scanf("%d", heap+i);
    }
     
    bmaxheap(heap);
     
    for(i=1; i<=n; i++) {
        printf(" %d", heap[i]);
    }
    printf("\n");
    return 0;
}

void maxheap(int *A, int i)
{
    int tmp;
    int l=i+i;
    int r=l+1;
    int large=i;
 
    if(l<=n && A[l]>A[i])
        large=l;
    if(r<=n && A[r] > A[large])
        large=r;
     
    if(large!=i) {
        tmp=A[i]; A[i]=A[large]; A[large]=tmp;
            maxheap(A, large);
    }
 
}
 
void bmaxheap(int *A)
{
    int i;
    for(i=n/2; i>0; i--) {
        maxheap(A, i);
    }
}

Compiler output:
main.c:8:6: error: expected identifier or '(' before 'int'
    8 | void(int *);
      |      ^~~
main.c: In function 'main':
main.c:18:5: error: implicit declaration of function 'bmaxheap'; did you mean 'maxheap'? [-Wimplicit-function-declaration]
   18 |     bmaxheap(heap);
      |     ^~~~~~~~
      |     maxheap
main.c: At top level:
main.c:46:6: warning: conflicting types for 'bmaxheap'; have 'void(int *)'
   46 | void bmaxheap(int *A)
      |      ^~~~~~~~
main.c:18:5: note: previous implicit declaration of 'bmaxheap' with type 'void(int *)'
   18 |     bmaxheap(heap);
      |     ^~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
 
#define M 500001

struct node{
  int p;
  int l;
  int r;
};
 
struct node A[M];

int heap_size;

int parent(int);
int left(int);
int right(int);
void maxheap(int *,int);
void bmaxheap(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 l,r,largest;
  int temp;
   
  l = left(i);
  r = right(i);
   
 
  if((l <= heap_size) && (A[l] > A[i])){
    largest = l;
  }
  else {
    largest = i;
  }
   
  if((r <= heap_size) && (A[r] > A[largest])){
    largest = r;
  } 
   
  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
     
    maxHeapify(A,largest);
  } 
}
 
void buildMaxHeap(int A[]){
  int i;
 
  for(i = heap_size/2 ; i >= 1 ; i--){
    maxHeapify(A,i);
  }
}
 
int main(int argc, char *argv[]){
  int i,key[M];
   
  scanf("%d",&heap_size);
   
  for(i = 1 ; i <= heap_size ; i++){
    scanf("%d",&key[i]);  
  }
   
  buildMaxHeap(key);
   
  for(i = 1 ; i <= heap_size ; i++){
    printf(" %d",key[i]);
  }
  printf("\n");
   
  return 0;
}

int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}
 
void maxheap(int A[],int i){
  int l,r,largest;
  int temp;
   
  l = left(i);
  r = right(i);
   
 
  if((l <= heap_size) && (A[l] > A[i])){
    largest = l;
  }
  else {
    largest = i;
  }
   
  if((r <= heap_size) && (A[r] > A[largest])){
    largest = r;
  } 
   
  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
     
    maxheap(A,largest);
  } 
}
 
void bmaxheap(int A[]){
  int i;
 
  for(i = heap_size/2 ; i >= 1 ; i--){
    maxheap(A,i);
  }
}
 

Compiler output:
main.c:87:5: error: redefinition of 'parent'
   87 | int parent(int i){
      |     ^~~~~~
main.c:22:5: note: previous definition of 'parent' with type 'int(int)'
   22 | int parent(int i){
      |     ^~~~~~
main.c:90:5: error: redefinition of 'left'
   90 | int left(int i){
      |     ^~~~
main.c:25:5: note: previous definition of 'left' with type 'int(int)'
   25 | int left(int i){
      |     ^~~~
main.c:93:5: error: redefinition of 'right'
   93 | int right(int i){
      |     ^~~~~
main.c:28:5: note: previous definition of 'right' with type 'int(int)'
   28 | int right(int i){
      |     ^~~~~
Language: C

#include<stdio.h>
#define MAX 250
 
int heapsize;
int A[MAX];
int p(int heap){
    return heap/2;
}
int l(int heap){
    return heap*2;
}
int r(int heap){
    return (heap*2+1);
}
 
main(){

    int i,left,right;
    scanf("%d",&heapsize);
     
    for(i = 1;i <= heapsize;i++){
        scanf("%d",&A[i]);
    }
    buildMaxHeap();
    for(i = 1;i < heapsize;i++)
    printf("%d",A[i]);
    printf("%d"A[i]);
    return 0;
}
 
int maxHeapify(i){
    int largest;
    int left = l(i);
    int right = r(i);
    if(left <= heapsize && A[i]< A[left]){
        largest = left;
    }else{
        largest = i;
    }
    if(right <= heapsize && A[right] > A[largest]){
        largest = right;
    }
    if(largest != i){
        int tmp;
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
    maxHeapify(largest);
    }
}
int buildMaxHeap(){
    int i;
    for(i = (heapsize/2); i >= 1;i--){
        maxHeapify(i);
    }
    
}

Compiler output:
main.c:16:1: error: return type defaults to 'int' [-Wimplicit-int]
   16 | main(){
      | ^~~~
main.c: In function 'main':
main.c:24:5: error: implicit declaration of function 'buildMaxHeap' [-Wimplicit-function-declaration]
   24 |     buildMaxHeap();
      |     ^~~~~~~~~~~~
main.c:27:16: error: expected ')' before 'A'
   27 |     printf("%d"A[i]);
      |           ~    ^
      |                )
main.c: In function 'maxHeapify':
main.c:31:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   31 | int maxHeapify(i){
      |     ^~~~~~~~~~
Language: C

include<stdio.h>
#define MAX 500000

void MaxHeapify(int[],int);
void BuildMaxHeap(int[]);

int n;

int main(){
  int i,A[MAX];
  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,Est,tmp;
  l=2*i;
  r=(2*i)+1;
  if(l<=n && A[l]>A[i]){
    Est=l;
  } else Est=i;
  if(r<=n && A[r]>A[Est]) Est=r;
  if(Est!=i){
    tmp=A[i]; 
    A[i]=A[Est];
    A[Est]=tmp;
    MaxHeapify(A,Est);
  }
}

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

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:11:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   11 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:11:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   11 |   scanf("%d",&n);
      |   ^~~~~
main.c:11:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:21: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   14 |   for(i=1;i<=n;i++) printf("%d ",A[i]);
      |                     ^~~~~~
main.c:14:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:21: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   15 |   printf("\n");
      |   ^~~~~~
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<algorithm>
using namespace std;

int heap[1], sz = 0;

void push(int x){
  
  int i = sz++;
  
  while(i > 0){
    int p = (i - 1) / 2;
    
    if(heap[p] <= x) break;
    
    heap[i] = heap[p];
    i = p;
  }
  
  heap[i] = x;
}

int pop(){
  
  int ret = heap[0];
  int x = heap[--sz];
  
  int i = 0;
  while(i * 2 + 1 < sz){
    int a = i * 2 + 1, b = i * 2 + 2;
    if(b < sz && heap[b] < heap[a]) a = b;
    
    if(heap[a] >= x) break;
    
    heap[i] = heap[a];
    i = a;
  }
  
  heap[i] = x;
  
  return ret;
}


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using namespace std;

const int N_MAX = 2000000001;
int a[N_MAX];
int n;

void maxheapfy(int ix){
  int root_key = a[ix];
  int l_key = -N_MAX;
  int r_key = -N_MAX;
  if(2*ix+1 < n) l_key = a[2*ix+1];
  if(2*ix+2 < n) r_key = a[2*ix+2];
  // r max
  if(root_key < r_key && l_key < r_key){
    // swap r and root
    swap(a[2*ix+2], a[ix]);
    maxheapfy(2*ix+2);
  }
  else if(root_key < l_key && r_key < l_key){
    // swap l and root
    swap(a[2*ix+1], a[ix]);
    maxheapfy(2*ix+1);
  }
}

int main(){
  cin >> n;
  rep(i, 0, n) cin >> a[i];
  
  //rep(i, 0, n) cout << a[i] << " ";
  //cout << endl;

  rep(ix, n/2, 0) maxheapfy(ix);
  
  rep(i, 0, n) cout << a[i] << " ";
  cout << endl;
  return 0;
}



Compiler output:
/tmp/ccJgIybG.o: in function `maxheapfy(int)':
a.cc:(.text+0x3d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x6f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
/tmp/ccJgIybG.o: in function `main':
a.cc:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x1cc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x1e5): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x1f6): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x216): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccJgIybG.o
a.cc:(.text+0x230): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using namespace std;

const int N_MAX = 2000000001;
int a[N_MAX];
int n;

void maxheapfy(int ix){
  int root_key = a[ix];
  int l_key = -N_MAX;
  int r_key = -N_MAX;
  if(2*ix+1 < n) l_key = a[2*ix+1];
  if(2*ix+2 < n) r_key = a[2*ix+2];
  // r max
  if(root_key < r_key && l_key < r_key){
    // swap r and root
    swap(a[2*ix+2], a[ix]);
    maxheapfy(2*ix+2);
  }
  else if(root_key < l_key && r_key < l_key){
    // swap l and root
    swap(a[2*ix+1], a[ix]);
    maxheapfy(2*ix+1);
  }
}

int main(){
  cin >> n;
  rep(i, 0, n) cin >> a[i];
  
  //rep(i, 0, n) cout << a[i] << " ";
  //cout << endl;

  rep(ix, n/2, 0) maxheapfy(ix);
  
  rep(i, 0, n) cout << a[i] << " ";
  cout << endl;
  return 0;
}



Compiler output:
/tmp/ccCP5zl2.o: in function `maxheapfy(int)':
a.cc:(.text+0x3d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x6f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
/tmp/ccCP5zl2.o: in function `main':
a.cc:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x1cc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x1e5): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x1f6): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x216): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCP5zl2.o
a.cc:(.text+0x230): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
using namespace std;
#define MAX 2000000

int H,A[MAX+1];

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

int main(){
  cin>>H;

  for(int i=1;i<=H;i++) cin>>A[i];
  for(int i+H/2;i>=1;i--) maxHeapify(i);

  for(int i=1;i<=H;i++){
    cout<<" "<<A[i];
  }
  cout<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: expected ';' before '+' token
   26 |   for(int i+H/2;i>=1;i--) maxHeapify(i);
      |            ^
      |            ;
a.cc:26:21: error: expected ')' before ';' token
   26 |   for(int i+H/2;i>=1;i--) maxHeapify(i);
      |      ~              ^
      |                     )
a.cc:26:22: error: 'i' was not declared in this scope
   26 |   for(int i+H/2;i>=1;i--) maxHeapify(i);
      |                      ^
Language: C++

#include <iostream>
using namespace std;
#define MAX 200000

int H, A[MAx+1];

void maxHeap(int i){
	int l,r,lagest;
	l = 2*l;
	
}


Compiler output:
a.cc:5:10: error: 'MAx' was not declared in this scope; did you mean 'MAX'?
    5 | int H, A[MAx+1];
      |          ^~~
      |          MAX
Language: C++

def maxHeapify(h, a, i)
  l = left(i)
  r = right(i)
  # 左の子、自分、右の子で値が最大のノードを選ぶ
  if l <= h && a[l] > a[i]
    largest = l
  else
    largest = i
  end

  if r <= h && a[r] > a[largest]
    largest = r
  end

  if largest != i # i の子の方が値が大きい場合
    a[i],a[largest] = a[largest],a[i]
    maxHeapify(h, a, largest) # 再帰的に呼び出し
  end
end

def buildMaxHeap(h, a)
  (h/2).downto(1){|i|
    maxHeapify(h, a, i)
  }
end

def right(i);
  (i*2)
end

def left(i)
  (i*2+1)
end

h = gets.to_i
a = [0] + gets.split.map(&:to_i)

buildMaxHeap(h, a)

puts " "+a[1..-1]*" "




Compiler output:
a.cc:4:5: error: extended character 、 is not valid in an identifier
    4 |   # 左の子、自分、右の子で値が最大のノードを選ぶ
      |     ^
a.cc:4:5: error: extended character 、 is not valid in an identifier
a.cc:4:5: error: invalid preprocessing directive #\U00005de6\U0000306e\U00005b50\U00003001\U000081ea\U00005206\U00003001\U000053f3\U0000306e\U00005b50\U00003067\U00005024\U0000304c\U00006700\U00005927\U0000306e\U000030ce\U000030fc\U000030c9\U00003092\U00009078\U00003076
    4 |   # 左の子、自分、右の子で値が最大のノードを選ぶ
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:15:19: error: stray '#' in program
   15 |   if largest != i # i の子の方が値が大きい場合
      |                   ^
a.cc:17:31: error: stray '#' in program
   17 |     maxHeapify(h, a, largest) # 再帰的に呼び出し
      |                               ^
a.cc:40:12: error: too many decimal points in number
   40 | puts " "+a[1..-1]*" "
      |            ^~~
a.cc:1:1: error: 'def' does not name a type
    1 | def maxHeapify(h, a, i)
      | ^~~
a.cc:25:1: error: 'end' does not name a type
   25 | end
      | ^~~
a.cc:28:5: error: expected ')' before '*' token
   28 |   (i*2)
      |   ~ ^
      |     )
Language: C++

#include<iostream>
using namespace std;
#define MAX 2000000

int H,a[MAX+1];

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

int main(){
  cin >> H;
  for(int i=1;i<=H;i++) cin >> A[i];

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

  for(int i=1;i<=H;i++){
    cout << " " << A[i];
  }
  cout << endl;
  return 0;
}



Compiler output:
a.cc: In function 'void maxHeapify(int)':
a.cc:12:14: error: 'A' was not declared in this scope
   12 |   if(l<=H && A[l] > A[i]) largest=l;
      |              ^
a.cc:14:14: error: 'A' was not declared in this scope
   14 |   if(r<=H && A[r] > A[largest]) largest=r;
      |              ^
a.cc:17:10: error: 'A' was not declared in this scope
   17 |     swap(A[i],A[largest]);
      |          ^
a.cc:18:23: error: expected ')' before ';' token
   18 |     maxHeapify(largest;)
      |               ~       ^
      |                       )
a.cc:18:24: error: expected primary-expression before ')' token
   18 |     maxHeapify(largest;)
      |                        ^
a.cc: In function 'int main()':
a.cc:24:32: error: 'A' was not declared in this scope
   24 |   for(int i=1;i<=H;i++) cin >> A[i];
      |                                ^
a.cc:29:20: error: 'A' was not declared in this scope
   29 |     cout << " " << A[i];
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int A[2000001],H;

maxheapify(int i){
  int l,r,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){
    swap(A[i],A[largest]);
    maxheapify(largest);
  }
}
  
int main(){
  cin>>H;
  for(int i=1;i<=H;i++) cin>>A[i];
  for(int i=H/2;i>=1;i--) maxheapify(i);
  for(int i=1;i<=H;i++){
    cout<<" "<<A[i];
  }
  cout<<endl;
  return 0;
}



Compiler output:
a.cc:6:1: error: ISO C++ forbids declaration of 'maxheapify' with no type [-fpermissive]
    6 | maxheapify(int i){
      | ^~~~~~~~~~
a.cc: In function 'int maxheapify(int)':
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

void MaxHeapify(int A[], int i, int n){
 int l = 2*i+1, r = 2*i+2;
 int largest = i;

 if(l < n && A[l] > A[i]){
  largest = l;
 }if(r < n && A[r] > A[largest]){
  largest = r;
 }if(largest != i){
  swap(A[i], A[largest]);
  MaxHeapify(A, largest, n);
 }
}

void buildMax(int A[], int n){
 for(int i =(n-2)/2; i >= 0; --i){
  MaxHeapify(A, i, n);
 }
}

void printMax(int *max, int number){
 for(int i=0; i<number; i++){
  cout << " " << max[i];
 }
 cout << endl;
}

int main(){
 int test, max[500010];

 cin >> test;

 for(int i =0; i <x; i++){
  cin >> max[i];
 }

 buildMax(max, test);
 printMax(max, test);

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:19: error: 'x' was not declared in this scope
   36 |  for(int i =0; i <x; i++){
      |                   ^
Language: C++

/*最大最小堆
https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/9/ALDS1_9_B
10
4 1 3 2 16 9 10 14 8 7
*/
#include<iostream>
using namespace std;
const int N=500001;
int a[N]; 
int h;
int left(int root){
	return root*2;
}
int right(int root){
	return root*2+1;
}
void maxHeapify(int *a,int root){
	int l=left(root);
	int r=right(root);
	int largest=root;
	if(l<=h&&a[l]>a[root])
		largest=l;
	if(r<=h&&a[r]>a[largest])
		largest=r;	
	if(largest!=root){
		swap(a[root],a[largest]);
		//printf("swap(%d,%d)\n",a[root],a[largest]) ;
		maxHeapify(a,largest);
	}	
}
void buildMaxHeap(int *a){
	for(int i=h/2;i>=1;i--)
		maxHeapify(a,i);
}
solve(){
	buildMaxHeap(a);
	for(int i=1;i<=h;i++)
		printf(" %d",a[i]);
		printf("\n");
}
int main(){
while(~scanf("%d",&h)){
	for(int i=1;i<=h;i++)
		scanf("%d",&a[i]);
	solve();	
}		
	return 0;
}



Compiler output:
a.cc:35:1: error: ISO C++ forbids declaration of 'solve' with no type [-fpermissive]
   35 | solve(){
      | ^~~~~
a.cc: In function 'int solve()':
a.cc:40:1: warning: no return statement in function returning non-void [-Wreturn-type]
   40 | }
      | ^
Language: C++

#include <bits\stdc++.h>

using namespace std;

void swap(void *a,void *b){
    void *c = a;
    a = b;
    b = c;
}

void make_heap(int *heap,int size,int idx){
    int left  = 2*idx+1;
    int right = left+1;

    int largest = idx;
    if(left < size && heap[idx] < heap[left])
        largest = left;
    if(right < size && heap[largest] < heap[right])
        largest = right;

    if(largest != idx){
        swap(heap[idx],heap[largest]);
        make_heap(heap,size,largest);
    } 
}


void build_heap(int *heap,int size){
    for(int i=size/2-1;i>-1;i--)
        make_heap(heap,size,i);
}


int main(){
    int h; cin >> h;
    int heap[h];
    for(int i=0;i<h;i++) cin >> heap[i];
    build_heap(heap,sizeof(heap)/sizeof(heap[0]));

    for(int i=0;i<h;i++) cout << heap[i] << " ";
    cout << endl;

}


Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

N=gets.to_i
a=gets.split
a.each_with_index { |e, i|
  i=i+1
  print "node #{i}: key = #{e}, "
  print "parent key = #{a[i/2-1]}, " unless i==1
  if (i=i*2) <= N
    print "left key = #{a[i-1]}, "
    print "right key = #{a[i]}, " if i+1<=N
  end
  puts
}

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=gets.to_i
      | ^
Language: C++

#include<stdio.h>

#define H 250

int A[H],size;

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

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

void maxHeapify(int B[],int i){
  int l = left(i);
  int r = right(i);
  int tmp,largest;
  if(l<=H && B[l]>B[i]) largest = l;
  else largest = i;
  if(r<=H && B[r]>B[largest]) largest = r;

  if(largest != i){
      tmp = B[i];
    B[i] = B[largest];
    B[largest] = tmp;
    maxHeapify(B, largest);
      }
}
void  buildMaxHeap(int B[]){
  for(int i=size/2;i>=1;i--){
    maxHeapify(B, i);
      }
}


int main(void){
  int i;
  scanf("%d",&size);
  
  for(i=1;i<=size;i++) scanf("%d",&A[i]);

  buildMaxHeap(A);

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

  return 0;
}

Compiler output:
a.cc:7:10: error: 'i' was not declared in this scope
    7 | int left(i){
      |          ^
a.cc:11:11: error: 'i' was not declared in this scope
   11 | int right(i){
      |           ^
a.cc: In function 'void maxHeapify(int*, int)':
a.cc:16:15: error: 'left' cannot be used as a function
   16 |   int l = left(i);
      |           ~~~~^~~
a.cc:17:16: error: 'right' cannot be used as a function
   17 |   int r = right(i);
      |           ~~~~~^~~
Language: C++

#include<iostream>
using spacename std;

#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],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=l;
}

if(largest != i){
swap(A[i],A[largest];
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

for(i=n/2;i>=1;i--){
maximumHeap(i);
}

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

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'spacename'
    2 | using spacename std;
      |       ^~~~~~~~~
a.cc: In function 'int maximumHeap(int)':
a.cc:23:21: error: expected ')' before ';' token
   23 | swap(A[i],A[largest];
      |     ~               ^
      |                     )
Language: C++

#include<iostream>

#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],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=l;
}

if(largest != i){
swap(A[i],A[largest];
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

for(i=n/2;i>=1;i--){
maximumHeap(i);
}

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

Compiler output:
a.cc: In function 'int maximumHeap(int)':
a.cc:22:21: error: expected ')' before ';' token
   22 | swap(A[i],A[largest];
      |     ~               ^
      |                     )
Language: C++

#include<iostream>

#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],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=l;
}

if(largest != i){
swap(A[i],A[largest]);
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

for(i=n/2;i>=1;i--){
maximumHeap(i);
}

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

Compiler output:
a.cc: In function 'int maximumHeap(int)':
a.cc:22:1: error: 'swap' was not declared in this scope
   22 | swap(A[i],A[largest]);
      | ^~~~
a.cc:22:1: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
Language: C++

#include<iostream>
#include<utility>
#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],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=l;
}

if(largest != i){
swap(A[i],A[largest]);
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

for(i=n/2;i>=1;i--){
maximumHeap(i);
}

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

Compiler output:
a.cc: In function 'int maximumHeap(int)':
a.cc:22:1: error: 'swap' was not declared in this scope
   22 | swap(A[i],A[largest]);
      | ^~~~
a.cc:22:1: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
Language: C++

#include<iostream>
#include<utility>
using spacename std;
#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],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=l;
}

if(largest != i){
swap(A[i],A[largest]);
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

for(i=n/2;i>=1;i--){
maximumHeap(i);
}

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

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'spacename'
    3 | using spacename std;
      |       ^~~~~~~~~
a.cc: In function 'int maximumHeap(int)':
a.cc:23:1: error: 'swap' was not declared in this scope
   23 | swap(A[i],A[largest]);
      | ^~~~
a.cc:23:1: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
Language: C++

#include<stdio.h>

#define H 250

int size;
int A[H];

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

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

void maxHeapify(int i){
  int l = left(i);
  int r = right(i);
  int tmp,largest;
  // ????????????????????????????????§???????????§????????????????????¶
  if(l<=size && A[l]>A[i]) largest = l;
  else largest = i;
  if(r<=size && A[r]>A[largest]) largest = r;

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

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


int main(void){
  int i;
  scanf("%d",&size);
  
  for(i=1;i<=size;i++) scanf("%d",&A[i]);

  buildMaxHeap();

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

  return 0;
}

Compiler output:
a.cc:8:10: error: 'i' was not declared in this scope
    8 | int left(i){
      |          ^
a.cc:12:11: error: 'i' was not declared in this scope
   12 | int right(i){
      |           ^
a.cc: In function 'void maxHeapify(int)':
a.cc:17:15: error: 'left' cannot be used as a function
   17 |   int l = left(i);
      |           ~~~~^~~
a.cc:18:16: error: 'right' cannot be used as a function
   18 |   int r = right(i);
      |           ~~~~~^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <list>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <map>

using namespace std;

int h, a[500000+1];

void maxHeapify( int i) {
	int l = 2*i, r = 2*i+1;
	int largest;
	if( l <= h && a[l] > a[i]) largest = l;
	else largest = i;
	if( r <= h && a[r] > a[]) largest = r;
	
	if( largest != i) {
		swap(a[i], a[largest]);
		maxHeapify(largest);
	}
	return;
}

int main(){
	cin >> h;
	for( int i = 1; i <= h; i++) cin >> a[i];
	for( int i = h/2; i >= 1; i--) maxHeapify(i);
	for( int i = 1; i <= h; i++) cout << " " << a[i];
	cout <<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void maxHeapify(int)':
a.cc:24:32: error: expected primary-expression before ']' token
   24 |         if( r <= h && a[r] > a[]) largest = r;
      |                                ^
Language: C++

#include<iostream>
#include <algorithm>

using namespace std;
const int MAX = 2000000;

int H,A[MAX+1];

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

    if(A[l] == max(A[i],A[l],A[r]) )largest = l;
    else if (A[r] == max(A[i],A[l],A[r]) )largest = r;
    else if (A[i] == max(A[i],A[l],A[r]) )largest = i;

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

int main(){
    cin >> H;
    for (int i = 0; i < H ; ++i) {
        cin >> A[i];
    }

    for (int i = H/2 ; i >= 1 ; i--) {
        maxHeapify(i);
    }
    for (int i = 0; i < H ; ++i) {
        cout << " " << A[i];
    }
    cout << endl;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:14:19:   required from here
   14 |     if(A[l] == max(A[i],A[l],A[r]) )largest = l;
      |                ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<iostream>
#include <algorithm>

using namespace std;
const int MAX = 2000000;

int H,A[MAX+1];

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

    if(A[l] == max(A[i],A[l],A[r]) )largest = l;
    else if (A[r] == max(A[i],A[l],A[r]) )largest = r;
    else if (A[i] == max(A[i],A[l],A[r]) )largest = i;

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

int main(){
    cin >> H;
    for (int i = 0; i < H ; ++i) {
        cin >> A[i];
    }

    for (int i = H/2 ; i >= 1 ; i--) {
        maxHeapify(i);
    }
    for (int i = 1; i <= H ; ++i) {
        cout << " " << A[i];
    }
    cout << endl;
    return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:14:19:   required from here
   14 |     if(A[l] == max(A[i],A[l],A[r]) )largest = l;
      |                ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

inline int left(int i, int H){ return (2 * i <= H ? 2 * i : -1); }
inline int right(int i, int H){ return (2 * i + 1 <= H ? 2 * i + 1 : -1); }

void max_heapify(int* A, int i, int H)
{
    int l = left(i, H), r = right(i, H);
    if(l < 0 && r < 0) return;
    int maxid = i, x;
    if(l > 0) maxid = (A[l] > A[maxid] ? l : maxid);
    if(r > 0) maxid = (A[r] > A[maxid] ? r : maxid);
    if(maxid == i) return;
    x = A[maxid]; A[maxid] = A[i]; A[i] = x;
    max_heapify(A, maxid, H);
}

void BuildMaxHeap(int* A, int H)
{
    for(int i = H / 2; i > 0; i--) max_heapify(A, i, H);
    return;
}

int main()
{
    int *A;
    int i, H;
    scanf("%d", &H);
    A = new int[H + 1];
    for(i = 1; i <= H; i++) scanf("%d", &A[i]);
    uildMaxHeap(A, H);
    for(i = 1; i <= H; i++) printf(" %d", A[i]);
    printf("\n");
    delete [] A;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'uildMaxHeap' was not declared in this scope; did you mean 'BuildMaxHeap'?
   33 |     uildMaxHeap(A, H);
      |     ^~~~~~~~~~~
      |     BuildMaxHeap
Language: C++

#include<iostream>
using namespace std;
#define MAX 2000000;

int H,A[MAX+1];

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

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

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

int main(){
  cin >> H;

  for(int i=1; i<=H;i++) cin >> A[i];
  for(int i=H/2;i>=1;i--) maxHeapify(i);

  for(int i=1;i<=H;i++){
    cout << " " << A[i];
    cout << endl;

    retur 0;
  }

Compiler output:
a.cc:3:20: error: expected ']' before ';' token
    3 | #define MAX 2000000;
      |                    ^
a.cc:5:9: note: in expansion of macro 'MAX'
    5 | int H,A[MAX+1];
      |         ^~~
a.cc:5:12: error: expected unqualified-id before '+' token
    5 | int H,A[MAX+1];
      |            ^
a.cc: In function 'void maxHeapify(int)':
a.cc:12:13: error: 'A' was not declared in this scope
   12 |  if(l<=H && A[l] > A[i] ) largest = r;
      |             ^
a.cc:14:13: error: 'A' was not declared in this scope
   14 |  if(r<=H && A[r] > A[largest]) largest = r;
      |             ^
a.cc:17:9: error: 'A' was not declared in this scope
   17 |    swap(A[i],A[largest]);
      |         ^
a.cc: In function 'int main()':
a.cc:25:33: error: 'A' was not declared in this scope
   25 |   for(int i=1; i<=H;i++) cin >> A[i];
      |                                 ^
a.cc:29:20: error: 'A' was not declared in this scope
   29 |     cout << " " << A[i];
      |                    ^
a.cc:32:5: error: 'retur' was not declared in this scope
   32 |     retur 0;
      |     ^~~~~
a.cc:33:4: error: expected '}' at end of input
   33 |   }
      |    ^
a.cc:22:11: note: to match this '{'
   22 | int main(){
      |           ^