Language: Java

#include <stdio.h>
int n;

void CountingSort(int *,int *,int );
int main(){

  int i,j;
  int C[2000000];
  int newC[2000000];
  scanf("%d",&n);
  for(i = 0;i <n ; i++){
    scanf("%d",&C[i]);
  }
  
  CountingSort(C,newC,n);
  return 0;
}

void CountingSort(int *A,int *B,int k){
  int i,j;
  int C[1000000];
  for(i=0;i<=100000;i++){
    C[i] = 0;
  }
  
  for(j = 1; j<=n;j++){
    C[A[j-1]]++;
  }
  
  for(i = 1; i<=1000000; i++){
    C[i] = C[i] + C[i-1];
  }
  /*
  printf("A[i]: ");
  for(i=0;i<n;i++){
    printf("%2d ",A[i]);
  }

  
  printf("\n");
 printf("C[i]: ");
  for(i=0;i<n;i++){
    printf("%2d ",C[i]);
  }
    printf("\n");
 printf("A[j-1]: ");
  for(j = n; j>=1; j--){
    printf("%2d ",A[j-1]);
  }
    printf("\n");
     printf("C[A[j-1]]: ");
  for(j = n; j>=1; j--){
    printf("%2d ",C[A[j-1]]);
  }
  printf("\n");
  */
  for(j = n; j>=1; j--){
    B[C[A[j-1]]] = A[j-1];
    C[A[j-1]]--;
  }
  
  for(i=1;i<n;i++){
    printf("%d ",B[i]);
  }
  printf("%d",B[i]);
  printf("\n");
}




Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
void CountingSort(int *,int *,int );
^
  (use --enable-preview to enable unnamed classes)
Main.java:4: error: <identifier> expected
void CountingSort(int *,int *,int );
                     ^
Main.java:4: error: class, interface, enum, or record expected
void CountingSort(int *,int *,int );
                        ^
Main.java:8: error: ']' expected
  int C[2000000];
        ^
Main.java:9: error: ']' expected
  int newC[2000000];
           ^
Main.java:10: error: illegal start of expression
  scanf("%d",&n);
             ^
Main.java:12: error: illegal start of expression
    scanf("%d",&C[i]);
               ^
Main.java:19: error: <identifier> expected
void CountingSort(int *A,int *B,int k){
                     ^
Main.java:19: error: class, interface, enum, or record expected
void CountingSort(int *A,int *B,int k){
                         ^
Main.java:21: error: class, interface, enum, or record expected
  int C[1000000];
  ^
Main.java:22: error: class, interface, enum, or record expected
  for(i=0;i<=100000;i++){
  ^
Main.java:22: error: class, interface, enum, or record expected
  for(i=0;i<=100000;i++){
          ^
Main.java:22: error: class, interface, enum, or record expected
  for(i=0;i<=100000;i++){
                    ^
Main.java:24: error: class, interface, enum, or record expected
  }
  ^
Main.java:26: error: class, interface, enum, or record expected
  for(j = 1; j<=n;j++){
             ^
Main.java:26: error: class, interface, enum, or record expected
  for(j = 1; j<=n;j++){
                  ^
Main.java:28: error: class, interface, enum, or record expected
  }
  ^
Main.java:30: error: class, interface, enum, or record expected
  for(i = 1; i<=1000000; i++){
             ^
Main.java:30: error: class, interface, enum, or record expected
  for(i = 1; i<=1000000; i++){
                         ^
Main.java:32: error: class, interface, enum, or record expected
  }
  ^
Main.java:57: error: class, interface, enum, or record expected
  for(j = n; j>=1; j--){
             ^
Main.java:57: error: class, interface, enum, or record expected
  for(j = n; j>=1; j--){
                   ^
Main.java:59: error: class, interface, enum, or record expected
    C[A[j-1]]--;
    ^
Main.java:60: error: class, interface, enum, or record expected
  }
  ^
Main.java:62: error: class, interface, enum, or record expected
  for(i=1;i<n;i++){
          ^
Main.java:62: error: class, interface, enum, or record expected
  for(i=1;i<n;i++){
              ^
Main.java:64: error: class, interface, enum, or record expected
  }
  ^
Main.java:66: error: class, interface, enum, or record expected
  printf("\n");
  ^
Main.java:67: error: class, interface, enum, or record expected
}
^
31 errors