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

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

int L[250002], R[250002],count = 0, A[MAX],n;

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

int main()
{
  int i;

  scanf("%d",&n);

  for(i = 0; i < n; i++) {
    scanf("%d",&A[i]);
  }
  mergeSort(0, n);
  for(i = 0; i < n - 1 ; i++) {
    printf("%d ",A[i]);
  }
  printf("%d", A[n - 1]);
  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 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 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] = SENTINEL;
  R[n2] = SENTINEL;

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

Compiler output:
main.c:39:6: error: redefinition of 'mergeSort'
   39 | void mergeSort(int left, int right) {
      |      ^~~~~~~~~
main.c:30:6: note: previous definition of 'mergeSort' with type 'void(int,  int)'
   30 | void mergeSort(int left, int right) {
      |      ^~~~~~~~~
Language: C

#include<stido.h>

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

int count = 0;

int main(){
  int S[10000000];
  int n,i;

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

  mergeSort(S,0,n);

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

    else {
      printf("%d\n%d\n",S[i],count);
    }
  }
  
    return 0;
}

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

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    count++;
    if( L[i] <= R[j] ) {
      A[k] = L[j];
      i += 1;
    }
    else {
      A[k] = R[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);
    }
  }
    

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

#include<stdio.h>

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

int count = 0;

int main(){
  int S[10000000];
  int n,i;

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

  mergeSort(S,0,n);

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

    else {
      printf("%d\n%d\n",S[i],count);
    }
  }
  
    return 0;
}

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

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    count++;
    if( L[i] <= R[j] ) {
      A[k] = L[j];
      i += 1;
    }
    else {
      A[k] = R[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);
    }
  }
    

Compiler output:
main.c: In function 'merge':
main.c:36:14: error: 'left' undeclared (first use in this function)
   36 |   n1 = mid - left;
      |              ^~~~
main.c:36:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:47:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   47 |   L[n1] = 10000000000;
      |           ^~~~~~~~~~~
main.c:48:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   48 |   R[n2] = 10000000000;
      |           ^~~~~~~~~~~
main.c: In function 'mergeSort':
main.c:72:7: error: too many arguments to function 'merge'
   72 |       merge(A,left,mid,right);
      |       ^~~~~
main.c:32:6: note: declared here
   32 | void merge(int *A,int mid ,int right) {
      |      ^~~~~
main.c: In function 'merge':
main.c:74:3: error: expected declaration or statement at end of input
   74 |   }
      |   ^
Language: C

#include<stdio.h>

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

int count = 0;

int main(){
  int S[10000000];
  int n,i;

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

  mergeSort(S,0,n);

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

    else {
      printf("%d\n%d\n",S[i],count);
    }
  }
  
    return 0;
}

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

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    count++;
    if( L[i] <= R[j] ) {
      A[k] = L[j];
      i += 1;
    }
    else {
      A[k] = R[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);
    }
  }
    

Compiler output:
main.c: In function 'merge':
main.c:47:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   47 |   L[n1] = 10000000000;
      |           ^~~~~~~~~~~
main.c:48:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   48 |   R[n2] = 10000000000;
      |           ^~~~~~~~~~~
main.c:74:3: error: expected declaration or statement at end of input
   74 |   }
      |   ^
Language: C

#include<stdio.h>

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

int count = 0;

int main(){
  int S[10000000];
  int n,i;

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

  mergeSort(S,0,n);

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

    else {
      printf("%d\n%d\n",S[i],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;
  
 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] = 10000000000;
  R[n2] = 10000000000;

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    count++;
    if( L[i] <= R[j] ) {
      A[k] = L[j];
      i += 1;
    }
    else {
      A[k] = R[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);
    }
  }
    

Compiler output:
main.c: In function 'merge':
main.c:48:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   48 |   L[n1] = 10000000000;
      |           ^~~~~~~~~~~
main.c:49:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   49 |   R[n2] = 10000000000;
      |           ^~~~~~~~~~~
main.c:75:3: error: expected declaration or statement at end of input
   75 |   }
      |   ^
Language: C

#include<stdio.h>

void marge(int [],  int, int ,int);
void margeSort( int [],int, int);
int L[250002],R[250002],count;

int main(){

  int left, mid, right,i,j,n1,n2,sumdata;
  int A[500000];

  scanf("%d",&sumdata);

  for(i = 0; i < sumdata; i++){

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

  }

  margeSort(A,0,sumdata);

  for(i = 0; i < sumdata; i++){

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

  printf("\n");

  printf("%d\",count);

  return 0;

}

void marge( 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] = 2000000000;
  R[n2] = 2000000000;

  i = 0;
  j  = 0;

  for(k = left; k < right  ; k++){

    if(L[i] <= R[j]){

      count = count + 1;

      A[k] = L[i];

      i = i + 1;
      

    }

    else{

      count = count + 1;

      A[k] = R[j];

      j = j + 1;


    }

  }
}

void margeSort( int A[],int left, int right){

  int i,j,mid;

  if(left + 1 < right){

    mid = (left + right) /2;

    margeSort(A,left,mid);
    margeSort(A,mid,right);
    marge(A,left, mid, right);

      }
}

Compiler output:
main.c: In function 'main':
main.c:30:10: warning: missing terminating " character
   30 |   printf("%d\",count);
      |          ^
main.c:30:10: error: missing terminating " character
   30 |   printf("%d\",count);
      |          ^~~~~~~~~~~~~
main.c:32:3: error: expected expression before 'return'
   32 |   return 0;
      |   ^~~~~~
main.c:32:12: error: expected ';' before '}' token
   32 |   return 0;
      |            ^
      |            ;
   33 | 
   34 | }
      | ~
Language: C

#include<stdio.h>

void marge(int [],  int, int ,int);
void margeSort( int [],int, int);
int L[250002],R[250002],count;

int main(){

  int left, mid, right,i,j,n1,n2,sumdata;
  int A[500000];

  scanf("%d",&sumdata);

  for(i = 0; i < sumdata; i++){

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

  }

  margeSort(A,0,sumdata);

  for(i = 0; i < summate ; i++){

if(i == summate -1){

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

}

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

}
  }


  printf("%d",count);

  return 0;

}

void marge( 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] = 2000000000;
  R[n2] = 2000000000;

  i = 0;
  j  = 0;

  for(k = left; k < right  ; k++){

    if(L[i] <= R[j]){

      count = count + 1;

      A[k] = L[i];

      i = i + 1;
      

    }

    else{

      count = count + 1;

      A[k] = R[j];

      j = j + 1;


    }

  }
}

void margeSort( int A[],int left, int right){

  int i,j,mid;

  if(left + 1 < right){

    mid = (left + right) /2;

    margeSort(A,left,mid);
    margeSort(A,mid,right);
    marge(A,left, mid, right);

      }
}

Compiler output:
main.c: In function 'main':
main.c:22:18: error: 'summate' undeclared (first use in this function); did you mean 'sumdata'?
   22 |   for(i = 0; i < summate ; i++){
      |                  ^~~~~~~
      |                  sumdata
main.c:22:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

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

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

void merge(int A[],int left,int mid,int ritht){
  int n1,n2,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] = INFTY;
  R[n2] = INFTY;
  
  i = 0;
  j = 0;
  
  for(k = left ;k < right ; k++){
    count++;
    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){
    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:12:19: error: 'a' undeclared (first use in this function)
   12 |   for(i = 0 ; i < a ; i++) scanf("%d",&A[i]);
      |                   ^
main.c:12:19: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'merge':
main.c:26:8: error: 'right' undeclared (first use in this function); did you mean 'ritht'?
   26 |   n2 = right - mid;
      |        ^~~~~
      |        ritht
main.c:33:11: error: 'INFTY' undeclared (first use in this function)
   33 |   L[n1] = INFTY;
      |           ^~~~~
main.c: In function 'mergeSort':
main.c:53:5: error: 'mid' undeclared (first use in this function)
   53 |     mid = (left + right)/2;
      |     ^~~
Language: C

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

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

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

void merge(int A[],int left,int mid,int ritht){
  int n1,n2,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] = INT_MAX;
  R[n2] = INT_MAX;
  
  i = 0;
  j = 0;
  
  for(k = left ;k < right ; k++){
    count++;
    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){
    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:12:19: error: 'a' undeclared (first use in this function)
   12 |   for(i = 0 ; i < a ; i++) scanf("%d",&A[i]);
      |                   ^
main.c:12:19: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'merge':
main.c:26:8: error: 'right' undeclared (first use in this function); did you mean 'ritht'?
   26 |   n2 = right - mid;
      |        ^~~~~
      |        ritht
main.c: In function 'mergeSort':
main.c:53:5: error: 'mid' undeclared (first use in this function)
   53 |     mid = (left + right)/2;
      |     ^~~
Language: C

#include<stdio.h>

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

int count=0;

int main(){

  int n,i;
  int S[500000];

  scanf("%d",&n);

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

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

void mergeSort(int *s,int l,int r){

  int m;

  if(l+1<r){
    mid=(l+r)/2;
    mergeSort(s,l,m);
    mergeSort(s,m,r);
    mergeSort(s,l,m,r);
  }
}

void merge(int *s,int l,int m,int r){

  int n1,n2,i,j,k;

  n1=m-l;
  n2=r-m;

  int l[n1+l],r[n2+1];

  for(i=0;i<=n1-1;i++) l[i]=s[l+i];
  for(i-0;i<=n2-1;i++) r[i]=s[m+i];

  l[n1]=1000000000;
  r[n2]=1000000000;

  i=0;
  k=0;

  for(j=l;j<=r-1;j++){
    count++;

    if(l[i]<=r[k]){
      s[j]=r[k];
      k=k+1;
    }
  }
}

Compiler output:
main.c: In function 'main':
main.c:16:15: error: invalid operands to binary & (have 'char *' and 'int')
   16 |     scanf("%d"&S[i]);
      |           ~~~~^~~~~
      |           |     |
      |           |     int
      |           char *
main.c: In function 'mergeSort':
main.c:36:5: error: 'mid' undeclared (first use in this function)
   36 |     mid=(l+r)/2;
      |     ^~~
main.c:36:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:39:5: error: too many arguments to function 'mergeSort'
   39 |     mergeSort(s,l,m,r);
      |     ^~~~~~~~~
main.c:31:6: note: declared here
   31 | void mergeSort(int *s,int l,int r){
      |      ^~~~~~~~~
main.c: In function 'merge':
main.c:50:7: error: 'l' redeclared as different kind of symbol
   50 |   int l[n1+l],r[n2+1];
      |       ^
main.c:43:23: note: previous definition of 'l' with type 'int'
   43 | void merge(int *s,int l,int m,int r){
      |                   ~~~~^
main.c:50:15: error: 'r' redeclared as different kind of symbol
   50 |   int l[n1+l],r[n2+1];
      |               ^
main.c:43:35: note: previous definition of 'r' with type 'int'
   43 | void merge(int *s,int l,int m,int r){
      |                               ~~~~^
Language: C

#include<stdio.h>

int merge(int,int,int);
int main(){


  int S[500000],n,i,n1,n2;


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












  int merge(int )

Compiler output:
main.c: In function 'merge':
main.c:26: error: expected '{' at end of input
main.c: In function 'main':
main.c:25:3: error: expected declaration or statement at end of input
   25 |   int merge(int )
      |   ^~~
Language: C

#include<stdio.h>
#define INFTY 999999
#define N 500000
 
void merge(int[],int,int,int);
void mergeSort(int[],int,int);
 
int count = 0;
 
int main()
{
  int i,n,A[N];
 
  scanf("%d",&n);
   
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);
   
  mergeSort(A,0,n);
   
  for(i = 0; i < n - 1; i++)
    printf("%d ",A[i]);
   
  printf("%d\n%d\n",A[n - 1],count);
   
  return 0;
}
 void merge(int A[],int left,int mid,int right)
 {
   int n1 = mid - left;
   int n2 = right - mid;
   int L[N],R[N],k,i,j; 
    
    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++)
{
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: In function 'merge':
main.c:77:1: error: expected declaration or statement at end of input
   77 | }
      | ^
Language: C

#include<stdio.h>
#define INFTY 999999
#define N 500000
 
void merge(int[],int,int,int);
void mergeSort(int[],int,int);
 
int count = 0;
 
int main()
{
  int i,n,A[N];
 
  scanf("%d",&n);
   
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);
   
  mergeSort(A,0,n);
   
  for(i = 0; i < n - 1; i++)
    printf("%d ",A[i]);
   
  printf("%d\n%d\n",A[n - 1],count);
   
  return 0;
}
 void merge(int A[],int left,int mid,int right)
 {
   int n1 = mid - left;
   int n2 = right - mid;
   int L[N],R[N],k,i,j; 
    
    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++;
          count++;
        }
     
      else
        {
          A[k] = R[j];
          j++;
         count++ 
        }
     
     
    }
 
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: In function 'merge':
main.c:60:17: error: expected ';' before '}' token
   60 |          count++
      |                 ^
      |                 ;
   61 |         }
      |         ~
Language: C

#include<stdio.h>
#define INFTY 999999
#define N 500000
 
void merge(int[],int,int,int);
void mergeSort(int[],int,int);
 
int count = 0;
 
int main()
{
  int i,n,A[N];
 
  scanf("%d",&n);
   
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);
   
  mergeSort(A,0,n);
   
  for(i = 0; i < n - 1; i++)
    printf("%d ",A[i]);
   
  printf("%d\n%d\n",A[n - 1],count);
   
  return 0;
}
 void merge(int A[],int left,int mid,int right)
 {
   int n1 = mid - left;
   int n2 = right - mid;
   int L[N],R[N],k,i,j; 
    
    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++;
          count++;
        }
     
      else
        {
          A[k] = R[j];
          j++;
         count++ 
        }
     
     
    }
 
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: In function 'merge':
main.c:60:17: error: expected ';' before '}' token
   60 |          count++
      |                 ^
      |                 ;
   61 |         }
      |         ~        
main.c:77:1: error: expected declaration or statement at end of input
   77 | }
      | ^
Language: C

#include<stdio.h>
#define INFTY 999999
#define N 500000
 
void merge(int[],int,int,int);
void mergeSort(int[],int,int);
 
int count = 0;
 
int main()
{
  int i,n,A[N];
 
  scanf("%d",&n);
   
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);
   
  mergeSort(A,0,n);
   
  for(i = 0; i < n - 1; i++)
    printf("%d ",A[i]);
   
  printf("%d\n%d\n",A[n - 1],count);
   
  return 0;
}
 void merge(int A[],int left,int mid,int right)
 {
   int n1 = mid - left;
   int n2 = right - mid;
   int L[N],R[N],k,i,j; 
    
    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++;
          count++;
        }
     
      else
        {
          A[k] = R[j];
          j++;
          count++;
        }
     
     
    }
 
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: In function 'merge':
main.c:75:1: error: expected declaration or statement at end of input
   75 | }
      | ^
Language: C

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

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

int count=0;
 
int main(){
  int n,i,A[MAX];
 
  scanf("%d",&n);

  for( i = 0; i < n; i++)

    scanf("%d",&A[i]);
 
  mergesort(A,0,n);
 
  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(S,left,mid);
      mergesort(S,mid,right);
      merge(S,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;
  int L[N],R[N];
 
  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++)
    {
      count++;

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

    else
      {
	A[k]=R[j];
	j++;
      }
    }
}

Compiler output:
main.c: In function 'main':
main.c:11:13: error: 'MAX' undeclared (first use in this function)
   11 |   int n,i,A[MAX];
      |             ^~~
main.c:11:13: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'mergesort':
main.c:35:17: error: 'S' undeclared (first use in this function)
   35 |       mergesort(S,left,mid);
      |                 ^
Language: C

#include<stdio.h>

#define Infty 2000000
void merge(int*, int, int, int);
void mergesort(int*, int, int);

int left=0,right,mid;
int L[1000],R[1000];
int main(){
  int n;
  int s[2000];
  int i;
  scanf("%d",&n);
  for(i=0; i < n; i++){
    scanf("%d",&s[i]);
  }
  right=n;
  mid=(left+right)/2;
  mergesort(s,left,right);
  for(i=0;i < n; i++){
    printf("%d ",s[i]);
  }
  printf("\n");

  return 0;
}
  void merge(int* A[],int left,int mid,int right){
    int n1,n2;
    int i,j,k;
    n1=mid-lefr;
    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;
    L[n2]=Infty;
    i=0;
    j=0;
    for(k=left; k < right; k++){
      if(L[i] <= R[j]){
	A[k]=L[i];
	i+=1;
      }
      else{
	A[k]=R[j];
	j+=1;
      }
    }
  }

void mergesort(int* A[], int left, int right){
  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:27:8: error: conflicting types for 'merge'; have 'void(int **, int,  int,  int)'
   27 |   void merge(int* A[],int left,int mid,int right){
      |        ^~~~~
main.c:4:6: note: previous declaration of 'merge' with type 'void(int *, int,  int,  int)'
    4 | void merge(int*, int, int, int);
      |      ^~~~~
main.c: In function 'merge':
main.c:30:12: error: 'lefr' undeclared (first use in this function); did you mean 'left'?
   30 |     n1=mid-lefr;
      |            ^~~~
      |            left
main.c:30:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:11: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   34 |       L[i]=A[left+i];
      |           ^
main.c:37:11: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   37 |       R[i]=A[mid+i];
      |           ^
main.c:45:13: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   45 |         A[k]=L[i];
      |             ^
main.c:49:13: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   49 |         A[k]=R[j];
      |             ^
main.c: At top level:
main.c:55:6: error: conflicting types for 'mergesort'; have 'void(int **, int,  int)'
   55 | void mergesort(int* A[], 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>
#include<stdlib.h>

#define max 500001

void merge(int *,int,int,int);
void mergeSort(int *,int,int);
 
int count=0; 
 
int main(){
  int n,i;
  int S[MAX];
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
    if(S[i]<0 || S[i]>1000000000){
      exit(1);
    }
  }
 
  mergeSort(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(int *A,int l,int m,int r){
  int n1=m-l;
  int n2=r-m;
  int i,j,k;
  int *L,*R;
 
  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));
 
  for(i=0;i<=n1-1;i++){
    L[i]=A[l+i];
  }
 
  for(j=0;j<=n2-1;j++){
    R[j]=A[m+j];
  }
 
  L[n1]=1000000000;
  R[n2]=1000000000;
 
  i=0;
  j=0;
 
  for(k=l;k<=r-1;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }else{
      A[k]=R[j];
      j=j+1;
    }
 
    count++;
  }
 
  free(L);
  free(R);
}

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: In function 'main':
main.c:13:9: error: 'MAX' undeclared (first use in this function)
   13 |   int S[MAX];
      |         ^~~
main.c:13:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

#define Infty 2000000
void merge(int, int, int, int);
void mergesort(int, int, int);


int L[1000],R[1000];
int c=0;
int main(){
  int n;
  int s[2000];
  int i;
  scanf("%d",&n);
  for(i=0; i < n; i++){
    scanf("%d",&s[i]);
  }

  mergesort(s,0,i);
  for(i=0;i < n; i++){
    printf("%d ",s[i]);
  }
  printf("\n");
  printf("%d\n",c);

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

Compiler output:
main.c: In function 'main':
main.c:19:13: error: passing argument 1 of 'mergesort' makes integer from pointer without a cast [-Wint-conversion]
   19 |   mergesort(s,0,i);
      |             ^
      |             |
      |             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:28:8: error: conflicting types for 'merge'; have 'void(int *, int,  int,  int)'
   28 |   void merge(int A[],int left,int mid,int right){
      |        ^~~~~
main.c:4:6: note: previous declaration of 'merge' with type 'void(int,  int,  int,  int)'
    4 | void merge(int, int, int, int);
      |      ^~~~~
main.c:57:6: error: conflicting types for 'mergesort'; have 'void(int *, int,  int)'
   57 | void mergesort(int A[], 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>
int mergeSort(int A[],int left,int right);
int merge(int A[],int left,int mid,int right);
int main(){
  int i,j,m,n,count,A[500000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  count=mergeSort(A,0,n);
  for(i = 0; i < n; i++)
    printf("%d ", A[i]);
  printf("\n");
  printf("%d\n",count);
  return 0;
}


int mergeSort(int A[],int left,int right){
  int mid,i,j,k,con=0;

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

int merge(int *A,int left,int mid,int right){
  int i,j,k=0,L[500000],R[500000],n1,n2;
  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]=1000000;
  R[n2]=1000000;
  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;
    }
  }
  return n1+n2;

Compiler output:
main.c: In function 'merge':
main.c:55:3: error: expected declaration or statement at end of input
   55 |   return n1+n2;
      |   ^~~~~~
Language: C

#include <stdio.h>
int count;
int mergeSort(int A[],int left,int right);
int merge(int A[],int left,int mid,int right);
int main(){
  int i,j,m,n,count,A[500000];
  count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  count=mergeSort(A,0,n);
  for(i = 0; i < n-1; i++)
    printf("%d ", A[i]);
  printf("%d",A[n-1])
  printf("\n");
  printf("%d\n",count);
  return 0;
}


int mergeSort(int A[],int left,int right){
  int mid,i,j,k,con=0;

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

int merge(int *A,int left,int mid,int right){
  int i,j,k=0,L[500000],R[500000],n1,n2;
  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]=1000000;
  R[n2]=1000000;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
      count++;
    }
    else{
      A[k]=R[j];
      j=j+1;
      count++;
    }
  }
  return count;
}

Compiler output:
main.c: In function 'main':
main.c:15:22: error: expected ';' before 'printf'
   15 |   printf("%d",A[n-1])
      |                      ^
      |                      ;
   16 |   printf("\n");
      |   ~~~~~~
Language: C

#include <stdio.h>
int count;
int mergeSort(int A[],int left,int right);
int merge(int A[],int left,int mid,int right);
int main(){
  int i,j,m,n,count,A[500000];
  count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  count=mergeSort(A,0,n);
  for(i = 0; i < n-1; i++)
    printf("%d ", A[i]);
  printf("%d",A[n-1]);
  printf("\n");
  printf("%d\n",count);
  return 0;
}


int mergeSort(int A[],int left,int right){
  int mid,i,j,k,con=0;

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

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

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

#include<stdio.h>

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

int n, S[500000];

int main()
{
  int i;

  scanf("%d", &n);

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

void merge(int S, int left, int mid, int right)
{
  
  int i, j, k, l;
  int L[mid - left], R[right - mid];
  
  for(i = 0; i < mid-left-1; i++) L[i] = S[left + i];
  for(i = 0; i < right-mid-1; i++) R[i] = S[mid + i];
  L[mid - left] = 10000000;
  R[right - mid] = 10000000;
  i = 0;
  j = 0;
  for(k = left; k < right-1; k++){
    if(L[i] <= R[j]){
      S[k] = L[i];
      i = i + 1;
    }
    else{ 
      S[k] = R[j];
      j = j + 1;
    }
  }

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


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 'merge':
main.c:25:43: error: subscripted value is neither array nor pointer nor vector
   25 |   for(i = 0; i < mid-left-1; i++) L[i] = S[left + i];
      |                                           ^
main.c:26:44: error: subscripted value is neither array nor pointer nor vector
   26 |   for(i = 0; i < right-mid-1; i++) R[i] = S[mid + i];
      |                                            ^
main.c:33:8: error: subscripted value is neither array nor pointer nor vector
   33 |       S[k] = L[i];
      |        ^
main.c:37:8: error: subscripted value is neither array nor pointer nor vector
   37 |       S[k] = R[j];
      |        ^
main.c:43:20: error: subscripted value is neither array nor pointer nor vector
   43 |     printf("%d ", S[l]);
      |                    ^
main.c:45:19: error: subscripted value is neither array nor pointer nor vector
   45 |   printf("%d\n", S[n-1]);
      |                   ^
Language: C

#include<stdio.h>

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

int n, S[500000];

int main()
{
  int i;

  scanf("%d", &n);

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

  mergeSort(*S, 0, n);

}

void merge(int S, int left, int mid, int right)
{
  
  int i, j, k, l;
  int L[mid - left], R[right - mid];
  
  for(i = 0; i < mid-left-1; i++) L[i] = S[left + i];
  for(i = 0; i < right-mid-1; i++) R[i] = S[mid + i];
  L[mid - left] = 1000;
  R[right - mid] = 1000;
  i = 0;
  j = 0;
  for(k = left; k < right-1; k++){
    if(L[i] <= R[j]){
      S[k] = L[i];
      i = i + 1;
    }
    else{ 
      S[k] = R[j];
      j = j + 1;
    }
  }

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


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 'merge':
main.c:28:43: error: subscripted value is neither array nor pointer nor vector
   28 |   for(i = 0; i < mid-left-1; i++) L[i] = S[left + i];
      |                                           ^
main.c:29:44: error: subscripted value is neither array nor pointer nor vector
   29 |   for(i = 0; i < right-mid-1; i++) R[i] = S[mid + i];
      |                                            ^
main.c:36:8: error: subscripted value is neither array nor pointer nor vector
   36 |       S[k] = L[i];
      |        ^
main.c:40:8: error: subscripted value is neither array nor pointer nor vector
   40 |       S[k] = R[j];
      |        ^
main.c:46:20: error: subscripted value is neither array nor pointer nor vector
   46 |     printf("%d ", S[l]);
      |                    ^
main.c:48:19: error: subscripted value is neither array nor pointer nor vector
   48 |   printf("%d\n", S[n-1]);
      |                   ^
Language: C

include<stdio.h>

#define Infty 2000000
#define Max 500000

int L[Max/2+2],R[Max/2+2];
int c=0;
void merge(int [], int, int, int, int);
void mergesort(int [],int,  int, int);
int main(){
  int n;
  int s[Max];
  int i;
  scanf("%d",&n);
  for(i=0; i < n; i++){
    scanf("%d",&s[i]);
  }

  mergesort(s,n,0,n);
  for(i=0;i < n; i++){
    if(i) printf(" ");
    printf("%d ",s[i]);
  }
  printf("\n");
  printf("%d\n",c);

  return 0;

void merge(int A[],int n, int left,int mid,int right){
    int n1,n2;
    int 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]=Infty;
   L[n2]=Infty;
    i=0;
    j=0;
    for(k=left; k < right; k++){
      c++;
      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:1:8: 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:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
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:21:11: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   21 |     if(i) printf(" ");
      |           ^~~~~~
main.c:21:11: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:11: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:11: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:22:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   22 |     printf("%d ",s[i]);
      |     ^~~~~~
main.c:22:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   24 |   printf("\n");
      |   ^~~~~~
main.c:24:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'merge':
main.c:36:7: error: 'L' undeclared (first use in this function)
   36 |       L[i]=A[left+i];
      |       ^
main.c:36:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:39:7: error: 'R' undeclared (first use in this function)
   39 |       R[i]=A[mid+i];
      |       ^
main.c: In function 'main':
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C

#include<stdio.h>

#define Infty 2000000
#define Max 500000

int L[Max/2+2],R[Max/2+2];
int c=0;
void merge(int [], int, int, int, int);
void mergesort(int [],int,  int, int);
int main(){
  int n;
  int s[Max];
  int i;
  scanf("%d",&n);
  for(i=0; i < n; i++){
    scanf("%d",&s[i]);
  }

  mergesort(s,n,0,n);
  for(i=0;i < n; i++){
    if(i) printf(" ");
    printf("%d ",s[i]);
  }
  printf("\n");
  printf("%d\n",c);

  return 0;

void merge(int A[],int n, int left,int mid,int right){
    int n1,n2;
    int 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]=Infty;
   L[n2]=Infty;
    i=0;
    j=0;
    for(k=left; k < right; k++){
      c++;
      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 'main':
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>
#define INFTY 1000000
#define MAX 1000000000

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

int A[MAX],L[MAX],R[MAX],C=0;

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++){
      if(i>0)
	printf(" ");
    printf("%d",A[i]);
}
    printf("\n");
    printf("%d\n",C);
  return 0;
}

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

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

Compiler output:
/tmp/cc9V7Y5k.o: in function `main':
main.c:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cc9V7Y5k.o
/tmp/cc9V7Y5k.o: in function `merge':
main.c:(.text+0x149): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x1b5): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x1d0): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x21b): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x25b): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x264): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cc9V7Y5k.o
main.c:(.text+0x27a): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>

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

int n, S[500000];
int count=0;

int main()
{
  int 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", count);

  return 0;
}

oid merge(int S[], int left, int mid, int right)
{

  int i, j, k, l;
  int L[mid - left], R[right - mid];

  for(i = 0; i <= mid-left-1; i++) L[i] = S[left + i];
  for(i = 0; i <= right-mid-1; i++) R[i] = S[mid + i];

  L[mid - left] = 250000;
  R[right - mid] = 250000;
  i = 0;
  j = 0;

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

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:30:1: error: unknown type name 'oid'; did you mean 'void'?
   30 | oid merge(int S[], int left, int mid, int right)
      | ^~~
      | void
main.c:30:5: error: conflicting types for 'merge'; have 'int(int *, int,  int,  int)'
   30 | oid merge(int S[], int left, int mid, int right)
      |     ^~~~~
main.c:3:6: note: previous declaration of 'merge' with type 'void(int *, int,  int,  int)'
    3 | void merge(int *, int, int, int);
      |      ^~~~~
Language: C

#include <stdio.h>
  
#define N 500000
  
void merge(int*, int, int);
  
int A[N],n,count=0;
int temp[N];
  
  
int main(){
  
  int i,j;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  
    merge(A,0,n-1);
  
  for(i=0;i<n-1;i++) printf("%d ",A[i]);
  printf("%d",A[n-1]);
  printf("\n%d\n",count);
  
  return 0;
}
  
  
void merge(int A[],int left,int right){
  
  int mid,i,j,k;
  
  if(left>=right) return;
  
  mid=(left+right)/2;
  
  merge(A,left,mid);
  merge(A,(mid+1),right);
  
  for(i=left;i<=mid;i++){
    temp[i]=A[i];
  }
  
  for(i=(mid+1),j=right;i<=right;i++,j--){
    temp[i]=A[j];
  }
  
  i=left;
  j=right;
  
  for(k=left;k<=right;k++){
  
    if(temp[i]<=temp[j]) A[k]=temp[i++];
    else A[k]=temp[j--];
  
    count++;
}
  
}

Compiler output:
main.c: In function 'main':
main.c:16:32: error: 'a' undeclared (first use in this function)
   16 |   for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                                ^
main.c:16:32: note: each undeclared identifier is reported only once for each function it appears in