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

#include <stdio.h>
using namespace std;
#define MAX 500000
#define INFTY 2000000000

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


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


int main()
{

  int A[MAX], n, i;
  count = 0;

  count >> n;
  for(i=0;i<n;i++){
    cin >> A[i];
  }

  mergeSort(A,n,0,n);

  for(i=0;i<n;i++){
    if(i==1){
      cout << " ";
    }
      cout << A[i];
  }
    cout << end1;
    cout << count << end1;

    return 0;

}



Compiler output:
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
main.c: In function 'mergeSort':
main.c:46:5: error: 'mid' undeclared (first use in this function)
   46 |     mid = (left + right)/2;
      |     ^~~
main.c:46:5: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:62:5: error: 'cin' undeclared (first use in this function)
   62 |     cin >> A[i];
      |     ^~~
main.c:69:7: error: 'cout' undeclared (first use in this function); did you mean 'count'?
   69 |       cout << " ";
      |       ^~~~
      |       count
main.c:73:13: error: 'end1' undeclared (first use in this function)
   73 |     cout << end1;
      |             ^~~~
Language: C

#include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 500000
#define INFTY 2000000000

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


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


int main()
{

  int A[MAX], n, i;
  count = 0;

  count >> n;
  for(i=0;i<n;i++){
    cin >> A[i];
  }

  mergeSort(A,n,0,n);

  for(i=0;i<n;i++){
    if(i==1){
      cout << " ";
    }
      cout << A[i];
  }
    cout << end1;
    cout << count << end1;

    return 0;

}



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

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

int S[500000];

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

int main(){
  int n,i;
  scanf("%d",&n);
   for(i=0;i<n;i++){
     scanf("%d",&S[i]);
  }
  margesort(S,0,n);
  for(i=0;i<n;i++){
    printf("%d",S[i]);
  }
  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 L[250000],R[250000],i,j=0,k;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  i=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i+=1;
    }
    else{
      A[k]=R[j];
      j=j+1;
    }
  }
}



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

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

int S[500000],l;

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

int main(){
  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>1)printf(" ");
    print("%d",S[i]);
 }
    printf("%d\n",l);
  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 L[250000],R[250000],i,j=0,k;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  i=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i+=1;
      l++;
    }
    else{
      A[k]=R[j];
      j=j+1;
      l++;
    }
  }
}



Compiler output:
main.c: In function 'main':
main.c:18:5: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   18 |     print("%d",S[i]);
      |     ^~~~~
      |     printf
Language: C

#include <stdio.h>

int count = 0;
void merge(int arr[],  int left, int mid, int right)
{
    int i,j,k;
    int left_size = mid - left + 1;
    int right_size = right - mid;

    /*creat temp arrays*/
    int L[left_size], R[right_size];

    /*copy data to temp arrays L[] and R[]*/
    for(i=0; i<left_size; i++)
        L[i] = arr[left+i];
    for(j=0; j<right_size; j++)
        R[j] = arr[mid+1+j];
    /*merge two temp arrays*/
    i = 0; //initial index of first subarray
    j = 0; //initial index of second subarray
    k = left; //initial index of merged subarray

    while(i<left_size && j<right_size){
        if(L[i]<=R[j]){
            arr[k] = L[i];
            i++;
        }
        else{
            arr[k] = R[j];
            j++;
        }
        k++;
        count++;
    }

    while(i<left_size){
        arr[k] = L[i];
        i++;
        k++;
        count++;
    }
    while(j<right_size){
        arr[k] = R[j];
        j++;
        k++;
        count++;
    }
}
void mergesort(int A[], int left, int right)
{
    int mid;
    if(left<right){
        mid = left + (right-left)/2;
        mergesort(A, left, mid);
        mergesort(A, mid+1, right);
        merge(A, left, mid, right);
    }
}

int main(){
    /*int A[] = {8, 5, 9, 2, 6, 3, 7, 1, 10, 4};*/
    int n, A[500005];
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &A[i]);
    }
    mergesort(A, 0, n-1);
    for(int i=0; i<n; i++){
        printf("%d ", A[i]);
    }
    printf("\n");
    printf("%d\n", count);
}



Compiler output:
main.c: In function 'main':
main.c:64:9: error: 'i' undeclared (first use in this function)
   64 |     for(i=0; i<n; i++){
      |         ^
main.c:64:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define N 500001
#define S 10000000000

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

int c;
main(){

int n,i,A[];

scanf("%d",&n);

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

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

}


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


void Merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  int L[N],R[N];
   
  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] = S;
  R[n2] = S;
   
  i = 0;
  j = 0;
  
   
  for (k = left; k <= right-1; k ++)
    {
      c++;
      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(){
      | ^~~~
main.c: In function 'main':
main.c:12:9: error: array size missing in 'A'
   12 | int n,i,A[];
      |         ^
main.c: At top level:
main.c:32:1: error: expected identifier or '(' before '}' token
   32 | }
      | ^
main.c: In function 'Merge_Sort':
main.c:41:11: error: passing argument 1 of 'Merge' makes integer from pointer without a cast [-Wint-conversion]
   41 |     Merge(A,left, mid, right);
      |           ^
      |           |
      |           int *
main.c:6:12: note: expected 'int' but argument is of type 'int *'
    6 | void Merge(int, int, int);
      |            ^~~
main.c:41:5: error: too many arguments to function 'Merge'
   41 |     Merge(A,left, mid, right);
      |     ^~~~~
main.c:6:6: note: declared here
    6 | void Merge(int, int, int);
      |      ^~~~~
main.c: In function 'Merge':
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:60:11: note: in expansion of macro 'S'
   60 |   L[n1] = S;
      |           ^
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:61:11: note: in expansion of macro 'S'
   61 |   R[n2] = S;
      |           ^
main.c: In function 'Merge_Sort':
main.c:78:1: error: expected declaration or statement at end of input
   78 | }
      | ^
Language: C

#include <stdio.h>
 
#define N 500001
#define S 10000000000
 
void Merge(int, int, int);
void Merge_Sort(int*,int, int);
 
int c;
main(){
 
int n,i,A[N];
 
scanf("%d",&n);
 
for(i = 0; i > n ; i++) scanf("%d",&A[i]);
 
Merge_Sort(A,0,n);
for(i = 0;i < n;i++){
    printf("%d",A[i]);
    if(i < n-1){
      printf(" ");
    }
  }
    
  printf("\n%d\n",c);
  
  return 0;
    
} 
 
}
 
 
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);
  }
 
 
void Merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  int L[N],R[N];
    
  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] = S;
  R[n2] = S;
    
  i = 0;
  j = 0;
   
    
  for (k = left; k <= right-1; k ++)
    {
      c++;
      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(){
      | ^~~~
main.c:32:1: error: expected identifier or '(' before '}' token
   32 | }
      | ^
main.c: In function 'Merge_Sort':
main.c:41:11: error: passing argument 1 of 'Merge' makes integer from pointer without a cast [-Wint-conversion]
   41 |     Merge(A,left, mid, right);
      |           ^
      |           |
      |           int *
main.c:6:12: note: expected 'int' but argument is of type 'int *'
    6 | void Merge(int, int, int);
      |            ^~~
main.c:41:5: error: too many arguments to function 'Merge'
   41 |     Merge(A,left, mid, right);
      |     ^~~~~
main.c:6:6: note: declared here
    6 | void Merge(int, int, int);
      |      ^~~~~
main.c: In function 'Merge':
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:60:11: note: in expansion of macro 'S'
   60 |   L[n1] = S;
      |           ^
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:61:11: note: in expansion of macro 'S'
   61 |   R[n2] = S;
      |           ^
main.c: In function 'Merge_Sort':
main.c:78:1: error: expected declaration or statement at end of input
   78 | }
      | ^
Language: C

#include <stdio.h>
 
#define N 500001
#define S 10000000000
 
void Merge(int, int, int);
void Merge_Sort(int*,int, int);
 
int c;
main(){
 
int n,i,A[N];
 
scanf("%d",&n);
 
for(i = 0; i > n ; i++) scanf("%d",&A[i]);
 
Merge_Sort(A,0,n);
for(i = 0;i < n;i++){
    printf("%d",A[i]);
    if(i < n-1){
      printf(" ");
    }
  }
    
  printf("\n%d\n",c);
  
  return 0;
    
} 

 
 
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);
  }
 
 
void Merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  int L[N],R[N];
    
  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] = S;
  R[n2] = S;
    
  i = 0;
  j = 0;
   
    
  for (k = left; k <= right-1; k ++)
    {
      c++;
      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(){
      | ^~~~
main.c: In function 'Merge_Sort':
main.c:40:11: error: passing argument 1 of 'Merge' makes integer from pointer without a cast [-Wint-conversion]
   40 |     Merge(A,left, mid, right);
      |           ^
      |           |
      |           int *
main.c:6:12: note: expected 'int' but argument is of type 'int *'
    6 | void Merge(int, int, int);
      |            ^~~
main.c:40:5: error: too many arguments to function 'Merge'
   40 |     Merge(A,left, mid, right);
      |     ^~~~~
main.c:6:6: note: declared here
    6 | void Merge(int, int, int);
      |      ^~~~~
main.c: In function 'Merge':
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:59:11: note: in expansion of macro 'S'
   59 |   L[n1] = S;
      |           ^
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:60:11: note: in expansion of macro 'S'
   60 |   R[n2] = S;
      |           ^
main.c: In function 'Merge_Sort':
main.c:77:1: error: expected declaration or statement at end of input
   77 | }
      | ^
Language: C

#include <stdio.h>
  
#define N 500001
#define S 10000000000
  
void Merge(int*,int, int, int);
void Merge_Sort(int*,int, int);
  
int c;
main(){
  
int n,i,A[N];
  
scanf("%d",&n);
  
for(i = 0; i > n ; i++) scanf("%d",&A[i]);
  
Merge_Sort(A,0,n);
for(i = 0;i < n;i++){
    printf("%d",A[i]);
    if(i < n-1){
      printf(" ");
    }
  }
     
  printf("\n%d\n",c);
   
  return 0;
     
} 
 
  
  
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);
  }
  
  
void Merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  int L[N],R[N];
     
  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] = S;
  R[n2] = S;
     
  i = 0;
  j = 0;
    
     
  for (k = left; k <= right-1; k ++)
    {
      c++;
      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(){
      | ^~~~
main.c: In function 'Merge':
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:59:11: note: in expansion of macro 'S'
   59 |   L[n1] = S;
      |           ^
main.c:4:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
    4 | #define S 10000000000
      |           ^~~~~~~~~~~
main.c:60:11: note: in expansion of macro 'S'
   60 |   R[n2] = S;
      |           ^
main.c: In function 'Merge_Sort':
main.c:77:1: error: expected declaration or statement at end of input
   77 | }
      | ^
Language: C

#include <stdio.h>

#define MAX_DATA 500000

int temp[MAX_DATA];    /* 最小でも配列と同じサイズの領域が必要 */

void MergeSort(int x[ ], int left, int right);
void main(void);

  /* 配列 x[ ] の left から right の要素のマージソートを行う */
void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;
	
    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */

      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (temp[i] <= temp[j])        /* ここでソートされる */
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
}

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

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

#define INF (1<<30)

int A[500000];
int count = 0;

//void merge(int A[],int left,int mid,int right);
//void mergeSort(int A[],int left,int right);

void merge(int A[],int left,int mid,int right){

  int n1,n2;
  int i,j,k;
  int *L,*R;

  n1 = mid - left;
  n2 = right - mid;
  
  L = malloc(sizeof(int) * n1);
  R = 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] = INF;
  R[n2] = INF;

  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++;
    }
  }
  free(L);
  free(R);

}


void mergeSort(int A[],int left,int right){
  int mid;
  //int i=0;

  if( left+1 < right){
    //fprintf(stderr,"error :%d\n",i);
    //i++;
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }

}



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

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

Compiler output:
main.c: In function 'main':
main.c:80:3: error: expected declaration or statement at end of input
   80 |   printf("%d\n%d\n",A[i],count);
      |   ^~~~~~
Language: C

#include <stdio.h>
void mg(int *,int,int,int);
void ms(int *,int,int);
int A[5000000];
int L[2500000];
int R[2500000];
int n,count=0;
int main(){
  int i;
  int l,m,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  ms(0,n);

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

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

}
void mg(*A,left,mid,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]=10000000;
  R[n2]=10000000;
  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;
    }
    count++;
  }


}

Compiler output:
main.c: In function 'main':
main.c:13:3: error: too few arguments to function 'ms'
   13 |   ms(0,n);
      |   ^~
main.c:3:6: note: declared here
    3 | void ms(int *,int,int);
      |      ^~
main.c: At top level:
main.c:24:9: error: expected declaration specifiers or '...' before '*' token
   24 | void ms(*A,left,right){
      |         ^
main.c:24:12: error: unknown type name 'left'
   24 | void ms(*A,left,right){
      |            ^~~~
main.c:24:17: error: unknown type name 'right'
   24 | void ms(*A,left,right){
      |                 ^~~~~
main.c:34:9: error: expected declaration specifiers or '...' before '*' token
   34 | void mg(*A,left,mid,right){
      |         ^
main.c:34:12: error: unknown type name 'left'
   34 | void mg(*A,left,mid,right){
      |            ^~~~
main.c:34:17: error: unknown type name 'mid'
   34 | void mg(*A,left,mid,right){
      |                 ^~~
main.c:34:21: error: unknown type name 'right'
   34 | void mg(*A,left,mid,right){
      |                     ^~~~~
Language: C

#include <stdio.h>
void mg(int *,int,int,int);
void ms(int *,int,int);
int A[5000000];
int L[2500000];
int R[2500000];
int n,count=0;
int main(){
  int i;
  int l,m,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  ms(0,n);

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

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

}
void mg(*A,left,mid,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]=10000000;
  R[n2]=10000000;
  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;
    }
    count++;
  }


}

Compiler output:
main.c: In function 'main':
main.c:13:3: error: too few arguments to function 'ms'
   13 |   ms(0,n);
      |   ^~
main.c:3:6: note: declared here
    3 | void ms(int *,int,int);
      |      ^~
main.c: At top level:
main.c:24:9: error: expected declaration specifiers or '...' before '*' token
   24 | void ms(*A,left,right){
      |         ^
main.c:24:12: error: unknown type name 'left'
   24 | void ms(*A,left,right){
      |            ^~~~
main.c:24:17: error: unknown type name 'right'
   24 | void ms(*A,left,right){
      |                 ^~~~~
main.c:34:9: error: expected declaration specifiers or '...' before '*' token
   34 | void mg(*A,left,mid,right){
      |         ^
main.c:34:12: error: unknown type name 'left'
   34 | void mg(*A,left,mid,right){
      |            ^~~~
main.c:34:17: error: unknown type name 'mid'
   34 | void mg(*A,left,mid,right){
      |                 ^~~
main.c:34:21: error: unknown type name 'right'
   34 | void mg(*A,left,mid,right){
      |                     ^~~~~
Language: C

#include <stdio.h>
#define NM 500000
#define SM 1000000000
void merge(int*, int, int, int);
void mergeSort(int*, int, int);
int num;
main()
{
  int i;
  int left;
  int right;
  int n;
  int S[NM];

  scanf("%d",&n);

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

  left = 0;
  right = n;
   
  mergeSort(S, left, right);

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

  return 0;

}

void mergeSort(*A, left, 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(*A, left, mid, right)
{
  int n1, n2;
  int i,j,k;

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

  int L[n1 + 1];
  int 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] = SM;
  R[n2] = SM;

  i = 0;
  j = 0;

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

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

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main()
      | ^~~~
main.c:42:16: error: expected declaration specifiers or '...' before '*' token
   42 | void mergeSort(*A, left, right)
      |                ^
main.c:42:20: error: unknown type name 'left'
   42 | void mergeSort(*A, left, right)
      |                    ^~~~
main.c:42:26: error: unknown type name 'right'
   42 | void mergeSort(*A, left, right)
      |                          ^~~~~
main.c:55:12: error: expected declaration specifiers or '...' before '*' token
   55 | void merge(*A, left, mid, right)
      |            ^
main.c:55:16: error: unknown type name 'left'
   55 | void merge(*A, left, mid, right)
      |                ^~~~
main.c:55:22: error: unknown type name 'mid'
   55 | void merge(*A, left, mid, right)
      |                      ^~~
main.c:55:27: error: unknown type name 'right'
   55 | void merge(*A, left, mid, right)
      |                           ^~~~~
Language: C

#include<stdio.h>
#include<limits.h>
#define N 500000
#define M 300000
#define SEN INT_MAX
int n,a=0;
int L[M],R[M],S[N];
int mergeSort(int,int);
int merge(int,int,int);
main(){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  mergeSort(0,i);
  
  for(j=0;j<i;j++){
    printf("%d",A[j]);
    if(j<i-1){
      printf(" ");
    }
  }
  printf("\n");
  printf("%d\n",a);
  return 0;
}

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





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


  for(i=0;i<n1;i++) L[i]=S[left+i];
  for(i=0;i<n2;i++) R[i]=A[mid+i];
  L[n1]=SEN;
  R[n2]=SEN;

  i=0;
  j=0;
  k=0;

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

Compiler output:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | main(){
      | ^~~~
main.c: In function 'main':
main.c:16:7: error: 'j' undeclared (first use in this function)
   16 |   for(j=0;j<i;j++){
      |       ^
main.c:16:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:17: error: 'A' undeclared (first use in this function)
   17 |     printf("%d",A[j]);
      |                 ^
main.c: In function 'merge':
main.c:48:26: error: 'A' undeclared (first use in this function)
   48 |   for(i=0;i<n2;i++) R[i]=A[mid+i];
      |                          ^
Language: C

#include <stdio.h>
#define N 500000
 
int tmp[N], count;
 
void MergeSort(int data[], int l, int r){
  int mid, i, j, k;

  if(l >= r) return;
  mid = (l + r) / 2;

  MergeSort(data, l, mid);
  MergeSort(data, mid+1, r);

  for(i=l;i<=mid;i++){
 tmp[i] = data[i];
}
  for(i=mid+1,j=r;i<=r;i++,j--){
 tmp[i] = data[j];
}

  i = l;
  j = r;

  for(k=l;k<=r;k++,cnt++){
    if(tmp[i] <= tmp[j]) data[k] = tmp[i++];
    else data[k] = tmp[j--];
  }
}
 
main(){
  int n, data[N], i;

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

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

Compiler output:
main.c: In function 'MergeSort':
main.c:25:20: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   25 |   for(k=l;k<=r;k++,cnt++){
      |                    ^~~
      |                    int
main.c:25:20: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:31:1: error: return type defaults to 'int' [-Wimplicit-int]
   31 | main(){
      | ^~~~
main.c: In function 'main':
main.c:43:33: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   43 |   printf("%d\n%d\n", data[n-1], cnt);
      |                                 ^~~
      |                                 int
Language: C

#include<stdio.h>

#define INF (1<<30)

int A[500000];
int count = 0;
int R[500000],L[500000];


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

  n1 = mid - left;
  n2 = right - mid; //divided by 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] = INF;
  R[n2] = INF;

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


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

  return 0;
  
}

Compiler output:
main.c: In function 'mergeSort':
main.c:49:5: error: implicit declaration of function 'merge'; did you mean 'marge'? [-Wimplicit-function-declaration]
   49 |     merge(A,left,mid,right);
      |     ^~~~~
      |     marge
Language: C

#include <stdio.h>

#define INFTY 1000000001
#define MAX 500000

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

int cnt=0;
int n;

int main(void)
{
	int i, S[MAX];
	
	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",cnt);
	
	return 0;
}

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

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

#include<stdio.h>
#define nmax 500000

#include<stdio.h>
#define nmax 500000


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

int A[nmax],count=0;
int main(){
  
  int n;
  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\n",A[i]);
  printf("%d\n",count);

  return 0;
}

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

  for( i = 0 ; i < n1 ; i++ )
    L[i] = A[left+i];
  for(i = 0 ; i < n2 ; i++ )
    R[i] = A[mid+i];
  L[n1] = 100000000;
  R[n2] = 100000000;
  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 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,int,int);
void mergeSort(int,int);

int A[nmax],count=0;
int main(){
  
  int n;
  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\n",A[i]);
  printf("%d\n",count);

  return 0;
}

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

  for( i = 0 ; i < n1 ; i++ )
    L[i] = A[left+i];
  for(i = 0 ; i < n2 ; i++ )
    R[i] = A[mid+i];
  L[n1] = 100000000;
  R[n2] = 100000000;
  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 left,int right)
{
  int mid;

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

}

Compiler output:
main.c:78:13: error: redefinition of 'count'
   78 | int A[nmax],count=0;
      |             ^~~~~
main.c:11:13: note: previous definition of 'count' with type 'int'
   11 | int A[nmax],count=0;
      |             ^~~~~
main.c:79:5: error: redefinition of 'main'
   79 | int main(){
      |     ^~~~
main.c:12:5: note: previous definition of 'main' with type 'int()'
   12 | int main(){
      |     ^~~~
main.c:98:6: error: redefinition of 'merge'
   98 | void merge(int left,int mid,int right)
      |      ^~~~~
main.c:31:6: note: previous definition of 'merge' with type 'void(int,  int,  int)'
   31 | void merge(int left,int mid,int right)
      |      ^~~~~
main.c:128:6: error: redefinition of 'mergeSort'
  128 | void mergeSort(int left,int right)
      |      ^~~~~~~~~
main.c:61:6: note: previous definition of 'mergeSort' with type 'void(int,  int)'
   61 | void mergeSort(int left,int right)
      |      ^~~~~~~~~
Language: C

#define N 2000
int solve(int , int);
int A[N], M[N];
  int i, j, n, q, m;
int main()
{
  
  scanf("%d",&n);
  
  for(i = 0 ; i < n ; i++)
    {
      scanf("%d",&A[i]);
    }
  
  scanf("%d",&q);
  for(i = 0 ; i < q ; i++)
    {
      scanf("%d",&M[i]);
    }
  
  for(i = 0 ; i < q ; i++)
    {
      j = 0;
      if(solve(j, M[i])==1)
    {
      printf("yes\n");
    }else if(solve(j, M[i])==0){
    printf("no\n");
    }
    }
   
  
  return 0;
}
  
  
int solve(int i, int m)
{
  int res;
  if(m==0) return 1;
  
  if(i>=n) return 0;
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  
    
}}}

Compiler output:
main.c: In function 'main':
main.c:8:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    8 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define N 2000
main.c:8:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    8 |   scanf("%d",&n);
      |   ^~~~~
main.c:8:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:26:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   26 |       printf("yes\n");
      |       ^~~~~~
main.c:26:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:26:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:28:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   28 |     printf("no\n");
      |     ^~~~~~
main.c:28:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:46:2: error: expected identifier or '(' before '}' token
   46 | }}}
      |  ^
main.c:46:3: error: expected identifier or '(' before '}' token
   46 | }}}
      |   ^
Language: C

#include <stdio.h>
#include <math.h>
#define N 100000

int n, s[N], x=0;

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

  mergeSort(0,n);

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

void merge(int left, int mid, int right)
{
  int n1, n2, i, j, k, L[], R[];
  n1 = mid - left;
  n2 = right - mid;
  L = (int *)malloc(sizeof(int)*n1);
  R = (int *)malloc(sizeof(int)*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] = INFINITY;
  R[n2] = INFINITY;
  i = 0;
  j = 0;
  for(k=left; k<=right-1; k++)
    if(L[i] <= R[j]){
      s[k] = L[i];
      i = i + 1;
      x++;
    } else {
      s[k] = R[j];
      j = j + 1;
      x++;
    }
}
void mergeSort(int left, int right)
{
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}

Compiler output:
main.c: In function 'merge':
main.c:31:24: error: array size missing in 'L'
   31 |   int n1, n2, i, j, k, L[], R[];
      |                        ^
main.c:31:29: error: array size missing in 'R'
   31 |   int n1, n2, i, j, k, L[], R[];
      |                             ^
main.c:34:14: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   34 |   L = (int *)malloc(sizeof(int)*n1);
      |              ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | #define N 100000
main.c:34:14: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   34 |   L = (int *)malloc(sizeof(int)*n1);
      |              ^~~~~~
main.c:34:14: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:34:5: error: assignment to expression with array type
   34 |   L = (int *)malloc(sizeof(int)*n1);
      |     ^
main.c:35:5: error: assignment to expression with array type
   35 |   R = (int *)malloc(sizeof(int)*n2);
      |     ^
main.c:40:11: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   40 |   L[n1] = INFINITY;
      |           ^~~~~~~~
main.c:41:11: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   41 |   R[n2] = INFINITY;
      |           ^~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
#define N 100000

int n, s[N], x=0;

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

  mergeSort(0,n);

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

void merge(int left, int mid, int right)
{
  int n1, n2, i, j, k, L[], R[];
  n1 = mid - left;
  n2 = right - mid;
  L[] = (int *)malloc(sizeof(int)*n1);
  R[] = (int *)malloc(sizeof(int)*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] = INFINITY;
  R[n2] = INFINITY;
  i = 0;
  j = 0;
  for(k=left; k<=right-1; k++)
    if(L[i] <= R[j]){
      s[k] = L[i];
      i = i + 1;
      x++;
    } else {
      s[k] = R[j];
      j = j + 1;
      x++;
    }
}
void mergeSort(int left, int right)
{
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}

Compiler output:
main.c: In function 'merge':
main.c:31:24: error: array size missing in 'L'
   31 |   int n1, n2, i, j, k, L[], R[];
      |                        ^
main.c:31:29: error: array size missing in 'R'
   31 |   int n1, n2, i, j, k, L[], R[];
      |                             ^
main.c:34:5: error: expected expression before ']' token
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |     ^
main.c:34:16: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |                ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | #define N 100000
main.c:34:16: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |                ^~~~~~
main.c:34:16: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:35:5: error: expected expression before ']' token
   35 |   R[] = (int *)malloc(sizeof(int)*n2);
      |     ^
main.c:40:11: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   40 |   L[n1] = INFINITY;
      |           ^~~~~~~~
main.c:41:11: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   41 |   R[n2] = INFINITY;
      |           ^~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
#define N 100000

int n, s[N], x=0;

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

  mergeSort(0,n);

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

void merge(int left, int mid, int right)
{
  int n1, n2, i, j, k, L, R;
  n1 = mid - left;
  n2 = right - mid;
  L[] = (int *)malloc(sizeof(int)*n1);
  R[] = (int *)malloc(sizeof(int)*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] = INFINITY;
  R[n2] = INFINITY;
  i = 0;
  j = 0;
  for(k=left; k<=right-1; k++)
    if(L[i] <= R[j]){
      s[k] = L[i];
      i = i + 1;
      x++;
    } else {
      s[k] = R[j];
      j = j + 1;
      x++;
    }
}
void mergeSort(int left, int right)
{
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}

Compiler output:
main.c: In function 'merge':
main.c:34:5: error: expected expression before ']' token
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |     ^
main.c:34:16: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |                ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | #define N 100000
main.c:34:16: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |                ^~~~~~
main.c:34:16: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:35:5: error: expected expression before ']' token
   35 |   R[] = (int *)malloc(sizeof(int)*n2);
      |     ^
main.c:37:6: error: subscripted value is neither array nor pointer nor vector
   37 |     L[i] = s[left + i];
      |      ^
main.c:39:6: error: subscripted value is neither array nor pointer nor vector
   39 |     R[i] = s[mid + i];
      |      ^
main.c:40:4: error: subscripted value is neither array nor pointer nor vector
   40 |   L[n1] = INFINITY;
      |    ^
main.c:41:4: error: subscripted value is neither array nor pointer nor vector
   41 |   R[n2] = INFINITY;
      |    ^
main.c:45:9: error: subscripted value is neither array nor pointer nor vector
   45 |     if(L[i] <= R[j]){
      |         ^
main.c:45:17: error: subscripted value is neither array nor pointer nor vector
   45 |     if(L[i] <= R[j]){
      |                 ^
main.c:46:15: error: subscripted value is neither array nor pointer nor vector
   46 |       s[k] = L[i];
      |               ^
main.c:50:15: error: subscripted value is neither array nor pointer nor vector
   50 |       s[k] = R[j];
      |               ^
Language: C

#include <stdio.h>
#include <math.h>
#define N 100000

int n, s[N], x=0;

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

  mergeSort(0,n);

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

void merge(int left, int mid, int right)
{
  int n1, n2, i, j, k, L[n1], R[n2];
  n1 = mid - left;
  n2 = right - mid;
  L[] = (int *)malloc(sizeof(int)*n1);
  R[] = (int *)malloc(sizeof(int)*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] = INFINITY;
  R[n2] = INFINITY;
  i = 0;
  j = 0;
  for(k=left; k<=right-1; k++)
    if(L[i] <= R[j]){
      s[k] = L[i];
      i = i + 1;
      x++;
    } else {
      s[k] = R[j];
      j = j + 1;
      x++;
    }
}
void mergeSort(int left, int right)
{
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}

Compiler output:
main.c: In function 'merge':
main.c:34:5: error: expected expression before ']' token
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |     ^
main.c:34:16: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |                ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | #define N 100000
main.c:34:16: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   34 |   L[] = (int *)malloc(sizeof(int)*n1);
      |                ^~~~~~
main.c:34:16: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:35:5: error: expected expression before ']' token
   35 |   R[] = (int *)malloc(sizeof(int)*n2);
      |     ^
main.c:40:11: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   40 |   L[n1] = INFINITY;
      |           ^~~~~~~~
main.c:41:11: warning: overflow in conversion from 'float' to 'int' changes value from '+Inff' to '2147483647' [-Woverflow]
   41 |   R[n2] = INFINITY;
      |           ^~~~~~~~
Language: C

#include <stdio.h>

#define INFTY 100000
#define N 500000

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

int s[N];
long count;

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

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

void MergeSort(int *s,int left,int right){
  long mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(s,left,mid);
    MergeSort(s,mid,rigaht);
    Merge(s,left,mid,right);
  }
}

Compiler output:
main.c: In function 'MergeSort':
main.c:61:21: error: 'rigaht' undeclared (first use in this function); did you mean 'right'?
   61 |     MergeSort(s,mid,rigaht);
      |                     ^~~~~~
      |                     right
main.c:61:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

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

int count=0;

int main(){
  int i, n, A[500000],sum;

  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",A[n-1]);
  printf("%d\n",count);
  
  return 0;
}

void Merge(int *A, int left, int mid, int right){
  int i, j, k, L[250000], R[250000], 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]=100000;
  R[n2]=100000;
  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:
/usr/bin/ld: /tmp/ccHw0gSA.o: in function `main':
main.c:(.text+0x79): undefined reference to `MergeSort'
collect2: error: ld returned 1 exit status