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

#include <iostream>
using namespace std;

long long cnt = 0; //for counting num of invensions
const int INF = numeric_limits<int>::max();

void merge(int *a, int left, int mid, int right) {

    int nL = mid - left;
    int nR = right - mid;

    int L[nL+1], R[nR+1];

    for(int i=0; i<nL; i++) {
        L[i] = a[left + i];
    }
    for(int i=0; i<nR; i++) {
        R[i] = a[mid + i];
    }
    L[nL] = R[nR] = INF;
    

    int indexL = 0,  indexR = 0;
    for(int i = left; i<right; i++) {

        if( L[indexL] <= R[indexR] ) {
            a[i] = L[indexL];
            indexL++;
            cnt += indexR; //L[]?????????????????¨??????????????§???R[]???????????????????????????????´?????????°(indexR)?????°????????°??????????????¢?????°????????????
                          //????????°????????????????°????????????????a[]???????????????????????¨??????????????§?????????????????????????????????????????¨????????????????????????????????????
        } else {
            a[i] = R[indexR];
            indexR++;
        }
        
    }

//    //display info. about this step
//    cout << "-----\n";
//    cout << "merge(" << left << ", " << mid << ", " << right <<")" << endl;
//
//    cout << "L" << " = "; for(int i=0; i<nL+1; i++) {cout << L[i] << " ";} cout << endl;
//    cout << "R" << " = "; for(int i=0; i<nR+1; i++) {cout << R[i] << " ";} cout << endl;
//    
//    cout << "cnt = " << cnt << endl;

    return;
}


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);

    }

    return;
}


int main(void) {
    int N;
    cin >> N;

    int a[N];
    for(int i=0; i<N; i++) {
        cin >> a[i];
    }

//    //display a[] before sorting
//    cout << "a[] = ";
//    for(int i=0; i<N; i++) {
//        cout << a[i] << " ";
//    }
//    cout << endl;

    //merge sort a[]
    mergeSort(a, 0, N);

//    //display a[] after sorting
//    cout << "a[] = ";
//    for(int i=0; i<N; i++) {
//        cout << a[i] << " ";
//    }
//    cout << endl;
    

//    cout << "Num of inversions = ";
    cout << cnt << endl;
    
    return 0;
}

Compiler output:
a.cc:5:17: error: 'numeric_limits' was not declared in this scope
    5 | const int INF = numeric_limits<int>::max();
      |                 ^~~~~~~~~~~~~~
a.cc:5:32: error: expected primary-expression before 'int'
    5 | const int INF = numeric_limits<int>::max();
      |                                ^~~
Language: C++

#include <iostream>
using namespace std;

long long cnt = 0; //for counting num of invensions

void merge(int *a, int left, int mid, int right) {

    int nL = mid - left;
    int nR = right - mid;

    int L[nL+1], R[nR+1];

    for(int i=0; i<nL; i++) {
        L[i] = a[left + i];
    }
    for(int i=0; i<nR; i++) {
        R[i] = a[mid + i];
    }
    L[nL] = R[nR] = numeric_limits<int>::max();
    

    int indexL = 0,  indexR = 0;
    for(int i = left; i<right; i++) {

        if( L[indexL] <= R[indexR] ) {
            a[i] = L[indexL];
            indexL++;
            cnt += indexR; //L[]?????????????????¨??????????????§???R[]???????????????????????????????´?????????°(indexR)?????°????????°??????????????¢?????°????????????
                          //????????°????????????????°????????????????a[]???????????????????????¨??????????????§?????????????????????????????????????????¨????????????????????????????????????
        } else {
            a[i] = R[indexR];
            indexR++;
        }
        
    }

//    //display info. about this step
//    cout << "-----\n";
//    cout << "merge(" << left << ", " << mid << ", " << right <<")" << endl;
//
//    cout << "L" << " = "; for(int i=0; i<nL+1; i++) {cout << L[i] << " ";} cout << endl;
//    cout << "R" << " = "; for(int i=0; i<nR+1; i++) {cout << R[i] << " ";} cout << endl;
//    
//    cout << "cnt = " << cnt << endl;

    return;
}


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);

    }

    return;
}


int main(void) {
    int N;
    cin >> N;

    int a[N];
    for(int i=0; i<N; i++) {
        cin >> a[i];
    }

//    //display a[] before sorting
//    cout << "a[] = ";
//    for(int i=0; i<N; i++) {
//        cout << a[i] << " ";
//    }
//    cout << endl;

    //merge sort a[]
    mergeSort(a, 0, N);

//    //display a[] after sorting
//    cout << "a[] = ";
//    for(int i=0; i<N; i++) {
//        cout << a[i] << " ";
//    }
//    cout << endl;
    

//    cout << "Num of inversions = ";
    cout << cnt << endl;
    
    return 0;
}

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

#include <cstdint>
#include <cstdio>
#include <utility>

const int kMaxN = 200000;
const int kMaxAi = 1000000000;
const int kSentinel = kMaxAi + 1;

void Merge(int A[], int left, int mid, int right,
           int L[], int R[], std::int64_t cnt) {
  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] = R[n2] = kSentinel;
  i = j = 0;
  for (k = left; k < right; ++k) {
    if (L[i] <= R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
      cnt += n1 - i;
    }
  }
}

void MergeSort(int A[], int left, int right,
               int L[], int R[], std::int64_t cnt) {
  int mid;
  if (left + 1 < right) {
    mid = (left + right) / 2;
    MergeSort(A, left, mid, L, R, cnt);
    MergeSort(A, mid, right, L, R, cnt);
    Merge(A, left, mid, right, L, R, cnt);
  }
}

int main() {
  int n, i;
  std::scanf("%d", &n);
  int A[n];
  for (i = 0; i < n; ++i) { std::scanf("%d", &A[i]); }
  int L[n/2 + 1], R[n/2 + 1];
  std::int64_t cnt = 0;
  MergeSort(A, left, right, L, R, cnt);
  std::printf("%d", cnt);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:16: error: 'left' was not declared in this scope
   46 |   MergeSort(A, left, right, L, R, cnt);
      |                ^~~~
a.cc:46:22: error: 'right' was not declared in this scope
   46 |   MergeSort(A, left, right, L, R, cnt);
      |                      ^~~~~
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
#define CENTINEL 2000000000
int n,A[200000],sum=0,cnt=0;
int L[MAX/2+2],R[MAX/2+2];
void merge(int A[],int left,int right){
  int na=mid-left;
  int nb=right-mid;
  for(int i=0;i<na;i++)L[i]=A[left+i];
  for(int i=0;i<nb;i++)R[i]=A[mid+1];
  L[na]=R[nb]=CENTINEL;
  int i=0,j=0;
  for(it k=left;k<right;k++){
    if(L[i]<=R[j])A[k]=L[i++];
    else {A[k]=R[j++];sum+=na-i;}
  }
}
int mergesort(int A[],int left,int mid,int right){
  mid=(left+right)/2;
  int v1,v2,v3;
  if(left+1<right){
    v1=mergesort(A,left,mid);
    v2=mergesort(A,mid,right);
    v3=merge(A,left,right);
    return v1+v2+v3;
  } else return 0;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  cnt=mergesort();
  pritf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc:6:7: error: 'MAX' was not declared in this scope
    6 | int L[MAX/2+2],R[MAX/2+2];
      |       ^~~
a.cc:6:18: error: 'MAX' was not declared in this scope
    6 | int L[MAX/2+2],R[MAX/2+2];
      |                  ^~~
a.cc: In function 'void merge(int*, int, int)':
a.cc:8:10: error: 'mid' was not declared in this scope
    8 |   int na=mid-left;
      |          ^~~
a.cc:10:24: error: 'L' was not declared in this scope
   10 |   for(int i=0;i<na;i++)L[i]=A[left+i];
      |                        ^
a.cc:11:24: error: 'R' was not declared in this scope
   11 |   for(int i=0;i<nb;i++)R[i]=A[mid+1];
      |                        ^
a.cc:12:3: error: 'L' was not declared in this scope
   12 |   L[na]=R[nb]=CENTINEL;
      |   ^
a.cc:12:9: error: 'R' was not declared in this scope
   12 |   L[na]=R[nb]=CENTINEL;
      |         ^
a.cc:14:7: error: 'it' was not declared in this scope; did you mean 'i'?
   14 |   for(it k=left;k<right;k++){
      |       ^~
      |       i
a.cc:14:17: error: 'k' was not declared in this scope
   14 |   for(it k=left;k<right;k++){
      |                 ^
a.cc: In function 'int mergesort(int*, int, int, int)':
a.cc:23:17: error: too few arguments to function 'int mergesort(int*, int, int, int)'
   23 |     v1=mergesort(A,left,mid);
      |        ~~~~~~~~~^~~~~~~~~~~~
a.cc:19:5: note: declared here
   19 | int mergesort(int A[],int left,int mid,int right){
      |     ^~~~~~~~~
a.cc:24:17: error: too few arguments to function 'int mergesort(int*, int, int, int)'
   24 |     v2=mergesort(A,mid,right);
      |        ~~~~~~~~~^~~~~~~~~~~~~
a.cc:19:5: note: declared here
   19 | int mergesort(int A[],int left,int mid,int right){
      |     ^~~~~~~~~
a.cc:25:13: error: void value not ignored as it ought to be
   25 |     v3=merge(A,left,right);
      |        ~~~~~^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:32:16: error: too few arguments to function 'int mergesort(int*, int, int, int)'
   32 |   cnt=mergesort();
      |       ~~~~~~~~~^~
a.cc:19:5: note: declared here
   19 | int mergesort(int A[],int left,int mid,int right){
      |     ^~~~~~~~~
a.cc:33:3: error: 'pritf' was not declared in this scope; did you mean 'printf'?
   33 |   pritf("%d\n",cnt);
      |   ^~~~~
      |   printf
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
#define CENTINEL 2000000000
#define MAX 200000
int n,A[200000],sum=0,cnt=0;
int L[MAX/2+2],R[MAX/2+2];
void merge(int A[],int left,int mid,int right){
  int na=mid-left;
  int nb=right-mid;
  for(int i=0;i<na;i++)L[i]=A[left+i];
  for(int i=0;i<nb;i++)R[i]=A[mid+1];
  L[na]=R[nb]=CENTINEL;
  int i=0,j=0;
  for(it k=left;k<right;k++){
    if(L[i]<=R[j])A[k]=L[i++];
    else {A[k]=R[j++];sum+=na-i;}
  }
}
int mergesort(int A[],int left,int right){
  mid=(left+right)/2;
  int v1,v2,v3;
  if(left+1<right){
    v1=mergesort(A,left,mid);
    v2=mergesort(A,mid,right);
    v3=merge(A,left,mid,right);
    return v1+v2+v3;
  } else return 0;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  cnt=mergesort(A,0,n);
  pritf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:15:7: error: 'it' was not declared in this scope; did you mean 'i'?
   15 |   for(it k=left;k<right;k++){
      |       ^~
      |       i
a.cc:15:17: error: 'k' was not declared in this scope
   15 |   for(it k=left;k<right;k++){
      |                 ^
a.cc: In function 'int mergesort(int*, int, int)':
a.cc:21:3: error: 'mid' was not declared in this scope
   21 |   mid=(left+right)/2;
      |   ^~~
a.cc: In function 'int main()':
a.cc:34:3: error: 'pritf' was not declared in this scope; did you mean 'printf'?
   34 |   pritf("%d\n",cnt);
      |   ^~~~~
      |   printf
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
#define CENTINEL 2000000000
#define MAX 200000
int n,A[200000],sum=0,cnt=0;
int L[MAX/2+2],R[MAX/2+2];
void merge(int A[],int left,int mid,int right){
  int na=mid-left;
  int nb=right-mid;
  for(int i=0;i<na;i++)L[i]=A[left+i];
  for(int i=0;i<nb;i++)R[i]=A[mid+1];
  L[na]=R[nb]=CENTINEL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j])A[k]=L[i++];
    else {A[k]=R[j++];sum+=na-i;}
  }
}
int mergesort(int A[],int left,int right){
  int mid=(left+right)/2;
  int v1,v2,v3;
  if(left+1<right){
    v1=mergesort(A,left,mid);
    v2=mergesort(A,mid,right);
    v3=merge(A,left,mid,right);
    return v1+v2+v3;
  } else return 0;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  cnt=mergesort(A,0,n);
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
a.cc: In function 'int mergesort(int*, int, int)':
a.cc:26:13: error: void value not ignored as it ought to be
   26 |     v3=merge(A,left,mid,right);
      |        ~~~~~^~~~~~~~~~~~~~~~~~
Language: C++

// ALDS1_5_B.cpp
// Divide and Conquer - Merge Sort
// ???????????????
// 1. ?????????L???R????????°??´???????????????????????¨???
// 2. ??????????¬???°??¶??????cnt++??????if??????if?????????????????¨?????????
// 3. vector????§??????????????????°???vector<int> nums'(n)'!

#include <iostream>
#include <vector>
using namespace std;
long long cnt = 0;
const int SENTINEL = 1E9 + 5;
void trace(vector<int>& nums)
{
	for (int i = 0; i < nums.size(); i++) {
		if (i > 0) cout << " ";
		cout << nums[i];
	}
	cout << endl;
}

void merge(vector<int>& nums, int left, int mid, int right)
{
	vector<int> L(nums.begin() + left, nums.begin() + mid);
	vector<int> R(nums.begin() + mid, nums.begin() + right);
	L.push_back(SENTINEL);
	R.push_back(SENTINEL);
	int i = 0;
	int j = 0;
	for (int k = left; k < right; k++) {
		if (L[i] <= R[j]) {
			nums[k] = L[i++];
		}
		else {
			nums[k] = R[j++];
			cnt += L.size() - 1 - i;
		}
	}
}

void MergeSort(vector<int>& nums, int left, int right)
{
	if (left + 1 >= right) return;
	int mid = left + (right - left) / 2;
	MergeSort(nums, left, mid);
	MergeSort(nums, mid, right);
	merge(nums, left, mid, right);
}

FILE *stream1, *stream2;

int main()
{
	freopen_s(&stream1, "in.txt", "r", stdin);
	freopen_s(&stream2, "out.txt", "w", stdout);
	int n;
	cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	MergeSort(nums, 0, n);
	trace(nums);
	cout << cnt << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:9: error: 'freopen_s' was not declared in this scope; did you mean 'freopen64'?
   54 |         freopen_s(&stream1, "in.txt", "r", stdin);
      |         ^~~~~~~~~
      |         freopen64
Language: C++

#include<cstdio>

#define M 500010
#define SENTINEL 2000000000
#define LL long long

int a[M];
LL merge(int,int,int);
LL mergeSort(int,int);

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	LL count=mergeSort(0,n);
	cout<<count<<endl;
	return 0;
}
LL mergeSort(int left,int right){
	LL v1=0,v2=0,v3=0;
	if(left+1<right){
		int mid=(left+right)/2;
		v1=mergeSort(left,mid);
		v2=mergeSort(mid,right);
		v3=merge(left,mid,right);
	}
	return v1+v2+v3;
}
LL merge(int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	int L[n1+1],R[n2+1];
	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;
	LL count=0;
	for(int k=left;k<right;k++){
		if(L[i]<=R[j]){
			a[k]=L[i];
			i++;
		}else{
			count+=n1-i;
			a[k]=R[j];
			j++;
		}
	}
	return count;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   17 |         cout<<count<<endl;
      |         ^~~~
      |         count
a.cc:17:22: error: 'endl' was not declared in this scope
   17 |         cout<<count<<endl;
      |                      ^~~~
Language: C++

#include <cstdio>

using namespace std;

#define MAX 200000
#define Sentinel 2000000000
typedif long long llong;

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

llong mergesort( int A[], int n, int left, int mid, int right){

    int i , j , k;

    llong cnt = 0;

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

    i = j = 0;

    for( k = left ; k < right ; k++ ){

        if( L[i] <= R[i] ){

            A[k] = L[i];
            i++;
    
        } else{

            A[k] = R[j];
            j++;

            cnt += n1 - i;

        }


    }

    return cnt;

}


llong mergesort( int A[], int n, int left, int right){

    int mid;
    llong v1, v2, v3;

    if( left + 1 < right ){

        mid = ( left + right ) / 2; 

        v1 = mergesort( A, n, left, mid );
        v2 = mergesort( A, n, mid, right );

        v3 = merge( A, n, left, mid, right);

        return v1 + v2 + v3;

    } else return 0;

}

int main(){

    int A[MAX], n, i;

    scanf("%d", &n);

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

    llong ans = mergesort( A, n, 0, n);

    printf("%d\n", ans);

    return 0;

}

Compiler output:
a.cc:7:1: error: 'typedif' does not name a type; did you mean 'typedef'?
    7 | typedif long long llong;
      | ^~~~~~~
      | typedef
a.cc:11:1: error: 'llong' does not name a type; did you mean 'long'?
   11 | llong mergesort( int A[], int n, int left, int mid, int right){
      | ^~~~~
      | long
a.cc:52:1: error: 'llong' does not name a type; did you mean 'long'?
   52 | llong mergesort( int A[], int n, int left, int right){
      | ^~~~~
      | long
a.cc: In function 'int main()':
a.cc:80:5: error: 'llong' was not declared in this scope; did you mean 'long'?
   80 |     llong ans = mergesort( A, n, 0, n);
      |     ^~~~~
      |     long
a.cc:82:20: error: 'ans' was not declared in this scope
   82 |     printf("%d\n", ans);
      |                    ^~~
Language: C++

#include <cstdio>

using namespace std;

#define MAX 200000
#define Sentinel 2000000000
typedef long long llong;

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

llong mergesort( int A[], int n, int left, int mid, int right){

    int i , j , k;

    llong cnt = 0;

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

    i = j = 0;

    for( k = left ; k < right ; k++ ){

        if( L[i] <= R[i] ){

            A[k] = L[i];
            i++;
    
        } else{

            A[k] = R[j];
            j++;

            cnt += n1 - i;

        }


    }

    return cnt;

}


llong mergesort( int A[], int n, int left, int right){

    int mid;
    llong v1, v2, v3;

    if( left + 1 < right ){

        mid = ( left + right ) / 2; 

        v1 = mergesort( A, n, left, mid );
        v2 = mergesort( A, n, mid, right );

        v3 = merge( A, n, left, mid, right);

        return v1 + v2 + v3;

    } else return 0;

}

int main(){

    int A[MAX], n, i;

    scanf("%d", &n);

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

    llong ans = mergesort( A, n, 0, n);

    printf("%d\n", ans);

    return 0;

}

Compiler output:
a.cc: In function 'llong mergesort(int*, int, int, int)':
a.cc:64:14: error: 'merge' was not declared in this scope
   64 |         v3 = merge( A, n, left, mid, right);
      |              ^~~~~
Language: C++

#include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <climits>
using namespace std;

static int g_numOfInv = 0;


int main()
{
  int numOfArray;
  cin >> numOfArray; cin.ignore();

  int array[numOfArray];
  for (int i = 0; i < numOfArray; i++)
    cin >> array[i];


  const int start = 0;
  const int end = numOfArray;
  int helper[numOfArray];

  mergeSort(array, helper, start, end);

  cout << g_numOfInv << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'mergeSort' was not declared in this scope
   26 |   mergeSort(array, helper, start, end);
      |   ^~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

#define MAX 200000;
#define SENTINEL 2000000000;
typedef long long llong;

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

llong merge(int A[], int left, int mid, int right) {
  int i, j, k;
  llong cnt = 0;
  int n1 = mid - left;
  int n2 = right - mid;
  for ( i = 0; i < n1; i++ ) L[i] = A[left + 1];
  for ( i = 0; i < n2; i++ ) R[i] = A[mid + 1];
  L[n1] = R[n2] = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ) {
    if ( L[i] <= R[j] )
      A[k] = L[i++];
    else {
      A[k] = R[j++];
      cnt += n1 - i;  // = mid + j - k - 1
    }
  }
  return cnt;
}

llong mergeSort(int A[], int left, int right) {
  int mid;
  llong v1, v2, v3;
  if ( left + 1 < right ) {
    mid = (left + right) / 2;
    v1 = mergeSort(A, left, mid);
    v2 = mergeSort(A, mid, right);
    v3 = merge(A, left, mid, right);
    return v1 + v2 + v3;
  } else return 0;
}

int main() {
  int A[MAX], n, i;

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

  llong ans = mergeSort(A, 0, n);
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc:4:19: error: expected ']' before ';' token
    4 | #define MAX 200000;
      |                   ^
a.cc:8:7: note: in expansion of macro 'MAX'
    8 | int L[MAX / 2 + 2], R[MAX / 2 + 2];
      |       ^~~
a.cc:8:11: error: expected unqualified-id before '/' token
    8 | int L[MAX / 2 + 2], R[MAX / 2 + 2];
      |           ^
a.cc:8:27: error: expected unqualified-id before '/' token
    8 | int L[MAX / 2 + 2], R[MAX / 2 + 2];
      |                           ^
a.cc: In function 'llong merge(int*, int, int, int)':
a.cc:15:30: error: 'L' was not declared in this scope
   15 |   for ( i = 0; i < n1; i++ ) L[i] = A[left + 1];
      |                              ^
a.cc:16:30: error: 'R' was not declared in this scope
   16 |   for ( i = 0; i < n2; i++ ) R[i] = A[mid + 1];
      |                              ^
a.cc:17:3: error: 'L' was not declared in this scope
   17 |   L[n1] = R[n2] = SENTINEL;
      |   ^
a.cc:17:11: error: 'R' was not declared in this scope
   17 |   L[n1] = R[n2] = SENTINEL;
      |           ^
a.cc: In function 'int main()':
a.cc:4:19: error: expected ']' before ';' token
    4 | #define MAX 200000;
      |                   ^
a.cc:43:9: note: in expansion of macro 'MAX'
   43 |   int A[MAX], n, i;
      |         ^~~
a.cc:43:12: error: expected primary-expression before ']' token
   43 |   int A[MAX], n, i;
      |            ^
a.cc:45:10: error: 'n' was not declared in this scope
   45 |   cin >> n;
      |          ^
a.cc:46:9: error: 'i' was not declared in this scope
   46 |   for ( i = 0; i < n; i++ )
      |         ^
a.cc:47:12: error: 'A' was not declared in this scope
   47 |     cin >> A[i];
      |            ^
a.cc:49:25: error: 'A' was not declared in this scope
   49 |   llong ans = mergeSort(A, 0, n);
      |                         ^
Language: C++

/*
* @Author: Samson
* @Date:   2018-05-04 10:11:57
* @Last Modified by:   Samson
* @Last Modified time: 2018-05-04 11:54:21
*/
//   @URL : http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_D
#include<bits/stdc++.h>
#include<algorithm>
#include <cstdlib>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int MAXN = 2*1e5+10;

int a[MAXN],n,L[MAXN/2],R[MAXN/2];

LL merge(int left,int mid,int right)
{
	int i,j,k;
	LL cnt = 0;
	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] = R[n2] = INF;
	i = j = 0;
	for(k = left; k < right; ++k)
	{
		if(L[i] <= R[j])
		{
			a[k] = L[i++];
		}
		else
		{
			a[k] = R[j++];
			cnt += n1-i;
		}
	}
	return cnt;
}

LL mergesort(int left,int right)
{
	int mid;
	LL v1,v2,v3;
	if(left + 1 < right)
	{
		mid = (left+right)/2;
		v1 = mergesort(left,mid);
		v2 = mergesort(mid,right);
		v3 = merge(left,mid,right);
		return v1+v2+v3;
	}
	else
		return 0;
}

int main(void)
{
	ios::sync_with_stdio(false); 
	//cin.tie(0);
	cin>>n;
	for(int i = 0; i < n; ++i)
		cin>>a[i];
	LL ans = mergesort(a,n,0,n);
	cout<<ans<<'\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:28: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   66 |         LL ans = mergesort(a,n,0,n);
      |                            ^
      |                            |
      |                            int*
a.cc:66:27: error: too many arguments to function 'LL mergesort(int, int)'
   66 |         LL ans = mergesort(a,n,0,n);
      |                  ~~~~~~~~~^~~~~~~~~
a.cc:43:4: note: declared here
   43 | LL mergesort(int left,int right)
      |    ^~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

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

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

llong merge_sort(int A[], int left, int right)
{
    llong v1, v2, v3;
    int mid;
    if (left + 1 < right) {
        mid = (left + right) / 2;
        v1 = merge_sort(A, left, mid);
        v2 = merge_sort(A, mid, right);
        v3 = merge(A, left, right);
        return v1 + v2 + v3;
    } else {
        return 0;
    }
}


int main(int argc, char const *argv[])
{
    int n;
    int A[MAX];
    cin >> n;
    llong ans;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    ans = merge_sort(A, 0, n);

    cout << ans << endl;

    return 0;
}




Compiler output:
a.cc: In function 'llong merge_sort(int*, int, int)':
a.cc:38:19: error: too few arguments to function 'llong merge(int*, int, int, int)'
   38 |         v3 = merge(A, left, right);
      |              ~~~~~^~~~~~~~~~~~~~~~
a.cc:9:7: note: declared here
    9 | llong merge(int A[], int left, int mid, int right)
      |       ^~~~~
Language: C++

#include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

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

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

llong merge_sort(int A[], int left, int right)
{
    llong v1, v2, v3;
    int mid;
    if (left + 1 < right) {
        mid = (left + right) / 2;
        v1 = merge_sort(A, left, mid);
        v2 = merge_sort(A, mid, right);
        v3 = merge(A, left, right);
        return v1 + v2 + v3;
    } else {
        return 0;
    }
}

int main(int argc, char const *argv[])
{
    int n;
    int A[MAX];
    cin >> n;
    llong ans;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    ans = merge_sort(A, 0, n);

    cout << ans << endl;

    return 0;
}




Compiler output:
a.cc: In function 'llong merge_sort(int*, int, int)':
a.cc:38:19: error: too few arguments to function 'llong merge(int*, int, int, int)'
   38 |         v3 = merge(A, left, right);
      |              ~~~~~^~~~~~~~~~~~~~~~
a.cc:9:7: note: declared here
    9 | llong merge(int A[], int left, int mid, int right)
      |       ^~~~~
Language: C++

#include <iostream>
#define INFTY 1000000000
#define int long long

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

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

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

    int left = 0;
    int right = n;
    int cnt = mergeSort(S, left, right);

    std::cout << cnt << '\n';
    return 0;
}


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

#include <stdio.h>

const int N = 200000;
int a[N];
int L[N / 2 + 2], R[N / 2 + 2];
int INF = 1000000001;
int64_t cnt;

void merge(int* a, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	L[n1] = INF;
	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 i = 0, j = 0;
	for (int k = left; k < right; k++)
	{
		if (L[i] <= R[j])
			a[k] = L[i++];
		else
		{
			a[k] = R[j++];
			cnt += n1 - i;
		}
	}
}

void merge_sort(int* a, int left, int right)
{
	if (left + 1 < right)
	{
		int mid = (left + right) / 2;
		merge_sort(a, left, mid);
		merge_sort(a, mid, right);
		merge(a, left, mid, right);
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	cnt = 0;
	merge_sort(a, 0, n);
	printf("%lld\n", cnt);

	return 0;
}



Compiler output:
a.cc:7:1: error: 'int64_t' does not name a type
    7 | int64_t cnt;
      | ^~~~~~~
a.cc:2:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    1 | #include <stdio.h>
  +++ |+#include <cstdint>
    2 | 
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:27:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |                         cnt += n1 - i;
      |                         ^~~
      |                         int
a.cc: In function 'int main()':
a.cc:49:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   49 |         cnt = 0;
      |         ^~~
      |         int
Language: C++

#include <stdio.h>

void bubbleSort(int *A, n) {
    int count = 0;
    for (int i=0; i<n; i++) {
        for (int j=n-1; j>i; j--) {
            if(A[j] < A[j-1]) {
                int tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                count++;
            }
        }
    }
    
    return count;
}

int main() {
    int n;
    scanf("%d", &n);
    int A[n];
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    
    int count = bubbleSort(A, n);
    
    printf("%d\n", count);
    return 0;
}


Compiler output:
a.cc:3:25: error: 'n' has not been declared
    3 | void bubbleSort(int *A, n) {
      |                         ^
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:5:21: error: 'n' was not declared in this scope
    5 |     for (int i=0; i<n; i++) {
      |                     ^
a.cc:16:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   16 |     return count;
      |            ^~~~~
a.cc: In function 'int main()':
a.cc:25:27: error: void value not ignored as it ought to be
   25 |     int count = bubbleSort(A, n);
      |                 ~~~~~~~~~~^~~~~~
Language: C++

#include <stdio.h>

void bubbleSort(int *A, int n) {
    int count = 0;
    for (int i=0; i<n; i++) {
        for (int j=n-1; j>i; j--) {
            if(A[j] < A[j-1]) {
                int tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                count++;
            }
        }
    }
    
    return count;
}

int main() {
    int n;
    scanf("%d", &n);
    int A[n];
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    
    int count = bubbleSort(A, n);
    
    printf("%d\n", count);
    return 0;
}


Compiler output:
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:16:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   16 |     return count;
      |            ^~~~~
a.cc: In function 'int main()':
a.cc:25:27: error: void value not ignored as it ought to be
   25 |     int count = bubbleSort(A, n);
      |                 ~~~~~~~~~~^~~~~~
Language: C++

#include <stdio.h>
#define INF 1<<30

int count;

void merge(int *A, int left, int mid, int right) {
    int n1 = mid-left;
    int n2 = right-mid;
    int L[n1+1], R[n2+1];
    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, j=0;
    for (int k=left, k<right; k++) {
        if(L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            for(int l=i; l<n1; l++) {
                if(R[j] > L[l]) count++;
            }
            A[k] = R[j];
            j++;
        }
    }
}

int 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;
    scanf("%d", &n);
    int A[n];
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    
    int count = 0;
    mergeSort(A, 0, n);
    
    printf("%d\n", count);
    return 0;
}


Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:11:28: error: expected primary-expression before ')' token
   11 |     for (int i=0; i<n2; i==) R[i] = A[mid+i];
      |                            ^
a.cc:16:23: error: expected ';' before '<' token
   16 |     for (int k=left, k<right; k++) {
      |                       ^
      |                       ;
a.cc:16:23: error: expected primary-expression before '<' token
a.cc: In function 'int mergeSort(int*, int, int)':
a.cc:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
   37 | }
      | ^
Language: C++

#include <stdio.h>
#define INF 1<<30

int count;

void merge(int *A, int left, int mid, int right) {
    int n1 = mid-left;
    int n2 = right-mid;
    int L[n1+1], R[n2+1];
    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, j=0;
    for (int k=left, k<right; k++) {
        if(L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            for(int l=i; l<n1; l++) {
                if(R[j] > L[l]) count++;
            }
            A[k] = R[j];
            j++;
        }
    }
}

int 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;
    scanf("%d", &n);
    int A[n];
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    
    int count = 0;
    mergeSort(A, 0, n);
    
    printf("%d\n", count);
    return 0;
}


Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:16:23: error: expected ';' before '<' token
   16 |     for (int k=left, k<right; k++) {
      |                       ^
      |                       ;
a.cc:16:23: error: expected primary-expression before '<' token
a.cc: In function 'int mergeSort(int*, int, int)':
a.cc:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
   37 | }
      | ^
Language: C++

#include<stdio.h>
#include<iostream>

#define MAX 500000
#define SENTINEL 2000000000

using namespace std;

int L[MAX/2+2], R[MAX/2+2];
int cnt
long long inv;

//[left, right)
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++){
        cnt++;
        if(L[i]<=R[j]){
            A[k]=L[i];
            i++;
        }
        else{
            A[k]=R[j];
            inv+=(long long)(n1-i);
            j++;
        }
    }
}

void MergeSort(int A[], int n, int left, int right)
{
    if(left+1<right){
        int mid=(left+right)/2;
        MergeSort(A, n, left, mid);
        MergeSort(A, n, mid, right);
        Merge(A, n, left, mid, right);
    }
}

int main()
{
    int A[MAX], n, i;
    cnt=0;
    inv=0;

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

    MergeSort(A, n, 0, n);

    printf("%lld\n", inv);
    return 0;
}




Compiler output:
a.cc:11:1: error: expected initializer before 'long'
   11 | long long inv;
      | ^~~~
a.cc: In function 'void Merge(int*, int, int, int, int)':
a.cc:25:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   25 |         cnt++;
      |         ^~~
      |         int
a.cc:32:13: error: 'inv' was not declared in this scope; did you mean 'int'?
   32 |             inv+=(long long)(n1-i);
      |             ^~~
      |             int
a.cc: In function 'int main()':
a.cc:51:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   51 |     cnt=0;
      |     ^~~
      |     int
a.cc:52:5: error: 'inv' was not declared in this scope; did you mean 'int'?
   52 |     inv=0;
      |     ^~~
      |     int
Language: C++

#include <iostream>
#include <cstdio>

typedef long long ll;
ll merge(int A[], int left, int mid, int right);
ll mergeSort(int A[], int left, int right);

int main()
{
  using namespace std;
  int n;
  cin >> n;
  int *A = new int[n];
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &A[i]);
  }
  cout << mergeSort(A, 0, n - 1) << endl;
  delete[] A;
  return 0;
}

ll merge(int A[], int left, int mid, int right)
{
  int count = 0;
  int len1 = mid - left + 1;
  int len2 = right - mid;
  int *L = new int[len1 + 1];
  int *R = new int[len2 + 1];
  for (int i = 0; i < len1; i++)
  {
    L[i] = A[i + left];
  }
  for (int i = 0; i < len2; i++)
  {
    R[i] = A[i + mid + 1];
  }

  int i = 0, j = 0, k = left;
  /*while (i < len1 && j < len2)
  {
    if (L[i] <= R[j])
    {
      A[k++] = L[i++];
    }
    else
    {
      A[k++] = R[j++];
      count += len1 - i;
    }
  }
  while (i < len1)
  {
    A[k++] = L[i++];
  }
  while (j < len2)
  {
    A[k++] = R[j++];
  }*/
  L[len1] = R[len2] = INT_MAX;
  for (k = left; k <= right; k++)
  {
    if (L[i] <= R[j])
    {
      A[k] = L[i++];
    }
    else
    {
      A[k] = R[j++];
      count += len1 - i;
    }
    
  }
  delete[] L;
  delete[] R;
  return count;
}

ll mergeSort(int A[], int left, int right)
{
  ll r1, r2, r3;
  if (left < right)
  {
    int mid = (left + right) / 2;
    r1 = mergeSort(A, left, mid);
    r2 = mergeSort(A, mid + 1, right);
    r3 = merge(A, left, mid, right);
    return r1 + r2 + r3;
  }
  else
  {
    return 0;
  }
}



Compiler output:
a.cc: In function 'll merge(int*, int, int, int)':
a.cc:60:23: error: 'INT_MAX' was not declared in this scope
   60 |   L[len1] = R[len2] = INT_MAX;
      |                       ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 |
Language: C++

#include<iostream>
#include<vector>
#include<map>

using namespace std;

class BIT{
public:
  int size;
  int* bit;

  BIT(int _size = 0){
    size = _size;
    bit = new int[size];
    for(int i = 0; i < size; i++) bit[i] = 0;
  }

  ~BIT(){delete[] bit;}

  /*
    En: returns sum of [from bit[0] to bit[i]].
    Ja: bit[0]からbit[i]までの合計をかえす。
   */
  int sum(int i){
    int s = 0;
    while(i > 0){
      s += bit[i];
      i -= i&-i;
    }
    return s;
  }

  /*
    En: add x at bit[i].
    Ja: bit[i]にxを加える。
   */
  void add(int i, int x){
    while(i<=size){
      bit[i] += x;
      i += i&-i;
    }
  }
};

vector<int> make(const vector<int> v){
  vector<int> tmp = v;
  sort(tmp.begin(), tmp.end());

  int cnt = 1, idx = 0;
  map<int,int> M;
  while(idx < (int)v.size()){
    M[tmp[idx]] = cnt++;
    while(idx+1 < (int)tmp.size() && tmp[idx] == tmp[idx+1]) idx++;
    idx++;
  }

  vector<int> vec(v.size());
  for(int i = 0; i < (int)v.size(); i++) vec[i] = M[v[i]];
  return vec;
}

int main(){

  int n;
  cin >> n;
  vector<int> v(n);
  for(int i = 0; i < n; i++) cin >> v[i];
  v = make(v);
  BIT bit(n);
  long long ans = 0;
  for(int i = 0; i < n; i++){
    ans += i - bit.sum(v[i]);
    bit.add(v[i],1);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> make(std::vector<int>)':
a.cc:47:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   47 |   sort(tmp.begin(), tmp.end());
      |   ^~~~
      |   short
Language: Java



import java.util.*;

/**
 * A
 */
public class A {

    void run() {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] A = new int[n];
        int[] B = new int[n];

        int max=0;

        for(int i=0; i<n; i++) {
            A[i] = sc.nextInt();
            if(A[i]>max) {
                max = A[i];
            }
        }

        sc.close();

        countingSort(A, B, max);


        System.out.print(B[0]);

        for(int i=1; i<n; i++) {
            if(i == n-1) {
                System.out.println(" "+B[i]);
            } else {
                System.out.print(" "+B[i]);
            }
        }

    }

    void countingSort(int[] A, int[] B, int k) {

        int[] C = new int[k+1];

        for(int j=0; j<A.length; j++) {
            C[A[j]]++;
        }

        for(int i=1; i<k+1; i++) {
            C[i] = C[i] + C[i-1];
        }

        for(int j=A.length-1; j>=0; j--) {

            B[C[A[j]]-1] = A[j];
            C[A[j]]--;

        }

    } 

    public static void main(String[] args) {
        new A().run();
    }
}


Compiler output:
Main.java:8: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: Java

import java.util.*;

public class A {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   int[] A = new int[n];
   int max = 0, min = 0; 
   for(int i = 0;i < n;i++){
      A[i] = sc.nextInt();
      if(i == 0) min = A[i];
      if(A[i] > max) max = A[i];
      else if(A[i] < max && A[i] < min) min = A[i]; 
   } 
   //int k = max -min + 1;
   int k = max;
   int[] B = new int[n];  
   int[] C = new int[k];

   for(int i = 0;i < k;i++) C[i] = 0;
   for(int j = 0;j < n;j++) C[A[j]]++;/*j = 1 to j = 0*/
   for(int i = 1;i < k;i++){
     C[i]+=C[i - 1];
   }
   for(int j = n - 1;j >= 0;j--){/*j > 0 to j>= 0 */
     B[C[A[j]] - 1] = A[j];
     C[A[j]]--;
   }
   StringBuilder sb = new StringBuilder();

   /*for(int i = 0;i < n - 1;i++){
      //System.out.print(B[i]);
      sb.append(B[i]);
    }
    for(int i = 0;i < n;i++){
      System.out.print(B[i]);
      if(i != n - 1) System.out.print(" ");
    }
   System.out.println();*/
   for(int i = 0;i < n - 1;i++){
    sb.append(B[i]+" ");
  }
  System.out.println(sb.append(B[n - 1]));
  }
}





Compiler output:
Main.java:3: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: Java

import java.io.*;
import java.util.*;


public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		ArrayList<String> list = new ArrayList<String>();
		for(int i=0; i<num;i++)
			list.add(scan.next());
		scan.close();
		CountingSort cs = new CountingSort(num);
		cs.loadSequence((String[])list.toArray(new String[0]));
		cs.sort();
		System.out.println(cs);

	}

}





class CountingSort extends Sorting{
	int[] seq;
	int[] sorted;
	public CountingSort(int n){
		super(n);
		seq = new int[n];
		sorted = new int[n];
	}
	@Override
	public void loadSequence(String[] str){
		for(int i=0; i<this.length;i++)
			seq[i] = Integer.parseInt(str[i]);
	}
	int maxElement(){
		int max = seq[0];
		for(int i=1;i<this.length;i++)
			if(max<seq[i])
				max=seq[i];
		return max;
	}

	@Override
	public void sort(){
		int[] counter = new int[maxElement()+1];
		for(int i=0; i<this.length;i++)
			counter[seq[i]]++;
		for(int i=1; i<=maxElement();i++)
			counter[i] += counter[i-1];
		for(int i=this.length-1;i>=0;i--){
			System.out.println(--counter[seq[i]]);
			sorted[counter[seq[i]]] = seq[i];
		}
	}
	@Override
	public String toString(){
		String tmp = "";
		for(int i=0; i<this.length; i++)
			tmp = tmp + " " + sorted[i];
		return tmp.trim();
	}

}

abstract class Sorting{
	int swapTimes;
	int length;
	ArrayList<comparable> sortList;
	public Sorting(int n){
		swapTimes=0;
		length=n;
		sortList = new ArrayList<comparable>();
	}
	

	void swap(int i, int j){
		swapTimes++;
		comparable tmp = sortList.set(i,sortList.get(j));
		sortList.set(j,tmp);
	}
	abstract public void loadSequence(String[] str);
	abstract public void sort();
}

Compiler output:
Main.java:73: error: cannot find symbol
	ArrayList<comparable> sortList;
	          ^
  symbol:   class comparable
  location: class Sorting
Main.java:77: error: cannot find symbol
		sortList = new ArrayList<comparable>();
		                         ^
  symbol:   class comparable
  location: class Sorting
Main.java:83: error: cannot find symbol
		comparable tmp = sortList.set(i,sortList.get(j));
		^
  symbol:   class comparable
  location: class Sorting
3 errors
Language: Java

import java.util.Scanner;
public class Main {
    public static void main (String[] args) throws IOException{
	Scanner scan = new Scanner(System.in);
	int n = scan.nextInt();
	int[] a = new int[n];
	int[] b = new int[n];
	int max = 0;
	for (int i = 0; i < n; i++) {
	    a[i] = scan.nextInt();
	    max = Math.max(max, a[i]);
	}
	CountingSort(a, b, max);
	StringBuilder sb = new StringBuilder();
	for (int i = 0; i < n; i++) {
	    sb.append(b[i]).append(' ');
	}
	System.out.println(sb.toString().trim());
    }
    static void CountingSort (int[] a, int[] b, int k) {
	int n = a.length;
	int[] c = new int[k+1];
	for (int j = 0; j < n; j++) {
	    c[a[j]]++;
	}
	for (int i = 1; i <= k; i++) {
	    c[i] = c[i] +c[i-1];
	}
	for (int j = n - 1; j >= 0; j--) {
	    b[c[a[j]]-1] = a[j];
	    c[a[j]]--;
	}
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
    public static void main (String[] args) throws IOException{
                                                   ^
  symbol:   class IOException
  location: class Main
1 error