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

#include<stdio.h>
#define MAX 500001
#define SENTINEL 2000000

 int count=0;

 int merge(int S[MAX],int left,int right,int mid){
         int n1,n2,i,L[MAX],R[MAX],j,k;
         n1=mid-left;
         n2=right-mid;
         for(i=0;i<n1;i++){L[i]=S[left+i];}
         for(i=0;i<n1;i++){R[i]=S[mid+i];}
         L[n1]=R[n2]=SENTINEL;
         i=0;
         j=0;
         for(k=left;k<right;k++){
                        count++;
                        if(L[i]<=R[j]){S[k]=L[i];
                                      i++;
                                      }
                        else {S[k]=R[i];
                              j++;
                              }
                        }
          }
                                   
                    

 int mergesort(int S[MAX],int left,int right){
        while(right-left>1){
             int mid=(left+right)/2
             mergesort(S,left,mid);
             mergesort(S,mid,right);
             merge(S,left,right,mid);
             }
        }

 int main(){
        int i,n,left,right;
        scanf("%d",&n);
        for(i=0;i<n;i++){
                   scanf("%d",&S[i]);
                   }
        
        mergesort(S,0,n);
        for(i=0;i<n;i++){
                   printf("%d%c",S[i],(i==n-1)?"\n":" ");
                   }
        printf("%d",count);
        return 0;
        }




Compiler output:
main.c: In function 'mergesort':
main.c:32:14: error: expected ',' or ';' before 'mergesort'
   32 |              mergesort(S,left,mid);
      |              ^~~~~~~~~
main.c: In function 'main':
main.c:42:32: error: 'S' undeclared (first use in this function)
   42 |                    scanf("%d",&S[i]);
      |                                ^
main.c:42:32: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define MAX 500001
#define SENTINEL 2000000000

 int count;

 int merge(int S[],int left,int right,int mid){
         int n1,n2,i,L[MAX/2],R[MAX/2],j,k;
         n1=mid-left;
         n2=right-mid;
         for(i=0;i<n1;i++){L[i]=S[left+i];}
         for(i=0;i<n2;i++){R[i]=S[mid+i];}
         L[n1]=R[n2]=SENTINEL;
         i=0;
         j=0;
         for(k=left;k<right;k++){
                        count++;
                        if(L[i]<=R[j]){S[k]=L[i];
                                      i++;
                                      }
                        else {S[k]=R[j];
                              j++;
                              }
                        }
          }
                                   
                    

 int mergesort(int S[],int left,int right){
        if(right-left>1){
             int mid=(left+right)/2;
             mergesort(S,left,mid);
             mergesort(S,mid,right);
             merge(S,left,right,mid);
             }
        }

 int main(){
        int i,n;
        cnt=0;
        int S[MAX];
        scanf("%d",&n);
        for(i=0;i<n;i++){
                   scanf("%d",&S[i]);
                   }
        
        mergesort(S,0,n);
        for(i=0;i<n;i++){
                   printf("%d%c",S[i],(i==n-1)?"\n":" ");
                   }
        printf("%d\n",count);
        return 0;
        }




Compiler output:
main.c: In function 'main':
main.c:40:9: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   40 |         cnt=0;
      |         ^~~
      |         int
main.c:40:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define INFTY 2000000000000
void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int cnt;
int A[100000],n;
int main()
{
  int i,cnt=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,n,0,n);
  printf("%d\n",cnt);
  return 0;
}
  
void merge(int *A, int left, int mid,int right){
  int i,j,k,n1,n2,L[10000],R[10000];
  
  n1 = mid - left;
  n2 = right - mid;
  //L[0...n1], R[0...n2] を生成
  for(i=0;i>n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i>n2;i++){
    R[i] = A[mid + i];
  }
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k>right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }
    else{
      A[k]=R[j];
      j=j+1;
    }
  }
}

void mergeSort(int *A, int left, int right){
  int mid,i;
  if(left+1<right){
    mid=(left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
    cnt++;
  }
   for(i=0;i<n;i++){
    printf("%d",A[i]);
  }
}



Compiler output:
main.c: In function 'main':
main.c:15:3: error: too many arguments to function 'mergeSort'
   15 |   mergeSort(A,n,0,n);
      |   ^~~~~~~~~
main.c:4:6: note: declared here
    4 | void mergeSort(int *,int,int);
      |      ^~~~~~~~~
main.c: In function 'merge':
main.c:2:15: warning: overflow in conversion from 'long int' to 'int' changes value from '2000000000000' to '-1454759936' [-Woverflow]
    2 | #define INFTY 2000000000000
      |               ^~~~~~~~~~~~~
main.c:32:9: note: in expansion of macro 'INFTY'
   32 |   L[n1]=INFTY;
      |         ^~~~~
main.c:2:15: warning: overflow in conversion from 'long int' to 'int' changes value from '2000000000000' to '-1454759936' [-Woverflow]
    2 | #define INFTY 2000000000000
      |               ^~~~~~~~~~~~~
main.c:33:9: note: in expansion of macro 'INFTY'
   33 |   R[n2]=INFTY;
      |         ^~~~~
Language: C

#include<stdio.h>
#define INFTY 2000000000
void merge(int *,int,int,int);
void Sort(int *,int,int);
int cnt;
int A[100000],n;
int main()
{
  int i,cnt=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  Sort(A,n,0,n);
  printf("%d\n",cnt);
  return 0;
}
  
void merge(int *A, int left, int mid,int right){
  int i,j,k,n1,n2,l[10000],r[10000];
  
  n1 = mid - left;
  n2 = right - mid;
  //L[0...n1], R[0...n2] を生成
  for(i=0;i>n1;i++){
    l[i] = A[left + i];
  }
  for(i=0;i>n2;i++){
    r[i] = A[mid + i];
  }
  l[n1]=INFTY;
  r[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k>right;k++){
    if(l[i]<=r[j]){
      A[k]=l[i];
      i=i+1;
    }
    else{
      A[k]=r[j];
      j=j+1;
    }
  }
}

void Sort(int *A, int left, int right){
  int mid,i;
  if(left+1<right){
    mid=(left + right)/2;
    Sort(A, left, mid);
    Sort(A, mid, right);
    merge(A, left, mid, right);
    cnt++;
  }
   for(i=0;i<n;i++){
    printf("%d",A[i]);
  }
}



Compiler output:
main.c: In function 'main':
main.c:15:3: error: too many arguments to function 'Sort'
   15 |   Sort(A,n,0,n);
      |   ^~~~
main.c:4:6: note: declared here
    4 | void Sort(int *,int,int);
      |      ^~~~
Language: C

#include <stdio.h>
#define MAX 500000
#define INF 100000000
void marge(int *, int, int, int);
void margesort(int *, int, int);

int L[MAX/2+2], R[MAX/2+2];
int count;


int main(){
  int A[MAX], n, i;
  count = 0;

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

  margesort(A,0,n);



  for(i=0;i<n;i++){
    if(i>0) printf(" %d");
    else printf("%d");
  }
  printf("\n");

  return 0;
}

void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  /*  L[0...n1], R[0...n2] を生成 */
  for (i=0;i<n1-1;i++) L[i] = A[left + i];
  for (i=0;i<n2-1;i++) R[i] = A[mid + i];

  L[n1] = INF;
  R[n2] = INF;

  i = 0;
  j = 0;

  for (k=left;k<right-1;k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    } else {
      A[k] = R[j];
      j = j + 1;
    }
  }
}


void mergeSort(int *A, int left,int right){
  if (left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
  }



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

#include <stdio.h>
#define MAX 500000
#define INF 100000000
void marge(int *, int, int, int);
void margesort(int *, int, int);

int L[MAX/2+2], R[MAX/2+2];
int count;


int main(){
  int A[MAX], n, i;
  count = 0;

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

  margesort(A,0,n);



  for(i=0;i<n;i++){
    if(i>0) printf(" %d");
    else printf("%d");
  }
  printf("\n");

  return 0;
}

void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  /*  L[0...n1], R[0...n2] を生成 */
  for (i=0;i<n1-1;i++) L[i] = A[left + i];
  for (i=0;i<n2-1;i++) R[i] = A[mid + i];

  L[n1] = INF;
  R[n2] = INF;

  i = 0;
  j = 0;

  for (k=left;k<right-1;k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    } else {
      A[k] = R[j];
      j = j + 1;
    }
  }
}


void mergeSort(int *A, int left,int right){
  if (left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
  }



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

#include <stdio.h>
#define MAX 500000
#define INF 100000000
void marge(int *, int, int, int);
void margesort(int *, int, int);

int L[MAX/2+2], R[MAX/2+2];
int count;


int main(){
  int A[MAX], n, i;
  count = 0;

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

  margesort(A,0,n);



  for(i=0;i<n;i++){
    if(i>0) printf(" %d");
    else printf("%d");
  }
  printf("\n");

  return 0;
}

void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;
  /*  L[0...n1], R[0...n2] を生成 */
  for (i=0;i<n1-1;i++) L[i] = A[left + i];
  for (i=0;i<n2-1;i++) R[i] = A[mid + i];

  L[n1] = INF;
  R[n2] = INF;

  i = 0;
  j = 0;

  for (k=left;k<right-1;k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    } else {
      A[k] = R[j];
      j = j + 1;
    }
  }
}


void mergesort(int *A, int left,int right){
  if (left+1 < right){
    int mid = (left + right)/2;
    mergesort(A, left, mid);
    mergesort(A, mid, right);
    merge(A, left, mid, right);
  }
  }



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

#include <stdio.h>

int S[500000];

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

  for(i=0;i<n;i++){
    printf("%d",S[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n%d\n",);

  return 0;
  
}



void merge(A, left, mid, right)
{
  n1 = mid - left;
  n2 = right - mid;
  
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  
  for(i = 0;i<n2;i++){
    R[i] = A[mid + i];
  }
  
  L[n1] = INFTY;
  R[n2] = INFTY;
  
  i = 0;
  j = 0;
  
  for(k = left;k<right;k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else{ 
      A[k] = R[j];
      j = j + 1;
    }
  }
}

void mergeSort(A, left, right)
{

  int mid=(left+right)/2;
  
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }

}



Compiler output:
main.c: In function 'main':
main.c:7:15: error: 'n' undeclared (first use in this function)
    7 |   scanf("%d",&n);
      |               ^
main.c:7:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:7: error: 'i' undeclared (first use in this function)
    9 |   for(i=0;i<n;i++){
      |       ^
main.c:17:19: error: expected expression before ')' token
   17 |   printf("\n%d\n",);
      |                   ^
main.c: In function 'merge':
main.c:25:6: error: type of 'A' defaults to 'int' [-Wimplicit-int]
   25 | void merge(A, left, mid, right)
      |      ^~~~~
main.c:25:6: error: type of 'left' defaults to 'int' [-Wimplicit-int]
main.c:25:6: error: type of 'mid' defaults to 'int' [-Wimplicit-int]
main.c:25:6: error: type of 'right' defaults to 'int' [-Wimplicit-int]
main.c:27:3: error: 'n1' undeclared (first use in this function)
   27 |   n1 = mid - left;
      |   ^~
main.c:28:3: error: 'n2' undeclared (first use in this function)
   28 |   n2 = right - mid;
      |   ^~
main.c:30:7: error: 'i' undeclared (first use in this function)
   30 |   for(i=0;i<n1;i++){
      |       ^
main.c:31:5: error: 'L' undeclared (first use in this function)
   31 |     L[i] = A[left + i];
      |     ^
main.c:35:5: error: 'R' undeclared (first use in this function)
   35 |     R[i] = A[mid + i];
      |     ^
main.c:38:11: error: 'INFTY' undeclared (first use in this function)
   38 |   L[n1] = INFTY;
      |           ^~~~~
main.c:42:3: error: 'j' undeclared (first use in this function)
   42 |   j = 0;
      |   ^
main.c:44:7: error: 'k' undeclared (first use in this function)
   44 |   for(k = left;k<right;k++){
      |       ^
main.c: In function 'mergeSort':
main.c:56:6: error: type of 'A' defaults to 'int' [-Wimplicit-int]
   56 | void mergeSort(A, left, right)
      |      ^~~~~~~~~
main.c:56:6: error: type of 'left' defaults to 'int' [-Wimplicit-int]
main.c:56:6: error: type of 'right' defaults to 'int' [-Wimplicit-int]
Language: C

#include <stdio.h>

#define INFTY 100000000

int S[500000],times=0;

void merge(int *A,int left,int mid,int right);
void mergeSort(int *A,int left,int right);

int main (){

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

  int S[n];
  
  for(i=0;i<n;i++){
    scanf("%d",S[i]);
  }

  merge_sort(&S[0],0,n-1);

  for(i=0;i<n;i++){
    printf("%d",S[i]);
    if(i!=n-1)printf(" ");
  }
  
  printf("\n%d\n",times);
  
  return 0;
  
}



void merge(int *A,int left,int mid,int right)
{

  int n1,n2,L[500000],R[500000],k,i,j;
  
  times++;
  
  n1 = mid - left;
  n2 = right - mid;
  
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  
  for(i = 0;i<n2;i++){
    R[i] = A[mid + i];
  }
  
  L[n1] = INFTY;
  R[n2] = INFTY;
  
  i = 0;
  j = 0;
  
  for(k = left;k<right;k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else{ 
      A[k] = R[j];
      j = j + 1;
    }
  }
}

void mergeSort(int *A,int left,int right)
{
  
  int mid=(left+right)/2;
  
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }

}



Compiler output:
main.c: In function 'main':
main.c:22:3: error: implicit declaration of function 'merge_sort'; did you mean 'mergeSort'? [-Wimplicit-function-declaration]
   22 |   merge_sort(&S[0],0,n-1);
      |   ^~~~~~~~~~
      |   mergeSort
Language: C

#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

int L[(MAX/2)+2];
int R[(MAX/2)+2];
int count;

void merge(int *, int, int, int, int);
void mergeSort(int *, int, int, int);

int main(){
  int A[MAX];
  int n, i;
  
  count = 0;

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

  mergeSort(A, n, 0, n);

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

  printf("\n");
  printf("%d\n",count);
  
  return 0;
}

void merge(int A[],int n,int left,int mid,int right){
  int n1, n2,i,j,k;
  
  n1 = mid - left;
  n2 = right - mid;
  
  for(i=0;i<n1;i++){
    L[i] = A[left + 1];
  }

  for(i=0;i<n2;i++){
    R[i] = A[mid + 1];
  }

  L[n1] =  R[n2] = SENTINEL;
  
  int i = 0;
  int j = 0;

  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
  }  
 }
}

void mergeSort(int A[],int n, int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }  
}



Compiler output:
main.c: In function 'merge':
main.c:52:7: error: redeclaration of 'i' with no linkage
   52 |   int i = 0;
      |       ^
main.c:37:14: note: previous declaration of 'i' with type 'int'
   37 |   int n1, n2,i,j,k;
      |              ^
main.c:53:7: error: redeclaration of 'j' with no linkage
   53 |   int j = 0;
      |       ^
main.c:37:16: note: previous declaration of 'j' with type 'int'
   37 |   int n1, n2,i,j,k;
      |                ^
Language: C

#include<stdio.h>
#define INFTY 500000
int R[10000],L[10000],C=0;
void merge(int *,int, int,int );
void mergeSort(int *,int,int);

int main()
{
  int S[10000],i,n,left,right;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      if(n<=500000)
        {
          scanf("%d",&S[i]);
        }
    }
  left=0;
  right=n;

  mergeSort(S,left,right);

  for(i=0;i<n;i++)
    {
       printf("%d",S[i]);
      if(i<n-1)
        {
          printf(" ");
        }
      if(i==n-1)
        {
          printf("\n");
        }
    }
  printf("%d\n",C);

  return 0;
}
void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k,l=0,r=0;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<=n1-1;i++)
    {
      L[i]=A[left+i];
      l++;
    }

  for(i=0;i<=n2-1;i++)
    {
      R[i]=A[mid+i];
 r++;
    }
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++)
    {
      C++;
      if(L[i]<=R[j])
        {
          if(l>0)
            {
              A[k]=L[i];
              i=i+1;
              l--;
            }
          else
            {
            A[k]=R[j];
            j=j+1;
            r--;
        }
        }
      else
            {
              A[k]=L[i];
          i=i+1;
          l--;
            }
        }
    }
}

void mergeSort(int A[],int left,int right)
{
  int mid;
  if(left+1<right)
    {
      mid=(left+right)/2;
      mergeSort(A,left,mid);
      mergeSort(A,mid,right);
      merge(A,left,mid,right);
    }
}




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

#include<stdio.h>
#define MAX 100001

int partition(int A[],int p,int r){
  int x,i,j,temp;
  i=p-1;
  for(j=p ;){
    if(){

    }

  }
  
}


int main(){
  int i,j,k,n;
  int A[MAX];

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




  
  return 0;
}



Compiler output:
main.c: In function 'partition':
main.c:7:12: error: expected expression before ')' token
    7 |   for(j=p ;){
      |            ^
main.c:8:8: error: expected expression before ')' token
    8 |     if(){
      |        ^
Language: C

#include<stdio.h>
#include<math.h>
#define MAX 500000

void merge(int, int, int);
void mergeSort(int ,int); 
int count;
int S[MAX];
int main(){
  int i,j;
  int ;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  mergeSort(0,n);

  for(j=0;j<n;j++){
     printf("%d",S[j]);
     if(j!=n-1)printf(" ");
  }
  printf("\n");
   
  printf("%d\n",count);
  return 0;
  
}  

void merge(int left,int mid,int right){
  int n1,n2,i,j,k;
  int L[MAX],R[MAX];
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<=n1-1;i++){
    L[i]=S[left+i];
  }

  for(i=0;i<=n2-1;i++){
    R[i]=S[mid+i];
  }
  
  L[n1]=MAX;
  R[n2]=MAX;
  i=0;
  j=0;

  for(k=left;k<=right-1;k++){
    if(L[i]<=R[j]){
      S[k]=L[i];
      i=i+1;
    count++;  
    }else{
      S[k]=R[j];
      j=j+1;
      count++;
    }
  }
}

void mergeSort(int left,int right){
  int mid;  
  if(left+1<right){
    mid = (left+right)/2;
    mergeSort(left,mid);
    mergeSort(mid,right);
    merge(left,mid,right);
  }
}

  



Compiler output:
main.c: In function 'main':
main.c:11:3: warning: useless type name in empty declaration
   11 |   int ;
      |   ^~~
main.c:12:15: error: 'n' undeclared (first use in this function)
   12 |   scanf("%d",&n);
      |               ^
main.c:12:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define N 500000
#define INFTY 1000000000

void mergeSort(int,int,int);
void merge(int,int,int,int);
int left, right,count;
int R[N/2],L[N/2];

int main(){
  int n,i,j,S[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",S[i]);
  }
  left = 0;
  right = n;
  mergeSort(S,left,right);
  for(i=0;i<n;i++){
    printf("%d ",S[i]);
  }

  printf("%d",count);
    return 0;
  }

void merge(int S[],int left,int mid,int right){
  int n1,n2,i,j,k,L[N],R[N];
  n1 = mid - left;
  n2 = right - mid;
for(i=0;i<n1;i++){
  L[i] = S[left+i];
 }
for(j=0;j<n2;j++){
  R[j] = S[mid+j];
 }

L[n1] = INFTY;
R[n2] = INFTY;
i = 0;
j = 0;

for (k=left;k<right-1;k++){
  count++;
  if (L[i] <= R[j]){
      S[k] = L[i];
      i = i + 1;
    }
    else{
      S[k] = R[j];
      j = j + 1;
    }
 }

}
void mergeSort(int S[], int left,int right){
  int mid;
  if (left+1 < right){
          mid = (left + right)/2;
          mergeSort(S, left, mid);
          mergeSort(S, mid, right);
          merge(S, left, mid, right);

        }
}



Compiler output:
main.c: In function 'main':
main.c:18:13: error: passing argument 1 of 'mergeSort' makes integer from pointer without a cast [-Wint-conversion]
   18 |   mergeSort(S,left,right);
      |             ^
      |             |
      |             int *
main.c:5:16: note: expected 'int' but argument is of type 'int *'
    5 | void mergeSort(int,int,int);
      |                ^~~
main.c: At top level:
main.c:27:6: error: conflicting types for 'merge'; have 'void(int *, int,  int,  int)'
   27 | void merge(int S[],int left,int mid,int right){
      |      ^~~~~
main.c:6:6: note: previous declaration of 'merge' with type 'void(int,  int,  int,  int)'
    6 | void merge(int,int,int,int);
      |      ^~~~~
main.c:56:6: error: conflicting types for 'mergeSort'; have 'void(int *, int,  int)'
   56 | void mergeSort(int S[], int left,int right){
      |      ^~~~~~~~~
main.c:5:6: note: previous declaration of 'mergeSort' with type 'void(int,  int,  int)'
    5 | void mergeSort(int,int,int);
      |      ^~~~~~~~~
Language: C

include <stdio.h>
#define N 500000
#define INFTY 1000000000

int count=0,left,right;

void merge(int S[],int left,int mid,int right){
int n1,n2,i,j,k,L[N],R[N];
n1 = mid - left;
n2 = right - mid;
for(i=0;i<n1;i++){
  L[i] = S[left+i];
 }
for(j=0;j<n2;j++){
  R[j] = S[mid+j];
 }

L[n1] = INFTY;
R[n2] = INFTY;
i = 0;
j = 0;

for (k=left;k<right-1;k++){
  count++;
  if (L[i] <= R[j]){
    S[k] = L[i];
    i = i + 1;
  }
  else{
    S[k] = R[j];
    j = j+1;
  }
 }
}

void mergeSort(int S[],int left,int right){
  if(left+1<right){
    int mid = (left + right)/2;
    mergeSort(S,left,mid);
    mergeSort(S,mid,right);
    merge(S,left,mid,right);
  }
}


int main(){
  int n,i,j,S[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",S[i]);
  }
  left = 0;
  right = n;
  mergeSort(S,left,right);
  for(i=0;i<n;i++){
    printf("%d ",S[i]);
  }

  printf("%d",count);
    return 0;
  }




Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'merge':
main.c:24:3: error: 'count' undeclared (first use in this function)
   24 |   count++;
      |   ^~~~~
main.c:24:3: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:48:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   48 |   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:48:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   48 |   scanf("%d",&n);
      |   ^~~~~
main.c:48:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:52:3: error: 'left' undeclared (first use in this function)
   52 |   left = 0;
      |   ^~~~
main.c:53:3: error: 'right' undeclared (first use in this function)
   53 |   right = n;
      |   ^~~~~
main.c:56:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   56 |     printf("%d ",S[i]);
      |     ^~~~~~
main.c:56:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:56:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:56:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:59:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   59 |   printf("%d",count);
      |   ^~~~~~
main.c:59:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:59:15: error: 'count' undeclared (first use in this function)
   59 |   printf("%d",count);
      |               ^~~~~
Language: C

#include<stdio.h>
#define INFTY 1000000000

int count = 0;

void merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  n1=mid-left;
  n2=right-mid;
  int L[n1],R[n2];
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      count++;
      A[k]=L[i];
      i=i+1;
    }
    else {
      count++;
      A[k]=R[j];
      j=j+1;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


int main(){
  int n,i;
  int A[500000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    if(i!=n-1)printf("%d ",A[i]);
    else printf("%d",A[i]);
  }
  printf("\n%d\n",cnt);
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:53:19: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   53 |   printf("\n%d\n",cnt);
      |                   ^~~
      |                   int
main.c:53:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define MAX 500000
#define INFTY 1000000001

void merge(int [],int,int,int);
void mergeSort(int [] ,int ,int);

int counter=0,n;

int main(){
  int A[MAX],  j;

  scanf("%d",&n);
  for(j=0;j<n;j++){
    scanf("%d",&A[j]);
  }

  mergeSort(A,0,n);
  for(j=0;j<n;j++){
    printf("%d",A[j]);
    if(j<n-1) printf(" ");
     }
  printf("\n%d\n",counter);

  return 0;
}

void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k,*L,*R;

  n1 = mid - left;
  n2 = right - mid;
L=malloc((n+1)*sizepf(int)):
R=malloc((n+1)*sizepf(int)):
  for(i=0;i<=n1-1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<=n2-1;i++){
    R[i] = A[mid  + i];
  }

  L[n1]=INFTY;
  R[n2] = INFTY;

  i=j=0;
  for(k=left;k<right-1;k++){

    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      counter++;
    }
    else{
      A[k] = R[j];
        j = j + 1;
        counter++;
    }
  }

}

void mergeSort(int A[],int left, int right){
  if(left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}


Compiler output:
main.c: In function 'merge':
main.c:35:3: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   35 | L=malloc((n+1)*sizepf(int)):
      |   ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:35:3: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   35 | L=malloc((n+1)*sizepf(int)):
      |   ^~~~~~
main.c:35:3: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:35:16: error: implicit declaration of function 'sizepf' [-Wimplicit-function-declaration]
   35 | L=malloc((n+1)*sizepf(int)):
      |                ^~~~~~
main.c:35:23: error: expected expression before 'int'
   35 | L=malloc((n+1)*sizepf(int)):
      |                       ^~~
main.c:35:28: error: expected ';' before ':' token
   35 | L=malloc((n+1)*sizepf(int)):
      |                            ^
      |                            ;
Language: C

#include <stdio.h>

#define MAX 500000
#define INFTY 1000000001

void merge(int [],int,int,int);
void mergeSort(int [] ,int ,int);

int counter=0,n;

int main(){
  int A[MAX],  j;

  scanf("%d",&n);
  for(j=0;j<n;j++){
    scanf("%d",&A[j]);
  }

  mergeSort(A,0,n);
  for(j=0;j<n;j++){
    printf("%d",A[j]);
    if(j<n-1) printf(" ");
     }
  printf("\n%d\n",counter);

  return 0;
}

void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k,*L,*R;

  n1 = mid - left;
  n2 = right - mid;
L=malloc((n+1)*sizepf(int));
R=malloc((n+1)*sizepf(int));
  for(i=0;i<=n1-1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<=n2-1;i++){
    R[i] = A[mid  + i];
  }

  L[n1]=INFTY;
  R[n2] = INFTY;

  i=j=0;
  for(k=left;k<right-1;k++){

    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      counter++;
    }
    else{
      A[k] = R[j];
        j = j + 1;
        counter++;
    }
  }

}

void mergeSort(int A[],int left, int right){
  if(left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}


Compiler output:
main.c: In function 'merge':
main.c:35:3: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   35 | L=malloc((n+1)*sizepf(int));
      |   ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:35:3: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   35 | L=malloc((n+1)*sizepf(int));
      |   ^~~~~~
main.c:35:3: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:35:16: error: implicit declaration of function 'sizepf' [-Wimplicit-function-declaration]
   35 | L=malloc((n+1)*sizepf(int));
      |                ^~~~~~
main.c:35:23: error: expected expression before 'int'
   35 | L=malloc((n+1)*sizepf(int));
      |                       ^~~
main.c:36:23: error: expected expression before 'int'
   36 | R=malloc((n+1)*sizepf(int));
      |                       ^~~
Language: C

#include <stdio.h>
#define INFTY 10000000

void merge(int *,int,int,int);
void mergeSort(int *,int,int);
  
int L[5000000],R[5000000],count=0;

int main() {

  int n,i,S[5000000];
  
  scanf("%d",&n);
  for(i = 0; i < n; i++) {
    scanf("%d",&S[i]);
  }

  mergeSort(0,n);
  
  for(i = 0; i < n; i++) {
    if(i) printf(" ");
    printf("%d",S[i]);
  }
  printf("\n%d\n",count);
  return 0;
}


void mergeSort(int S[],int left,int right)
{
  int mid;
  if(left + 1 < right) {
    mid = (left + right)/2;
    mergeSort(S,left,mid);
    mergeSort(S,mid,right);
    merge(S,left,mid,right);
  } 
}

void merge(int S[],int left,int mid,int right)
{
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;

  for(i = 0; i < n1; i++) {
    L[i] = S[left + i];
  }
  for(i = 0; i < n2; i++) {
    R[i] = S[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  
  for(k = left; k < right; k++) {
    count++;
    if(L[i] <= R[j]) {
      S[k] = L[i];
      i = i + 1;
    }
    else {
      S[k] = R[j];
      j = j + 1;
    }
}
}



Compiler output:
main.c: In function 'main':
main.c:18:3: error: too few arguments to function 'mergeSort'
   18 |   mergeSort(0,n);
      |   ^~~~~~~~~
main.c:5:6: note: declared here
    5 | void mergeSort(int *,int,int);
      |      ^~~~~~~~~
Language: C

include <stdio.h>
#include <math.h>
//#define INFINITY HUGE_VALF                                                    
//#define HUGE_VALF __builtin_huge_valf()                                       
#define INFTY 2000000000
#define N 500000
int count,L[N/2+2],R[N/2+2];
//float inf = INFINITY;                                                         
void merge(int*,int,int,int);
void mergeSort(int*,int,int);

int main(){
  int n,A[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  } 
  L[n1] = R[n2] = INFTY;
  //inf;                                                                        
  i = j = 0;
  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1 < right){
      mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | //#define INFINITY HUGE_VALF
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("\n%d\n",count);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 20000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++) L[i] = A[left+i];
    for(int i = 0; i < n2; i++) R[i] = A[mid+i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for(int k = left; k < right; k++){
        cnt++;
        if(L[i] <= R[j]){
            A[k] = L[i++];
        } else {
        A[k] = R[j++];    
        
        }
    }
}

void mergeSort(int A[], int n, int left, int right){
    if(left+1 < right){
        int mid = (left + right)/2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main(){
    int A[MAX], n, i;
    cnt = 0;
    cin >> n;
    for(i = 0; i<n; i++) cin >> A[i]
    mergeSort(A, n, 0, n);
    for(i = 0; i<n; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

include <stdio.h>
#include <math.h>
//#define INFINITY HUGE_VALF                                                    
//#define HUGE_VALF __builtin_huge_valf()                                       
#define INFTY 2000000000
#define N 500000
int count,L[N/2+2],R[N/2+2];
//float inf = INFINITY;                                                         
void merge(int*,int,int,int);
void mergeSort(int*,int,int);

int main(){
  int n,A[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1] = R[n2] = INFTY;
  //inf;                                                                        
  i = j = 0;
  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);  
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | //#define INFINITY HUGE_VALF
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("\n%d\n",count);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#include <math.h>
//#define INFINITY HUGE_VALF                                                    
//#define HUGE_VALF __builtin_huge_valf()                                       
#define INFTY 2000000000
#define N 500000
int count,L[N/2+2],R[N/2+2];
//float inf = INFINITY;                                                         
void merge(int*,int,int,int);
void mergeSort(int*,int,int);

int main(){
  int n,A[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1] = R[n2] =  2000000000 ;
  //inf;                                                                        
  i = j = 0;
  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);  
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | //#define INFINITY HUGE_VALF
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("\n%d\n",count);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#include <math.h>
//#define INFINITY HUGE_VALF                                                    
//#define HUGE_VALF __builtin_huge_valf()                                       
#define INFTY 2000000000
#define N 500000
int count,L[N/2+2],R[N/2+2];
//float inf = INFINITY;                                                         
void merge(int* ,int ,int ,int );
void mergeSort(int* ,int ,int );

int main(){
  int n,A[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1] = R[n2] =  2000000000 ;
  //inf;                                                                        
  i = j = 0;
  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);  
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | //#define INFINITY HUGE_VALF
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("\n%d\n",count);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#include <math.h>
//#define INFINITY HUGE_VALF                                                    
//#define HUGE_VALF __builtin_huge_valf()                                       
//#define INFTY 2000000000
#define N 500000
int count,L[N/2+2],R[N/2+2];
//float inf = INFINITY;                                                         
void merge(int* ,int ,int ,int );
void mergeSort(int* ,int ,int );

int main(){
  int n,A[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1] = R[n2] =  2000000000 ;
  //inf;                                                                        
  i = j = 0;
  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);  
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | //#define INFINITY HUGE_VALF
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("\n%d\n",count);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#include <math.h>
//#define INFINITY HUGE_VALF                                                    
//#define HUGE_VALF __builtin_huge_valf()                                       
//#define INFTY 2000000000
#define N 500000
int count,L[N/2+2],R[N/2+2];
//float inf = INFINITY;                                                         
void merge(int * ,int ,int ,int );
void mergeSort(int * ,int ,int );

int main(){
  int n,A[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1] = R[n2] =  2000000000 ;
  //inf;                                                                        
  i = j = 0;
  for(k=left;k<right;k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
}
void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);  
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:14:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | //#define INFINITY HUGE_VALF
main.c:14:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   14 |   scanf("%d",&n);
      |   ^~~~~
main.c:14:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("\n%d\n",count);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'