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

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <type_traits>
#include <vector>

using namespace std;

static int comp_count = 0;


#ifndef NDEBUG
#define _DBG 1
#include <stdio.h>
#include <stdarg.h>
    void _DbgFunc(char *fn, char *fmt, ...){
        va_list arg; va_start(arg, fmt);
        fprintf(stderr, "%s(", fn);
        vprintf(fmt, arg);
        fputs(")\n", stderr);
        va_end(arg);
    }
#else
#define _DBG 0
#endif

#define DbgP(fmt, ...) \
    do { if (_DBG) fprintf(stderr, fmt, __VA_ARGS__); } while (0)

#define DbgFunc(fmt, ...) \
    do { if (_DBG) _DbgFunc(__FUNCTION__, fmt, __VA_ARGS__); } while (0)

template<typename R, typename A>
void merge(int left, int left_last, int right_last, R ar, A tmp){
    int right = left_last + 1;
    int n = right_last - left + 1;
    int t = left;
    int c = left;
    DbgFunc("%d,%d,%d,%d", left, left_last, right, right_last);

    while (left <= left_last && right <= right_last) {
        if(ar[left] <= ar[right]){
            tmp[t] = ar[left];
            left++;
        }else{
            tmp[t] = ar[right];
            right++;
        }
        t++;
    }

    while (left <= left_last) {
        tmp[t++] = ar[left++];
    }
    while (right <= right_last) {
        tmp[t++] = ar[right++];
    }

    for (int i = 0; i < n; i++) {
        ar[right_last] = tmp[right_last];
        right_last--;
    }

    comp_count += t - c;
}

template<typename R, typename A>
void m_sort(int left, int right, R ar, A tmp){
    if(left < right){
        int mid = (left + right) / 2;
        
        m_sort(left, mid, ar, tmp);
        m_sort(mid + 1, right, ar, tmp);

        merge(left, mid, right, ar, tmp);
    }
}

template<typename T>
void merge_sort(T begin, T end){
    if(begin < end){
        int n = end - begin;
        using t = decay<decltype(*begin)>::type;
        auto tmp = new t[n];
        m_sort(0, end - begin - 1, begin, tmp);
    }
}

int ar[500000];

int main(int argc, char const* argv[])
{
    int n;

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

    merge_sort(ar, ar + n);

    for (int i = 0; i < n - 1; i++) {
        printf("%d ", ar[i]);
    }
    printf("%d\n", ar[n - 1]);
    printf("%d\n", comp_count);

    return 0;
}

Compiler output:
a.cc: In function 'void merge_sort(T, T)':
a.cc:83:19: error: need 'typename' before 'std::decay<decltype (* begin)>::type' because 'std::decay<decltype (* begin)>' is a dependent scope
   83 |         using t = decay<decltype(*begin)>::type;
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                   typename 
a.cc:84:24: error: 't' does not name a type
   84 |         auto tmp = new t[n];
      |                        ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <type_traits>
#include <vector>

using namespace std;

static int comp_count = 0;


#ifndef NDEBUG
#define _DBG 1
#include <stdio.h>
#include <stdarg.h>
    void _DbgFunc(char *fn, char *fmt, ...){
        va_list arg; va_start(arg, fmt);
        fprintf(stderr, "%s(", fn);
        vprintf(fmt, arg);
        fputs(")\n", stderr);
        va_end(arg);
    }
#else
#define _DBG 0
#endif

#define DbgP(fmt, ...) \
    do { if (_DBG) fprintf(stderr, fmt, __VA_ARGS__); } while (0)

#define DbgFunc(fmt, ...) \
    do { if (_DBG) _DbgFunc(__FUNCTION__, fmt, __VA_ARGS__); } while (0)

template<typename R, typename A>
void merge(int left, int left_last, int right_last, R ar, A tmp){
    int right = left_last + 1;
    int n = right_last - left + 1;
    int t = left;
    int c = left;
    DbgFunc("%d,%d,%d,%d", left, left_last, right, right_last);

    while (left <= left_last && right <= right_last) {
        if(ar[left] <= ar[right]){
            tmp[t] = ar[left];
            left++;
        }else{
            tmp[t] = ar[right];
            right++;
        }
        t++;
    }

    while (left <= left_last) {
        tmp[t++] = ar[left++];
    }
    while (right <= right_last) {
        tmp[t++] = ar[right++];
    }

    for (int i = 0; i < n; i++) {
        ar[right_last] = tmp[right_last];
        right_last--;
    }

    comp_count += t - c;
}

template<typename R, typename A>
void m_sort(int left, int right, R ar, A tmp){
    if(left < right){
        int mid = (left + right) / 2;
        
        m_sort(left, mid, ar, tmp);
        m_sort(mid + 1, right, ar, tmp);

        merge(left, mid, right, ar, tmp);
    }
}

template<typename T>
void merge_sort(T begin, T end){
    if(begin < end){
        int n = end - begin;
        typedef decay<decltype(*begin)>::type t;
        auto tmp = new t[n];
        m_sort(0, end - begin - 1, begin, tmp);
    }
}

int ar[500000];

int main(int argc, char const* argv[])
{
    int n;

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

    merge_sort(ar, ar + n);

    for (int i = 0; i < n - 1; i++) {
        printf("%d ", ar[i]);
    }
    printf("%d\n", ar[n - 1]);
    printf("%d\n", comp_count);

    return 0;
}

Compiler output:
a.cc: In function 'void merge_sort(T, T)':
a.cc:83:17: error: need 'typename' before 'std::decay<decltype (* begin)>::type' because 'std::decay<decltype (* begin)>' is a dependent scope
   83 |         typedef decay<decltype(*begin)>::type t;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
      |                 typename 
a.cc:84:24: error: 't' does not name a type
   84 |         auto tmp = new t[n];
      |                        ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <type_traits>
#include <vector>

using namespace std;

static int comp_count = 0;


#ifndef NDEBUG
#define _DBG 1
#include <stdio.h>
#include <stdarg.h>
    void _DbgFunc(char *fn, char *fmt, ...){
        va_list arg; va_start(arg, fmt);
        fprintf(stderr, "%s(", fn);
        vprintf(fmt, arg);
        fputs(")\n", stderr);
        va_end(arg);
    }
#else
#define _DBG 0
#endif

#define DbgP(fmt, ...) \
    do { if (_DBG) fprintf(stderr, fmt, __VA_ARGS__); } while (0)

#define DbgFunc(fmt, ...) \
    do { if (_DBG) _DbgFunc(__FUNCTION__, fmt, __VA_ARGS__); } while (0)

template<typename R, typename A>
void merge(int left, int left_last, int right_last, R ar, A tmp){
    int right = left_last + 1;
    int n = right_last - left + 1;
    int t = left;
    int c = left;
    DbgFunc("%d,%d,%d,%d", left, left_last, right, right_last);

    while (left <= left_last && right <= right_last) {
        if(ar[left] <= ar[right]){
            tmp[t] = ar[left];
            left++;
        }else{
            tmp[t] = ar[right];
            right++;
        }
        t++;
    }

    while (left <= left_last) {
        tmp[t++] = ar[left++];
    }
    while (right <= right_last) {
        tmp[t++] = ar[right++];
    }

    for (int i = 0; i < n; i++) {
        ar[right_last] = tmp[right_last];
        right_last--;
    }

    comp_count += t - c;
}

template<typename R, typename A>
void m_sort(int left, int right, R ar, A tmp){
    if(left < right){
        int mid = (left + right) / 2;
        
        m_sort(left, mid, ar, tmp);
        m_sort(mid + 1, right, ar, tmp);

        merge(left, mid, right, ar, tmp);
    }
}

template<typename T>
void merge_sort(T begin, T end){
    if(begin < end){
        int n = end - begin;
        typename typedef decay<decltype(*begin)>::type t;
        auto tmp = new t[n];
        m_sort(0, end - begin - 1, begin, tmp);
    }
}

int ar[500000];

int main(int argc, char const* argv[])
{
    int n;

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

    merge_sort(ar, ar + n);

    for (int i = 0; i < n - 1; i++) {
        printf("%d ", ar[i]);
    }
    printf("%d\n", ar[n - 1]);
    printf("%d\n", comp_count);

    return 0;
}

Compiler output:
a.cc: In function 'void merge_sort(T, T)':
a.cc:83:56: error: qualified-id in declaration before 't'
   83 |         typename typedef decay<decltype(*begin)>::type t;
      |                                                        ^
a.cc:84:24: error: 't' does not name a type
   84 |         auto tmp = new t[n];
      |                        ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <type_traits>
#include <vector>

using namespace std;

static int comp_count = 0;


#ifndef NDEBUG
#define _DBG 1
#include <stdio.h>
#include <stdarg.h>
    void _DbgFunc(char *fn, char *fmt, ...){
        va_list arg; va_start(arg, fmt);
        fprintf(stderr, "%s(", fn);
        vprintf(fmt, arg);
        fputs(")\n", stderr);
        va_end(arg);
    }
#else
#define _DBG 0
#endif

#define DbgP(fmt, ...) \
    do { if (_DBG) fprintf(stderr, fmt, __VA_ARGS__); } while (0)

#define DbgFunc(fmt, ...) \
    do { if (_DBG) _DbgFunc(__FUNCTION__, fmt, __VA_ARGS__); } while (0)

template<typename R, typename A>
void merge(int left, int left_last, int right_last, R ar, A tmp){
    int right = left_last + 1;
    int n = right_last - left + 1;
    int t = left;
    int c = left;
    DbgFunc("%d,%d,%d,%d", left, left_last, right, right_last);

    while (left <= left_last && right <= right_last) {
        if(ar[left] <= ar[right]){
            tmp[t] = ar[left];
            left++;
        }else{
            tmp[t] = ar[right];
            right++;
        }
        t++;
    }

    while (left <= left_last) {
        tmp[t++] = ar[left++];
    }
    while (right <= right_last) {
        tmp[t++] = ar[right++];
    }

    for (int i = 0; i < n; i++) {
        ar[right_last] = tmp[right_last];
        right_last--;
    }

    comp_count += t - c;
}

template<typename R, typename A>
void m_sort(int left, int right, R ar, A tmp){
    if(left < right){
        int mid = (left + right) / 2;
        
        m_sort(left, mid, ar, tmp);
        m_sort(mid + 1, right, ar, tmp);

        merge(left, mid, right, ar, tmp);
    }
}

template<typename T>
void merge_sort(T begin, T end){
    if(begin < end){
        int n = end - begin;
        auto tmp = new decay<decltype(*begin)>::type[n];
        m_sort(0, end - begin - 1, begin, tmp);
    }
}

int ar[500000];

int main(int argc, char const* argv[])
{
    int n;

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

    merge_sort(ar, ar + n);

    for (int i = 0; i < n - 1; i++) {
        printf("%d ", ar[i]);
    }
    printf("%d\n", ar[n - 1]);
    printf("%d\n", comp_count);

    return 0;
}

Compiler output:
a.cc: In function 'void merge_sort(T, T)':
a.cc:83:24: error: need 'typename' before 'std::decay<decltype (* begin)>::type' because 'std::decay<decltype (* begin)>' is a dependent scope
   83 |         auto tmp = new decay<decltype(*begin)>::type[n];
      |                        ^~~~~~~~~~~~~~~~~~~~~~~
      |                        typename
Language: C++

#include <iostream>
using namespace std;

const long NUM = 500000;
long n, S[NUM], c = 0;

void merge(long A[], long left, long mid, long right) {
  long L[NUM/2], R[NUM/2], n1 = mid - left, 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] = numeric_limits<long>::max();

  long i = 0, j = 0;

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

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

int main() {
  cin >> n;
  for (long i = 0; i < n; i++)
    cin >> S[i];

  mergeSort(S, 0, n);

  for (long i = 0; i < n; i++) {
    if (i) cout << ' ';
    cout << S[i];
  }
  cout << endl;
  cout << c << endl;

  return 0;
}

Compiler output:
a.cc: In function 'void merge(long int*, long int, long int, long int)':
a.cc:15:19: error: 'numeric_limits' was not declared in this scope
   15 |   L[n1] = R[n2] = numeric_limits<long>::max();
      |                   ^~~~~~~~~~~~~~
a.cc:15:34: error: expected primary-expression before 'long'
   15 |   L[n1] = R[n2] = numeric_limits<long>::max();
      |                                  ^~~~
Language: C++

#include <iostream>
using namespace std;

int INF = 1234567890;

int L[300000];
int R[300000];
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] = INF;
    R[n2] = INF;

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

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

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

    for (int i = 0; i < n ; ++i) {
        if( i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:32:9: error: 'mergesort' was not declared in this scope; did you mean 'mergeSort'?
   32 |         mergesort(A,mid,right);
      |         ^~~~~~~~~
      |         mergeSort
Language: C++


#include <iostream>
using namespace std;

int INF = 1234567890;

int L[300000];
int R[300000];
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] = INF;
    R[n2] = INF;

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

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

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

    for (int i = 0; i < n ; ++i) {
        if( i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:33:9: error: 'mergesort' was not declared in this scope; did you mean 'mergeSort'?
   33 |         mergesort(A,mid,right);
      |         ^~~~~~~~~
      |         mergeSort
Language: C++

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

int merge_sort(int *array, int left, int right);
int merge(int *array, int left, int mid, int right);
void print_array(int *array, int size);
int main(){
	int n;

	cin >> n;

	int* array = (int*)malloc(n * sizeof(int));
	int result = 0;

	if(n < 1){
		return 0;
	}

	for(int i = 0; i < n; i++){
		cin >> array[i];
	}
	result = merge_sort(array, 0, n);
	print_array(array, n);
	cout << result <<endl;
	return 0;
}

int merge_sort(int *array, int left, int right){
	int swap_num = 0;
	if(left+1 < right){
		int mid = (left + right) >> 1;
		swap_num += merge_sort(array, mid, right);
		swap_num += merge_sort(array, left, mid);
		swap_num += merge(array, left, mid, right);
	}

	return swap_num;
}
int merge(int *array, int left, int mid, int right){
	int swap_num = 0;
	int n1 = mid - left;
	int n2 = right - mid;

	int* L = (int*)malloc((n1+1) * sizeof(int));
	int* R = (int*)malloc((n2+1) * sizeof(int));

	for(int i = 0; i < n1; ++i){
		L[i] = array[left + i];
	}
	L[n1] = INT_MAX;
	for(int i = 0; i < n2; ++i){
		R[i] = array[mid + i];
	}
	R[n2] = INT_MAX;

	int i = 0;
	int j = 0;
	for(int k = left; k < right; ++k){
		if(L[i] <= R[j]){
			array[k] = L[i];
			++i;
		}else{
			array[k] = R[j];
			++j;
		}
	}
	swap_num = right - left;
	return swap_num;
}


void print_array(int *array, int size){
	for(int i = 0; i < size; i++){
		cout <<  array[i];
		if(i != size - 1){
		cout << " " ;
		}
	}
	cout << endl;
}

Compiler output:
a.cc: In function 'int merge(int*, int, int, int)':
a.cc:51:17: error: 'INT_MAX' was not declared in this scope
   51 |         L[n1] = INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <iostream>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int cnt = 0;

void merge(vector<int>& A, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	
	vector<int> L(n1 + 1), R(n2 + 1);
	for (int i = 0; i <= n1 - 1; ++i)
		L[i] = A[left + i];
	for (int i = 0; i <= n2 - 1; ++i)
		R[i] = A[mid + i];
	L[n1] = R[n2] = INT_MAX;

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

void mergeSort(vector<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()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	
	vector<int> S(n);
	for (int i = 0; i < n; ++i)
		cin >> S[i];

	mergeSort(S, 0, n);

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

	return 0;
}

Compiler output:
a.cc: In function 'void merge(std::vector<int>&, int, int, int)':
a.cc:18:25: error: 'INT_MAX' was not declared in this scope
   18 |         L[n1] = R[n2] = INT_MAX;
      |                         ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: C++

#include <stdio.h>
#define N 4000000000
#define INF 200000000
int S[N],L[N],R[N];
int count=0;
void merge(int[],int,int,int);
void mergeSort(int[],int ,int);
int main()
{
  int i,n;
  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%d\n",S[i],count);
  return 0;
}
void merge(int S[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  n1= mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
    L[i]=S[left +i];
  }
  for(j=0;j<n2;j++){
    R[j]=S[mid+j];
  }
    L[n1]=INF;
    R[n2]=INF;
    i=0;
    j=0;
  
  for(k=left;k<right;k++){
    count++;
    if(L[i]<R[j]){
      S[k]=L[i];
      i=i+1;
    }
      else {
      S[k]=R[j];
      j=j+1;
      }
  }
}

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

Compiler output:
/tmp/cc921Hv5.o: in function `main':
a.cc:(.text+0xc6): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/cc921Hv5.o
/tmp/cc921Hv5.o: in function `merge(int*, int, int, int)':
a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x1c1): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x1dc): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x202): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x20b): relocation truncated to fit: R_X86_64_PC32 against symbol `count' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x21f): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x265): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/cc921Hv5.o
a.cc:(.text+0x298): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

{
  int i,n,A[MAX_DATA];

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

    mergeSort(A, 0, n - 1);

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

   printf("\n");
    return 0;
}



void mergesort(int temp[], int left, int right)
{
  int mid;

  if (left+1 < right)
  {
    mid = (left + right)/2;
    m_sort(temp, left, mid);
    m_sort(temp, mid+1, right);

    merge(temp, left, mid+1, right);
  }
}


void merge(int temp[], int left, int mid, int right)
{
  int i, left_end, num_elements, tmp_pos;

  left_end = mid - 1;
  tmp_pos = left;
  num_elements = right - left + 1;

  while ((left <= left_end) && (mid <= right))
  {
    if (numbers[left] <= numbers[mid])
    {
      temp[tmp_pos] = numbers[left];
      tmp_pos = tmp_pos + 1;
      left = left +1;
    }
    else
    {
      temp[tmp_pos] = numbers[mid];
      tmp_pos = tmp_pos + 1;
      mid = mid + 1;
    }
  }

  while (left <= left_end)
  {
    temp[tmp_pos] = numbers[left];
    left = left + 1;
    tmp_pos = tmp_pos + 1;
  }
  while (mid <= right)
  {
    temp[tmp_pos] = numbers[mid];
    mid = mid + 1;
    tmp_pos = tmp_pos + 1;
  }

  for (i=0; i <= num_elements; i++)
  {
    numbers[right] = temp[right];
    right = right - 1;
  }
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before '{' token
    1 | {
      | ^
a.cc: In function 'void mergesort(int*, int, int)':
a.cc:27:5: error: 'm_sort' was not declared in this scope
   27 |     m_sort(temp, left, mid);
      |     ^~~~~~
a.cc:30:5: error: 'merge' was not declared in this scope
   30 |     merge(temp, left, mid+1, right);
      |     ^~~~~
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:45:9: error: 'numbers' was not declared in this scope
   45 |     if (numbers[left] <= numbers[mid])
      |         ^~~~~~~
a.cc:61:21: error: 'numbers' was not declared in this scope
   61 |     temp[tmp_pos] = numbers[left];
      |                     ^~~~~~~
a.cc:67:21: error: 'numbers' was not declared in this scope
   67 |     temp[tmp_pos] = numbers[mid];
      |                     ^~~~~~~
a.cc:74:5: error: 'numbers' was not declared in this scope
   74 |     numbers[right] = temp[right];
      |     ^~~~~~~
Language: C++

#include<stdio.h>
#define MAX 50000
#define SENTINEL 2000000000

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

void merge( int A[] , int n , int left , int mid , int right ) {
  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] = SENTINEL;
  R[n2] = SENTINEL;

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i;
  c = 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 << end1;
  cout << c << end1;
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:10:3: error: 'n1' was not declared in this scope; did you mean 'n'?
   10 |   n1 = mid -left;
      |   ^~
      |   n
a.cc:11:3: error: 'n2' was not declared in this scope; did you mean 'n'?
   11 |   n2 = right - mid;
      |   ^~
      |   n
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:37:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   37 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:44:3: error: 'cin' was not declared in this scope
   44 |   cin >> n;
      |   ^~~
a.cc:47:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   47 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:29:6: note: declared here
   29 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
a.cc:50:11: error: 'cout' was not declared in this scope
   50 |     if(i) cout << " ";
      |           ^~~~
a.cc:52:3: error: 'cout' was not declared in this scope
   52 |   cout << end1;
      |   ^~~~
a.cc:52:11: error: 'end1' was not declared in this scope
   52 |   cout << end1;
      |           ^~~~
Language: C++

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

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

void merge( int A[] , int n , int left , int mid , int right ) {
  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] = SENTINEL;
  R[n2] = SENTINEL;

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i;
  c = 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 << end1;
  cout << c << end1;
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:11:3: error: 'n1' was not declared in this scope; did you mean 'n'?
   11 |   n1 = mid -left;
      |   ^~
      |   n
a.cc:12:3: error: 'n2' was not declared in this scope; did you mean 'n'?
   12 |   n2 = right - mid;
      |   ^~
      |   n
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:38:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   38 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:48:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   48 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:30:6: note: declared here
   30 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
a.cc:53:11: error: 'end1' was not declared in this scope
   53 |   cout << end1;
      |           ^~~~
Language: C++

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

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

void merge( int A[] , int n , int left , int mid , int right ) {
  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] = SENTINEL;
  R[n2] = SENTINEL;

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i;
  c = 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 << endl;
  cout << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:11:3: error: 'n1' was not declared in this scope; did you mean 'n'?
   11 |   n1 = mid -left;
      |   ^~
      |   n
a.cc:12:3: error: 'n2' was not declared in this scope; did you mean 'n'?
   12 |   n2 = right - mid;
      |   ^~
      |   n
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:38:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   38 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:48:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   48 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:30:6: note: declared here
   30 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
Language: C++

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

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

void merge( int A[] , int n , int left , int mid , int right ) {
  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] = SENTINEL;
  R[n2] = SENTINEL;

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i,cout,endl;
  c = 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 << endl;
  cout << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:11:3: error: 'n1' was not declared in this scope; did you mean 'n'?
   11 |   n1 = mid -left;
      |   ^~
      |   n
a.cc:12:3: error: 'n2' was not declared in this scope; did you mean 'n'?
   12 |   n2 = right - mid;
      |   ^~
      |   n
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:38:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   38 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:48:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   48 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:30:6: note: declared here
   30 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
a.cc:51:16: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<'
   51 |     if(i) cout << " ";
      |           ~~~~ ^~ ~~~
      |           |       |
      |           int     const char [2]
Language: C++

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

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

void merge( int A[] , int n , int left , int mid , int right ) {
  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] = SENTINEL;
  R[n2] = SENTINEL;

  i = 0;
  j = 0;

  for( k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i,cout,endl;
  c = 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 << endl;
  cout << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:11:3: error: 'n1' was not declared in this scope; did you mean 'n'?
   11 |   n1 = mid -left;
      |   ^~
      |   n
a.cc:12:3: error: 'n2' was not declared in this scope; did you mean 'n'?
   12 |   n2 = right - mid;
      |   ^~
      |   n
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:38:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   38 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:48:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   48 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:30:6: note: declared here
   30 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
a.cc:51:16: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<'
   51 |     if(i) cout << " ";
      |           ~~~~ ^~ ~~~
      |           |       |
      |           int     const char [2]
Language: C++

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

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

void merge( int A[] , int n , int left , int mid , int right ) {
  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] = SENTINEL;
  R[n2] = SENTINEL;

  int i = 0, j = 0;

  for( k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i;
  c = 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 << endl;
  cout << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int)':
a.cc:12:8: error: 'i' was not declared in this scope
   12 |   for( i = 0 ; i < n1 ; i++) L[i] = A[left + i];
      |        ^
a.cc:13:8: error: 'i' was not declared in this scope
   13 |   for( i = 0 ; i < n2 ; i++) R[i] = A[mid + i];
      |        ^
a.cc:20:8: error: 'k' was not declared in this scope
   20 |   for( k = left ; k < right ; k++ ) {
      |        ^
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:36:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   36 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:46:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   46 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:28:6: note: declared here
   28 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
Language: C++

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

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

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] = SENTINEL;
  R[n2] = SENTINEL;

  int i = 0, j = 0;

  for( int k = left ; k < right ; k++ ) {
    c++;
    if( L[i] <= R[j] ) A[k] = L[i++];
    else A[k] = R[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 A[MAX],n,i;
  c = 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 << endl;
  cout << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:36:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   36 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:46:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   46 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:28:6: note: declared here
   28 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
Language: C++

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

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

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++ ) {
    c++;
    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);
  }
}

int main() {
  int A[MAX],n,i;
  c = 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 << endl;
  cout << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:34:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   34 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:44:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   44 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:27:6: note: declared here
   27 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
Language: C++

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

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

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++ ) {
    c++;
    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);
  }
}

int main() {
  int A[MAX],n,i;
  c = 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 << c << endl;
  return 0;
}

Compiler output:
a.cc: In function 'void mergeSort(int*, int, int)':
a.cc:34:8: error: too few arguments to function 'void merge(int*, int, int, int, int)'
   34 |   merge( A , left , mid , right);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void merge( int A[] , int n , int left , int mid , int right ) {
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:44:12: error: too many arguments to function 'void mergeSort(int*, int, int)'
   44 |   mergeSort(A,n,0,n);
      |   ~~~~~~~~~^~~~~~~~~
a.cc:27:6: note: declared here
   27 | void mergeSort( int A[] , int left , int right ) {
      |      ^~~~~~~~~
Language: C++


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <stdio.h>
#define N 1000000
  
int A[N];
int c=0;
 
 
void Merge(int [],int,int,int);
 
void Merge_Sort(int [],int,int);
 
 
int main(){
    int n,i;
      
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
 
    Merge_Sort(A,0,n);
 
      
   for(i=0;i<n-1;i++){
        printf("%d ",A[i]);
    }
    printf("%d\n",A[n-1]);
    printf("%d\n",c);
    return 0;
      
}
 
 
void Merge(int A[],int left,int mid,int right){
    int n1,n2;
    int i=0,j=0,k;
    int L[N],R[N];
      
    n1=mid-left;
    n2=right-mid;
      
    for(i=0;i<n1;i++){
      L[i]=A[left+i];
    }
    for(j=0;j<n2;j++){
      R[j]=A[mid+j];
    }
     
    i=0;
    j=0;
     
    L[n1] = 2147483647;
    R[n2] = 2147483647;
    for(k=left;k<right;k++){
      if(L[i]<=R[j]){
    A[k]=L[i];
    c++;
    i++;
      }else{
    A[k]=R[j];
    c++;
    j++;
      }
    }
     
}
 
 
 
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);
  }
}

Compiler output:
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 60
      | ^~
a.cc: In function 'int main()':
a.cc:36:5: error: 'scanf' was not declared in this scope
   36 |     scanf("%d",&n);
      |     ^~~~~
a.cc:45:9: error: 'printf' was not declared in this scope
   45 |         printf("%d ",A[i]);
      |         ^~~~~~
a.cc:22:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
   21 | #include <stdio.h>
  +++ |+#include <cstdio>
   22 | #define N 1000000
a.cc:47:5: error: 'printf' was not declared in this scope
   47 |     printf("%d\n",A[n-1]);
      |     ^~~~~~
a.cc:47:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
using namespace std;

int cnt=0;

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

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




int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int A[n];
	for(i=0; i<n; i++){
		cin >> A[i];
	}
	
	merge_sort(A, 0, n-1);
	for(int i=0; i<n; i++){
		if(i==0) cout << A[i];
		else cout << " " << A[i];
	}
	cout << "\n" << cnt << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:16:17: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   16 |         L[n1] = 10000000000;
      |                 ^~~~~~~~~~~
a.cc:17:17: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   17 |         R[n2] = 10000000000;
      |                 ^~~~~~~~~~~
a.cc: In function 'void merge_sort(int*, int, int)':
a.cc:34:17: error: 'mid' was not declared in this scope
   34 |                 mid = (left+right)/2;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:49:13: error: 'i' was not declared in this scope
   49 |         for(i=0; i<n; i++){
      |             ^
Language: C++

#include <iostream>
using namespace std;
void mergeSort(int* a, int low, int high, int& cmpr);
void merge(int*a, int low, int mid, int high, int& cmpr);
void merge(int* a, int low, int mid, int high, int& cmpr) {
   int lSize = mid - low;
   int rSize = high - mid;
   int lIndex = 0;
   int rIndex = 0;
   int b[lSize + rSize];
   int cur = 0;
   while(lIndex < lSize && rIndex < rSize) {
       cmpr++;
       if (a[lIndex] <= a[rIndex]) {
          b[cur++] = a[lIndex++];
       }
       else {
          b[cur++] = a[rIndex++];
       }
   }
   while(lIndex < lSize) {
       b[cur++] = a[lIndex++];
   }
   while(rIndex < rSize) {
       b[cur++] = a[rIndex++];
   }
   for (int i = left; i < right; i ++) {
       a[i] = b[i - left];
   }
   
}
void mergeSort(int*a, int low, int high, int& cmpr) {
   if (low + 1 >= high) {
      return;
   }
   int mid = (low + high) / 2;
   mergeSort(a, low, mid, cmpr);
   mergeSort(a, mid, high, cmpr);
   merge(a, low, mid, high, cmpr);
}
int main() {
   int n;
   cin >> n;
   int a[n];
   for (int i = 0; i < n; i ++) {
       cin >> a[i];
   }
   int cmpr = 0;
   mergetSort(a, 0, n, cmpr);
   for (int i = 0; i < n; i ++) {
       cout << a[i] << " ";
   }
   cout << endl;
   cout << cmpr;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int&)':
a.cc:27:17: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   27 |    for (int i = left; i < right; i ++) {
      |                 ^~~~
      |                 |
      |                 std::ios_base& (*)(std::ios_base&)
a.cc:27:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |    for (int i = left; i < right; i ++) {
      |                       ~~^~~~~~~
a.cc:28:19: error: invalid operands of types 'int' and 'std::ios_base&(std::ios_base&)' to binary 'operator-'
   28 |        a[i] = b[i - left];
      |                 ~ ^ ~~~~
      |                 |   |
      |                 int std::ios_base&(std::ios_base&)
a.cc: In function 'int main()':
a.cc:49:4: error: 'mergetSort' was not declared in this scope; did you mean 'mergeSort'?
   49 |    mergetSort(a, 0, n, cmpr);
      |    ^~~~~~~~~~
      |    mergeSort
Language: C++

#include <iostream>
using namespace std;
void mergeSort(int* a, int low, int high, int& cmpr);
void merge(int*a, int low, int mid, int high, int& cmpr);
void merge(int* a, int low, int mid, int high, int& cmpr) {
   int lSize = mid - low;
   int rSize = high - mid;
   int lIndex = 0;
   int rIndex = 0;
   int b[lSize + rSize];
   int cur = 0;
   while(lIndex < lSize && rIndex < rSize) {
       cmpr++;
       if (a[lIndex] <= a[rIndex]) {
          b[cur++] = a[lIndex++];
       }
       else {
          b[cur++] = a[rIndex++];
       }
   }
   while(lIndex < lSize) {
       b[cur++] = a[lIndex++];
   }
   while(rIndex < rSize) {
       b[cur++] = a[rIndex++];
   }
   for (int i = low; i < high; i ++) {
       a[i] = b[i - left];
   }
    
}
void mergeSort(int*a, int low, int high, int& cmpr) {
   if (low + 1 >= high) {
      return;
   }
   int mid = (low + high) / 2;
   mergeSort(a, low, mid, cmpr);
   mergeSort(a, mid, high, cmpr);
   merge(a, low, mid, high, cmpr);
}
int main() {
   int n;
   cin >> n;
   int a[n];
   for (int i = 0; i < n; i ++) {
       cin >> a[i];
   }
   int cmpr = 0;
   mergetSort(a, 0, n, cmpr);
   for (int i = 0; i < n; i ++) {
       cout << a[i] << " ";
   }
   cout << endl;
   cout << cmpr;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int, int&)':
a.cc:28:19: error: invalid operands of types 'int' and 'std::ios_base&(std::ios_base&)' to binary 'operator-'
   28 |        a[i] = b[i - left];
      |                 ~ ^ ~~~~
      |                 |   |
      |                 int std::ios_base&(std::ios_base&)
a.cc: In function 'int main()':
a.cc:49:4: error: 'mergetSort' was not declared in this scope; did you mean 'mergeSort'?
   49 |    mergetSort(a, 0, n, cmpr);
      |    ^~~~~~~~~~
      |    mergeSort