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

#include<iostream>
using namespace std;
#define MAX 500000
#define SMAX 1000000000

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

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

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

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

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

return 0;
}

Compiler output:
a.cc: In function 'void mergesort(int*, int, int, int)':
a.cc:30:11: error: 'a' was not declared in this scope
   30 | mergesort(a,n,left,mid);
      |           ^
a.cc:31:19: error: 'roght' was not declared in this scope; did you mean 'right'?
   31 | mergesort(a,n,mid,roght);
      |                   ^~~~~
      |                   right
a.cc: In function 'int main()':
a.cc:48:14: error: 'end1' was not declared in this scope
   48 | cout<<count<<end1;
      |              ^~~~
Language: C++

#include<iostream>
using namespace std;
#define MAX 500000
#define SMAX 1000000000

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

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

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

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

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

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:14: error: 'end1' was not declared in this scope
   48 | cout<<count<<end1;
      |              ^~~~
Language: C++

#include<iostream>
using namespace std;
#define MAX 500000
#define SMAX 1000000000

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

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

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

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

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

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:7: error: 'end1' was not declared in this scope
   48 | cout<<end1;
      |       ^~~~
Language: C++

#include<iostream>
using namespace std;
  
int Merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  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]=1000000000;
  R[n2]=1000000000;
    
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
    }
  }
  return right-left;
}
  
int Merge_Sort(int A[],int left,int right){
  int mid,res=0;
  if(left+1<right){
    mid=(left+right)/2;
  
    res+=Merge_Sort(A,left,mid);
    res+=Merge_Sort(A,mid,right);
    res+=Merge(A,left,mid,right);
      
  }
  return res;
}
  
int main(){
  int i,x,n,S[500000]; 
  cin>>n;

  int cnt=0;
  
  for(i=0;i<n;i++){
    cin>>S[i];
    if(S[i]==1e9)cnt++;  
  }

  assert(cnt<2);
  
  x=Merge_Sort(S,0,n);
    
  for(i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<S[i];
  }
  cout<<endl;
  cout<<x<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:3: error: 'assert' was not declared in this scope
   52 |   assert(cnt<2);
      |   ^~~~~~
a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    1 | #include<iostream>
  +++ |+#include <cassert>
    2 | using namespace std;
Language: C++

#include <stdio.h>
#define INF 1111111111

int l[25045] = {};
int r[25045] = {};
int c ;

void merge(int *s,int n,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] = s[mid + i];

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

  i = j = 0;
  
  for(k = left;k < right;k++){
    c++;
    if(l[i] <= r[j]){
      s[k] = l[i];
      i++;
    }
    else{
      s[k] = r[j];
      j++;
    }
  }
}

void mergesort(int *s,int n,int left,int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergesort(s,n,left,mid);
    mergesort(s,n,mid,right);
    merge(s,n,left,mid,right);
  }
}
    
int main(){
  
  int n,i,left,right;
  int s[500090] = {};
  c = 0;
  
  scanf("%d",&n);
  for(i = 0;i < n;i++) scanf("%d",&s[i]);

  
  left = 0;right = n;

  mergesort(s,n,left,right);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:64:11: error: expected ';' before '}' token
   64 |   return 0
      |           ^
      |           ;
   65 | }
      | ~
Language: C++

#include <stdio.h>
// #include <limits.h>
#define N 500000

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

int s[N], 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]=INT_MAX;
  R[n2]=INT_MAX;
  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,right);
    Merge(s,left,mid,right);
  }
}

Compiler output:
a.cc: In function 'void Merge(int*, int, int, int)':
a.cc:36:9: error: 'INT_MAX' was not declared in this scope
   36 |   L[n1]=INT_MAX;
      |         ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <stdio.h>
  +++ |+#include <climits>
    2 | // #include <limits.h>
Language: C++

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp
 */

#include <iostream>
#include <limits>
#include <sstream>
#include <vector>

void printVector(const std::vector<unsigned int> &v) {
  std::ostringstream oss;
  std::copy(v.begin(), v.end() - 1,
            std::ostream_iterator<unsigned int>(oss, " "));
  oss << v.back();
  std::cout << oss.str() << std::endl;
}

void merge(std::vector<unsigned int> &A, const unsigned int &left,
           const unsigned int &mid, const unsigned int &right) {
  unsigned int n1 = mid - left;  // 5 - 0
  unsigned int n2 = right - mid; // 9 - 6
  // L[0...n1], R[0...n2] ?????????
  std::vector<unsigned int> L(n1 + 1); // 0 1 2 3 4 MAX
  std::vector<unsigned int> R(n2 + 1); // 5 6 7 8 9 MAX

  for (size_t i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  for (size_t i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  L[n1] = std::numeric_limits<unsigned int>::max();
  R[n2] = std::numeric_limits<unsigned int>::max();
  unsigned int i = 0;
  unsigned int j = 0;
  for (size_t k = left; k < right; k++) {
    if (L[i] <= R[j]) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(std::vector<unsigned int> &A, const unsigned int &left,
               const unsigned int &right) {
  if (left + 1 < right) {
    unsigned int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(int argc, char const *argv[]) {
  std::string Param;
  std::istringstream Stream;
  unsigned int n = 0;

  getline(std::cin, Param);
  Stream.str(Param);
  Stream >> n;
  Stream.clear();

  std::vector<unsigned int> S(n);
  getline(std::cin, Param);
  Stream.str(Param);
  for (size_t i = 0; i < n; i++) {
    Stream >> S[i];
  }
  Stream.clear();

  mergeSort(S, 0, n);

  printVector(S);

  return 0;
}

Compiler output:
a.cc: In function 'void printVector(const std::vector<unsigned int>&)':
a.cc:13:18: error: 'ostream_iterator' is not a member of 'std'
   13 |             std::ostream_iterator<unsigned int>(oss, " "));
      |                  ^~~~~~~~~~~~~~~~
a.cc:9:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
    8 | #include <vector>
  +++ |+#include <iterator>
    9 | 
a.cc:13:35: error: expected primary-expression before 'unsigned'
   13 |             std::ostream_iterator<unsigned int>(oss, " "));
      |                                   ^~~~~~~~
Language: C++

#include<stdio.h>
#define N 500000
#define M 200000
void merge(int *,int,int,int);
void mergesort(int *,int,int);
int L[(N/2)+2],R[(N/2)+2];
int count;

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

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

void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++)
    {
      L[i]=A[left+i];
    }
  for(i=0;i<n2;i++)
    {
      R[i]=A[mid+i];
    }
  L[n1]=M;
  R[n2]=M;
  i=0;
  j=0;
for (k = left;k < right;k++)
    {
      count++;
      if(L[i]=>R[j]){
        A[k]=R[j];
        j=j+1;
      }
      else{
        A[k]=L[i];
        i=i+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:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:48:15: error: expected primary-expression before '>' token
   48 |       if(L[i]=>R[j]){
      |               ^
Language: C++

#include<stdio.h>
#define MAX 500000
int L[MAX/2+2], R[MAX/2+2];
int cnt;

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

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

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

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

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

  printf("%d\n", cnt);

  return 0;
}

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int, int)':
a.cc:11:5: error: 'merge' was not declared in this scope
   11 |     merge(A, n, left, mid, right);
      |     ^~~~~
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:20:19: warning: overflow in conversion from 'long int' to 'int' changes value from '20000000000' to '-1474836480' [-Woverflow]
   20 |   L[n1] = R[n2] = 20000000000;
      |                   ^~~~~~~~~~~
Language: C++

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

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

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

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

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

  cin >> n;
  for(i = 0 ; i , n ; i++){
    if(i) cout << " ";
    cout << A[i];
  }
  cout << end1;

  cout << cnt << end1;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:11: error: 'end1' was not declared in this scope
   45 |   cout << end1;
      |           ^~~~
Language: C++

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

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

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

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

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

  cin >> n;

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

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

  cout << cnt << end1;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:3: error: 'mergesort' was not declared in this scope; did you mean 'mergeSort'?
   44 |   mergesort(A, n, 0, n);
      |   ^~~~~~~~~
      |   mergeSort
a.cc:50:11: error: 'end1' was not declared in this scope
   50 |   cout << end1;
      |           ^~~~
Language: C++

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

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

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

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

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

  cin >> n;

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

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

  cout << cnt << end1;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:11: error: 'end1' was not declared in this scope
   50 |   cout << end1;
      |           ^~~~
Language: C++

#include<cstdio>
using namespace std;
int i,j,k,o,n,c,s[500000];
g(int l,int m,int r){
  int L[m-l+1],R[r-m+1];
  for(i=0;i<m-l;++i)L[i]=s[i+l];
  for(i=0;i<r-m;++i)R[i]=s[i+m];
  L[m-l]=R[r-m]=1e9,i=o=0;
  for(k=l;k<r;++c)s[k++]=L[i]>R[o]?R[o++]:L[i++];
}
e(int l,int r){
  int m=(l+r)/2;
  l+1<r?e(l,m),e(m,r),g(l,m,r):0;
}
main(){
  for(scanf("%d",&n);i<n;scanf("%d",&s[i++]));
  e(0,n);
  for(;j<n;)printf(j-n?"%d ":"%d\n",s[j++]);
  printf("%d\n",c);
}

Compiler output:
a.cc:4:1: error: ISO C++ forbids declaration of 'g' with no type [-fpermissive]
    4 | g(int l,int m,int r){
      | ^
a.cc: In function 'int g(int, int, int)':
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: At global scope:
a.cc:11:1: error: ISO C++ forbids declaration of 'e' with no type [-fpermissive]
   11 | e(int l,int r){
      | ^
a.cc: In function 'int e(int, int)':
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
a.cc: At global scope:
a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF=1LL<<55LL; 
int cnt;
void merge(int *A,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int L[n1+1],R[n2+1];
  for(int i=0;i<n1;i++) L[i]=A[left+i];
  for(int i=0;i<n2;i++) R[i]=A[mid +i];
  L[n1]=INF;
  R[n2]=INF;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]) A[k]=L[i++];
    else A[k]=R[j++];
  }
}
void mergeSort(int *A,int left,int right){
  if(left+1<right){
    int mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin>>n;
  int S[n];
  for(int i=0;i<n;i++) cin>>S[i];
  cnt=0;
  mergeSort(S,0,n);
  for(int i=0;i<n;i++) cout<<S[i]<<" \n"[i==n-1];
  cout<<cnt<<endl;
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:40:12: error: expected '}' at end of input
   40 |   return 0;
      |            ^
a.cc:29:14: note: to match this '{'
   29 | signed main(){
      |              ^
Language: C++

#include <stdio.h>

#define N 1000000000
#define inf 2147483647

int S[N],L[N/2],R[N/2];
int n,count = 0;
int l=0;

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

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

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-1;i++){
		printf("%d ",S[i]);
	}
	printf("%d\n%d\n",S[i],count);
}

Compiler output:
/tmp/ccZhfXfB.o: in function `merge(int, int, int)':
a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0xad): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x111): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x12e): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccZhfXfB.o
a.cc:(.text+0x166): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#define INF 1111111111

 int s[500090] = {};
  long l[25045] = {};
  long r[25045] = {};


void merge(left,mid,right){

  int i,j,k;
  int n1 = mid - left;
  int n2 = right - mid;

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

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

  i = j = 0;
  
  for(k = left;k < right;k++){
    if(l[i] <= r[j]){
      s[k] = l[i];
      i++;
    }
    else{
      s[k] = r[j];
      j++;
    }
  
}


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

  int n,i,left,right;
 

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

  left = 0;right = n + 1;

  mergesort(left,right);

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

Compiler output:
a.cc:9:6: error: variable or field 'merge' declared void
    9 | void merge(left,mid,right){
      |      ^~~~~
a.cc:9:12: error: 'left' was not declared in this scope
    9 | void merge(left,mid,right){
      |            ^~~~
a.cc:9:17: error: 'mid' was not declared in this scope
    9 | void merge(left,mid,right){
      |                 ^~~
a.cc:9:21: error: 'right' was not declared in this scope
    9 | void merge(left,mid,right){
      |                     ^~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <iostream>
using namespace std;

int cnt = 0;

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

int main(void)
{
	int n, s[20];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> s[i];

	mergeSort(s, 0, n - 1);

	cout << s[0];
	for (int i = 1; i < n; i++) cout << " " << s[i];
	cout << endl << cnt << endl;

	return 0;
}

void merge(int a[], int left, int mid, int right)
{	
	int n1 = mid - left + 1;
	int n2 = right - (mid + 1) + 1;
	int *l = new int[n1 + 1];
	int *r = new int[n2 + 1];
	for (int i = 0; i <= n1; i++) l[i] = a[left + i];
	for (int i = 0; i <= n2; i++) r[i] = a[(mid + 1) + i];
	l[n1] = INFINITY;
	r[n2] = INFINITY;
	
	int i = 0, j = 0;
	for (int k = left; k <= right; k++) {
		if (l[i] <= r[j]) {
			a[k] = l[i];
			i++;
		}
		else {
			a[k] = r[j];
			j++;
		}
		cnt++;
	}
	delete[] l, r;
}

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

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:35:17: error: 'INFINITY' was not declared in this scope
   35 |         l[n1] = INFINITY;
      |                 ^~~~~~~~
Language: C++

#include <stdio.h>

#define N 500000
#define MAX 1000000

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]=MAX;
  R[n2]=MAX;
  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,right);
    Merge(s,left,mid,right);
  }
}

int s[N], count;

int main(){
  int i,n,left,right;
  scanf("%d",&n);
  left=0;
  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;
}

Compiler output:
a.cc: In function 'void Merge(int*, int, int, int)':
a.cc:32:5: error: 'count' was not declared in this scope
   32 |     count++;
      |     ^~~~~
Language: C++

#include <stdio.h>

#define N 500000
#define MAX 100000

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]=MAX;
  R[n2]=MAX;
  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,right);
    Merge(s,left,mid,right);
  }
}

int s[N], count;

int main(){
  int i,n,left,right;
  scanf("%d",&n);
  left=0;
  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;
}

Compiler output:
a.cc: In function 'void Merge(int*, int, int, int)':
a.cc:32:5: error: 'count' was not declared in this scope
   32 |     count++;
      |     ^~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#define MAX 500000
#define NIL 100000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],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]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  i=0;j=0;
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k]=L[i++];
    }else{
      A[k]=R[j++];
    }
  }
}
void sort(int A[],int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    sort(A,left,mid);
    sort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  sort(A,0,n);
  for(i=0;i<n-1;i++){
    if(i)cout<<" ";
    cout << A[i];
  }
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   39 |     if(i)cout<<" ";
      |          ^~~~
      |          std::cout
In file included from a.cc:2:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:40:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   40 |     cout << A[i];
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<stdio.h>
#include<iostream>
#define MAX 500000
#define NIL 100000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],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]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  i=0;j=0;
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k]=L[i++];
    }else{
      A[k]=R[j++];
    }
  }
}
void sort(int A[],int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    sort(A,left,mid);
    sort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  sort(A,0,n);
  for(i=0;i<n-1;i++){
    if(i)cout << " ";
    cout << A[i];
  }
cout << endl;
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   39 |     if(i)cout << " ";
      |          ^~~~
      |          std::cout
In file included from a.cc:2:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:40:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   40 |     cout << A[i];
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:42:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   42 | cout << endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:42:9: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   42 | cout << endl;
      |         ^~~~
      |         std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
#define MAX 500000
#define NIL 100000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  i=0;j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k]=L[i++];
    }else{
      A[k]=R[j++];
    }
  }
}
void sort(int A[],int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    sort(A,left,mid);
    sort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  sort(A,0,n);
  for(i=0;i<n;i++){
    if(i)cout<<" ";
    cout << A[i];
  }
  cout << endl;
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:14:3: error: 'i' was not declared in this scope
   14 |   i=0;j=0;
      |   ^
a.cc:14:7: error: 'j' was not declared in this scope
   14 |   i=0;j=0;
      |       ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
#define MAX 500000
#define NIL 100000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  int i=0;j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k]=L[i++];
    }else{
      A[k]=R[j++];
    }
  }
}
void sort(int A[],int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    sort(A,left,mid);
    sort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  sort(A,0,n);
  for(i=0;i<n;i++){
    if(i)cout<<" ";
    cout << A[i];
  }
  cout << endl;
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:14:11: error: 'j' was not declared in this scope
   14 |   int i=0;j=0;
      |           ^
Language: C++

#include<cstdion>
#define MAX 500000
#define NIL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void Merge(int,int,int,int,int);

void Sort(int A[],int n,int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    Sort(A,n,left,mid);
    Sort(A,n,mid,right);
    Merge(A,n,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d", &A[i]);
  Sort(A,n,0,n);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    cout << A[i];
  }
  printf("\n");;
  printf("%d\n",cnt);
  return 0;
}
void Merge(int A[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j])
      A[k]=L[i++];
    else
      A[k]=R[j++];
  }
}

Compiler output:
a.cc:1:9: fatal error: cstdion: No such file or directory
    1 | #include<cstdion>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
#define MAX 500000
#define NIL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void Merge(int A[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j])
      A[k]=L[i++];
    else
      A[k]=R[j++];
  }
}


void Sort(int A[],int n,int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    Sort(A,n,left,mid);
    Sort(A,n,mid,right);
    Merge(A,n,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d", &A[i]);
  Sort(A,n,0,n);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    cout << A[i];
  }
  printf("\n");;
  printf("%d\n",cnt);
  return 0;
}
void Merge(int A[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j])
      A[k]=L[i++];
    else
      A[k]=R[j++];
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << A[i];
      |     ^~~~
a.cc: At global scope:
a.cc:45:6: error: redefinition of 'void Merge(int*, int, int, int, int)'
   45 | void Merge(int A[],int n,int left,int mid,int right){
      |      ^~~~~
a.cc:6:6: note: 'void Merge(int*, int, int, int, int)' previously defined here
    6 | void Merge(int A[],int n,int left,int mid,int right){
      |      ^~~~~
Language: C++

#include<cstdio>
#define MAX 500000
#define NIL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void Merge(int A[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++)L[i]=A[left+i];
  for(int i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=R[n2]=NIL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j])
      A[k]=L[i++];
    else
      A[k]=R[j++];
  }
}


void Sort(int A[],int n,int left,int right){
  if(left+1<right){
    int mid =(left+right)/2;
    Sort(A,n,left,mid);
    Sort(A,n,mid,right);
    Merge(A,n,left,mid,right);
  }
}
int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d", &A[i]);
  Sort(A,n,0,n);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    cout << A[i];
  }
  printf("\n");;
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << A[i];
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
#define MAX 1997328
#define Sentinel 19970328

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

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

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

void main(){
    ios_base::sync_with_stdio(false);
    int A[MAX],n,i;
    cnt = 0;
    cin>>n;
    for (i = 0;i<n;i++){cin>>A[i];}
    
    mergesort(A,n,0,n);
    for(i = 0;i<n;i++){
        if(i){cout<<" ";}
        cout<<A[i];
    }
    cout<<endl<<cnt<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int mergesort(int*, int, int, int)':
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
a.cc: At global scope:
a.cc:36:1: error: '::main' must return 'int'
   36 | void main(){
      | ^~~~
Language: C++

#include<iostream>
#include<stdio.h>
#define MAX 500000
#define INFTY 2000000000

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

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

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

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:21:9: error: 'i' was not declared in this scope
   21 |         i = 0;
      |         ^
a.cc: In function 'void mergeSort(int*, int, int, int)':
a.cc:38:17: error: 'mid' was not declared in this scope
   38 |                 mid = (left + right) / 2;
      |                 ^~~
Language: C++

#include<iostream>
#include<stdio.h>
#define MAX 500000
#define INFTY 2000000000

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

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

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

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int, int)':
a.cc:41:26: error: too few arguments to function 'void mergeSort(int*, int, int, int)'
   41 |                 mergeSort(A, left, mid);
      |                 ~~~~~~~~~^~~~~~~~~~~~~~
a.cc:37:6: note: declared here
   37 | void mergeSort(int A[],int n, int left, int right){
      |      ^~~~~~~~~
a.cc:42:26: error: too few arguments to function 'void mergeSort(int*, int, int, int)'
   42 |                 mergeSort(A, mid, right);
      |                 ~~~~~~~~~^~~~~~~~~~~~~~~
a.cc:37:6: note: declared here
   37 | void mergeSort(int A[],int n, int left, int right){
      |      ^~~~~~~~~
a.cc:43:22: error: too many arguments to function 'void merge(int*, int, int, int)'
   43 |                 merge(A, n, left, mid, right);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge(int A[], int left, int mid, int right){
      |      ^~~~~
Language: C++

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

int L[MAX / 2 + 1], R[MAX / 2 + 1];
int A[MAX];
int cnt = 0;

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

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

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

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:11:9: error: 'n1' was not declared in this scope
   11 |         n1 = mid - left;
      |         ^~
a.cc:12:9: error: 'n2' was not declared in this scope
   12 |         n2 = right - mid;
      |         ^~
a.cc: In function 'void mergSort(int*, int, int)':
a.cc:34:17: error: 'mergeSort' was not declared in this scope; did you mean 'mergSort'?
   34 |                 mergeSort(A, left, mid);
      |                 ^~~~~~~~~
      |                 mergSort
a.cc: In function 'int main()':
a.cc:46:9: error: 'mergeSort' was not declared in this scope; did you mean 'mergSort'?
   46 |         mergeSort(A, 0, n);
      |         ^~~~~~~~~
      |         mergSort
Language: C++

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

int L[MAX / 2 + 1], R[MAX / 2 + 1];
int A[MAX];
int cnt = 0;

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

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

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

Compiler output:
a.cc: In function 'void mergSort(int*, int, int)':
a.cc:34:17: error: 'mergeSort' was not declared in this scope; did you mean 'mergSort'?
   34 |                 mergeSort(A, left, mid);
      |                 ^~~~~~~~~
      |                 mergSort
a.cc: In function 'int main()':
a.cc:46:9: error: 'mergeSort' was not declared in this scope; did you mean 'mergSort'?
   46 |         mergeSort(A, 0, n);
      |         ^~~~~~~~~
      |         mergSort
Language: C++

#include<iostream>
using namespace std;
#define SENTINEL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],int n,int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+1];
    L[n1]=R[n2]=SENTINEL;
    int i=0,j=0;
    for(int k=left; k<right;k++)
    {
        cnt++;
        if(L[i]<=R[j])
        {
            A[k]=L[i++];
        }else
        {
            A[k]=R[j++];
        }
    }
}
void mergeSort(int A[],int n,int left,int right)
{
    if(left+<right)
    {
        int mid=(left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}
int main()
{
    int A[MAX],n,i;
    cnt=0;
    cin>>n;
    for(i=0;i<n;i++) cin>>A[i];
    mergeSort(A,n,0,n);
    for(i=0;i<n;i++)
    {
        if(i) cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<cnt<<endl;
    return 0;
}

Compiler output:
a.cc:4:7: error: 'MAX' was not declared in this scope
    4 | int L[MAX/2+2],R[MAX/2+2];
      |       ^~~
a.cc:4:18: error: 'MAX' was not declared in this scope
    4 | int L[MAX/2+2],R[MAX/2+2];
      |                  ^~~
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:10:27: error: 'L' was not declared in this scope
   10 |     for(int i=0;i<n1;i++) L[i]=A[left+i];
      |                           ^
a.cc:11:27: error: 'R' was not declared in this scope
   11 |     for(int i=0;i<n2;i++) R[i]=A[mid+1];
      |                           ^
a.cc:12:5: error: 'L' was not declared in this scope
   12 |     L[n1]=R[n2]=SENTINEL;
      |     ^
a.cc:12:11: error: 'R' was not declared in this scope
   12 |     L[n1]=R[n2]=SENTINEL;
      |           ^
a.cc: In function 'void mergeSort(int*, int, int, int)':
a.cc:28:13: error: expected primary-expression before '<' token
   28 |     if(left+<right)
      |             ^
a.cc: In function 'int main()':
a.cc:38:11: error: 'MAX' was not declared in this scope
   38 |     int A[MAX],n,i;
      |           ^~~
a.cc:41:27: error: 'A' was not declared in this scope
   41 |     for(i=0;i<n;i++) cin>>A[i];
      |                           ^
a.cc:42:15: error: 'A' was not declared in this scope
   42 |     mergeSort(A,n,0,n);
      |               ^
Language: C++

#include<iostream>
using namespace std;
#define MAX 500000
#define SEHTINEL 20000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],int n,int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        cnt++;
        if(L[i]<=R[i])
        {
            A[k]=L[i++];
        }else
        {
            A[k]=R[j++];
        }
    }
}
void mergeSort(int A[],int n,int left,int mid,int right)
{
    if(left+1<right)
    {
        int mid=(left+right)/2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}
int main()
{
    int A[MAX],n,i;
    cnt=0;
    cin>>n;
    for(i=0;i<n;i++) cin>>A[i];
    mergeSort(A,n,0,n);
    for(i=0;i<n;i++)
    {
        if(i) cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<cnt<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:13:17: error: 'SENTINEL' was not declared in this scope; did you mean 'SEHTINEL'?
   13 |     L[n1]=R[n2]=SENTINEL;
      |                 ^~~~~~~~
      |                 SEHTINEL
a.cc: In function 'void mergeSort(int*, int, int, int, int)':
a.cc:32:18: error: too few arguments to function 'void mergeSort(int*, int, int, int, int)'
   32 |         mergeSort(A,n,left,mid);
      |         ~~~~~~~~~^~~~~~~~~~~~~~
a.cc:27:6: note: declared here
   27 | void mergeSort(int A[],int n,int left,int mid,int right)
      |      ^~~~~~~~~
a.cc:33:18: error: too few arguments to function 'void mergeSort(int*, int, int, int, int)'
   33 |         mergeSort(A,n,mid,right);
      |         ~~~~~~~~~^~~~~~~~~~~~~~~
a.cc:27:6: note: declared here
   27 | void mergeSort(int A[],int n,int left,int mid,int right)
      |      ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:43:14: error: too few arguments to function 'void mergeSort(int*, int, int, int, int)'
   43 |     mergeSort(A,n,0,n);
      |     ~~~~~~~~~^~~~~~~~~
a.cc:27:6: note: declared here
   27 | void mergeSort(int A[],int n,int left,int mid,int right)
      |      ^~~~~~~~~
Language: C++

//
//  main.cpp
//  merge_sort
//
//  Created by ???????????? on 2017/10/08.
//  Copyright ?? 2017 ????????????. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <cmath>

using namespace std;

int ct = 0;

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

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


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


int main(int argc, const char * argv[]) {
    int n, i;
    scanf("%d", &n);
    int S[n];
    for (i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    merge_sort(S, 0, n);
    for (i = 0; i < n; i++){
        if(i)cout << " ";
        cout<<S[i];
    }
    cout << endl;
    cout << ct << endl;
    

    return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:28:13: error: 'INT_MAX' was not declared in this scope
   28 |     L[n1] = INT_MAX;
      |             ^~~~~~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <cmath>
  +++ |+#include <climits>
   12 |