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

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

void merge_sort(int[], int, int);
void merge(int[], int, int, int);
int count = 0;

int main(){

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

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

    return 0;
}

void merge_sort(int s[], int left, int right){
    if(left + 1 < right) {      // ２つかどうか判定
        int mid = (left + right) / 2;
        merge_sort(s, left, mid);
        merge_sort(s, mid, right);
        merge(s, left, mid, right);
    }
}

void merge(int s[], int left, int mid, int right){
    int i;
    int n1 = mid - left + 1;
    int n2 = right - mid + 1;
    int L[n1], R[n2];
    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 - 1] = SENTINEL;
    R[n2 - 1] = SENTINEL;

    int i = 0;
    int j = 0;

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

Compiler output:
main.c: In function 'merge':
main.c:52:9: error: redeclaration of 'i' with no linkage
   52 |     int i = 0;
      |         ^
main.c:37:9: note: previous declaration of 'i' with type 'int'
   37 |     int i;
      |         ^
main.c:55:9: error: 'k' undeclared (first use in this function)
   55 |     for(k = left; k < right; k++){
      |         ^
main.c:55:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

void merge_sort(int[], int, int);
void merge(int[], int, int, int);
int count = 0;

int main(){

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

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

    return 0;
}

void merge_sort(int s[], int left, int right){
    if(left + 1 < right) {      // ２つかどうか判定
        int mid = (left + right) / 2;
        merge_sort(s, left, mid);
        merge_sort(s, mid, right);
        merge(s, left, mid, right);
    }
}

void merge(int s[], int left, int mid, int right){
    int i, k;
    int n1 = mid - left + 1;
    int n2 = right - mid + 1;
    int L[n1], R[n2];
    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 - 1] = SENTINEL;
    R[n2 - 1] = SENTINEL;

    int i = 0;
    int j = 0;

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

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

#include <stdio.h>
#define N 1000000
 
int A[N];
int c=0;


void Merge(int [],int,int,int);

void Merge_Sort(int [],int,int);


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

    Merge_Sort(A,0,n);

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


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



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

Compiler output:
main.c: In function 'Merge':
main.c:57:9: error: 'count' undeclared (first use in this function)
   57 |         count++;
      |         ^~~~~
main.c:57:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define MAX 1000000000;
int A[500000];
int Lef[500000],Rig[500000];
int count=0;

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

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);
    }
		}
		
void merge(int left,int mid,int right){
  int a,b,i,j,k;	
  a=mid-left;	
 b=mid;
   
  for(i=0;i<n1;i++)
    {
      Lef[i]=A[left+i];
    }
  for(i=0;i<n2;i++)
    {
      Rig[i]=A[mid+i];
    }
  Lef[n1]=MAX;
  Rig[n2]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(Lef[i]<=Rig[j])
    {
      A[i];
      i++;
    }
      else
    {
    	  A[k]=Rig[j];
      j++;
    }	
   }	
}	
 	
	

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:15:3: error: implicit declaration of function 'mergesort' [-Wimplicit-function-declaration]
   15 |   mergesort(0,n);
      |   ^~~~~~~~~
main.c:26:10: warning: missing terminating " character
   26 |   printf("%d
      |          ^
main.c:26:10: error: missing terminating " character
   26 |   printf("%d
      |          ^~~
main.c:28:1: error: expected expression before 'void'
   28 | void mergesort(int left,int right){
      | ^~~~
main.c:70:1: error: expected declaration or statement at end of input
   70 | }
      | ^
Language: C

#include <stdio.h>
#define MAX 1000000000;
int A[500000];
int Lef[500000],Rig[500000];
int count=0;
void Mergesort(int,int);
void Merge(int,int,int);

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

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);
    }
		}
		
void Merge(int left,int mid,int right){
  int a,b,i,j,k;	
  a=mid-left;	
 b=mid;
   
  for(i=0;i<n1;i++)
    {
      Lef[i]=A[left+i];
    }
  for(i=0;i<n2;i++)
    {
      Rig[i]=A[mid+i];
    }
  Lef[n1]=MAX;
  Rig[n2]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(Lef[i]<=Rig[j])
    {
      A[i];
      i++;
    }
      else
    {
    	  A[k]=Rig[j];
      j++;
    }	
   }	
}	
 	
	

Compiler output:
main.c:9:1: error: return type defaults to 'int' [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function 'main':
main.c:28:10: warning: missing terminating " character
   28 |   printf("%d
      |          ^
main.c:28:10: error: missing terminating " character
   28 |   printf("%d
      |          ^~~
main.c:30:1: error: expected expression before 'void'
   30 | void Mergesort(int left,int right){
      | ^~~~
main.c:72:1: error: expected declaration or statement at end of input
   72 | }
      | ^
Language: C

#include <stdio.h>
#define MAX 1000000000;
int A[500000];
int Lef[500000],Rig[500000];
int count=0;
void Mergesort(int,int);
void Merge(int,int,int);

main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
 
  Mergesort(0,n);
 
  for(i=0;i<n;i++)
    {
      printf("%d",A[i]);
      if(i<n-1)
    {
      printf(" ");
    }
    }
  printf("\n");
  printf("%d\n",count);
return 0;
}
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);
    }
		}
		
void Merge(int left,int mid,int right){
  int a,b,i,j,k;	
  a=mid-left;	
 b=mid;
   
  for(i=0;i<n1;i++)
    {
      Lef[i]=A[left+i];
    }
  for(i=0;i<n2;i++)
    {
      Rig[i]=A[mid+i];
    }
  Lef[n1]=MAX;
  Rig[n2]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(Lef[i]<=Rig[j])
    {
      A[i];
      i++;
    }
      else
    {
    	  A[k]=Rig[j];
      j++;
    }	
   }	
}	
 	

Compiler output:
main.c:9:1: error: return type defaults to 'int' [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function 'Mergesort':
main.c:36:7: error: implicit declaration of function 'mergesort'; did you mean 'Mergesort'? [-Wimplicit-function-declaration]
   36 |       mergesort(left,mid);
      |       ^~~~~~~~~
      |       Mergesort
main.c:38:7: error: implicit declaration of function 'merge'; did you mean 'Merge'? [-Wimplicit-function-declaration]
   38 |       merge(left,mid,right);
      |       ^~~~~
      |       Merge
main.c: In function 'Merge':
main.c:47:13: error: 'n1' undeclared (first use in this function)
   47 |   for(i=0;i<n1;i++)
      |             ^~
main.c:47:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:51:13: error: 'n2' undeclared (first use in this function)
   51 |   for(i=0;i<n2;i++)
      |             ^~
Language: C

#include <stdio.h>
#define MAX 1000000000;
int A[500000];
int Lef[500000],Rig[500000];
int count=0;
void Mergesort(int,int);
void Merge(int,int,int);

main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
 
  Mergesort(0,n);
 
  for(i=0;i<n;i++)
    {
      printf("%d",A[i]);
      if(i<n-1)
    {
      printf(" ");
    }
    }
  printf("\n");
  printf("%d\n",count);
return 0;
}
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);
    }
		}
		
void Merge(int left,int mid,int right){
  int a,b,i,j,k;	
  a=mid-left;	
 b=right-mid;
   
  for(i=0;i<n1;i++)
    {
      Lef[i]=A[left+i];
    }
  for(i=0;i<n2;i++)
    {
      Rig[i]=A[mid+i];
    }
  Lef[a]=MAX;
  Rig[b]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(Lef[i]<=Rig[j])
    {
      A[i];
      i++;
    }
      else
    {
    	  A[k]=Rig[j];
      j++;
    }	
   }	
}	
 	
	

Compiler output:
main.c:9:1: error: return type defaults to 'int' [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function 'Merge':
main.c:47:13: error: 'n1' undeclared (first use in this function)
   47 |   for(i=0;i<n1;i++)
      |             ^~
main.c:47:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:51:13: error: 'n2' undeclared (first use in this function)
   51 |   for(i=0;i<n2;i++)
      |             ^~
Language: C

#include <stdio.h>
#define MAX 1000000000
int A[500000];
int Lef[500000],Rig[500000];
int count=0;

main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
 
  Mergesort(0,n);
 
  for(i=0;i<n;i++)
    {
      printf("%d",A[i]);
      if(i<n-1)
    {
      printf(" ");
    }
    }
  printf("\n");
  printf("%d\n",count);
return 0;
}
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);
    }
		}
		
void Merge(int left,int mid,int right){
  int a,b,i,j,k;	
  a=mid-left;	
 b=right-mid;
   
  for(i=0;i<a;i++)
    {
      Lef[i]=A[left+i];
    }
  for(i=0;i<b;i++)
    {
      Rig[i]=A[mid+i];
    }
  Lef[a]=MAX;
  Rig[b]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(Lef[i]<=Rig[j])
    {
      A[k]=L[i];
      i++;
    }
      else
    {
    	  A[k]=Rig[j];
      j++;
    }	
   }	
}	
 	
	

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:15:3: error: implicit declaration of function 'Mergesort' [-Wimplicit-function-declaration]
   15 |   Mergesort(0,n);
      |   ^~~~~~~~~
main.c: At top level:
main.c:29:6: warning: conflicting types for 'Mergesort'; have 'void(int,  int)'
   29 | void Mergesort(int left,int right){
      |      ^~~~~~~~~
main.c:15:3: note: previous implicit declaration of 'Mergesort' with type 'void(int,  int)'
   15 |   Mergesort(0,n);
      |   ^~~~~~~~~
main.c: In function 'Mergesort':
main.c:36:7: error: implicit declaration of function 'Merge' [-Wimplicit-function-declaration]
   36 |       Merge(left,mid,right);
      |       ^~~~~
main.c: At top level:
main.c:40:6: warning: conflicting types for 'Merge'; have 'void(int,  int,  int)'
   40 | void Merge(int left,int mid,int right){
      |      ^~~~~
main.c:36:7: note: previous implicit declaration of 'Merge' with type 'void(int,  int,  int)'
   36 |       Merge(left,mid,right);
      |       ^~~~~
main.c: In function 'Merge':
main.c:62:12: error: 'L' undeclared (first use in this function)
   62 |       A[k]=L[i];
      |            ^
main.c:62:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define MAX 1000000000;
int A[500000];
int Lef[500000],Rig[500000];
int count=0;

main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
 
  Mergesort(0,n);
 
  for(i=0;i<n;i++)
    {
      printf("%d",A[i]);
      if(i<n-1)
    {
      printf(" ");
    }
    }
  printf("\n");
  printf("%d\n",count);
return 0;
}
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);
    }
		}
		
void Merge(int left,int mid,int right){
  int a,b,i,j,k;	
  a=mid-left;	
 b=right-mid;
   
  for(i=0;i<a;i++)
    {
      Lef[i]=A[left+i];
    }
  for(i=0;i<b;i++)
    {
      Rig[i]=A[mid+i];
    }
  Lef[a]=MAX;
  Rig[b]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(Lef[i]<=Rig[j])
    {
      A[k]=L[i];
      i++;
    }
      else
    {
    	  A[k]=Rig[j];
      j++;
    }	
   }	
}	
 	

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:15:3: error: implicit declaration of function 'Mergesort' [-Wimplicit-function-declaration]
   15 |   Mergesort(0,n);
      |   ^~~~~~~~~
main.c: At top level:
main.c:29:6: warning: conflicting types for 'Mergesort'; have 'void(int,  int)'
   29 | void Mergesort(int left,int right){
      |      ^~~~~~~~~
main.c:15:3: note: previous implicit declaration of 'Mergesort' with type 'void(int,  int)'
   15 |   Mergesort(0,n);
      |   ^~~~~~~~~
main.c: In function 'Mergesort':
main.c:36:7: error: implicit declaration of function 'Merge' [-Wimplicit-function-declaration]
   36 |       Merge(left,mid,right);
      |       ^~~~~
main.c: At top level:
main.c:40:6: warning: conflicting types for 'Merge'; have 'void(int,  int,  int)'
   40 | void Merge(int left,int mid,int right){
      |      ^~~~~
main.c:36:7: note: previous implicit declaration of 'Merge' with type 'void(int,  int,  int)'
   36 |       Merge(left,mid,right);
      |       ^~~~~
main.c: In function 'Merge':
main.c:62:12: error: 'L' undeclared (first use in this function)
   62 |       A[k]=L[i];
      |            ^
main.c:62:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define a 500000


void Merge(int *, int , int , int );
void MergeSort(int *, int, int);

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

  MergeSort(S, 0, n);

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

  return 0;

}

void Merge(int A[], int left, int mid, int right)
{
  int i, j, k;
  int n1, n2;

  n1 = mid - left;
  n2 = right - mid;

  int L[n1+1], R[n2+1];

  for(i=0; i<n1; i++)
    {
      L[i] = A[left + i];
    }

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

  // L[n1] = SENTINEL;
  //R[n2] = SENTINEL;

  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)
{
  int mid;

  if(left+1 < right)
    {
      mid = (left + right)/2;
      Merge-Sort(A, left, mid);
      Merge-Sort(A, mid, right);
      Merge(A, left, mid, right);
    }
}

Compiler output:
main.c: In function 'MergeSort':
main.c:80:13: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   80 |       Merge-Sort(A, left, mid);
      |             ^~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#define N 500000
#define S 1000000000
#define SENTINEL 10000000
void Merge(int *,int,int,int);
void MergeSort(int *,int,int);
int A[N],count;
int main(){
  int n,i,left,right;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    //printf("%d",A[i]);
  }
  right = n;
  left=0;
  MergeSort(A,left,right);

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

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

void Merge(int *A, int left, int mid, int right){
  int n1= mid -left;
  int n2 = right - mid;
  int i,j,k//,*L,*R;
    int L[n1+1],R[n2+1];
  //L=(int *)malloc(sizeof(int)*n1);
  //R=(int *)malloc(sizeof(int)*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]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
    count++;
  }
}

Compiler output:
main.c: In function 'Merge':
main.c:41:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
   41 |     int L[n1+1],R[n2+1];
      |     ^~~
main.c:45:5: error: 'L' undeclared (first use in this function)
   45 |     L[i]=A[left+i];
      |     ^
main.c:45:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:48:5: error: 'R' undeclared (first use in this function)
   48 |     R[i]=A[mid+i];
      |     ^
main.c:54:7: error: 'k' undeclared (first use in this function)
   54 |   for(k=left;k<right;k++){
      |       ^
Language: C

#include(stdio.h)

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1].R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-SOrt(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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


return 0;
}

Compiler output:
main.c:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include(stdio.h)
      |         ^
main.c: In function 'Merge':
main.c:8:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | int L[n1].R[n2];
      |          ^
main.c:8:10: error: expected expression before '.' token
main.c:10:1: error: 'L' undeclared (first use in this function)
   10 | L[i]=A[l+i];
      | ^
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:1: error: 'R' undeclared (first use in this function)
   13 | R[i]=A[r+i];
      | ^
main.c:20:4: error: expected ';' before '}' token
   20 | i++
      |    ^
      |    ;
   21 | }
      | ~   
main.c: At top level:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-SOrt(int l,int r){
      |           ^
main.c: In function 'main':
main.c:43:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   43 | 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:43:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   43 | scanf("%d",&n);
      | ^~~~~
main.c:43:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
main.c:48:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 | printf("%d",A[i]);
      | ^~~~~~
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   51 | printf("\n%d\n",count);
      | ^~~~~~
main.c:51:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:55:1: error: expected identifier or '(' before 'return'
   55 | return 0;
      | ^~~~~~
main.c:56:1: error: expected identifier or '(' before '}' token
   56 | }
      | ^
Language: C

#include(stdio.h)

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1].R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-SOrt(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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


return 0;
}

Compiler output:
main.c:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include(stdio.h)
      |         ^
main.c: In function 'Merge':
main.c:8:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | int L[n1].R[n2];
      |          ^
main.c:8:10: error: expected expression before '.' token
main.c:10:1: error: 'L' undeclared (first use in this function)
   10 | L[i]=A[l+i];
      | ^
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:1: error: 'R' undeclared (first use in this function)
   13 | R[i]=A[r+i];
      | ^
main.c: At top level:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-SOrt(int l,int r){
      |           ^
main.c: In function 'main':
main.c:43:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   43 | 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:43:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   43 | scanf("%d",&n);
      | ^~~~~
main.c:43:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
main.c:48:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 | printf("%d",A[i]);
      | ^~~~~~
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   51 | printf("\n%d\n",count);
      | ^~~~~~
main.c:51:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:55:1: error: expected identifier or '(' before 'return'
   55 | return 0;
      | ^~~~~~
main.c:56:1: error: expected identifier or '(' before '}' token
   56 | }
      | ^
Language: C

#include(stdio.h)

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1].R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-SOrt(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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


return 0;
}

Compiler output:
main.c:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include(stdio.h)
      |         ^
main.c: In function 'Merge':
main.c:8:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | int L[n1].R[n2];
      |          ^
main.c:8:10: error: expected expression before '.' token
main.c:10:1: error: 'L' undeclared (first use in this function)
   10 | L[i]=A[l+i];
      | ^
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:1: error: 'R' undeclared (first use in this function)
   13 | R[i]=A[r+i];
      | ^
main.c: At top level:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-SOrt(int l,int r){
      |           ^
main.c: In function 'main':
main.c:43:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   43 | 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:43:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   43 | scanf("%d",&n);
      | ^~~~~
main.c:43:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
main.c:48:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 | printf("%d",A[i]);
      | ^~~~~~
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   51 | printf("\n%d\n",count);
      | ^~~~~~
main.c:51:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:55:1: error: expected identifier or '(' before 'return'
   55 | return 0;
      | ^~~~~~
main.c:56:1: error: expected identifier or '(' before '}' token
   56 | }
      | ^
Language: C

#include(stdio.h)

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1].R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-Sort(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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


return 0;
}

Compiler output:
main.c:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include(stdio.h)
      |         ^
main.c: In function 'Merge':
main.c:8:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | int L[n1].R[n2];
      |          ^
main.c:8:10: error: expected expression before '.' token
main.c:10:1: error: 'L' undeclared (first use in this function)
   10 | L[i]=A[l+i];
      | ^
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:1: error: 'R' undeclared (first use in this function)
   13 | R[i]=A[r+i];
      | ^
main.c: At top level:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-Sort(int l,int r){
      |           ^
main.c: In function 'main':
main.c:43:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   43 | 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:43:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   43 | scanf("%d",&n);
      | ^~~~~
main.c:43:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
main.c:48:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 | printf("%d",A[i]);
      | ^~~~~~
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   51 | printf("\n%d\n",count);
      | ^~~~~~
main.c:51:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:55:1: error: expected identifier or '(' before 'return'
   55 | return 0;
      | ^~~~~~
main.c:56:1: error: expected identifier or '(' before '}' token
   56 | }
      | ^
Language: C

#include(stdio.h)

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1].R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-Sort(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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



return 0;
}

Compiler output:
main.c:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include(stdio.h)
      |         ^
main.c: In function 'Merge':
main.c:8:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | int L[n1].R[n2];
      |          ^
main.c:8:10: error: expected expression before '.' token
main.c:10:1: error: 'L' undeclared (first use in this function)
   10 | L[i]=A[l+i];
      | ^
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:1: error: 'R' undeclared (first use in this function)
   13 | R[i]=A[r+i];
      | ^
main.c: At top level:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-Sort(int l,int r){
      |           ^
main.c: In function 'main':
main.c:43:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   43 | 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:43:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   43 | scanf("%d",&n);
      | ^~~~~
main.c:43:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
main.c:48:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 | printf("%d",A[i]);
      | ^~~~~~
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:48:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   51 | printf("\n%d\n",count);
      | ^~~~~~
main.c:51:1: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1].R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-Sort(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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

return 0;
}

Compiler output:
main.c: In function 'Merge':
main.c:8:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | int L[n1].R[n2];
      |          ^
main.c:8:10: error: expected expression before '.' token
main.c:10:1: error: 'L' undeclared (first use in this function)
   10 | L[i]=A[l+i];
      | ^
main.c:10:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:1: error: 'R' undeclared (first use in this function)
   13 | R[i]=A[r+i];
      | ^
main.c: At top level:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-Sort(int l,int r){
      |           ^
main.c: In function 'main':
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
Language: C

#include<stdio.h>

int A[500000],count=0;

void Merge(int l,int m,int r){

int n1=m-l,n2=r-m,i,j,k;
int L[n1],R[n2];
for(i=0;i<n1;i++){
L[i]=A[l+i];
}
for(i=0;i<n2;i++){
R[i]=A[r+i];
}
L[n1]=1000000001;
R[n2]=1000000001;
for(i=0,j=0,k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
count++;
}

}

void Merge-Sort(int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
Merge-Sort(l,m);
Merge-Sort(m,r);
Merge(l,m,r);
}
}

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

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

return 0;
}

Compiler output:
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   31 | void Merge-Sort(int l,int r){
      |           ^
main.c: In function 'main':
main.c:46:7: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   46 | Merge-Sort(0,n);
      |       ^~~~
Language: C

#include<stdio.h>
#define MAX 500000
#define SENTINEL 1000000000
int  A[MAX];
int count = 0 ;
void Merge(int,int,int);

void Merge_Sort(int,int);

main(){
  int n;
  int i;
  int left,mid,right;

  scanf("%d", &n);

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

  left = 0;
  right = n;
  Merge_Sort(left,right);

  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 left,int mid,int right){
  int n1,n2;
  int i,j,k;
  n1 = mid-left;
  n2 = right-mid;
  int L[n1+1],R[n2+1];

  for(i=0; i<n1; i++){
    L[i] = A[left+i];

  }

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

  }

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

  i = 0;
  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++;
      }  
}
}

Compiler output:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | main(){
      | ^~~~
Language: C

include<stdio.h>
 
#define SIZE 500000
#define MERGESIZE (SIZE/2+1)
#define SENTINEL (1000000000+1)
 
int S[SIZE];
int L[MERGESIZE], R[MERGESIZE];
 
int Merge(int A[], int left, int mid, int right)
{
  int n1 = mid - left;
  int n2 = right - mid;
  int i, j, k;
   
  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] = SENTINEL;
  R[n2] = SENTINEL;
 
  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;
    }
  }
 
  return(right - left);
}
 
int Merge_Sort(int A[], int left, int right)
{
    int mid, c = 0;
    if(left+1 < right){
        mid = (left + right)/2;
        c += Merge_Sort(A, left, mid);
        c += Merge_Sort(A, mid, right);
        c += Merge(A, left, mid, right);
    }
    else{
        c = 0;
    }

    return(c);

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

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

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:64:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   64 |     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:64:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   64 |     scanf("%d", &n);
      |     ^~~~~
main.c:64:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:66:22: error: 'S' undeclared (first use in this function)
   66 |         scanf("%d", &S[i]);
      |                      ^
main.c:66:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:72:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   72 |         printf("%d ", S[i]);
      |         ^~~~~~
main.c:72:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:72:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:72:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:74:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   74 |     printf("%d\n%d\n", S[i], c);
      |     ^~~~~~
main.c:74:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<iostream>
using namespace std;
#define Max 500000
#define SENTINEL 200000000000

int L[Max/2+2], M[Max/2+2];
int cnt;

int merge(int A,int left,int mid,int right){
  int n1=mid-left,i,j;
  int 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]=SENTINEL;
  j=i=0;
  for(int k=left;k<right;k++){
    cnt++;
     if(L[i]<=R[j]){
         A[k]=L[i++];
       }
     else{
       A[k]=R[i];
     }
  }
}

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(){
    nit 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<<end1;
    return 0;
}


Compiler output:
a.cc: In function 'int merge(int, int, int, int)':
a.cc:13:11: error: invalid types 'int[int]' for array subscript
   13 |     L[i]=A[left+i];
      |           ^
a.cc:15:5: error: 'R' was not declared in this scope
   15 |     R[i]=A[mid+i];
      |     ^
a.cc:15:11: error: invalid types 'int[int]' for array subscript
   15 |     R[i]=A[mid+i];
      |           ^
a.cc:16:9: error: 'R' was not declared in this scope
   16 |   L[n1]=R[n2]=SENTINEL;
      |         ^
a.cc:21:11: error: invalid types 'int[int]' for array subscript
   21 |          A[k]=L[i++];
      |           ^
a.cc:24:9: error: invalid types 'int[int]' for array subscript
   24 |        A[k]=R[i];
      |         ^
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
a.cc: In function 'void mergeSort(int*, int, int, int)':
a.cc:34:15: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   34 |         merge(A,n,left,mid,right);
      |               ^
      |               |
      |               int*
a.cc:34:14: error: too many arguments to function 'int merge(int, int, int, int)'
   34 |         merge(A,n,left,mid,right);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:9:5: note: declared here
    9 | int merge(int A,int left,int mid,int right){
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:39:5: error: 'nit' was not declared in this scope; did you mean 'int'?
   39 |     nit A[MAX],n,i;
      |     ^~~
      |     int
a.cc:42:10: error: 'n' was not declared in this scope
   42 |     cin>>n;
      |          ^
a.cc:43:9: error: 'i' was not declared in this scope
   43 |     for(i=0;i<n;i++)
      |         ^
a.cc:44:13: error: 'a' was not declared in this scope
   44 |        cin>>a[i];
      |             ^
a.cc:46:15: error: 'A' was not declared in this scope
   46 |     mergeSort(A,n,0,n);
      |               ^
a.cc:48:9: error: 'i' was not declared in this scope
   48 |     for(i=0;i<n;i++){
      |         ^
a.cc:53:16: error: 'end1' was not declared in this scope
   53 |     cout<<cnt<<end1;
      |                ^~~~
Language: C++

#include<iostream>
using namespace std;
#define Max 500000
#define SENTINEL 200000000000

int L[Max/2+2], M[Max/2+2];
int cnt;

int merge(int A[],int left,int mid,int right){
  int n1=mid-left,i,j;
  int 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]=SENTINEL;
  j=i=0;
  for(int k=left;k<right;k++){
    cnt++;
     if(L[i]<=R[j]){
         A[k]=L[i++];
       }
     else{
       A[k]=R[i];
     }
  }
}

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(){
    nit 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<<end1;
    return 0;
}


Compiler output:
a.cc: In function 'int merge(int*, int, int, int)':
a.cc:15:5: error: 'R' was not declared in this scope
   15 |     R[i]=A[mid+i];
      |     ^
a.cc:16:9: error: 'R' was not declared in this scope
   16 |   L[n1]=R[n2]=SENTINEL;
      |         ^
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
a.cc: In function 'void mergeSort(int*, int, int, int)':
a.cc:34:14: error: too many arguments to function 'int merge(int*, int, int, int)'
   34 |         merge(A,n,left,mid,right);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:9:5: note: declared here
    9 | int merge(int A[],int left,int mid,int right){
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:39:5: error: 'nit' was not declared in this scope; did you mean 'int'?
   39 |     nit A[MAX],n,i;
      |     ^~~
      |     int
a.cc:42:10: error: 'n' was not declared in this scope
   42 |     cin>>n;
      |          ^
a.cc:43:9: error: 'i' was not declared in this scope
   43 |     for(i=0;i<n;i++)
      |         ^
a.cc:44:13: error: 'a' was not declared in this scope
   44 |        cin>>a[i];
      |             ^
a.cc:46:15: error: 'A' was not declared in this scope
   46 |     mergeSort(A,n,0,n);
      |               ^
a.cc:48:9: error: 'i' was not declared in this scope
   48 |     for(i=0;i<n;i++){
      |         ^
a.cc:53:16: error: 'end1' was not declared in this scope
   53 |     cout<<cnt<<end1;
      |                ^~~~
Language: C++

#include<iostream>
using namespace std;
#define Max 500000
#define SENTINEL 200000000000

int L[Max/2+2], M[Max/2+2];
int cnt;

int merge(int A[],int n,int left,int mid,int right){
  int n1=mid-left,i,j;
  int 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]=SENTINEL;
  j=i=0;
  for(int k=left;k<right;k++){
    cnt++;
     if(L[i]<=R[j]){
         A[k]=L[i++];
       }
     else{
       A[k]=R[i];
     }
  }
}

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(){
    nit 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<<end1;
    return 0;
}


Compiler output:
a.cc: In function 'int merge(int*, int, int, int, int)':
a.cc:15:5: error: 'R' was not declared in this scope
   15 |     R[i]=A[mid+i];
      |     ^
a.cc:16:9: error: 'R' was not declared in this scope
   16 |   L[n1]=R[n2]=SENTINEL;
      |         ^
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
a.cc: In function 'int main()':
a.cc:39:5: error: 'nit' was not declared in this scope; did you mean 'int'?
   39 |     nit A[MAX],n,i;
      |     ^~~
      |     int
a.cc:42:10: error: 'n' was not declared in this scope
   42 |     cin>>n;
      |          ^
a.cc:43:9: error: 'i' was not declared in this scope
   43 |     for(i=0;i<n;i++)
      |         ^
a.cc:44:13: error: 'a' was not declared in this scope
   44 |        cin>>a[i];
      |             ^
a.cc:46:15: error: 'A' was not declared in this scope
   46 |     mergeSort(A,n,0,n);
      |               ^
a.cc:48:9: error: 'i' was not declared in this scope
   48 |     for(i=0;i<n;i++){
      |         ^
a.cc:53:16: error: 'end1' was not declared in this scope
   53 |     cout<<cnt<<end1;
      |                ^~~~