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

nclude <stdio.h>
#define N 2000001

int A[N],B[N],C[N];
int n;


void CountingSort(int k){
  
  int i,j;
  
  for(i=0;i<=k;i++){
    C[i]=0;
  }

  for(j=1;j<=n;i++){
    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]]--;
  }
}





int main(){
  int i,m=0;
 


  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(m<A[i]){
      m=A[i];
    }
  }  
  CountingSort(m);

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

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | nclude <stdio.h>
      |        ^
main.c: In function 'CountingSort':
main.c:13:5: error: 'C' undeclared (first use in this function)
   13 |     C[i]=0;
      |     ^
main.c:13:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:7: error: 'A' undeclared (first use in this function)
   17 |     C[A[j]]++;
      |       ^
main.c:23:5: error: 'B' undeclared (first use in this function)
   23 |     B[C[A[j]]]=A[j];
      |     ^
main.c: In function 'main':
main.c:37:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   37 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | nclude <stdio.h>
main.c:37:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   37 |   scanf("%d",&n);
      |   ^~~~~
main.c:37:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:40:17: error: 'A' undeclared (first use in this function)
   40 |     scanf("%d",&A[i]);
      |                 ^
main.c:48:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 |     printf("%d",B[i]);
      |     ^~~~~~
main.c:48:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:48:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:17: error: 'B' undeclared (first use in this function)
   48 |     printf("%d",B[i]);
      |                 ^
main.c:52:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   52 |   printf("\n");
      |   ^~~~~~
main.c:52:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>
#define N 20000
int len;
int A[N];
int B[N];
int C[N];
main(){
  int i,j,k=0;
  scanf("%d",&len);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(K<A[i])k=A[i];
  }
  for(i=0;i<k;i++){//数字の種類だけループ
    C[i]=0;
    for(j=1; j<len; j++)
      C[A[j]]++;
    for(i=1; i<k;i++)
      C[i]=C[i]+C[i-1];
    for(j=len; j>1;j--){
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
  }
  for(i=0;i<len;i++){
    printf("%d ",B[i]);
    if(i<=len-1)
      printf("  ");
    printf("\n");
    return 0;
  }  
}

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:10:13: error: 'n' undeclared (first use in this function)
   10 |   for(i=0;i<n;i++){
      |             ^
main.c:10:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:8: error: 'K' undeclared (first use in this function)
   12 |     if(K<A[i])k=A[i];
      |        ^
Language: C

main(){
  int i,j,k=0,len;
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&A[i]);
    if(k<A[i])k=A[i];
  }
  for(i=0;i<k;i++){//数字の種類だけループ
    C[i]=0;
    for(j=1; j<len; j++)
      C[A[j]]++;
    for(i=1; i<k;i++)
      C[i]=C[i]+C[i-1];
    for(j=len; j>1;j--){
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
  }
  for(i=0;i<len;i++){
    printf("%d ",B[i]);
    if(i<=len-1)
      printf("  ");
    printf("\n");
    return 0;
  }  
}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:3:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |   scanf("%d",&len);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){
main.c:3:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |   scanf("%d",&len);
      |   ^~~~~
main.c:3:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:17: error: 'A' undeclared (first use in this function)
    5 |     scanf("%d",&A[i]);
      |                 ^
main.c:5:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:5: error: 'C' undeclared (first use in this function)
    9 |     C[i]=0;
      |     ^
main.c:15:7: error: 'B' undeclared (first use in this function)
   15 |       B[C[A[j]]]=A[j];
      |       ^
main.c:20:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |     printf("%d ",B[i]);
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>
#define N 20000
int A[N];
int B[N];
int C[N];
main(){
  int i,j,k=0,len;
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&A[i]);
    if(k<A[i])k=A[i];
  }
  for(i=0;i<k;i++){//数字の種類だけループ
    C[i]=0;
    for(j=1; j<len; j++)
      C[A[j]]++;
    for(i=1; i<k;i++)
      C[i]=C[i]+C[i-1];
    for(j=len; j>1;j--){
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
  }
  for(i=0;i<len;i++){
    printf("%d ",B[i]);
    if(i !=len-1)
      printf(" ");
    else if
      printf("\n");
    return 0;
  }  
}

Compiler output:
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:29:7: error: expected '(' before 'printf'
   29 |       printf("\n");
      |       ^~~~~~
      |       (
Language: C++

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


/*void CountingSort(unsigned short *A, unsigned short *B, int k){
  int i,j;
  unsigned short C[VMAX];
  
  for (i = 0 ; i <= k ; i++)
    C[i] = 0;

  
  for (j = 1; i <= n; i++)
    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]]--;
      }
}*/


int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int  i, j,n, k=0;

  scanf("%d", &n);

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

  /* your code */

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

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

  /* C[i] に i の出現数を記録する */
  for (j = 1; j <= n; j++){
    C[A[j]]++;
    
  }
  /* C[i] に i 以下の数の出現数を記録する*/
   for (i = 1 ;i < VMAX;i++)
    C[i] = C[i] + C[i-1];

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

   for(i=1;i<=n;i++){
     if(i!=1)
      printf(" ");
      
    printf("%u",B[i]);
   }
  printf("\n");
  free(A);
  free(B);


  return 0;
}



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

#include<stdio.h>
#include<stdlib.h>
#define max 10000


int main(){
    long A[max],B[max];

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

 

  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( i = 1; i <= n; ji+){
    
    B[C[A[i]]] = A[i];
    
    C[A[i]]--;
    
  }

  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:15:21: error: 'VMAX' was not declared in this scope
   15 |   for ( i = 0; i <= VMAX; i++ ) C[i] = 0;
      |                     ^~~~
a.cc:25:21: error: 'VMAX' was not declared in this scope
   25 |   for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i + 1];
      |                     ^~~~
a.cc:27:23: error: 'ji' was not declared in this scope; did you mean 'i'?
   27 |   for( i = 1; i <= n; ji+){
      |                       ^~
      |                       i
a.cc:27:26: error: expected primary-expression before ')' token
   27 |   for( i = 1; i <= n; ji+){
      |                          ^
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 = 0; 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 unsigned int*' [-fpermissive]
   10 | A = malloc(sizeof(short) * n + 1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
a.cc:11:11: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   11 | B = malloc(sizeof(short) * n + 1);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<ctype.h>
#include<stack>
#include<math.h>
#include <string>
#include<algorithm>
#include<iomanip>
#include<stdlib.h>
#define _for(i,a,b) for(int i = (a);i < (b);i++)
#define mset(x) memset(x,0,sizeof(x));
using namespace std;
#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:25:19: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   25 |         A = malloc(sizeof(short)*n + 1);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
a.cc:26:19: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   26 |         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: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<bits/stdc++.h>
using namespace std;
#define int long long
#define k 10001

int main(){
  int n;
  
  cin >> n;
  vector<int> A(n),B(n);
  
  for(int i=0;i < n ;i++) cin>>A[i];
  int C[k];
  for(int i=0;i < k;i++) C[i]=0;
  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]]--;
  }
  for(int i=0;i<n;i++){
    if(i)cout << " ";
    cout<<B[i];
  }
  cout << endl;
  return 0;
}



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

#include <iostream>
#include <cstdlib>
#include <string>
#include <typeinfo>
#include <cstring>
#include <iostream>
#define MAX 2000001
#define VMAX 10000
using namespace std;

int main(){
    unsigned short *A,*B;
    int C[VMAX + 1];
    int n,i,j;
    cin >> 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++){
        cin >> A[i+1];
        C[A[i+1]]++;
    }
    for(i = 1;i <= VMAX; i++)C[i] = C[i] + C[i - 1];
    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] << endl;
    }
    cout << endl;
    return 0;
}



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

#include "iostream"
#include <algorithm>

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

int main(){
  int A[20000000],n,B[200000000];
  cin >> n;
  for (int i=0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
CountingSort(A,B,n);
sort(B,B+i);
  for (int i=0; i < n; i++) {
cout << B[i];
}
return 0;
}



Compiler output:
a.cc: In function 'void CountingSort(int*, int*, int)':
a.cc:8:21: error: 'n' was not declared in this scope
    8 |     for(int j = 1;j<n;j++){
      |                     ^
a.cc:11:17: error: 'n' was not declared in this scope
   11 |     for(int j = n;j<1;j--){
      |                 ^
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   20 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:26:10: error: 'i' was not declared in this scope
   26 | sort(B,B+i);
      |          ^
a.cc:26:1: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   26 | sort(B,B+i);
      | ^~~~
      | std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:28:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   28 | cout << B[i];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include "iostream"
#include <algorithm>

void CountingSort(int A[],int B[],int k){
  int C[200000000];
  for (int i = 0; i < k; i++) {
    C[i] = 0;
    for(int j = 1;j<k;j++){
      C[A[j]]++;
    }
    for(int j = k;j<1;j--){
      B[C[A[j]]] = A[j];
      C[A[j]]--;
    }
  }
}

int main(){
  int A[20000000],n,B[200000000];
  cin >> n;
  for (int i=0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
CountingSort(A,B,n);
sort(B,B+i);
  for (int i=0; i < n; i++) {
cout << B[i];
}
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   20 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:26:10: error: 'i' was not declared in this scope
   26 | sort(B,B+i);
      |          ^
a.cc:26:1: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   26 | sort(B,B+i);
      | ^~~~
      | std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:28:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   28 | cout << B[i];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include "iostream"
#include <algorithm>

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

int main(){
  int A[20000000],B[200000000];
  int n;
  cin >> n;
  for (int i=0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
CountingSort(A,B,n);
sort(B,B+i);
  for (int i=0; i < n; i++) {
cout << B[i];
}
return 0;
}



Compiler output:
a.cc: In function 'void CountingSort(int*, int*, int)':
a.cc:8:21: error: 'n' was not declared in this scope
    8 |     for(int j = 1;j<n;j++){
      |                     ^
a.cc:11:17: error: 'n' was not declared in this scope
   11 |     for(int j = n;j<1;j--){
      |                 ^
a.cc: In function 'int main()':
a.cc:21:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   21 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:27:10: error: 'i' was not declared in this scope
   27 | sort(B,B+i);
      |          ^
a.cc:27:1: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   27 | sort(B,B+i);
      | ^~~~
      | std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:29:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 | cout << B[i];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include "iostream"
#include <algorithm>

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

int main(){
  int A[20000000],B[200000000];
  int n;
  cin >> n;
  for (int i=0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
CountingSort(A,B,n);
sort(B,B+i);
  for (int i=0; i < n; i++) {
cout << B[i];
}
return 0;
}



Compiler output:
a.cc: In function 'void CountingSort(int*, int*, int)':
a.cc:8:21: error: 'n' was not declared in this scope
    8 |     for(int j = 1;j<n;j++){
      |                     ^
a.cc: In function 'int main()':
a.cc:21:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   21 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:27:10: error: 'i' was not declared in this scope
   27 | sort(B,B+i);
      |          ^
a.cc:27:1: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   27 | sort(B,B+i);
      | ^~~~
      | std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:29:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 | cout << B[i];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include "iostream"
#include <algorithm>

using namespace std;

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

int main(){
  int A[20000000],B[200000000];
  int n;
  cin >> n;
  for (int i=0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
CountingSort(A,B,n);
sort(B,B+i);
  for (int i=0; i < n; i++) {
cout << B[i];
}
return 0;
}



Compiler output:
a.cc: In function 'void CountingSort(int*, int*, int)':
a.cc:10:21: error: 'n' was not declared in this scope
   10 |     for(int j = 1;j<n;j++){
      |                     ^
a.cc: In function 'int main()':
a.cc:29:10: error: 'i' was not declared in this scope
   29 | sort(B,B+i);
      |          ^
Language: C++

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

#define MAX 2000001
#define VMAX 10000

int C[VMAX+1],n;

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

int main(){
  unsigned short *A, *B;
  int i, j,k=0;
  scanf("%d",&n);

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

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(A[i]>k)k=A[i];
  }
  countingSort(A,B,k);

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

void countingSort(short A[],short B[],int k){
  int i,j;
  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-1];
  for(j=n;j>=1;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   16 |   A = malloc(sizeof(short)*n+1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
a.cc:17:13: error: invalid conversion from 'void*' to 'short unsigned int*' [-fpermissive]
   17 |   B = malloc(sizeof(short)*n+1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
a.cc:23:16: error: invalid conversion from 'short unsigned int*' to 'short int*' [-fpermissive]
   23 |   countingSort(A,B,k);
      |                ^
      |                |
      |                short unsigned int*
a.cc:9:19: note:   initializing argument 1 of 'void countingSort(short int*, short int*, int)'
    9 | void countingSort(short *,short *,int);
      |                   ^~~~~~~
a.cc:23:18: error: invalid conversion from 'short unsigned int*' to 'short int*' [-fpermissive]
   23 |   countingSort(A,B,k);
      |                  ^
      |                  |
      |                  short unsigned int*
a.cc:9:27: note:   initializing argument 2 of 'void countingSort(short int*, short int*, int)'
    9 | void countingSort(short *,short *,int);
      |                           ^~~~~~~
Language: C++

#include<stdio.h>
int main(){
  int i,a,A[1000],C[1000],j,B[1000];
  scanf("%d",&a);
  for(i=1;i<=a;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<100++){
    C[i] = 0;
  }
  for(j=1;j<a;j++){
    C[A[j]]++;
  }
 
  for (i=1;i<1000i++){
    C[i] = C[i] + C[i-1];
  }
  for( j=a;j>0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }


  
  for(i=0;i<a;i++){
   printf("%d ",B[i]);
  
  }

  printf("\n");
}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: lvalue required as increment operand
    8 |   for(i=0;i<100++){
      |             ^~~
a.cc:8:18: error: expected ';' before ')' token
    8 |   for(i=0;i<100++){
      |                  ^
      |                  ;
a.cc:15:19: error: lvalue required as increment operand
   15 |   for (i=1;i<1000i++){
      |                   ^~
a.cc:15:21: error: expected ';' before ')' token
   15 |   for (i=1;i<1000i++){
      |                     ^
      |                     ;
Language: C++

def CountingSort(A, B, k):
    C = [0] * (k+1)
    for i in range(k):
        C[i] = 0
    #C[i] に i の出現数を記録する 
    for j in range(0,n):
        C[A[j]]+=1
    #print("C ",j,C[:100])
    #C[i] に i 以下の数の出現数を記録する
    for i in range(1,k+1):
        C[i] = C[i] + C[i-1]
    #print("C' ",j,C[:100])
    for j in range(n-1,-1,-1):
        B[C[A[j]]] = A[j]
        C[A[j]]-=1
        #print(j,A[j],C[A[j]],B[C[A[j]]],B,C)

n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
CountingSort(A,B,100000)
print(' '.join(map(str,B[1:])))



Compiler output:
a.cc:5:6: error: invalid preprocessing directive #C
    5 |     #C[i] に i の出現数を記録する
      |      ^
a.cc:8:6: error: invalid preprocessing directive #print
    8 |     #print("C ",j,C[:100])
      |      ^~~~~
a.cc:9:6: error: invalid preprocessing directive #C
    9 |     #C[i] に i 以下の数の出現数を記録する
      |      ^
a.cc:12:6: error: invalid preprocessing directive #print
   12 |     #print("C' ",j,C[:100])
      |      ^~~~~
a.cc:16:10: error: invalid preprocessing directive #print
   16 |         #print(j,A[j],C[A[j]],B[C[A[j]]],B,C)
      |          ^~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def CountingSort(A, B, k):
      | ^~~
Language: C++

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

#define MAX 2000001
#define VMAX 10000

int n,i,j;

void CountingSort(short A[],short B[],int k)
{
  int C[VMAX+1];
  for(i=0;i<=k;i++) C[i]=0;

  for(j=0;j<n;j++) C[A[j]]++;

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

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

int main(){
  unsigned short A[VMAX], B[VMAX];

  scanf("%d", &n);

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

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

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



Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <stdio.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:27:3: error: 'scanf' was not declared in this scope
   27 |   scanf("%d", &n);
      |   ^~~~~
a.cc:33:16: error: invalid conversion from 'short unsigned int*' to 'short int*' [-fpermissive]
   33 |   CountingSort(A,B,VMAX);
      |                ^
      |                |
      |                short unsigned int*
a.cc:9:25: note:   initializing argument 1 of 'void CountingSort(short int*, short int*, int)'
    9 | void CountingSort(short A[],short B[],int k)
      |                   ~~~~~~^~~
a.cc:33:18: error: invalid conversion from 'short unsigned int*' to 'short int*' [-fpermissive]
   33 |   CountingSort(A,B,VMAX);
      |                  ^
      |                  |
      |                  short unsigned int*
a.cc:9:35: note:   initializing argument 2 of 'void CountingSort(short int*, short int*, int)'
    9 | void CountingSort(short A[],short B[],int k)
      |                             ~~~~~~^~~
a.cc:36:5: error: 'printf' was not declared in this scope
   36 |     printf("%d",B[i]);
      |     ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <stdlib.h>
  +++ |+#include <cstdio>
    3 |
Language: C++

#include <bits/stdc++.h>
#define lp(n) for(int i = 0; i < n; i++)
#define lpp(i, n) for(int i = 0; i < n; i++)

using namespace std;
int main() {
    int A[2000000];
    int B[2000000];
    int C[10001];
    int n;
    cin >> n;
    lp(10001) C[i] = 0;
    lp(n) C[A[i]]++;
    for(int i = 1; i < n; i++) C[i] = C[i] + C[i-1];
    for(int i = n-1; i >= 0; i--) {
        B[C[A[i]]] = A[j];
        C[A[j]]--;
    }
    lp(n) cout << B[i] << ((i == n-1)?"\n":" ")
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: 'j' was not declared in this scope
   16 |         B[C[A[i]]] = A[j];
      |                        ^
a.cc:19:48: error: expected ';' before 'return'
   19 |     lp(n) cout << B[i] << ((i == n-1)?"\n":" ")
      |                                                ^
      |                                                ;
   20 |     return 0;
      |     ~~~~~~
Language: C++

#include <bits/stdc++.h>
#define lp(n) for(int i = 0; i < n; i++)
#define lpp(i, n) for(int i = 0; i < n; i++)

using namespace std;
int main() {
    int A[2000000];
    int B[2000000];
    int C[10001];
    int n;
    cin >> n;
    lp(10001) C[i] = 0;
    lp(n) C[A[i]]++;
    for(int i = 1; i < n; i++) C[i] = C[i] + C[i-1];
    for(int i = n-1; i >= 0; i--) {
        B[C[A[i]]] = A[j];
        C[A[j]]--;
    }
    lp(n) cout << B[i] << ((i == n-1)?"\n":" ");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: 'j' was not declared in this scope
   16 |         B[C[A[i]]] = A[j];
      |                        ^
Language: C++

using namespace std;

const int K = 10000;

void counting_sort(int A[], int B[], int n) {
  int i;
  int C[K+1] = {};

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

  int accum = 0;
  for (i = 0; i < K+1; i++) {
    accum += C[i];
    C[i] = accum;
  }

  for (i = n; i > 0; i--) {
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
}
  

int main() {
  int i, n;
  int *A, *B;

  cin >> n;
  
  A = new int[n+1];
  B = new int[n+1];

  for (i = 1; i < n+1; i++) {
    cin >> A[i];
    B[i] = 0;
  }

  counting_sort(A, B, n);

  for (i = 1; i < n+1; i++) {
    if (i > 1) cout << " ";
    cout << B[i];
  }
  cout << endl;    

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:3: error: 'cin' was not declared in this scope
   28 |   cin >> n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:41:16: error: 'cout' was not declared in this scope
   41 |     if (i > 1) cout << " ";
      |                ^~~~
a.cc:41:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:42:5: error: 'cout' was not declared in this scope
   42 |     cout << B[i];
      |     ^~~~
a.cc:42:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:44:3: error: 'cout' was not declared in this scope
   44 |   cout << endl;
      |   ^~~~
a.cc:44:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:44:11: error: 'endl' was not declared in this scope
   44 |   cout << endl;
      |           ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#define MAX 2000001
#define VMAX 10000

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

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

#include <iostream>
using namespace std;

void CountingSort(long A[], long B[], const long k){
	long C[k];
	for (long i = 0; i <= k; i++) C[i] = 0;
	for (long i = 1; i <= n; i++) C[A[i]]++;
	for (long i = 1; i <= k; i++) C[i] += C[i - 1];
	for (long i = n; i > 0; i--){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
}

int main(){
	long n;
	cin >> n;
	long A[2000000], B[2000000] = {};
	for (long i = 0; i < n; i++) cin >> A[i];
	CountingSort(A, B, 10000);
	for (long i = 0; i < n; i++){
		if (i) cout << " ";
		cout << B[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void CountingSort(long int*, long int*, long int)':
a.cc:7:31: error: 'n' was not declared in this scope
    7 |         for (long i = 1; i <= n; i++) C[A[i]]++;
      |                               ^
a.cc:9:23: error: 'n' was not declared in this scope
    9 |         for (long i = n; i > 0; i--){
      |                       ^
a.cc:10:23: error: 'j' was not declared in this scope
   10 |                 B[C[A[j]]] = A[j];
      |                       ^
Language: C++

#include <iostream>
using namespace std;
???
int main(){
	long n;
	cin >> n;
	long A[10001] = {};
	for (long i = 0; i < n; i++){
		long x;
		A[x]++;
	}
	for (long i = 0; i <= 10000; i++){
		for (long j = 0; j < A[i]; j++){
			if (j) cout << " ";
			cout << i;
		}
	}
	cout << endl;
	return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ???
      | ^
Language: C++

#include <iostream>
using namespace std;
???
int main(){
	long n;
	cin >> n;
	long A[10001] = {};
	for (long i = 0; i < n; i++){
		long x;
		cin >> x;
		A[x]++;
	}
	for (long i = 0; i <= 10000; i++){
		for (long j = 0; j < A[i]; j++){
			long k = 0;
			if (k) cout << " ";
			cout << i;
			k++;
		}
	}
	cout << endl;
	return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ???
      | ^
Language: C++

#include <iostream>
using namespace std;
???
int main(){
	long n;
	cin >> n;
	long A[10001] = {};
	for (long i = 0; i < n; i++){
		long x;
		cin >> x;
		A[x]++;
	}
	for (long i = 0; i <= 10000; i++){
????????????????????????long k = 0;
		for (long j = 0; j < A[i]; j++){
			if (k) cout << " ";
			cout << i;
			k++;
		}
	}
	cout << endl;
	return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ???
      | ^
Language: C++

#include <iostream>
using namespace std;
???
int main(){
	long n;
	cin >> n;
	long A[10001] = {};
	for (long i = 0; i < n; i++){
		long x;
		cin >> x;
		A[x]++;
	}
	for (long i = 0; i <= 10000; i++){
		long k = 0;
		for (long j = 0; j < A[i]; j++){
			if (k) cout << " ";
			cout << i;
			k++;
		}
	}
	cout << endl;
	return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ???
      | ^
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>

int main(){

  int count[10000];
  int i,j,a_num;
  unsigned short *a,*b;


  for(i = 0; i < 10000; i++){
    count[i] = 0;
  }

  scanf("%d",&a_num);
  a = malloc(sizeof(short)*a_num+1);
  b = malloc(sizeof(short)*a_num+1);

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

  for(i = 0; i < a_num; i++){
    count[a[i+1]]++;
  }


  for(i = 1; i <= 10000; i++){
    count[i] = count[i]+count[i-1];
  }

  for(i = a_num; i > 0;i--){
    b[count[a[i]]] = a[i];
    count[a[i]]--;
  }

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

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: 'malloc' was not declared in this scope
   15 |   a = malloc(sizeof(short)*a_num+1);
      |       ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include<stdio.h>
  +++ |+#include <cstdlib>
    2 |
Language: C++

#include<iostream>
#include<cstdlib>
using namespace std;
#define M 2000001
#define K 10001
int main(){
  int *a,*b;
  int n;
  int c[K+1];
  a=(int*)malloc(sizeof(int)*M);
  b=(int*)malloc(sizeof(int)*M);
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    c[a[i]]++;
  }
  for(int i=1;i<k;i++)c[i]+=c[i-1];
  for(int i=1;i<=n;i++){
    b[c[a[i]]]=a[i];
    c[a[i]]--;
  }

  for(int i=1;i<n;i++)
    cout<<b[i]<<' ';
  cout<<endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'k' was not declared in this scope
   17 |   for(int i=1;i<k;i++)c[i]+=c[i-1];
      |                 ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#define nMAX 2000000
#define AMAX 10000

void Countingsort(int);
int A[nMAX],B[nMAX],C[AMAX];

int main(){

  int i,j,n;

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

    for(i=0;i<=AMAX;i++){
      C[i]=0;
    }

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

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



void Countingsort(int k){

    int i,j;

    for(i=1;i<=AMAX;i++){
      C[i]=C[i]+C[i-1];
    }
    for(j=1;j<=k;j++){
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
      return ;
    }

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

#include <iostream>
#define MAX  10000
using namespace std;

int n;

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

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

int main()
{
    int k = MAX;
    
    cin >> n;
    int A[n], B[n]
    for (int i = 1; i <= n; i++){
        cin >> A[i];
    }

    countingSort(A, B, k);
    for (int i = 1; i <= n; i++){
        if(i > 1) cout << " ";
        cout << B[i];
        
    }
    cout << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: expected initializer before 'for'
   34 |     for (int i = 1; i <= n; i++){
      |     ^~~
a.cc:34:21: error: 'i' was not declared in this scope
   34 |     for (int i = 1; i <= n; i++){
      |                     ^
a.cc:38:21: error: 'B' was not declared in this scope
   38 |     countingSort(A, B, k);
      |                     ^
Language: C++

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

const int MAX = 2000001;
const int VMAX = 10000;

int main(){
    //ios::sync_with_stdio(false);

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

    for(i=0; i<n; 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");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: storage size of 'A' isn't known
   15 |     unsigned short A[], B[];
      |                    ^
a.cc:15:25: error: storage size of 'B' isn't known
   15 |     unsigned short A[], B[];
      |                         ^
Language: C++

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

const int MAX = 2000001;
const int VMAX = 10000;

int main(){
    //ios::sync_with_stdio(false);

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

    for(i=0; i<n; 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");
}

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

//#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

//#define MAX 2000000
//#define MAX_ 10000
#define MAX 2000
#define MAX_ 100

int n;
void CountingSort(int A[], int B[],int k)
{
}
int main(void)
{
	int A[MAX], B[MAX], k;
	int C[MAX_];
	scanf_s("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf_s("%d", &A[i]);
		if (i == 0 || k < A[i]) k = A[i];
	}
	for (int i = 0; i <= k; i++)
		C[i] = 0;
	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]]--;
	}
	for (int i = 0; i < n; i++) {
		if (i != 0) printf(" ");
		printf("%d", B[i]);
	}
	printf("\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   25 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

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

static const int MAX_NUM  = 2000000;
static const int MAX_ELEM = 10000;

#if 0
void CountSort(int elem[], int num)
{
    int i;
    int cnt[MAX_ELEM] = {0};
    int elem2[MAX_NUM+1];
    int target;

    for (i = 0; i < num; i++) {
        ++cnt[elem[i]];
    }
    for (i = 1; i <= MAX_ELEM; i++) {
        cnt[i] += cnt[i - 1];
    }

    for (i = num - 1; i >= 0; i--) {
        target = elem[i];
        --cnt[target];
        elem2[cnt[target]] = target;
    }

    printf("%d", elem2[0]);
    for (i = 1; i < num; i++) {
        printf(" %d", elem2[i]);
    }
    printf("\n");

    return;
}
#endif

int main(void)
{
    int i;
    int num;
    int cnt[MAX_ELEM+1] = {0};
    int target;
    int *elem1, *elem2;

    scanf("%d", &num);

    elem1 = malloc(sizeof(int) * num);
    elem2 = malloc(sizeof(int) * num);

    for (i = 0; i < num; i++) {
        scanf("%d", &elem1[i]);
        ++cnt[elem1[i]];
    }

    for (i = 1; i <= MAX_ELEM; i++) {
        cnt[i] += cnt[i - 1];
    }

    for (i = num - 1; i >= 0; i--) {
        target = elem1[i];
        --cnt[target];
        elem2[cnt[target]] = target;
    }

    printf("%d", elem2[0]);
    for (i = 1; i < num; i++) {
        printf(" %d", elem2[i]);
    }
    printf("\n");

    free(elem1);
    free(elem2);
//    CountSort(elem, num, maxelem);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:19: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   50 |     elem1 = malloc(sizeof(int) * num);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
a.cc:51:19: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   51 |     elem2 = malloc(sizeof(int) * num);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
Language: C++

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

void CountingSort(const vector<int> &A, vector<int> &B, int k)
{
	list<int> D;
	int n = A.size();
	vector<int> C;
	C.resize(k+1);
	for(int i = 0; i <= k; i++){
		C[i] = 0;
	}
	/* C[i] ??? i ???????????°????¨?????????? */
	for(int j = 0; j < n; j++){
		C[A[j]]++;
	}
	/* C[i] ??? i ??\????????°???????????°????¨??????????*/
	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]]--;
	}	
}
int main()
{
	int n;
	int k = 10000;
	cin >> n;
	vector<int> A;
	vector<int> B;
	A.resize(n);
	B.resize(n);
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}
	CountingSort(A, B, k);
	for(int i = 0; i < n-1; i++){
		cout << B[i] << ' ';
	}
	cout << B.back() << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void CountingSort(const std::vector<int>&, std::vector<int>&, int)':
a.cc:7:9: error: 'list' was not declared in this scope
    7 |         list<int> D;
      |         ^~~~
a.cc:3:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
    2 | #include <vector>
  +++ |+#include <list>
    3 | using namespace std;
a.cc:7:14: error: expected primary-expression before 'int'
    7 |         list<int> D;
      |              ^~~