Language: C++

#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
int L[MAX/2 + 2], R[MAX/2 +2];
int count = 0;
??
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] = SENTINEL;
????????R[n2] = SENTINEL;
????????i = 0;
????????j = 0;
????????for(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 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];
????????int i, n;
??scanf("%d", &n);
??for(i = 0; i < n; i++)
??scanf("%d", &A[i]);
??
??mergeSort(A, 0, n);
??
??for(i = 0; i < n; i++) {
??????????????
??if(i == n-1)
????printf("%d\n", A[i]);
????else
????printf("%d ", A[i]);
????????}
??
????????printf("%d\n", count);
????????return 0;
}

Compiler output:
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ??
      | ^
a.cc:30:1: error: expected unqualified-id before '?' token
   30 | ??
      | ^
a.cc: In function 'int main()':
a.cc:41:2: error: expected primary-expression before '?' token
   41 | {????
      |  ^
a.cc:41:3: error: expected primary-expression before '?' token
   41 | {????
      |   ^
a.cc:41:4: error: expected primary-expression before '?' token
   41 | {????
      |    ^
a.cc:41:5: error: expected primary-expression before '?' token
   41 | {????
      |     ^
a.cc:42:1: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      | ^
a.cc:42:2: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |  ^
a.cc:42:3: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |   ^
a.cc:42:4: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |    ^
a.cc:42:5: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |     ^
a.cc:42:6: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |      ^
a.cc:42:7: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |       ^
a.cc:42:8: error: expected primary-expression before '?' token
   42 | ????????int A[MAX];
      |        ^
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:42:9: error: expected ':' before 'int'
   42 | ????????int A[MAX];
      |         ^~~
      |         :
a.cc:42:9: error: expected primary-expression before 'int'
   42 | ????????int A[MAX];
      |         ^~~
a.cc:43:1: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      | ^
a.cc:43:2: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |  ^
a.cc:43:3: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |   ^
a.cc:43:4: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |    ^
a.cc:43:5: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |     ^
a.cc:43:6: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |      ^
a.cc:43:7: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |       ^
a.cc:43:8: error: expected primary-expression before '?' token
   43 | ????????int i, n;
      |        ^
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:43:9: error: expected ':' before 'int'
   43 | ????????int i, n;
      |         ^~~
      |         :
a.cc:43:9: error: expected primary-expression before 'int'
   43 | ????????int i, n;
      |         ^~~
a.cc:44:1: error: expected primary-expression before '?' token
   44 | ??scanf("%d", &n);
      | ^
a.cc:44:2: error: expected primary-expression before '?' token
   44 | ??scanf("%d", &n);
      |  ^
a.cc:44:16: error: 'n' was not declared in this scope
   44 | ??scanf("%d", &n);
      |                ^
a.cc:44:18: error: expected ':' before ';' token
   44 | ??scanf("%d", &n);
      |                  ^
      |                  :
a.cc:44:18: error: expected primary-expression before ';' token
a.cc:44:18: error: expected ':' before ';' token
   44 | ??scanf("%d", &n);
      |                  ^
      |                  :
a.cc:44:18: error: expected primary-expression before ';' token
a.cc:45:1: error: expected primary-expression before '?' token
   45 | ??for(i = 0; i < n; i++)
      | ^
a.cc:45:2: error: expected primary-expression before '?' token
   45 | ??for(i = 0; i < n; i++)
      |  ^
a.cc:45:3: error: expected primary-expression before 'for'
   45 | ??for(i = 0; i < n; i++)
      |   ^~~
a.cc:45:3: error: expected ':' before 'for'
   45 | ??for(i = 0; i < n; i++)
      |   ^~~
      |   :
a.cc:45:3: error: expected primary-expression before 'for'
   45 | ??for(i = 0; i < n; i++)
      |   ^~~
a.cc:45:3: error: expected ':' before 'for'
   45 | ??for(i = 0; i < n; i++)
      |   ^~~
      |   :
a.cc:45:3: error: expected primary-expression before 'for'
   45 | ??for(i = 0; i < n; i++)
      |   ^~~
a.cc:45:14: error: 'i' was not declared in this scope
   45 | ??for(i = 0; i < n; i++)
      |              ^
a.cc:47:1: error: expected primary-expression before '?' token
   47 | ??
      | ^
a.cc:47:2: error: expected primary-expression before '?' token
   47 | ??
      |  ^
a.cc:48:1: error: expected primary-expression before '?' token
   48 | ??mergeSort(A, 0, n);
      | ^
a.cc:48:2: error: expected primary-expression before '?' token
   48 | ??mergeSort(A, 0, n);
      |  ^
a.cc:48:13: error: 'A' was not declared in this scope
   48 | ??mergeSort(A, 0, n);
      |             ^
a.cc:48:3: error: 'mergeSort' was not declared in this scope
   48 | ??mergeSort(A, 0, n);
      |   ^~~~~~~~~
a.cc:48:21: error: expected ':' before ';' token
   48 | ??mergeSort(A, 0, n);
      |                     ^
      |                     :
a.cc:48:21: error: expected primary-expression before ';' token
a.cc:48:21: error: expected ':' before ';' token
   48 | ??mergeSort(A, 0, n);
      |                     ^
      |                     :
a.cc:48:21: error: expected primary-expression before ';' token
a.cc:48:21: error: expected ':' before ';' token
   48 | ??mergeSort(A, 0, n);
      |                     ^
      |                     :
a.cc:48:21: error: expected primary-expression before ';' token
a.cc:48:21: error: expected ':' before ';' token
   48 | ??mergeSort(A, 0, n);
      |                     ^
      |                     :
a.cc:48:21: error: expected primary-expression before ';' token
a.cc:49:1: error: expected primary-expression before '?' token
   49 | ??
      | ^
a.cc:49:2: error: expected primary-expression before '?' token
   49 | ??
      |  ^
a.cc:50:1: error: expected primary-expression before '?' token
   50 | ??for(i = 0; i < n; i++) {
      | ^
a.cc:50:2: error: expected primary-expression before '?' token
   50 | ??for(i = 0; i < n; i++) {
      |  ^
a.cc:50:3: error: expected primary-expression before 'for'
   50 | ??for(i = 0; i < n; i++) {
      |   ^~~
a.cc:50:3: error: expected ':' before 'for'
   50 | ??for(i = 0; i < n; i++