Language: C++

//ALDS1_5_B

#include <iostream>
#include <algorithm>
using namespace std;

const int INFTY = 1000000001;

int count;

void Merge(int A[]; int left; int mid; int right){
	int n1 = mid - left;
	int n2 = right - mid;

	int* L = new int[n1+1];
	int* R = new int[n2+1];

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

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

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

	delete[] L;
	delete[] R;
}

void mergeSort(int A[], int left, int right){
	if(left+1 >= right)
		return;

	int mid = (left + right)/2;
	mergeSort(A, left, mid);
	mergeSort(A, mid, right);
	Merge(A, left, mid, right);
}

int main(){
	int n;
  	cin >> n;
 	int a[n];
	for (int i = 0; i < n; i++) {
    		cin >> a[i];
  	}
 
  	count = 0;
  	mergeSort(a, 0, n);
 
  	cout << a[0];
  	for (int i = 1; i < n; i++) {
    		cout << ' ' << a[i];
  	}
  	cout << endl;
  	cout << count << endl;
 
  	return 0;
}

Compiler output:
a.cc:11:19: error: expected ')' before ';' token
   11 | void Merge(int A[]; int left; int mid; int right){
      |           ~       ^
      |                   )
a.cc:11:49: error: expected initializer before ')' token
   11 | void Merge(int A[]; int left; int mid; int right){
      |                                                 ^
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:46:14: error: too many arguments to function 'void Merge(int*)'
   46 |         Merge(A, left, mid, right);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:11:6: note: declared here
   11 | void Merge(int A[]; int left; int mid; int right){
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:57:9: error: reference to 'count' is ambiguous
   57 |         count = 0;
      |         ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:4:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:9:5: note:                 'int count'
    9 | int count;
      |     ^~~~~
a.cc:65:17: error: reference to 'count' is ambiguous
   65 |         cout << count << endl;
      |                 ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:9:5: note:                 'int count'
    9 | int count;
      |     ^~~~~