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

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

class Main
{
    static class Len
    {	
	//int[] a = new int[2500000];
	//int[] b = new int[2500000];
	Len(int n)
	{
	    int[] a = new int[n];
	    int[] b = new int[n];
	}
    }

    public static void main(String args[])
    {
	int n;
	int i, j, k;
	Scanner in = new Scanner(System.in);
	String line = new String();
	BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
	//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));

	//Read ----------------
	//read n
	try{
	    line=line=bin.readLine();
	}	
	catch(IOException e){
	    System.out.println("Error");
	}
	n=Integer.parseInt(line);
	Len len = new Len(n);
	j=0;

	//Read A[]
	try{
	    line=bin.readLine();
	    //System.out.println(line);
	    StringTokenizer str = new StringTokenizer(line);   
	    for(i=0; i<n; i++)
		{
		    len.a[i]=Integer.parseInt(str.nextToken());
		    if(j<len.a[i])j=len.a[i];
		}
	}
	catch(IOException e){
	    System.out.println("Error");
	}
	//Read end------------


	//sort
	countingSort(len, j, n);

	//print
	for(i=1; i<n; i++)System.out.print(len.b[i]+" ");
	System.out.println(len.b[n]);

    }

    static void countingSort(Len len, int max, int n)
    {
	int i, j, k;
	int[] c = new int[max+1];

	//for(i=0; i<=max; i++)c[i]=0;
	for(i=0; i<n; i++)c[len.a[i]]++;

	for(i=0; i<=max; i++)
	    {
		if(i!=0)c[i]+=c[i-1];
	    }

	for(i=n-1; i>=0; i--)
	    {
		len.b[c[len.a[i]]]=len.a[i];
		c[len.a[i]]--;
	    }
    }
}

Compiler output:
Main.java:45: error: cannot find symbol
		    len.a[i]=Integer.parseInt(str.nextToken());
		       ^
  symbol:   variable a
  location: variable len of type Len
Main.java:46: error: cannot find symbol
		    if(j<len.a[i])j=len.a[i];
		            ^
  symbol:   variable a
  location: variable len of type Len
Main.java:46: error: cannot find symbol
		    if(j<len.a[i])j=len.a[i];
		                       ^
  symbol:   variable a
  location: variable len of type Len
Main.java:59: error: cannot find symbol
	for(i=1; i<n; i++)System.out.print(len.b[i]+" ");
	                                      ^
  symbol:   variable b
  location: variable len of type Len
Main.java:60: error: cannot find symbol
	System.out.println(len.b[n]);
	                      ^
  symbol:   variable b
  location: variable len of type Len
Main.java:70: error: cannot find symbol
	for(i=0; i<n; i++)c[len.a[i]]++;
	                       ^
  symbol:   variable a
  location: variable len of type Len
Main.java:79: error: cannot find symbol
		len.b[c[len.a[i]]]=len.a[i];
		   ^
  symbol:   variable b
  location: variable len of type Len
Main.java:79: error: cannot find symbol
		len.b[c[len.a[i]]]=len.a[i];
		           ^
  symbol:   variable a
  location: variable len of type Len
Main.java:79: error: cannot find symbol
		len.b[c[len.a[i]]]=len.a[i];
		                      ^
  symbol:   variable a
  location: variable len of type Len
Main.java:80: error: cannot find symbol
		c[len.a[i]]--;
		     ^
  symbol:   variable a
  location: variable len of type Len
10 errors
Language: Java

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

class Main
{
    static class Len
    {	
	int[] a = new int[2000000];
	int[] b = new int[2000000];
    }

    public static void main(String args[])
    {
	int n;
	int i, j, k;
	Scanner in = new Scanner(System.in);
	String line = new String();
	BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
	//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));

	//Read ----------------
	//read n
	try{
	    line=line=bin.readLine();
	}	
	catch(IOException e){
	    System.out.println("Error");
	}
	n=Integer.parseInt(line);
	Len len = new Len(n);
	j=0;

	//Read A[]
	try{
	    line=bin.readLine();
	    //System.out.println(line);
	    StringTokenizer str = new StringTokenizer(line);   
	    for(i=0; i<n; i++)
		{
		    len.a[i]=Integer.parseInt(str.nextToken());
		    if(j<len.a[i])j=len.a[i];
		}
	}
	catch(IOException e){
	    System.out.println("Error");
	}
	//Read end------------


	//sort
	countingSort(len, j, n);

	//print
	for(i=1; i<n; i++)System.out.print(len.b[i]+" ");
	System.out.println(len.b[n]);

    }

    static void countingSort(Len len, int max, int n)
    {
	int i, j, k;
	int[] c = new int[max+1];

	//for(i=0; i<=max; i++)c[i]=0;
	for(i=0; i<n; i++)c[len.a[i]]++;

	for(i=0; i<=max; i++)
	    {
		if(i!=0)c[i]+=c[i-1];
	    }

	for(i=n-1; i>=0; i--)
	    {
		len.b[c[len.a[i]]]=len.a[i];
		c[len.a[i]]--;
	    }
    }
}

Compiler output:
Main.java:30: error: constructor Len in class Len cannot be applied to given types;
	Len len = new Len(n);
	          ^
  required: no arguments
  found:    int
  reason: actual and formal argument lists differ in length
1 error
Language: Java

package aoj.sort;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class CountingSort {
	public static void main(String args[]) throws IOException {
		// ??\????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int elementNum = Integer.parseInt(br.readLine());
		String line = br.readLine();
		int[] numArray = parseInt(getSplitLine(line));

		// ?????????????¨???°?????????

		// ??????????????????????????????
		int maxRange = 2000000;
		int[] counter = new int[maxRange];

		for (int i = 0; i < numArray.length; i++) {
			// numArray?????????????????°?????????????????°????¨??????????
			counter[numArray[i]]++;
			// 4,3,4,0,0,3,1 ???????????§????????´??????
			// counter[0] = 2 ???
			// counter[1] = 1 ???
			// counter[2] = 0 ???
			// counter[3] = 2 ???
			// counter[4] = 2 ???
			// ????§?????¨???????????????????
		}

		for (int i = 1; i < maxRange; i++) {
			counter[i] = counter[i] + counter[i - 1];
			// ??¬????????§?????°??????1??????????§?????????????????????§?????¨?????????????¨????????????????
			// ??°????????´???????¨???¶??????????????¨??§?????????????????????????????¨???????????????
			// counter[0] = 2???????????§
			// counter[1] = 2(0????????°) + 1(1????????°); ->3???????????§
			// counter[2] = 3(1????????°) + 0; -> 3???????????§(2????????¨??????????????§??????????????????)
			// counter[3] = 3(1????????°) + 2(3????????°); ->5???????????§
			// counter[4] = 5(3????????°) + 2(4????????°); ->7???????????§
		}

		// output(?????????????????????????????????)????¨????????????????????¨??????????
		int[] output = new int[numArray.length];
		for (int i = 0; i < numArray.length; i++) {
			output[counter[numArray[i]] - 1] = numArray[i];
			// numArray?????????????????°????????´??????counter??????????????????
			// output?????´?????¨??°??????????????????
			// 4 = numArray[0]
			// 6 = counter[4] - 1????????°???????§?????????¨???????¨???????????????????????????????????§?????????¨?????????????????????
			// output[6] = 4 ???numArray[0]????????°??????6??¨??????
			counter[numArray[i]] = counter[numArray[i]] - 1;
			// output?????????????????°?????????????????????????¬?????????¨???????????°????¨??????????
			// 6(???????????§????????????) = counter[numarray[0]] = 7 - 1
			// 4???counter[4]??????7??????????????¨????????????1???????????¨?¬????6?????????
			// 6????????´???????????¨????????????????????????
		}

		System.out.println(Arrays.toString(output).replaceAll("[\\[\\],]", ""));
	}

	private static String[] getSplitLine(String line) {
		return line.split("\\s");
	}

	private static int[] parseInt(String[] line) {
		int[] numArray = new int[line.length];
		for (int i = 0; i < line.length; i++) {
			numArray[i] = Integer.parseInt(line[i]);
		}
		return numArray;
	}

}

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

import java.util.Scanner;

public class AlgoA {
	public static void main(String[] args) {
		CountingSort CS = new CountingSort();
		CS.setA(CS.inputArray(CS.getA()));
		CS.setB(CS.coutingSort(CS.getA(), CS.getB(), CS.getK()));
		CS.displayArray(CS.getB());
	}
}

class CountingSort {
	private int n;
	private int[] A;
	private int[] B;
	private int k;

	public int getN() {
		return n;
	}

	public void setN(int n) {
		this.n = n;
	}

	public int[] getA() {
		return A;
	}

	public void setA(int[] array) {
		A = array;
	}

	public int[] getB() {
		return B;
	}

	public void setB(int[] array) {
		this.B = array;
	}

	public int getK() {
		return k;
	}

	public void setK(int k) {
		this.k = k;
	}

	protected int[] inputArray(int[] array) {
		Scanner sc = new Scanner(System.in);

		setN(sc.nextInt());
		array = new int[n];
		for (int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
			if (getK() < array[i]) {
				setK(array[i]);
			}
		}

		return array;
	}

	public int[] coutingSort(int[] array, int[] sortedArray, int k) {
		int[] C = new int[k + 1];
		sortedArray = new int[array.length];

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

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

		for (int j = sortedArray.length - 1; j >= 0; j--) {
			sortedArray[C[array[j]] - 1] = array[j];
			C[array[j]]--;
		}

		return sortedArray;
	}

	public void displayArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0) {
				System.out.print(" ");
			}
			System.out.print(array[i]);
		}
		System.out.println();
	}

}

Compiler output:
Main.java:3: error: class AlgoA is public, should be declared in a file named AlgoA.java
public class AlgoA {
       ^
1 error
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);

  /* your code */
  for(i=0;i<VMAX;i++){
    C[i] = 0;
  }

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

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

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




Compiler output:
main.c: In function 'main':
main.c:23:6: error: array subscript is not an integer
   23 |     C[A{i}]++;
      |      ^
main.c:23:8: error: expected ']' before '{' token
   23 |     C[A{i}]++;
      |        ^
      |        ]
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 <= n ){
        printf("%d ",B[i]);
    }
    else printf("\n");
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:36:1: error: expected declaration or statement at end of input
   36 | }
      | ^
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 < n ){
        printf("%d ",B[i]);
    }
    else printf("%d\n");
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:36:1: error: expected declaration or statement at end of input
   36 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 20000001
#define N 10000
int c[N+!],n,j;

int main(){
    int i;
    unsigned short *A,*B;
    
    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+1]);
    }
    for(i=0;i<=n;i++){
        c[i]=0;
    }
    for(j=1;j<=n;j++){
        c[A[j]]++;
    }
    for(i=1;i<=n;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-1;i++){
        printf("%d",B[i]);
    }
    printf("%d\n",B[n]);
    
    return 0;
}


Compiler output:
main.c:5:10: error: expected expression before ']' token
    5 | int c[N+!],n,j;
      |          ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAXLEN 20000001
#define VMAX 10000

void CountingSoat(unsigned short *, unsigned short *, int);

unsigned short *A, *B;

int main(){
  int i, j, max=0;
  
  int n;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  for(i=0; i<n; i++){
    scanf("%hd", &A[i+1]);
    if(A[i+1] > max) max = A[i+1];
  }
  
  CountingSoat(A, B, max);
  for(i=1; i<n; i++){
    printf("%d ", B[i]);
  } printf("%d\n", B[i]);

  free(A);
  free(B);
  return 0;
}

void CountingSoat(unsigned short *A, unsigned short *B, int max){
  int i, j;
  short *C;

  C = malloc(sizeof(short)*max+1);
  for(i=0; i<=max; i++){
    C[i] = 0;
  }

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

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



Compiler output:
main.c: In function 'CountingSoat':
main.c:43:14: error: 'n' undeclared (first use in this function)
   43 |   for(j=0; j<n; j++){
      |              ^
main.c:43:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAXLEN 20000001
#define VMAX 10000

void CountingSoat(unsigned int *, unsigned int *, int, int);

unsigned int *A, *B;

int main(){
  int i, j, max=0;
  
  int n;

  scanf("%d", &n);

  A = malloc(sizeof(int)*n+1);
  B = malloc(sizeof(int)*n+1);
  for(i=0; i<n; i++){
    scanf("%hd", &A[i+1]);
    if(A[i+1] > max) max = A[i+1];
  }
  
  CountingSoat(A, B, max, n);
  for(i=1; i<n; i++){
    printf("%d ", B[i]);
  } printf("%d\n", B[i]);

  free(A);
  free(B);
  return 0;
}

void CountingSoat(unsigned short *A, unsigned short *B, int max, int n){
  int i, j;
  int *C;

  C = malloc(sizeof(int)*max+1);
  for(i=0; i<=max; i++){
    C[i] = 0;
  }

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

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



Compiler output:
main.c:34:6: error: conflicting types for 'CountingSoat'; have 'void(short unsigned int *, short unsigned int *, int,  int)'
   34 | void CountingSoat(unsigned short *A, unsigned short *B, int max, int n){
      |      ^~~~~~~~~~~~
main.c:6:6: note: previous declaration of 'CountingSoat' with type 'void(unsigned int *, unsigned int *, int,  int)'
    6 | void CountingSoat(unsigned int *, unsigned int *, int, int);
      |      ^~~~~~~~~~~~
Language: C

#include <iostream>
#include <vector>

constexpr const int k = 10000;
using namespace std;
void countingSort( vector<int>& v ){
    vector<int> ct( k + 1 ); 
    for( auto& cElem : ct ){
        cElem = 0;
    }

    int i = 1;
    for( ; i <= v.size(); ++i ){
        ++ct[v[i]];
    }

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

    vector<int> rs( v.size() );
    for( i = v.size(); i > 0; --i ){
        rs[ct[v[i]]] = v[i];
        --ct[v[i]];
    }
    v = move(rs);
}


int main(){
    int n;
    cin.tie(0);
    cin >> n;

    vector<int> v( n + 1 );
    for( int i = 1; i <= n; ++i ){
        cin >> v[i];
    }

    countingSort(v);

    for( int i = 2; i <= v.size(); ++i ){
        cout << v[i] << ( ( i != v.size() )? " " : "\n" );
    }
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
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:
main.c: In function 'main':
main.c:15:21: error: 'VMAX' undeclared (first use in this function)
   15 |   for ( i = 0; i <= VMAX; i++ ) C[i] = 0;
      |                     ^~~~
main.c:15:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:23: error: 'ji' undeclared (first use in this function); did you mean 'i'?
   27 |   for( i = 1; i <= n; ji+){
      |                       ^~
      |                       i
main.c:27:26: error: expected expression before ')' token
   27 |   for( i = 1; i <= n; ji+){
      |                          ^
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 <= max; 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; i++){
    
    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:
main.c: In function 'main':
main.c:25:21: error: 'VMAX' undeclared (first use in this function)
   25 |   for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i + 1];
      |                     ^~~~
main.c:25:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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



Compiler output:
main.c:5:1: error: return type defaults to 'int' [-Wimplicit-int]
    5 | main(){
      | ^~~~
main.c: In function 'main':
main.c:19:5: error: 'B' undeclared (first use in this function)
   19 |     B[C[D[j]]] = D[j];
      |     ^
main.c:19:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:7: error: 'C' undeclared (first use in this function)
   19 |     B[C[D[j]]] = D[j];
      |       ^
Language: C

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



Compiler output:
main.c:5:1: error: return type defaults to 'int' [-Wimplicit-int]
    5 | main(){
      | ^~~~
main.c: In function 'main':
main.c:19:7: error: 'C' undeclared (first use in this function)
   19 |     E[C[D[j]]] = D[j];
      |       ^
main.c:19:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

static const int MAX=1000;
static const int VMAX=10000;

int n, A[MAX],s;
int B[MAX],T[VMAX+1];

int solve() {
  int ans=0;
  bool V[MAX];
  for (int i=0; i<n; i++) {
    B[i]=A[i];
    V[i]=false;
  }
  sort(B,B+n);
  for (int i=0; i<n; i++) {
    T[B[i]]=i;
  }
  for (int i=0; i<n; i++) {
    if (V[i]) {
      continue;
    }
    int cur=i;
    int S=0;
    int m=VMAX;
    int an=0;
    while (true) {
      V[cur]=true;
      an++;
      int v=A[cur];
      m=min(m,v);
      S+=v;
      cur=T[v];
      if (V[cur]) {
        break;
      }
    }
    ans+=min(S+(an-2)*m,m+S+(an+1)*s);
  }
  return ans;
}
int main() {
  cin>>n;
  s=VMAX;
  for (int i=0; i<n; i++) {
    cin>>A[i];
    s=min(s,A[i]);
  }
  int ans=solve();
  cout<<ans<<endl;
  return 0;
}




Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>
#define c 10001

void CountingSort(int *,int *,int);
int N;

int main(){
  int i,k=0;
  int *A,*B;

  scanf("%d",&N);

  A=(int*)malloc((N+1)*sizeof(int));
  B=(int*)malloc((N+1)*sizeof(int));
  for(i=1;i<=N;i++){
    scanf("%d",&A[i]);
    if(k<A[i]){
      k=A[i];
    }
  }
  CountingSort(A,B,k);
  return 0;
}

void CountingSort(int *A,int *B,int k){
  int i,j,C[c];

  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]]--;
  }
  for(i=1;i<=N;i++){
    if(i==N){
      printf("%d\n",B[i]);
    }
    else{
      printf("%d",B[i]);
    }
  }
  

  



Compiler output:
main.c: In function 'CountingSort':
main.c:38:19: error: expected ';' before ')' token
   38 |   for(j=N;j>=1,j--){
      |                   ^
      |                   ;
main.c:49:3: error: expected declaration or statement at end of input
   49 |   }
      |   ^
Language: C

#include<stdio.h>
#defibe D 200000
#define k 10000
  int A[D];
  int B[D];
int main(){
  int i,n,j;
  int C[k+1];

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

  for(i=0;i<k;i++){
    C[i]=0;
  }
  /* for(i=0;i<n-1;i++){
    printf("%d ",B[i]);
    }
    printf("%d\n",B[n-1]);
  */
  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;j>=0;j--){
    B[C[A[j]]-1]=A[j];
    C[A[j]]--;
  }

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



Compiler output:
main.c:2:2: error: invalid preprocessing directive #defibe; did you mean #define?
    2 | #defibe D 200000
      |  ^~~~~~
      |  define
main.c:4:9: error: 'D' undeclared here (not in a function)
    4 |   int A[D];
      |         ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))

int main() {

	int n, i, max;
	scanf("%d", &n);

	unsigned short A[n+1];
	unsigned short B[n+1];

	max = (1<<30)*-1;
	for (i = 0; i < n; i++) {
		scanf("%hu", &A[i+1]);
		max = MAX(max, A[i+1]);
	}
	int C[max+1] = {0};

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

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

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

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:24: error: variable-sized object may not be initialized except with an empty initializer
   18 |         int C[max+1] = {0};
      |                        ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 20000000
#define VMAX 1000000

int countingsort(int A[], int B[], int n, int C[]){
    int i;
    for (i = 0; i < n; i++){
        C[A[i]] += 1;
    }


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

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

    return 0;
}


int main(){
    int i, n;
    int C[VMAX];
    scanf("%d", &n);

    int A[n], B[n];

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

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

    countingsort(A, B, n, C);

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

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:49:33: error: expected ';' before '}' token
   49 |             printf("%d\n", B[i])
      |                                 ^
      |                                 ;
   50 |         }
      |         ~
Language: C

#include <stdio.h>

int A[2000000];

int main(){
  
  int n,i;
  
  scanf("%d",&n);

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

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

  for(i=0;i<n;i++){
    c[i]=c[i]+[i-1];
  }

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

  for(i=0;i<n;i++){
    print("%d",B[i]);
    if(i!=n-1)printf(" ");
  }

  printf("\n");

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:14:15: error: expected ')' before 'A'
   14 |     scanf("%d"A[i]);
      |          ~    ^
      |               )
main.c:15:5: error: 'c' undeclared (first use in this function)
   15 |     c[i]=0;
      |     ^
main.c:15:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:15: error: expected expression before '[' token
   23 |     c[i]=c[i]+[i-1];
      |               ^
main.c:26:15: error: expected expression before '>' token
   26 |   for(i=n-1;i=>0;i--){
      |               ^
main.c:27:11: error: 'j' undeclared (first use in this function)
   27 |     B[C[A[j]]]=A[j];
      |           ^
main.c:32:5: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |     print("%d",B[i]);
      |     ^~~~~
      |     printf
Language: C

#include <stdio.h>

int A[2000000];

int main(){
  
  int n,i;
  
  scanf("%d",&n);

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

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

  for(i=0;i<n;i++){
    c[i]=c[i]+[i-1];
  }

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

  for(i=0;i<n;i++){
    print("%d",B[i]);
    if(i!=n-1)printf(" ");
  }

  printf("\n");

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:14:15: error: invalid operands to binary & (have 'char *' and 'int')
   14 |     scanf("%d"&A[i]);
      |           ~~~~^~~~~
      |           |     |
      |           |     int
      |           char *
main.c:15:5: error: 'c' undeclared (first use in this function)
   15 |     c[i]=0;
      |     ^
main.c:15:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:15: error: expected expression before '[' token
   23 |     c[i]=c[i]+[i-1];
      |               ^
main.c:26:15: error: expected expression before '>' token
   26 |   for(i=n-1;i=>0;i--){
      |               ^
main.c:27:11: error: 'j' undeclared (first use in this function)
   27 |     B[C[A[j]]]=A[j];
      |           ^
main.c:32:5: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |     print("%d",B[i]);
      |     ^~~~~
      |     printf
Language: C

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

int n,A[MAX],B[MAX];

void CountingSort();

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

  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
 
  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

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

  return 0;
}

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

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

  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]]--;
  }
}


Compiler output:
main.c: In function 'CountingSort':
main.c:43:18: error: expected expression before ';' token
   43 |   for(i=1;i<VMAX;;i++){
      |                  ^
Language: C

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

int n,A[MAX],B[MAX];

void CountingSort();

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

  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
 
  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

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

  return 0;
}

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

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

  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]]--;
  }
}


Compiler output:
main.c: In function 'CountingSort':
main.c:43:18: error: expected expression before ';' token
   43 |   for(i=1;i<VMAX;;i++){
      |                  ^
Language: C

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

int n,A[MAX],B[MAX];

void CountingSort();

int main(){

  int i, j;

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

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

  return 0;
}

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

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

  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]]--;
  }
}


Compiler output:
main.c: In function 'main':
main.c:22:12: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   22 |     if(i>1)prinf(" ");
      |            ^~~~~
      |            printf
Language: C

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

int main(){
  unsigned short *A,*B,*C;
 
  int n,i,j;

  scanf("%d",&n);
  A=malloc(n*sizeof(short)+1);
  B=malloc(n*sizeof(short)+1);
  C=malloc(n*sizeof(short)+1));
  
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<=n;i++){
    C[i]=0;
  }
  for(j=1;j<=n;j++){
    C[A[j]]++;
  }
  for(i=1;i<=n;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("%d",B[i]);
    }
  printf("\n");
  
  free(A);
  free(B);
  free(C);
  return 0;
}




Compiler output:
main.c: In function 'main':
main.c:12:30: error: expected ';' before ')' token
   12 |   C=malloc(n*sizeof(short)+1));
      |                              ^
      |                              ;
main.c:12:30: error: expected statement before ')' token
Language: C

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

int main(){
  unsigned short *A,*B;
  int *C
  int n,i,j;

  scanf("%d",&n);
  A=malloc(n*sizeof(short)+1);
  B=malloc(n*sizeof(short)+1);
  C=malloc(n*sizeof(int));
  
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<=n;i++){
    C[i]=0;
  }
  for(j=1;j<=n;j++){
    C[A[j]]++;
  }
  for(i=1;i<=n;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("%d",B[i]);
    }
  printf("\n");
  
  free(A);
  free(B);
  free(C);
  return 0;
}




Compiler output:
main.c: In function 'main':
main.c:6:9: error: expected ';' before 'int'
    6 |   int *C
      |         ^
      |         ;
    7 |   int n,i,j;
      |   ~~~    
main.c:12:3: error: 'C' undeclared (first use in this function)
   12 |   C=malloc(n*sizeof(int));
      |   ^
main.c:12:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int A[2000000];
int B[2000000];

int main(){

  int C[VMAX+1];
  int n, i, j, k = 0;

  scanf("%d", &n);
  
  for(i = 1; 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 < 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]]--;
  }

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



Compiler output:
main.c: In function 'main':
main.c:43:1: error: expected declaration or statement at end of input
   43 | }
      | ^
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);

  /* your code */



Compiler output:
main.c: In function 'main':
main.c:14:3: error: expected declaration or statement at end of input
   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++)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:
main.c: In function 'main':
main.c:17:7: error: called object 'A' is not a function or function pointer
   17 |     C[A(i+1)]++;
      |       ^
main.c:7:19: note: declared here
    7 |   unsigned short *A,*B;
      |                   ^
Language: C

#include <stdio.h>
#define N 10000
int i,k,num,math[N];

void input(void){
    scanf("%d",&num);
    for(i=0;i<=num;i++){
        scanf("%d",&math[I]);
        if(k < math[i]) k = math[I];
    }
}

int main(void){
    int j,count[N],pri[N];
    //input
    input();
    for(i=0;i<=k;i++)
        count[i]=0;
    //calc       
    for(j=0;j<num;j++)
        count[math[j]]++;
            
    for(i=0;i<k;i++)
        count[i+1]+=count[I];
        
    for (i = num - 1; i >= 0; i--) {
        pri[--count[math[i]]] = math[I];
        count[math[j]]--;
    }
    //output
    for(i=0;i<num;i++){
       printf("%d",pri[I]);
       if(i != num) printf(" ");
    }
    printf("\n");
    return 0;
}


Compiler output:
main.c: In function 'input':
main.c:8:26: error: 'I' undeclared (first use in this function)
    8 |         scanf("%d",&math[I]);
      |                          ^
main.c:8:26: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:24:27: error: 'I' undeclared (first use in this function)
   24 |         count[i+1]+=count[I];
      |                           ^
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;
  int k=;
  

  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]);
  
  }
  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]]--;
  }
  for(i=0;i<n;i++){
    if(i==n-1) printf("%d\n",B[i]);
    else printf("%d ",B[i]);
  }
    free(A);
  free(B);
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:10:9: error: expected expression before ';' token
   10 |   int k=;
      |         ^
Language: C

#include<stdio.h>

int partition(int *,int ,int );

int main(){
  int i, j, n, p, A[100000];

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

  p = partition(A, 0, n-1);

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

int partition(int *A,int  p,int  r){
  
  int i, j, x, tmp;

  x = A[r];

  i = p-1;

  for (j = p; j <= r-1; j++){
    if (A[j] <= x){
      i = i+1;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }

  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i+1;
}



Compiler output:
main.c: In function 'main':
main.c:51:1: error: expected declaration or statement at end of input
   51 | }
      | ^
Language: C

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

int b[MAX],c[MAX];

void countingsort(int a[],int b[],int k,int n){
    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]+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("%d",b[i]);
    }
    printf("\n");
}

int main(){
    int a[MAX];
    int n,i,j,k=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i+1]);
        if(k<a[i])k=a[i];
    }
    countingsort(a,b,k,n);
    
    return 0;
}
    }
}


Compiler output:
main.c:42:5: error: expected identifier or '(' before '}' token
   42 |     }
      |     ^
main.c:43:1: error: expected identifier or '(' before '}' token
   43 | }
      | ^
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+1;i++) C[i]=0;
  
  for(i=0;i<n;i++){
    
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++; 
	  }
  for(i=1;i<VMAX+1;i++) C[i] = C[i] + C[i-1];
  for(j=1;j<n+1;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;

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

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:30:22: error: expected ';' before 'if'
   30 |     printf("%d",B[i])
      |                      ^
      |                      ;
   31 |     if(i != n) printf(" ");
      |     ~~
Language: C

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

#define MAX 10000

int main(void){
  int *A,*B;
  int C[MAX];
  int s,n,k;
  int i,j;
  
  scanf("%d",&n);

  s = sizeof(int)*n + 1;
  
  A = malloc(s);
  B = malloc(s);
  
  for(i = 0;i < n;i++){
    C[i] = 0;
  }
    
  for(i = 0;i < n;i++){
    scanf("%d",&A[i+1]);
    C[ A[i+1] ]++;
  }

  for(i = 1;i <= n;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 != a){
      printf(" ");
    }
    printf("%d",B[i]);
  }
  printf("\n");

  free(A);
  free(B);

  return 0;
}
      



Compiler output:
main.c: In function 'main':
main.c:38:13: error: 'a' undeclared (first use in this function)
   38 |     if(i != a){
      |             ^
main.c:38:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

#define MAX 10000

int main(void){
  
  int C[MAX];
  int n;
  int i,j;
  int s;
  unsigned short *A,*B;
  
  scanf("%d",&n);

  s = sizeof(short)*n + 1
    
  A = malloc(s);
  B = malloc(s);
  
  for(i = 0;i < MAX;i++){
    C[i] = 0;
  }
    
  for(i = 0;i < n;i++){
    scanf("%hu",&A[i+1]);
    C[ A[i+1] ]++;
  }

  for(i = 1;i <= MAX;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");

  free(A);
  free(B);

  return 0;
}
      



Compiler output:
main.c: In function 'main':
main.c:16:26: error: expected ';' before 'A'
   16 |   s = sizeof(short)*n + 1
      |                          ^
      |                          ;
   17 | 
   18 |   A = malloc(s);
      |   ~
Language: C

include <stdio.h>

#define MAX 2000001
#define VMAX 10000

void countingsort();
int n,A[MAX],B[MAX],C[VMAX+1],i,k=0;


int main(){

  scanf("%d",&n);

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

  countingsort(VMAX,n);

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


return 0;
}

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




Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d",&n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:3: error: implicit declaration of function 'countingsort' [-Wimplicit-function-declaration]
   18 |   countingsort(VMAX,n);
      |   ^~~~~~~~~~~~
main.c:21:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   21 |     printf("%d ",B[i]);
      |     ^~~~~~
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("%d",B[n]);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:30:6: warning: conflicting types for 'countingsort'; have 'void(int,  int)'
   30 | void countingsort(int k,int n){
      |      ^~~~~~~~~~~~
main.c:18:3: note: previous implicit declaration of 'countingsort' with type 'void(int,  int)'
   18 |   countingsort(VMAX,n);
      |   ^~~~~~~~~~~~
Language: C

include <stdio.h>

#define MAX 2000001
#define VMAX 10000

void countingsort();
int n,A[MAX],B[MAX],C[VMAX+1],i,k=0;


int main(){

  scanf("%d",&n);

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

  countingsort(VMAX,n);

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


return 0;
}

void countingsort(int k,int n){
  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] + C[i-1];
  }


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






Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d",&n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:3: error: implicit declaration of function 'countingsort' [-Wimplicit-function-declaration]
   18 |   countingsort(VMAX,n);
      |   ^~~~~~~~~~~~
main.c:21:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   21 |     printf("%d ",B[i]);
      |     ^~~~~~
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("%d",B[n]);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:30:6: warning: conflicting types for 'countingsort'; have 'void(int,  int)'
   30 | void countingsort(int k,int n){
      |      ^~~~~~~~~~~~
main.c:18:3: note: previous implicit declaration of 'countingsort' with type 'void(int,  int)'
   18 |   countingsort(VMAX,n);
      |   ^~~~~~~~~~~~
Language: C

include <stdio.h>

#define MAX 2000001
#define VMAX 10000

void countingsort();
int n,A[MAX],B[MAX],C[VMAX+1],i,k=0;


int main(){

  scanf("%d",&n);

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

  countingsort(VMAX,n);

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


return 0;
}

void countingsort(int k,int n){
  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] + C[i-1];
  }

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




Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d",&n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:3: error: implicit declaration of function 'countingsort' [-Wimplicit-function-declaration]
   18 |   countingsort(VMAX,n);
      |   ^~~~~~~~~~~~
main.c:21:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   21 |     printf("%d ",B[i]);
      |     ^~~~~~
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |   printf("%d",B[n]);
      |   ^~~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:30:6: warning: conflicting types for 'countingsort'; have 'void(int,  int)'
   30 | void countingsort(int k,int n){
      |      ^~~~~~~~~~~~
main.c:18:3: note: previous implicit declaration of 'countingsort' with type 'void(int,  int)'
   18 |   countingsort(VMAX,n);
      |   ^~~~~~~~~~~~