Language: C++

#include <iostream>

using namespace std;

int n;
int a[500005];
int count = 0;

void merge(int l, int mid, int r) {
    int n1 = mid - l;
    int n2 = r - mid;
    int *lf = new int[n1];
    int *rt = new int[n2];
    for (int i = 0; i < n1; i++) {
        lf[i] = a[l + i];
    }
    for (int i = 0; i < n2; i++) {
        rt[i] = a[mid + i];
    }
    int i = 0;
    int j = 0;
    for (int k = l; k < r; k++) {
        count++;
        if ((lf[i] <= rt[j] && i != n1) || (j == n2)) {
            a[k] = lf[i];
            i++;
        } else {
            a[k] = rt[j];
            j++;
        }
    }
    delete(lf);
    delete(rt);#include <iostream>

    using namespace std;

    int n;
    int a[500005];
    int count = 0;

    void merge(int l, int mid, int r) {
        int n1 = mid - l;
        int n2 = r - mid;
        int *lf = new int[n1];
        int *rt = new int[n2];
        for (int i = 0; i < n1; i++) {
            lf[i] = a[l + i];
        }
        for (int i = 0; i < n2; i++) {
            rt[i] = a[mid + i];
        }
        int i = 0;
        int j = 0;
        for (int k = l; k < r; k++) {
            count++;
            if ((lf[i] <= rt[j] && i != n1) || (j == n2)) {
                a[k] = lf[i];
                i++;
            } else {
                a[k] = rt[j];
                j++;
            }
        }
    }

    void mergeSort(int l, int r) {
        if (l + 1 < r) {
            int mid = (l + r) / 2;
            mergeSort(l, mid);
            mergeSort(mid, r);
            merge(l, mid, r);
        }
    }

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

void mergeSort(int l, int r) {
    if (l + 1 < r) {
        int mid = (l + r) / 2;
        mergeSort(l, mid);
        mergeSort(mid, r);
        merge(l, mid, r);
    }
}

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

Compiler output:
a.cc:33:16: error: stray '#' in program
   33 |     delete(rt);#include <iostream>
      |                ^
a.cc: In function 'void merge(int, int, int)':
a.cc:33:17: error: 'include' was not declared in this scope
   33 |     delete(rt);#include <iostream>
      |                 ^~~~~~~
a.cc:33:34: error: expected primary-expression before '>' token
   33 |     delete(rt);#include <iostream>
      |                                  ^
a.cc:35:5: error: expected primary-expression before 'using'
   35 |     using namespace std;
      |     ^~~~~
a.cc:41:39: error: a function-definition is not allowed here before '{' token
   41 |     void merge(int l, int mid, int r) {
      |                                       ^
a.cc:66:34: error: a function-definition is not allowed here before '{' token
   66 |     void mergeSort(int l, int r) {
      |                                  ^
a.cc:75:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   75 |     int main() {
      |             ^~
a.cc:75:13: note: remove parentheses to default-initialize a variable
   75 |     int main() {
      |             ^~
      |             --
a.cc:75:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:75:16: error: a function-definition is not allowed here before '{' token
   75 |     int main() {
      |                ^