Language: C

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

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

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

Compiler output:
main.c: In function 'main':
main.c:3:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:3:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:3:15: error: 'n' undeclared (first use in this function)
    3 |   scanf("%d",&n);
      |               ^
main.c:3:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:32: error: 'A' undeclared (first use in this function)
    4 |   for(i=0;i<n;i++) scanf("%d",&A[i]);
      |                                ^
main.c:5:3: error: implicit declaration of function 'mergeSort' [-Wimplicit-function-declaration]
    5 |   mergeSort(A,0,n);
      |   ^~~~~~~~~
main.c:6:22: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    6 |   for(i=0;i<n-1;i++) printf("%d ",A[i]);
      |                      ^~~~~~
main.c:6:22: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:6:22: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:6:22: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    7 |   printf("%d\n",A[i]);
      |   ^~~~~~
main.c:7:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:8:17: error: 'count' undeclared (first use in this function)
    8 |   printf("%d\n",count);
      |                 ^~~~~
main.c: At top level:
main.c:12:6: warning: conflicting types for 'mergeSort'; have 'void(int *, int,  int)'
   12 | void mergeSort(int *A,int left,int right){
      |      ^~~~~~~~~
main.c:5:3: note: previous implicit declaration of 'mergeSort' with type 'void(int *, int,  int)'
    5 |   mergeSort(A,0,n);
      |   ^~~~~~~~~
main.c: In function 'mergeSort':
main.c:18:5: error: implicit declaration of function 'merge' [-Wimplicit-function-declaration]
   18 |     merge(A,left,mid,right);
      |     ^~~~~
main.c: At top level:
main.c:22:6: warning: conflicting types for 'merge'; have 'void(int *, int,  int,  int)'
   22 | void merge(int *A,int left,int mid,int right){
      |      ^~~~~
main.c:18:5: note: previous implicit declaration of 'merge' with type 'void(int *, int,  int,  int)'
   18 |     merge(A,left,mid,right);
      |     ^~~~~
main.c: In function 'merge':
main.c:23:21: error: 'MAX' undeclared (first use in this function)
   23 |   int n1,n2,i,j,k,L[MAX/2+2],R[MAX/2+2];
      |                     ^~~
main.c:28:11: error: 'SMAX' undeclared (first use in this function)
   28 |   L[n1] = SMAX;
      |           ^~~~
main.c:33:5: error: 'count' undeclared (first use in this function)
   33 |     count++;
      |     ^~~~~