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

#include <iostream>
#include <cstdio>
using namespace std;
long long ll;

int S = 0, cnt = 0;
ll A[200000];
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
        S++;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    /*for(int i = 0;i < n;i++){
        if(i)printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", S);*/
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll A[200000];
      | ^~
a.cc: In function 'int merge(int, int, int)':
a.cc:11:7: error: expected ';' before 'L'
   11 |     ll L[n1 + 1], R[n2 + 1];
      |       ^~
      |       ;
a.cc:12:26: error: 'L' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:13:33: error: 'A' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:16:34: error: 'L' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:16:48: error: 'A' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'int main()':
a.cc:34:42: error: 'A' was not declared in this scope
   34 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
long long ll;

int S = 0, cnt = 0;
ll A[20000];
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
        S++;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    /*for(int i = 0;i < n;i++){
        if(i)printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", S);*/
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll A[20000];
      | ^~
a.cc: In function 'int merge(int, int, int)':
a.cc:11:7: error: expected ';' before 'L'
   11 |     ll L[n1 + 1], R[n2 + 1];
      |       ^~
      |       ;
a.cc:12:26: error: 'L' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:13:33: error: 'A' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:16:34: error: 'L' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:16:48: error: 'A' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'int main()':
a.cc:34:42: error: 'A' was not declared in this scope
   34 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
long long ll;

int S = 0, cnt = 0;
ll A[200];
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
        S++;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    /*for(int i = 0;i < n;i++){
        if(i)printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", S);*/
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll A[200];
      | ^~
a.cc: In function 'int merge(int, int, int)':
a.cc:11:7: error: expected ';' before 'L'
   11 |     ll L[n1 + 1], R[n2 + 1];
      |       ^~
      |       ;
a.cc:12:26: error: 'L' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:13:33: error: 'A' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:16:34: error: 'L' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:16:48: error: 'A' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'int main()':
a.cc:34:42: error: 'A' was not declared in this scope
   34 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
long long ll;

int S = 0, cnt = 0;
ll A[2000];
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
        S++;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    /*for(int i = 0;i < n;i++){
        if(i)printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", S);*/
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll A[2000];
      | ^~
a.cc: In function 'int merge(int, int, int)':
a.cc:11:7: error: expected ';' before 'L'
   11 |     ll L[n1 + 1], R[n2 + 1];
      |       ^~
      |       ;
a.cc:12:26: error: 'L' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:13:33: error: 'A' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:16:34: error: 'L' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:16:48: error: 'A' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'int main()':
a.cc:34:42: error: 'A' was not declared in this scope
   34 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
long long ll;

int S = 0, cnt = 0;
ll A[2000];
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    int L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
        S++;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    /*for(int i = 0;i < n;i++){
        if(i)printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", S);*/
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll A[2000];
      | ^~
a.cc: In function 'int merge(int, int, int)':
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:13:33: error: 'A' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:16:48: error: 'A' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'int main()':
a.cc:34:42: error: 'A' was not declared in this scope
   34 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
long long ll;

int S = 0, cnt = 0;
ll A[2000000];
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++, S++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'll' does not name a type
    7 | ll A[2000000];
      | ^~
a.cc: In function 'int merge(int, int, int)':
a.cc:11:7: error: expected ';' before 'L'
   11 |     ll L[n1 + 1], R[n2 + 1];
      |       ^~
      |       ;
a.cc:12:26: error: 'L' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:13:33: error: 'A' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:16:34: error: 'L' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:16:48: error: 'A' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
a.cc: In function 'int main()':
a.cc:33:42: error: 'A' was not declared in this scope
   33 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

int S = 0, cnt = 0;
ll A[2000000], cnt = 0;
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++, S++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc:7:16: error: conflicting declaration 'll cnt'
    7 | ll A[2000000], cnt = 0;
      |                ^~~
a.cc:6:12: note: previous declaration as 'int cnt'
    6 | int S = 0, cnt = 0;
      |            ^~~
a.cc: In function 'int merge(int, int, int)':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

ll A[2000000], cnt = 0;
 
int merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    ll L[n1 + 1], R[n2 + 1];
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

int mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
mergeSort();
	printf("%d\n", cnt);
     
    return 0;
}

Compiler output:
a.cc: In function 'int merge(int, int, int)':
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
a.cc: In function 'int mergeSort(int, int)':
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
a.cc: In function 'int main()':
a.cc:33:10: error: too few arguments to function 'int mergeSort(int, int)'
   33 | mergeSort();
      | ~~~~~~~~~^~
a.cc:20:5: note: declared here
   20 | int mergeSort(int l, int r){
      |     ^~~~~~~~~
Language: C++

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

long long cnt = 0;
int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
 
void merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

void mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
	mergeSort(0, n);
	printf("%lld\n", cnt);
}

Compiler output:
a.cc:6:7: error: 'M' was not declared in this scope
    6 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |       ^
a.cc:6:13: error: 'M' was not declared in this scope
    6 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |             ^
a.cc:6:27: error: 'M' was not declared in this scope
    6 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |                           ^
a.cc: In function 'void merge(int, int, int)':
a.cc:10:26: error: 'L' was not declared in this scope
   10 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:10:33: error: 'A' was not declared in this scope
   10 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:11:26: error: 'R' was not declared in this scope
   11 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:11:33: error: 'A' was not declared in this scope
   11 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:14:34: error: 'L' was not declared in this scope
   14 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:14:42: error: 'R' was not declared in this scope
   14 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:14:48: error: 'A' was not declared in this scope
   14 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:15:14: error: 'A' was not declared in this scope
   15 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc: At global scope:
a.cc:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:30:42: error: 'A' was not declared in this scope
   30 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

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

long long cnt = 0;
int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
 
void merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

void mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
	mergeSort(0, n);
	printf("%lld\n", cnt);
return 0;
}

Compiler output:
a.cc:6:7: error: 'M' was not declared in this scope
    6 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |       ^
a.cc:6:13: error: 'M' was not declared in this scope
    6 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |             ^
a.cc:6:27: error: 'M' was not declared in this scope
    6 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |                           ^
a.cc: In function 'void merge(int, int, int)':
a.cc:10:26: error: 'L' was not declared in this scope
   10 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:10:33: error: 'A' was not declared in this scope
   10 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:11:26: error: 'R' was not declared in this scope
   11 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:11:33: error: 'A' was not declared in this scope
   11 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:14:34: error: 'L' was not declared in this scope
   14 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:14:42: error: 'R' was not declared in this scope
   14 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:14:48: error: 'A' was not declared in this scope
   14 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:15:14: error: 'A' was not declared in this scope
   15 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc: In function 'int main()':
a.cc:30:42: error: 'A' was not declared in this scope
   30 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

long long cnt = 0;
int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
 
void merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

void mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
	mergeSort(0, n);
	printf("%lld\n", cnt);
return 0;
}

Compiler output:
a.cc:7:7: error: 'M' was not declared in this scope
    7 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |       ^
a.cc:7:13: error: 'M' was not declared in this scope
    7 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |             ^
a.cc:7:27: error: 'M' was not declared in this scope
    7 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |                           ^
a.cc: In function 'void merge(int, int, int)':
a.cc:11:26: error: 'L' was not declared in this scope
   11 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:11:33: error: 'A' was not declared in this scope
   11 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:12:26: error: 'R' was not declared in this scope
   12 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:15:34: error: 'L' was not declared in this scope
   15 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:15:42: error: 'R' was not declared in this scope
   15 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:15:48: error: 'A' was not declared in this scope
   15 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:16:14: error: 'A' was not declared in this scope
   16 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc: In function 'int main()':
a.cc:31:42: error: 'A' was not declared in this scope
   31 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

ll cnt = 0;
int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
 
void merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}

void mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
 
int main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
	mergeSort(0, n);
	printf("%lld\n", cnt);
return 0;
}

Compiler output:
a.cc:7:7: error: 'M' was not declared in this scope
    7 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |       ^
a.cc:7:13: error: 'M' was not declared in this scope
    7 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |             ^
a.cc:7:27: error: 'M' was not declared in this scope
    7 | int A[M], L[M / 2 + 1], R[M / 2 + 1], n;
      |                           ^
a.cc: In function 'void merge(int, int, int)':
a.cc:11:26: error: 'L' was not declared in this scope
   11 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                          ^
a.cc:11:33: error: 'A' was not declared in this scope
   11 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                                 ^
a.cc:12:26: error: 'R' was not declared in this scope
   12 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:12:33: error: 'A' was not declared in this scope
   12 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                                 ^
a.cc:15:34: error: 'L' was not declared in this scope
   15 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                  ^
a.cc:15:42: error: 'R' was not declared in this scope
   15 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc:15:48: error: 'A' was not declared in this scope
   15 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                                ^
a.cc:16:14: error: 'A' was not declared in this scope
   16 |         else A[k + l] = R[j++], cnt += n1 - i;
      |              ^
a.cc: In function 'int main()':
a.cc:31:42: error: 'A' was not declared in this scope
   31 |     for(int i = 0;i < n;i++)scanf("%d", &A[i]);
      |                                          ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
#define M 200000
 
long long cnt = 0;
int A[M], n;
  
void merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
int L[n1], R[n2]
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}
 
void mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
  
main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    printf("%lld\n", cnt);
}

Compiler output:
a.cc: In function 'void merge(int, int, int)':
a.cc:12:5: error: expected initializer before 'for'
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |     ^~~
a.cc:12:25: error: expected ';' before ')' token
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                         ^
      |                         ;
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc: At global scope:
a.cc:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   30 | main(){
      | ^~~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
#define M 200000
 
long long cnt = 0;
int A[M], n;
  
void merge(int l, int m, int r){
    int n1 = m - l, n2 = r - m, i, j;
int L[n1+1], R[n2+1]
    for(i = 0;i < n1;i++)L[i] = A[i + l];
    for(i = 0;i < n2;i++)R[i] = A[i + m];
    i = j = 0;
    for(int k = 0;k < r - l;k++){
        if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
        else A[k + l] = R[j++], cnt += n1 - i;
    }
}
 
void mergeSort(int l, int r){
    if(l + 1 < r){
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}
  
main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
    mergeSort(0, n);
    printf("%lld\n", cnt);
}

Compiler output:
a.cc: In function 'void merge(int, int, int)':
a.cc:12:5: error: expected initializer before 'for'
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |     ^~~
a.cc:12:25: error: expected ';' before ')' token
   12 |     for(i = 0;i < n1;i++)L[i] = A[i + l];
      |                         ^
      |                         ;
a.cc:13:26: error: 'R' was not declared in this scope
   13 |     for(i = 0;i < n2;i++)R[i] = A[i + m];
      |                          ^
a.cc:16:42: error: 'R' was not declared in this scope
   16 |         if(j == n2 || (i < n1 && L[i] <= R[j]))A[k + l] = L[i++];
      |                                          ^
a.cc: At global scope:
a.cc:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   30 | main(){
      | ^~~~
Language: C++

include <iostream>
using namespace std;
const int num = 200002, INF = 2000000000;
int a[num], n;
inline long long me(int left, int mid, int right) {
	int long long cnt = 0;
	int n1 = mid - left;
	int n2 = right - mid;
	int l[num / 2], r[num/2];
	l[n1] = r[n2] = INF;
	for (int i = 0; i < n1; i++) 
		l[i] = a[left + i];
	for (int i = 0; i < n2; i++)
		r[i] = a[mid + i];
	int s = 0, t = 0;
	for (int i = left; i < right; i++) {
		if (l[s] > r[t]) {
			a[i] = r[t];
			t++;
			cnt += n1 - s;
		}
		else {
			a[i] = l[s];
			s++;
		}
	}
	return cnt;
}
inline long long ms(int l, int r) {
	long long s1 = 0, s2 = 0, v = 0;
	if (l != r - 1) {
		int m = (l + r) / 2;
		 s1 = ms(l, m);
		 s2 = ms(m, r);
		 v = me(l, m, r);
	}
	return s1 + s2 + v;
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {

		cin >> a[i];
	}
	long long ans = ms(0, n);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:40:9: error: 'cin' was not declared in this scope
   40 |         cin >> n;
      |         ^~~
a.cc:46:9: error: 'cout' was not declared in this scope
   46 |         cout << ans << endl;
      |         ^~~~
a.cc:46:24: error: 'endl' was not declared in this scope
   46 |         cout << ans << endl;
      |                        ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 200005;

int a[MAX_N];
int k[MAX_N];
int bit[MAX_N+1],n;
map<int,int> mp;

//i???????????§??????????¨??????????(i???1????????????)
int sum(int i)
{
	int s = 0;
	while(i>0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}
//i???????????????x????????????(i???1????????????)
void add(int i,int x)
{
	while(i <= n){
		bit[i] += x;
		i += i & -i;
	}
}

int main()
{
	cin >> n;
	rep(i,n){
		scanf("%d",&a[i]);
		k[i] = a[i];
		mp[a[i]] = i;
	}
	sort(a,a+n);
	rep(i,n){
		k[b[a[i]]] = i;
	}
	ll ans = 0;
	rep(j,n){
		ans += j - sum(k[j]);
		add(k[j],1);
	}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:19: error: 'b' was not declared in this scope
   47 |                 k[b[a[i]]] = i;
      |                   ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "DataStructure.h"
#include <map>
#include <set>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>
#include <math.h>
using namespace std;
const int num = 500, num1 = 10000000;
double numd = 10000000.0;
typedef long long int ll;
const int INF = 2000000000;
int a[200000],bit[200001];
int sum(int i, int bit[]) {
	int sum = 0;
	while (i > 0) {
		sum += bit[i];
		i -= i & -i;
	}
	return sum;
}
void add(int i, int x, int n, int *bit) {
	while (i <= n) {
		bit[i] += x;
		i += i & -i;
	}
}
int main() {
	int n;
	memset(bit, 0, sizeof(bit));
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll su = 0;
	for (int i = 0; i < n; i++) {
		su += i - sum(a[i], bit);
		add(a[i], 1, n, bit);
	cout << su << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'memset' was not declared in this scope
   36 |         memset(bit, 0, sizeof(bit));
      |         ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   13 | #include <math.h>
  +++ |+#include <cstring>
   14 | using namespace std;
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:34:12: note: to match this '{'
   34 | int main() {
      |            ^
Language: C++

#include<cstdio>
#include<map>
using namespace std;

struct BIT{
	int bit[200001];
	int size;
	BIT(int n){
		size = n;
		for(int i=0;i<=n;i++) bit[i] = 0;
	}
	void add(int i,int x){
		i++;
		while(i<=size){
			bit[i] += x;
			i += i & -i;
		}
	}
	int sum(int i){
		int ret = 0;
		i++;
		while(i>0){
			ret += bit[i];
			i -= i & -i;
		}
		return ret;
	}
};

int main(){
	int n,a[200000],b[200000],p[200000];
	long long ans = 0;
	map<int,int> mp;
	scanf("%d",&n);
	BIT bit(n);
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
		b[i] = a[i];
	}
	sort(b,b+n);
	for(int i=0;i<n;i++) mp[b[i]] = i;
	for(int i=0;i<n;i++) p[mp[a[i]]] = i;
	for(int i=n-1;i>=0;i--){
		ans += bit.sum(p[i]);
		bit.add(p[i],1);
	}
	printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   40 |         sort(b,b+n);
      |         ^~~~
      |         short
Language: C++

Last login: Mon May 22 18:52:44 on console
pc038003m:~ 9924856575$ ls
Desktop		Downloads	Movies		Pictures	report.txt
Documents	Library		Music		Public		test.txt
pc038003m:~ 9924856575$ cd Documents/
pc038003m:Documents 9924856575$ ls
Applied Linguistics-2001-Altenberg-173-95.pdf
Current.vdf
MATLAB
Online university.docx
What you need to know about CRISPR.docx
Wolfram Mathematica
constitution.xlsx
cpp
iral.2009.007.pdf
prog_giho
test.vdf
workspace
~$line university.docx
?????±
?????????.2mdl
?????????.mdl
????????????.xlsx
???????????°??????.pptx
?????¬?????????????????§???1.pptx
pc038003m:Documents 9924856575$ cd cpp/
pc038003m:cpp 9924856575$ ls
a.out		test2		test3.cpp
test.cpp	test2.cpp	test4.cpp
pc038003m:cpp 9924856575$ vim zitsu.cpp

                if(!(p1==cnt) &&( p2==en || T[p1] <= T[p2])){
                        A[i] = T[p1];
                        p1++;
                        ans+= lat;
                }else{
                        A[i] = T[p2];
                        p2++;
                        lat++;
                }
        }
        return ans;
}
int main(){
        int n;
        cin>>n;
        A.resize(n);
        T.resize(n);
        for(int i=0;i<n;i++){
                cin>>A[i];
        }
        cout<<solve(0,n,A)<<endl;
        return 0;
}      

Compiler output:
a.cc:15:5: error: too many decimal points in number
   15 | iral.2009.007.pdf
      |     ^~~~~~~~~~~~~
a.cc:20:6: error: extended character ± is not valid in an identifier
   20 | ?????±
      |      ^
a.cc:24:12: error: extended character ° is not valid in an identifier
   24 | ???????????°??????.pptx
      |            ^
a.cc:25:6: error: extended character ¬ is not valid in an identifier
   25 | ?????¬?????????????????§???1.pptx
      |      ^
a.cc:25:24: error: extended character § is not valid in an identifier
   25 | ?????¬?????????????????§???1.pptx
      |                        ^
a.cc:1:1: error: 'Last' does not name a type
    1 | Last login: Mon May 22 18:52:44 on console
      | ^~~~
a.cc:36:18: error: expected unqualified-id before 'else'
   36 |                 }else{
      |                  ^~~~
a.cc:41:9: error: expected declaration before '}' token
   41 |         }
      |         ^
a.cc:42:9: error: expected unqualified-id before 'return'
   42 |         return ans;
      |         ^~~~~~
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
a.cc: In function 'int main()':
a.cc:46:9: error: 'cin' was not declared in this scope
   46 |         cin>>n;
      |         ^~~
a.cc:47:9: error: 'A' was not declared in this scope
   47 |         A.resize(n);
      |         ^
a.cc:48:9: error: 'T' was not declared in this scope
   48 |         T.resize(n);
      |         ^
a.cc:52:9: error: 'cout' was not declared in this scope
   52 |         cout<<solve(0,n,A)<<endl;
      |         ^~~~
a.cc:52:15: error: 'solve' was not declared in this scope
   52 |         cout<<solve(0,n,A)<<endl;
      |               ^~~~~
a.cc:52:29: error: 'endl' was not declared in this scope
   52 |         cout<<solve(0,n,A)<<endl;
      |                             ^~~~
Language: C++

#include <iostream>
using namespace std;

#define INFTY 1000000001

long long merge(long long A[], long long left, long long mid, long long right)
{
  long long n1 = mid - left, n2 = right - mid;
  long long L[n1 + 1], R[n2 + 1];
  for (long long i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  for (long long i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  long long i = 0, j = 0, count = 0;
  for (long long k = left, p = (-1) * n1; k < right; k++, p++) {
    if (L[i] < R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j];
      count += j - p;
      j++;
    }
  }
  return count;
}

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

long long main() {
  long long n;
  cin >> n;
  long long S[n], count;
  for (long long i = 0; i < n; i++) cin >> S[i];
  count = mergeSort(S, 0, n);
  cout << count << endl;
  return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

int bubbleSort(int* a, int n) {
    int count = 0;
    bool flag = true;
    while (flag) {
        flag = false;
        for (int j = n-1; j > 0; j--) {
            if (a[j] < a[j-1]) {
                int tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                flag = true;
                count++;
            }
        }
    }
    return count;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    int* a = new int[n]:
    FOR(i,0,n) {
        cin >> a[0];
    }
    int count = bubbleSort(a, n);
    cout << count << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: expected ',' or ';' before ':' token
   34 |     int* a = new int[n]:
      |                        ^
a.cc:35:9: error: 'i' was not declared in this scope
   35 |     FOR(i,0,n) {
      |         ^
a.cc:6:34: note: in definition of macro 'FOR'
    6 | #define FOR(i,s,e) for (int i=s; i<e; i++)
      |                                  ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "MyDisjointset.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <map>
using namespace std;
typedef pair<int, int> P; typedef long long int ll;
const int INF = 2000000000;
int bit[1 << 14], a[200000]; 
int n;
void add(int j, int t) {
	while (j <= n) {
		bit[j] += t;
		j += j & -j;
	}
}
ll sum(int j) {
	ll ans = 0;
	while (j != 0) {
		ans += bit[j];
		j -= j & -j;
	}
	//cout << "j " << j << " ans " << ans << endl;
	return ans;
}
int main() {
	cin >> n;
	ll res = 0;
	memset(bit, 0, sizeof(bit));
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		res += i - sum(a[i]);
		add(a[i], 1);
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'memset' was not declared in this scope
   36 |         memset(bit, 0, sizeof(bit));
      |         ^~~~~~
a.cc:13:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <map>
  +++ |+#include <cstring>
   13 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <climits>

using namespace std;

template<typename T>
int64_t merge(vector<T> &A, int32_t left, int32_t mid, int32_t right) {
    int32_t n1 = mid - left;
    int32_t n2 = right - mid;

    vector<T> L(n1+1);
    vector<T> R(n2+1);
    for (int32_t i = 0; i < n1; i++) {
        L[i] = A[left+i];
    }
    for (int32_t i = 0; i < n2; i++) {
        R[i] = A[mid+i];
    }
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;

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

    return count;
}

template<typename T>
int64_t merge_sort(vector<T> &A, int32_t left, int32_t right) {
    if (left + 1 < right) {
        int32_t mid = left + (right - left) / 2;
        int64_t count1 = merge_sort(A, left, mid);
        int64_t count2 = merge_sort(A, mid, right);
        int64_t count3 = merge(A, left, mid, right);
        return count1 + count2 + count3;
    }

    return 0;
}

int main() {
    int32_t n;

    cin >> n;
    vector<int64_t> S(n);
    for (int32_t i = 0; i < n; i++) {
        cin >> S[i];
    }

    cout << merge_sort(S, 0, n) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int64_t merge(std::vector<T>&, int32_t, int32_t, int32_t)':
a.cc:24:5: error: expected ',' or ';' before 'int64_t'
   24 |     int64_t count = 0;
      |     ^~~~~~~
a.cc:32:13: error: 'count' was not declared in this scope
   32 |             count += n1 - i;
      |             ^~~~~
a.cc:36:12: error: 'count' was not declared in this scope
   36 |     return count;
      |            ^~~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 200000
#define INFTY 2000000000
int cnt=0;
void bubble(int [],int,int,int);
void bubbleSort(int [],int,int);

void bubble(int A[],int left,int mid,int right){
  int i,j=0,k=0;
  int x1=mid-left,x2=right-mid;
  int L[MAX]={},R[MAX]={};
  
  for(i=0;i<x1;i++){
    L[i]=A[left+i];
  }

  L[i]=INFTY;
  
  for(i=0;i<x2;i++){
    R[i]=A[mid+i];
  }

  R[i]=INFTY;
  
  //L[x1]=INFTY;
  //R[x2]=INFTY;

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

void bubbleSort(int A[],int left,int right){
  int middle;

  if(left+1<right){
    middle=(left+right+1)/2;
    bubbleSort(A,left,middle);
    bubbleSort(A,middle,right);
    bubble(A,left,middle,right);
  }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status