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

#include <iostream>

using namespace std;
#define max  2000001
#define vmax  10000

int main(){
    unsigned short *A, *B;
    int c[vmax+1];
    int n,i,j;
    cin >> n;
    A = int[n+1];
    B = int[n+1];
    for (i = 0; i<vmax;i++){
        c[i]=0;
    }
    for (i = 0;i<n; i++){
        cin >> A[i];
        c[A[i]]++;
    }
    for (i = 1;i<=vmax;i++){
        c[i] = c[i -1] + c[i];
    }
    for (j = 0; j<=n;j++){
        B[c[A[j]]] = A[j];
        c[A[j]]--;
    }
    for (i = 1; i<=n ;i++){
        if (i>1) cout << " ";
        cout << B[i];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: expected primary-expression before 'int'
   12 |     A = int[n+1];
      |         ^~~
a.cc:13:9: error: expected primary-expression before 'int'
   13 |     B = int[n+1];
      |         ^~~
Language: C++

#include <iostream>

using namespace std;
#define max  2000001
#define vmax  10000

int main(){
    unsigned short *A, *B;
    int c[vmax+1];
    int n,i,j;
    cin >> n;
    vector <int> A;
    vector <int> B;
    for (i = 0; i<vmax;i++){
        c[i]=0;
    }
    for (i = 0;i<n; i++){
        cin >> A[i];
        c[A[i]]++;
    }
    for (i = 1;i<=vmax;i++){
        c[i] = c[i -1] + c[i];
    }
    for (j = 0; j<=n;j++){
        B[c[A[j]]] = A[j];
        c[A[j]]--;
    }
    for (i = 1; i<=n ;i++){
        if (i>1) cout << " ";
        cout << B[i];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector <int> A;
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:12:13: error: expected primary-expression before 'int'
   12 |     vector <int> A;
      |             ^~~
a.cc:13:13: error: expected primary-expression before 'int'
   13 |     vector <int> B;
      |             ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define max  2000001
#define vmax  10000

int main(){
    unsigned short *A, *B;
    int c[vmax+1];
    int n,i,j;
    cin >> n;
    vector <int> A;
    vector <int> B;
    for (i = 0; i<vmax;i++){
        c[i]=0;
    }
    for (i = 0;i<n; i++){
        cin >> A[i];
        c[A[i]]++;
    }
    for (i = 1;i<=vmax;i++){
        c[i] = c[i -1] + c[i];
    }
    for (j = 0; j<=n;j++){
        B[c[A[j]]] = A[j];
        c[A[j]]--;
    }
    for (i = 1; i<=n ;i++){
        if (i>1) cout << " ";
        cout << B[i];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: conflicting declaration 'std::vector<int> A'
   12 |     vector <int> A;
      |                  ^
a.cc:8:21: note: previous declaration as 'short unsigned int* A'
    8 |     unsigned short *A, *B;
      |                     ^
a.cc:13:18: error: conflicting declaration 'std::vector<int> B'
   13 |     vector <int> B;
      |                  ^
a.cc:8:25: note: previous declaration as 'short unsigned int* B'
    8 |     unsigned short *A, *B;
      |                         ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define max  2000001
#define vmax  10000

int main(){
    unsigned short *A, *B;
    int c[vmax+1];
    int n,i,j;
    cin >> n;
    vector <unsigned short> A;
    vector <unsigned short> B;
    for (i = 0; i<vmax;i++){
        c[i]=0;
    }
    for (i = 0;i<n; i++){
        cin >> A[i];
        c[A[i]]++;
    }
    for (i = 1;i<=vmax;i++){
        c[i] = c[i -1] + c[i];
    }
    for (j = 0; j<=n;j++){
        B[c[A[j]]] = A[j];
        c[A[j]]--;
    }
    for (i = 1; i<=n ;i++){
        if (i>1) cout << " ";
        cout << B[i];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: conflicting declaration 'std::vector<short unsigned int> A'
   12 |     vector <unsigned short> A;
      |                             ^
a.cc:8:21: note: previous declaration as 'short unsigned int* A'
    8 |     unsigned short *A, *B;
      |                     ^
a.cc:13:29: error: conflicting declaration 'std::vector<short unsigned int> B'
   13 |     vector <unsigned short> B;
      |                             ^
a.cc:8:25: note: previous declaration as 'short unsigned int* B'
    8 |     unsigned short *A, *B;
      |                         ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define max  2000001
#define vmax  10000

int main(){
    
    int c[vmax+1];
    int n,i,j;
    cin >> n;
    int[] A;
    int[] B;
    for (i = 0; i<vmax;i++){
        c[i]=0;
    }
    for (i = 0;i<n; i++){
        cin >> A[i];
        c[A[i]]++;
    }
    for (i = 1;i<=vmax;i++){
        c[i] = c[i -1] + c[i];
    }
    for (j = 0; j<=n;j++){
        B[c[A[j]]] = A[j];
        c[A[j]]--;
    }
    for (i = 1; i<=n ;i++){
        if (i>1) cout << " ";
        cout << B[i];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: structured binding declaration cannot have type 'int'
   12 |     int[] A;
      |        ^~
a.cc:12:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:8: error: empty structured binding declaration
a.cc:12:11: error: expected initializer before 'A'
   12 |     int[] A;
      |           ^
a.cc:13:8: error: structured binding declaration cannot have type 'int'
   13 |     int[] B;
      |        ^~
a.cc:13:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:13:8: error: empty structured binding declaration
a.cc:13:11: error: expected initializer before 'B'
   13 |     int[] B;
      |           ^
a.cc:18:16: error: 'A' was not declared in this scope
   18 |         cin >> A[i];
      |                ^
a.cc:25:9: error: 'B' was not declared in this scope
   25 |         B[c[A[j]]] = A[j];
      |         ^
a.cc:25:13: error: 'A' was not declared in this scope
   25 |         B[c[A[j]]] = A[j];
      |             ^
a.cc:30:17: error: 'B' was not declared in this scope
   30 |         cout << B[i];
      |                 ^
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int main(){
int n,a[100000];
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
sort(a,a+n);
printf("%d",a[0]);
for(int i=1;i<n;i++)prinf(" %d",a[i]);
printf("\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   10 | for(int i=1;i<n;i++)prinf(" %d",a[i]);
      |                     ^~~~~
      |                     printf
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main() {
	unsigned short *A, *B;

	int C[VMAX + 1];
	int n, i, j;
	scanf("%d", &n);

	A = malloc(sizeof(short)*n + 1);
	B = malloc(sizeof(short)*n + 1);

	for (i = 0; i <= VMAX; i++)C[i] = 0;

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

	for (i = 1; i <= VMAX; i++)C[i] = C[i] + C[i - 1];

	for (j = 1; j <= n; j++) {
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}

	for (i = 1; i <= n; i++) {
		if (i > 1)printf(" ");
		printf("%d", B[i]);
	}
	printf("\n");

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |         A = malloc(sizeof(short)*n + 1);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
a.cc:15:19: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   15 |         B = malloc(sizeof(short)*n + 1);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=1;i<=n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define INF 2000000000
#define llong long long
#define MAX 2000001
#define VMAX 10000
using namespace std;
int main(){
  int C[VMAX+1];
  int n,i,j;
  unsigned short *A,*B;
  scanf("%d",&n);
  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);
  C[0]=0;
  REP(i,n) C[i]=0;
  REP(i,n){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  REP(i,VMAX) C[i+1]=C[i+1]+C[i];
  REP(j,n){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  REP(i,n){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:15:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   15 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=1;i<=n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define INF 2000000000
#define llong long long
#define MAX 2000001
#define VMAX 10000
using namespace std;
int main(){
  int C[VMAX+1];
  int n,i,j;
  unsigned short *A,*B;
  scanf("%d",&n);
  A=malloc(sizeof(short) * n+1);
  B=malloc(sizeof(short) * n+1);
  C[0]=0;
  REP(i,n) C[i]=0;
  REP(i,n){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  REP(i,VMAX) C[i+1]=C[i+1]+C[i];
  REP(j,n){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  REP(i,n){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |   A=malloc(sizeof(short) * n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:15:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   15 |   B=malloc(sizeof(short) * n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define REP(i,n) for(int i=1;i<=n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define MAX 2000001
#define VMAX 10000
int main(){
  int C[VMAX+1];
  int n,i,j;
  unsigned short *A,*B;
  scanf("%d",&n);
  A=malloc(sizeof(short) * n+1);
  B=malloc(sizeof(short) * n+1);
  C[0]=0;
  REP(i,n) C[i]=0;
  REP(i,n){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  REP(i,VMAX) C[i+1]=C[i+1]+C[i];
  REP(j,n){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  REP(i,n){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   12 |   A=malloc(sizeof(short) * n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:13:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   13 |   B=malloc(sizeof(short) * n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define REP(i,n) for(int i=1;i<=n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define MAX 2000001
#define VMAX 10000
int main(){
  int C[VMAX+1];
  int n,i,j;
  unsigned short *A,*B;
  scanf("%d",&n);
  A=malloc(sizeof(unsigned short) * n+1);
  B=malloc(sizeof(unsigned short) * n+1);
  C[0]=0;
  REP(i,n) C[i]=0;
  REP(i,n){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  REP(i,VMAX) C[i+1]=C[i+1]+C[i];
  REP(j,n){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  REP(i,n){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   12 |   A=malloc(sizeof(unsigned short) * n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:13:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   13 |   B=malloc(sizeof(unsigned short) * n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  unsigned int *A,*B;
  inc C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=a;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'inc' was not declared in this scope; did you mean 'int'?
    7 |   inc C[VMAX+1];
      |   ^~~
      |   int
a.cc:10:11: error: invalid conversion from 'void*' to 'unsigned int*' [-fpermissive]
   10 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:11:11: error: invalid conversion from 'void*' to 'unsigned int*' [-fpermissive]
   11 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:12:24: error: 'C' was not declared in this scope
   12 |   for(i=0;i<=VMAX;i++) C[i]=0;
      |                        ^
a.cc:15:5: error: 'C' was not declared in this scope
   15 |     C[A[i+1]]++;
      |     ^
a.cc:17:24: error: 'C' was not declared in this scope
   17 |   for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
      |                        ^
a.cc:19:7: error: 'C' was not declared in this scope
   19 |     B[C[A[j]]]=A[j];
      |       ^
a.cc:22:9: error: 'a' was not declared in this scope
   22 |   for(i=a;i<n;i++){
      |         ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=a;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   10 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:11:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   11 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:22:9: error: 'a' was not declared in this scope
   22 |   for(i=a;i<n;i++){
      |         ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc(sizeof(short) (short int)*n+1);
  B=malloc(sizeof(short) (short int)*n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: expected ')' before '(' token
   10 |   A=malloc(sizeof(short) (short int)*n+1);
      |           ~             ^~
      |                         )
a.cc:10:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   10 |   A=malloc(sizeof(short) (short int)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:11:25: error: expected ')' before '(' token
   11 |   B=malloc(sizeof(short) (short int)*n+1);
      |           ~             ^~
      |                         )
a.cc:11:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   11 |   B=malloc(sizeof(short) (short int)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc(sizeof(short) short int*n+1);
  B=malloc(sizeof(short) short int*n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: expected ')' before 'short'
   10 |   A=malloc(sizeof(short) short int*n+1);
      |           ~             ^~~~~~
      |                         )
a.cc:10:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   10 |   A=malloc(sizeof(short) short int*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:11:25: error: expected ')' before 'short'
   11 |   B=malloc(sizeof(short) short int*n+1);
      |           ~             ^~~~~~
      |                         )
a.cc:11:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   11 |   B=malloc(sizeof(short) short int*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc(sizeof(short) *n+1);
  B=malloc(sizeof(short) *n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   10 |   A=malloc(sizeof(short) *n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:11:11: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   11 |   B=malloc(sizeof(short) *n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc short int*(sizeof(short) *n+1);
  B=malloc short int*(sizeof(short) *n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: cannot convert 'void*(size_t) noexcept' {aka 'void*(long unsigned int) noexcept'} to 'short int*' in assignment
   10 |   A=malloc short int*(sizeof(short) *n+1);
      |     ^~~~~~
      |     |
      |     void*(size_t) noexcept {aka void*(long unsigned int) noexcept}
a.cc:11:5: error: cannot convert 'void*(size_t) noexcept' {aka 'void*(long unsigned int) noexcept'} to 'short int*' in assignment
   11 |   B=malloc short int*(sizeof(short) *n+1);
      |     ^~~~~~
      |     |
      |     void*(size_t) noexcept {aka void*(long unsigned int) noexcept}
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
int main(){
  short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc (short int*)(sizeof(short) *n+1);
  B=malloc (short int*)(sizeof(short) *n+1);
  for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: expected primary-expression before 'short'
   10 |   A=malloc (short int*)(sizeof(short) *n+1);
      |             ^~~~~
a.cc:11:13: error: expected primary-expression before 'short'
   11 |   B=malloc (short int*)(sizeof(short) *n+1);
      |             ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main(void)
{
/* *** initialize *** */
	int dataN = 0;
        int maxN = 2000000;
        int maxData = 10000;
	int boxA[maxData] = {};
	int boxB[maxData] = {};
	int boxC[maxData] = {};

/*  *** input Data *** */
	cin >> dataN;
	if((dataN > maxN) && (dataN != 0))
	{
		cout << "Invalid Data!!" << endl;
		return 0;
	}
	
	if(dataN >= maxData)
	{
		dataN = maxaData;
		for(int n = 0; n < dataN; n++)
		{
			cin >> boxA[n];
		}
	}

/* *** data analysis *** */
	for(int n = 0; n < dataN; n++)
	{
		int dataA = boxA[n];
		int count = 0;
		for(int c = 0; c < dataN; c++)
		{	/* Count the same number of values???as data A */
			if(boxA[c] == dataA)
			{
				count ++;
			}
		}
		boxC[dataA] = count;	/* Acquire data from boxC[0] */
	}

	for(int c = 1; c <= maxData; c++)
	{
		if(c == 0)
		{
			boxC[c] = boxC[0];
		}
		else
		{
			boxC[c] += boxC[c-1];
		}
	}

/* *** sort *** */
	for(int b = 0; b <= dataN; b++)
	{
		boxB[boxC[boxA[b]]] = boxA[b];
		boxC[boxA[b]]--;
	}
	
/* *** result *** */
	for(int data = 1; data <= dataN; data++)
	{
		if(data == dataN)
		{
			cout << boxB[data] << endl;
		}
		else
		{
			cout << boxB[data] << " ";
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'maxaData' was not declared in this scope; did you mean 'maxData'?
   24 |                 dataN = maxaData;
      |                         ^~~~~~~~
      |                         maxData
Language: C++

#include <iostream>
using namespace std;

#define maxN 2000000
#define maxData 10000

int main(void)
{
/* *** initialize *** */
	int dataN = 0;
	int boxA[maxData] = {};
	int boxB[maxData] = {};
	int boxC[maxData] = {};

/*  *** input Data *** */
	cin >> dataN;
	if((dataN > maxN) && (dataN != 0))
	{
		cout << "Invalid Data!!" << endl;
		return 0;
	}
	
	if(dataN >= maxData)
	{
		dataN = maxaData;
		for(int n = 0; n < dataN; n++)
		{
			cin >> boxA[n];
		}
	}

/* *** data analysis *** */
	for(int n = 0; n < dataN; n++)
	{
		int dataA = boxA[n];
		int count = 0;
		for(int c = 0; c < dataN; c++)
		{	/* Count the same number of values???as data A */
			if(boxA[c] == dataA)
			{
				count ++;
			}
		}
		boxC[dataA] = count;	/* Acquire data from boxC[0] */
	}

	for(int c = 1; c <= maxData; c++)
	{
		if(c == 0)
		{
			boxC[c] = boxC[0];
		}
		else
		{
			boxC[c] += boxC[c-1];
		}
	}

/* *** sort *** */
	for(int b = 0; b <= dataN; b++)
	{
		boxB[boxC[boxA[b]]] = boxA[b];
		boxC[boxA[b]]--;
	}
	
/* *** result *** */
	for(int data = 1; data <= dataN; data++)
	{
		if(data == dataN)
		{
			cout << boxB[data] << endl;
		}
		else
		{
			cout << boxB[data] << " ";
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'maxaData' was not declared in this scope; did you mean 'maxData'?
   25 |                 dataN = maxaData;
      |                         ^~~~~~~~
      |                         maxData
Language: C++

#include <iostream>

using namespace std;

int A[2000000];
int B[2000000];
int C[10001];

int main()
{
    int n;
    cin >> n;

    for(int i=0; i<n; i++){
        cin >> A[i];
        cout << i << endl;
        C[A[i]]++;
    }

    for(int i=1; i<=10000; i++){
        C[i] += C[i-1];
        cout << "C" << endl;
    }

    for(int j=n-1; j>=0; j--){
        B[--C[A[j]]] = A[j];
        cout << "B" << endl;
    }

    for(int i=0; i<n; i++){
        cout << B[i];
        if(i==n-1){
            cout << endl;
        } else {
            cout << ' ';
        }
    }
}
#include <iostream>

using namespace std;

int A[2000000];
int B[2000000];
int C[10001];

int main()
{
    int n;
    cin >> n;

    for(int i=0; i<n; i++){
        cin >> A[i];
        cout << i << endl;
        C[A[i]]++;
    }

    for(int i=1; i<=10000; i++){
        C[i] += C[i-1];
        cout << "C" << endl;
    }

    for(int j=n-1; j>=0; j--){
        B[--C[A[j]]] = A[j];
        cout << "B" << endl;
    }

    for(int i=0; i<n; i++){
        cout << B[i];
        if(i==n-1){
            cout << endl;
        } else {
            cout << ' ';
        }
    }
}

Compiler output:
a.cc:43:5: error: redefinition of 'int A [2000000]'
   43 | int A[2000000];
      |     ^
a.cc:5:5: note: 'int A [2000000]' previously declared here
    5 | int A[2000000];
      |     ^
a.cc:44:5: error: redefinition of 'int B [2000000]'
   44 | int B[2000000];
      |     ^
a.cc:6:5: note: 'int B [2000000]' previously declared here
    6 | int B[2000000];
      |     ^
a.cc:45:5: error: redefinition of 'int C [10001]'
   45 | int C[10001];
      |     ^
a.cc:7:5: note: 'int C [10001]' previously declared here
    7 | int C[10001];
      |     ^
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main()
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main()
      |     ^~~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int mian()
{
	unsigned short *A,*B;

	int C[VMAX+1];
	int n,i,j;
	scanf("%d",&n);

	A=malloc(sizeof(short)*n+1);
	B=malloc(sizeof(short)*n+1);

	for(i=0;i<= VMAX;i++)C[i]=0;

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

	for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i+1];

	for(j=1;j<=n;j++)
	{
		B[C[A[j]]]=A[j];
		C[A[j]]--;
	}

	for(i=1;i<=ni++)
	{
		if(i>1)printf(" ");
		printf("%d",B[i]);
	}
	printf("\n");

	return 0;
}

Compiler output:
a.cc: In function 'int mian()':
a.cc:14:17: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |         A=malloc(sizeof(short)*n+1);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:15:17: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   15 |         B=malloc(sizeof(short)*n+1);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:33:20: error: 'ni' was not declared in this scope; did you mean 'i'?
   33 |         for(i=1;i<=ni++)
      |                    ^~
      |                    i
a.cc:33:24: error: expected ';' before ')' token
   33 |         for(i=1;i<=ni++)
      |                        ^
      |                        ;
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
	unsigned short *A,*B;
	
	int C[VMAX+1];
	int n,i,j;
	scanf("%d",&n);
	
	A=malloc(sizeof(short)*n+1);
	B=malloc(sizeof(short)*n+1);
	
	for(i=0;i<=VMAX;i++)C[i]=0;
	
	for(i=0;i<n;i++){
		scanf("%hu",&A[i+1]);
		C[A[i+1]]++;
	}
	
	for(i=1;i<=VMAX;i++){
		C[i]=C[i]+C[i-1];
	}
	
	for(j=1;j<=n;j++){
		B[C[A[j]]]=A[j];
		C[A[j]]--;
	}
	
	for(i=1;i<=n;i++){
		if(i>1)printf(" ");
		printf("%d",B[i]);
	}
	printf("\n");
	
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   13 |         A=malloc(sizeof(short)*n+1);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:14:17: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |         B=malloc(sizeof(short)*n+1);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define 10000

int main()
{
	unsigned short *A,*B;
	
	int C[VMAX+1];
	int n,i,j;
	scanf("%d",&n);
	
	A=malloc(sizeof(short)*n+1);
	B=malloc(sizeof(short)*n+1);
	
	for(i=0;i<=VMAX;i++) C[i]=0;
	
	for(i=0;i<n;i++)
	{
		scanf("%hu",&A[i+1]);
		C[A[i+1]]++;
	}
	
	for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
	
	for(j=1;j<=n;j++)
	{
		B[C[A[j]]]=A[j];
		C[A[j]]--;
	}
	for(i=1;i<=n;i++)
	{
		if(i>1) printf(" ");
		printf("%d",B[i]);
	}
	
	printf("\n");
	
	return 0;
}

Compiler output:
a.cc:4:9: error: macro names must be identifiers
    4 | #define 10000
      |         ^~~~~
a.cc: In function 'int main()':
a.cc:10:15: error: 'VMAX' was not declared in this scope; did you mean 'MAX'?
   10 |         int C[VMAX+1];
      |               ^~~~
      |               MAX
a.cc:14:17: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |         A=malloc(sizeof(short)*n+1);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:15:17: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   15 |         B=malloc(sizeof(short)*n+1);
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:17:30: error: 'C' was not declared in this scope
   17 |         for(i=0;i<=VMAX;i++) C[i]=0;
      |                              ^
a.cc:22:17: error: 'C' was not declared in this scope
   22 |                 C[A[i+1]]++;
      |                 ^
a.cc:25:30: error: 'C' was not declared in this scope
   25 |         for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
      |                              ^
a.cc:29:19: error: 'C' was not declared in this scope
   29 |                 B[C[A[j]]]=A[j];
      |                   ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX+1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short) * n + 1);
  B = malloc(sizeof(short) * n + 1);

  for ( i = 0; i <= VMAX; i++ ) C[i] = 0;

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

  for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   13 |   A = malloc(sizeof(short) * n + 1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
a.cc:14:13: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |   B = malloc(sizeof(short) * n + 1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000
 
int main (){
 unsigned short *A,*B;
  
 int C[VMAX+1];
 int n,i,j;
 scanf("%d",&n);
  
 A=malloc(sizeof(short)*n+1);
 B=malloc(sizeof(short)*n+1);
  
 for(i=0;i<=VMAX;i++) C[i]=0;
  
 for(i=0;i<n;i++){
  scanf("%hu",&A[i+1]);
  C[A[i+1]]++;
  }
   
  
 for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  
 for(j=1;j<=n;j++){
  B[C[A[j]]]=A[j];
  C[A[j]]--;
  }
  
 for(i=1;i<=n;i++){
  if(i>1)printf(" ");
  printf("%d",B[i]);
  }
  printf("\n");
   
  return 0;
   
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   13 |  A=malloc(sizeof(short)*n+1);
      |    ~~~~~~^~~~~~~~~~~~~~~~~~~
      |          |
      |          void*
a.cc:14:10: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |  B=malloc(sizeof(short)*n+1);
      |    ~~~~~~^~~~~~~~~~~~~~~~~~~
      |          |
      |          void*
Language: C++

#include<iostream>
#include<vector>
#include<cstring>

const int MAX=10010;

void countingSort(std::vector<int> &A,std::vector<int> &sorted){
    int count[MAX];
    int n=A.size();
    memset(count,0,sizeof(count));
    for(int i=0;i<n;i++)
        count[A[i]]++;
    for(int i=0;i<MAX;i++)
        count[i+1]+=count[i];
    for(int i=n-1;i>=0;i++)
        sorted[--count[A[i]]]=A[i];
}

int main(void){
    int n;
    std::cin>>n;
    std::vector<int> A(n);
    for(int i=0;i<n;i++)
        std::cin>>A[i]
    std::vector<int> sorted(n);
    countingSort(A,sorted);
    for(int i=0;i<n;i++)
        std::cout<<(i?" ":"")<<sorted[i]
    std::cin<<std::endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: expected ';' before 'std'
   24 |         std::cin>>A[i]
      |                       ^
      |                       ;
   25 |     std::vector<int> sorted(n);
      |     ~~~                
a.cc:26:20: error: 'sorted' was not declared in this scope; did you mean 'strtod'?
   26 |     countingSort(A,sorted);
      |                    ^~~~~~
      |                    strtod
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsinged short *A, *B;

  int C[VMAX + 1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short) * n + 1);
  B = malloc(sizeof(short) * n + 1);

  for ( i = 0; i <= VMAX; i++ ) {
    scanf("%hu", &A[i + 1]);
    C[A[i + 1]]++;
  }

  for ( i = 1; i <= VMAX; i++) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ) {
    if ( i > 1) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'unsinged' was not declared in this scope; did you mean 'unsigned'?
    7 |   unsinged short *A, *B;
      |   ^~~~~~~~
      |   unsigned
a.cc:13:3: error: 'A' was not declared in this scope
   13 |   A = malloc(sizeof(short) * n + 1);
      |   ^
a.cc:14:3: error: 'B' was not declared in this scope
   14 |   B = malloc(sizeof(short) * n + 1);
      |   ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX + 1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short) * n + 1);
  B = malloc(sizeof(short) * n + 1);

  for ( i = 0; i <= VMAX; i++ ) {
    scanf("%hu", &A[i + 1]);
    C[A[i + 1]]++;
  }

  for ( i = 1; i <= VMAX; i++) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ) {
    if ( i > 1) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   13 |   A = malloc(sizeof(short) * n + 1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
a.cc:14:13: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   14 |   B = malloc(sizeof(short) * n + 1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
Language: C++

def countingSort(A,B,k):
    c=[]
    for i in range(k+1):
        c.append(0)

    for j in range(len(A)):
        c[A[j]]+=1

    for i in range(1,k+1):
        c[i]=c[i]+c[i-1]
    for j in range(len(A)-1,-1,-1):
        B[c[A[j]]-1]=A[j]
        c[A[j]]-=1

n=int(input())
s=input()
l=s.split()
a=[]
b=[0 for i in range(n)]
for i in l:
    a.append(int(i))
countingSort(a,b,max(a))
for i in range(len(b)):
    print(b[i],end="");
    if i<len(b)-1:
        print(" ",end="")
print()



Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def countingSort(A,B,k):
      | ^~~
a.cc:25:5: error: expected unqualified-id before 'if'
   25 |     if i<len(b)-1:
      |     ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
map <int ,int> mpa,mpb;
#define VMAX 100000
#define MAX 200000001
int A[MAX],n;

int main (){
  unsigned short *A,*B;
  int C[VMAX+1]={0};
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  //for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=1;i<=n;i++) {
    scanf("%hu", &A[i]);
    C[A[i]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];  
  for(i=1;i<=n;i++) {
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++) {
    if(i) cout << " ";
    printf("%d", B[i]);
  }
  printf("\n");
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   23 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:24:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   24 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
map <int ,int> mpa,mpb;
#define VMAX 100000
#define MAX 200000001

int main (){
  unsigned short *A,*B;
  int C[VMAX+1]={0};
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  //for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=1;i<=n;i++) {
    scanf("%hu", &A[i]);
    C[A[i]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];  
  for(i=1;i<=n;i++) {
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++) {
    if(i) cout << " ";
    printf("%d", B[i]);
  }
  printf("\n");
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   22 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:23:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   23 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
map <int ,int> mpa,mpb;
#define VMAX 100000
#define MAX 200000001

int main (){
  unsigned short *A,*B;
  int C[VMAX+1]={0};
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  //for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=1;i<=n;i++) {
    scanf("%hu", &A[i]);
    C[A[i]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];  
  for(i=1;i<=n;i++) {
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++) {
    if(i) cout << " ";
    printf("%d", B[i]);
  }
  printf("\n");
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   23 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:24:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   24 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

//#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
map <int ,int> mpa,mpb;
#define VMAX 100000
#define MAX 200000001

int main (){
  unsigned short *A,*B;
  int C[VMAX+1]={0};
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  //for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=1;i<=n;i++) {
    scanf("%hu", &A[i]);
    C[A[i]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];  
  for(i=1;i<=n;i++) {
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++) {
    if(i) cout << " ";
    printf("%d", B[i]);
  }
  printf("\n");
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   23 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:24:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   24 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++


#include <stdio.h>
#include <stdlib.h>
using namespace std;
map <int ,int> mpa,mpb;
#define VMAX 100000
#define MAX 200000001

int main (){
  unsigned short *A,*B;
  int C[VMAX+1]={0};
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  //for(i=0;i<=VMAX;i++) C[i]=0;
  for(i=1;i<=n;i++) {
    scanf("%hu", &A[i]);
    C[A[i]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];  
  for(i=1;i<=n;i++) {
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++) {
    if(i) cout << " ";
    printf("%d", B[i]);
  }
  printf("\n");
  return 0;
}


Compiler output:
a.cc:5:1: error: 'map' does not name a type
    5 | map <int ,int> mpa,mpb;
      | ^~~
a.cc: In function 'int main()':
a.cc:15:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   15 |   A=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:16:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   16 |   B=malloc(sizeof(short)*n+1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:29:11: error: 'cout' was not declared in this scope
   29 |     if(i) cout << " ";
      |           ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <stdlib.h>
  +++ |+#include <iostream>
    4 | using namespace std;
Language: C++

#include <stdio.h>

void countingSort(int *A, int *B, int k) {
    int C[10000];
    for (int i=0; i<=k; i++) C[i] = 0;
    
    for (int j=1; j<=n; j++) C[A[j]]++;
    
    for (int i=1; i<=k; i++) C[i] = C[i] + C[i-1];
    
    for (int j=n; j>0; j--) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }
}

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


Compiler output:
a.cc: In function 'void countingSort(int*, int*, int)':
a.cc:7:22: error: 'n' was not declared in this scope
    7 |     for (int j=1; j<=n; j++) C[A[j]]++;
      |                      ^
a.cc:11:16: error: 'n' was not declared in this scope
   11 |     for (int j=n; j>0; j--) {
      |                ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

#define MAX 2000001
#define VMAX 10001

void countingSort(int*, int, int*, int);

int main() {
  int i, al;
  int *arrayA, *arrayB;

  arrayA = malloc(sizeof(int)*MAX);
  arrayB = malloc(sizeof(int)*MAX);
  
  scanf("%d", &al);
  for(i=1 ; i <= al ; i++) { scanf("%d", &arrayA[i]); }

  countingSort(arrayA, al, arrayB, 10000);
  
  for(i=1 ; i <= al ; i++) {
    printf("%d", arrayB[i]);
    if(i != al) { printf(" "); }
  }
  printf("\n");
  
  return 0;
}

void countingSort(int *A, int al, int *B, int k) {
  int i, C[VMAX];
  
  for(i=0; i <= k ; i++) { C[i] = 0; }

  for(i=1; i <= al ; i++) { C[A[i]]++; }

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

  for(i=al; i >= 1 ; i--) {
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   13 |   arrayA = malloc(sizeof(int)*MAX);
      |            ~~~~~~^~~~~~~~~~~~~~~~~
      |                  |
      |                  void*
a.cc:14:18: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   14 |   arrayB = malloc(sizeof(int)*MAX);
      |            ~~~~~~^~~~~~~~~~~~~~~~~
      |                  |
      |                  void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
int main(){
  int *A,*B,i,n,k,max=-1;
  scanf("%d",&n);
  A=malloc(sizeof(int)*(n+2));
  B=malloc(sizeof(int)*(n+2));
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(A[i]>max)max=A[i];
   
  }
  int *C=malloc(sizeof(int)*(max+2));
  
  for(i=0;i<=max;i++)C[i]=0;
  for(i=0;i<n;i++)C[A[i]]++;
  int j=0;
  i=0;
  while(1){
    if(j==max+1)break;
      if(C[j]==0){
      j++;
      continue;
    }
    B[i]=j;
    C[j]--;
     i++;
  }
  for(i=0;i<n;i++){
    printf("%d",B[i]);
    if(i!=n-1)printf(" ");
    else printf("\n");
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
    6 |   A=malloc(sizeof(int)*(n+2));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:7:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
    7 |   B=malloc(sizeof(int)*(n+2));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:13:16: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   13 |   int *C=malloc(sizeof(int)*(max+2));
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                |
      |                void*
Language: C++

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

void cs(int* A, int* B, int k);
 
int n;
 
// length is n
main(){
 
int A[2000001];
int B[2000001];
  int i,k=0;
  scanf("%d",&n);
 
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(A[i]>k) k=A[i];
  }
  // setting is finished
 
  cs(k);
 
  for(i=1;i<=n;i++){
    printf("%d",B[i]);
    if(i!=n) printf(" ");
  }
  printf("n");
 
  return 0;
}
 
void cs(int* A, int* B, int k){
  int C[k+1];
  int i,j,len;
  for(i=0; i<=k; i++)
    C[i] = 0;
 
  for(j=1; j<=n;j++)
    C[A[j]]++;
 
  for(i=1; i<=k; i++)
    C[i] = C[i] + C[i-1];
 
  for(j=n; j>=1; j--){
 
    B[C[A[j]]] = A[j];
    C[A[j]] = C[A[j]]-1;
 
  }
 
}

Compiler output:
a.cc:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:22:6: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   22 |   cs(k);
      |      ^
      |      |
      |      int
a.cc:22:5: error: too few arguments to function 'void cs(int*, int*, int)'
   22 |   cs(k);
      |   ~~^~~
a.cc:4:6: note: declared here
    4 | void cs(int* A, int* B, int k);
      |      ^~