Language: C++

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

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

void merge(int A[], int n, int left, int mid, int righat){
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i = 0; i < n1; i++)L[i] = A[left + 1];
	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+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:2:7: error: expected nested-name-specifier before 'namespase'
    2 | using namespase std;
      |       ^~~~~~~~~
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:11:18: error: 'right' was not declared in this scope; did you mean 'std::right'?
   11 |         int n2 = right - mid;
      |                  ^~~~~
      |                  std::right
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:1070:3: note: 'std::right' declared here
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:17:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   17 |                 cnt++;
      |                 ^~~
      |                 int
a.cc: In function 'int main()':
a.cc:37:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   37 |         cnt = 0;
      |         ^~~
      |         int
a.cc:39:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   39 |         cin >> n;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:45:22: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   45 |                 if(i)cout << " ";
      |                      ^~~~
      |                      std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:46:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   46 |                 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:48:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   48 |         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:48:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   48 |         cout << endl;
      |                 ^~~~
      |                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~