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

import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=0; i<a.lenth-1;i++){
			int v=a[i];
			int j=i-1;
			while(j>=0 && a[j]>v){
				a[j+1]=a[j];
				j--;
			}
			a[j+1]=v;
			for(int j=0;j<a.length-1;i++){
				System.out.print(a[j]+" ");
			}
			System.out.println(a[a.length-1]);
		}
	}
}


Compiler output:
Main.java:12: error: cannot find symbol
		for(int i=0; i<a.lenth-1;i++){
		                ^
  symbol:   variable lenth
  location: variable a of type int[]
Main.java:20: error: variable j is already defined in method main(String[])
			for(int j=0;j<a.length-1;i++){
			        ^
2 errors
Language: Java

import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=1;i<n;i++){
			int v=a[i];
			int j=i-1;
			while(j>=0 && a[j]>v){
				a[j+1]=a[j];
				j--;
			}
			a[j+1]=v;
			for(int j=0;j<a.length-1;i++){
				System.out.print(a[j]+" ");
			}
			System.out.println(a[a.length-1]);
		}
	}
}


Compiler output:
Main.java:20: error: variable j is already defined in method main(String[])
			for(int j=0;j<a.length-1;i++){
			        ^
1 error
Language: Java

import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=1;i<n;i++){
			int v=a[i];
			int j=i-1;
			while(j>=0 && a[j]>v){
				a[j+1]=a[j];
				j--;
			}
			a[j+1]=v;
			for(int j=0;j<n-1;i++){
				System.out.print(a[j]+" ");
			}
			System.out.println(a[a.length-1]);
		}
	}
}


Compiler output:
Main.java:20: error: variable j is already defined in method main(String[])
			for(int j=0;j<n-1;i++){
			        ^
1 error
Language: Java

import java.sql.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import javax.xml.ws.AsyncHandler;
public class Main{
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int len = scanner.nextInt();
		int nums[] = new int[len] ;
		for (int i = 0; i < len; i++) {
			nums[i] = scanner.nextInt();
		}
		
		for (int i = 1; i < nums.length; i++) {
			System.out.println(String.join(' ',nums));
			int val = nums[i];
			int preIndex = i-1;
			while (preIndex>=0 && nums[preIndex] > val) {
				nums[i] = nums[preIndex];
				nums[preIndex] = val;
				preIndex--;
			}
		}
	}

}


Compiler output:
Main.java:6: error: package javax.xml.ws does not exist
import javax.xml.ws.AsyncHandler;
                   ^
Main.java:17: error: no suitable method found for join(char,int[])
			System.out.println(String.join(' ',nums));
			                         ^
    method String.join(CharSequence,CharSequence...) is not applicable
      (argument mismatch; char cannot be converted to CharSequence)
    method String.join(CharSequence,Iterable<? extends CharSequence>) is not applicable
      (argument mismatch; char cannot be converted to CharSequence)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] ags){
    Scanner nyuryoku = new Scanner(System.in);
    int N = nyuryoku.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();

      insertionSort(A, N);
      show();
    }
  }
  static void insertionSort(int[] A, int N){
    for(int i = 0; i < N; i++){
      int tmp = A[i];
      int j = i;
      for (j > 0 && A[j] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;

      show(A, N);
      }
  static void show(int[] A, int N){
    System.out.println(A[0]);
    for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    }
    System.out.println();
  }
    }
  }
}



Compiler output:
Main.java:19: error: not a statement
      for (j > 0 && A[j] > tmp; j--)
                 ^
Main.java:19: error: ';' expected
      for (j > 0 && A[j] > tmp; j--)
                                   ^
Main.java:25: error: illegal start of expression
  static void show(int[] A, int N){
  ^
Main.java:33: error: class, interface, enum, or record expected
  }
  ^
4 errors
Language: Java

package alds1_1.a;

import java.util.Scanner;

public class InsertionSort {

	public static void main(String[] args) {
		int length = new Scanner(System.in).nextInt();
		
		String[] metaValues = new Scanner(System.in).nextLine().split(" ");
		int[] array = new int[length];
		for (int i=0; i<metaValues.length; i++) {
			array[i] = Integer.parseInt(metaValues[i]);
		}
		
		printArray(array);
		insertionSort(array, length);
		
		
	}
	
	public static void insertionSort(int[] array, int length) {
		for (int i=1; i<length; i++) {
			int key = array[i];
			int j = i - 1;
			while (j>=0 && key<array[j]) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = key;
			
			printArray(array);
		}
	}
	
	public static void printArray(int[] array) {
		for (int object : array) {
			System.out.print(object + " ");
		}
		System.out.println();
	}

}



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

package alds1_1.a;

import java.util.Scanner;

public class InsertionSort {

	public static void main(String[] args) {
		int length = new Scanner(System.in).nextInt();
		
		String[] metaValues = new Scanner(System.in).nextLine().split(" ");
		int[] array = new int[length];
		for (int i=0; i<metaValues.length; i++) {
			array[i] = Integer.parseInt(metaValues[i]);
		}
		
		printArray(array);
		insertionSort(array, length);
		
		
	}
	
	public static void insertionSort(int[] array, int length) {
		for (int i=1; i<length; i++) {
			int key = array[i];
			int j = i - 1;
			while (j>=0 && key<array[j]) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = key;
			
			printArray(array);
		}
	}
	
	public static void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i>0) System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	}

}



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

package section5;

import java.util.Scanner;

public class ALDS11A_InsertionSort {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		// 標準入力から数列と整数N（数列の長さ）を読み込み
		int n = Integer.parseInt(scanner.nextLine());  // 数列の長さ
		String a = scanner.nextLine();                 // 数列（スペース区切りの文字列）
		String[] array = a.split(" ");              // ↑を配列化
		
		// 初期状態の配列状態を出力
		System.out.println(String.join(" ", array));
		
		for (int i = 1; i < n; i++) {
			int v = Integer.parseInt(array[i]);
			int j = i - 1;
			while(j >= 0 && Integer.parseInt(array[j]) > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = Integer.toString(v);
			
			// 途中経過の配列状態を出力
			System.out.println(String.join(" ", array));
		}
		
		scanner.close();
	}
}



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

//============================================================================
// Name        : AOJCpp.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 100;

int main() {


	int n;
	int A[MAX];

	cin >> n;

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

	for(int i = 1; i < n; i++) {
		int v = A[i];
		int j = i - 1;
		while(j >= 0 && A[j] > v) {
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		for (int j = 0; j < n-1; j++) {
			cout << A[j] << " ";
		}

		cout << A[n-1] << endl;
	}
}





Compiler output:
Main.java:9: error: illegal character: '#'
#include <iostream>
^
Main.java:10: error: illegal character: '#'
#include <algorithm>
^
Main.java:12: error: class, interface, enum, or record expected
static const int MAX = 100;
       ^
Main.java:18: error: not a statement
	int A[MAX];
	      ^
Main.java:20: error: not a statement
	cin >> n;
	    ^
Main.java:23: error: not a statement
		cin >> A[i];
		    ^
Main.java:35: error: not a statement
			cout << A[j] << " ";
			             ^
Main.java:38: error: not a statement
		cout << A[n-1] << endl;
		               ^
Main.java:14: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:18: error: ';' expected
	int A[MAX];
	         ^
10 errors
Language: Java

import java.util.Scanner;

/**
 * Sort
 */
public class Main {

    public int size;
    public int[] mx;

    public void scan() {
        Scanner sc = new Scanner(System.in);
        this.size = sc.nextInt();
        this.mx = new int[this.size];
        for (int i = 0; i < this.size; i++) {
            this.mx[i] = sc.nextInt();
        }
    }

    public void go() {
        for (int i = 1; i < this.size; i++) {
            int v = this.mx[i];
            int j = i - 1;
            while (j >= 0 && this.mx[j] > v) {
                this.mx[j + 1] = this.mx[j];
                j--;
            }
            this.mx[j + 1] = v;
            this.print();
        }
    }

    public void go() {
        for (int i = 1; i < this.size; i++) {
            this.print();
            int v = this.mx[i];
            int j = i - 1;
            while (j >= 0 && this.mx[j] > v) {
                this.mx[j + 1] = this.mx[j];
                j--;
            }
            this.mx[j + 1] = v;
        }
        this.print();
    }

    public static void main(String[] args) {
        Main sort = new Main();
        sort.scan();
        sort.go();
    }
}


Compiler output:
Main.java:33: error: method go() is already defined in class Main
    public void go() {
                ^
Main.java:29: error: cannot find symbol
            this.print();
                ^
  symbol: method print()
Main.java:35: error: cannot find symbol
            this.print();
                ^
  symbol: method print()
Main.java:44: error: cannot find symbol
        this.print();
            ^
  symbol: method print()
4 errors
Language: Java

package example;

import java.util.Scanner;

public class InsertionSort {
	
	public static void main(String[] args) {	
		Scanner scanner = new Scanner(System.in);
		int[] a = new int[scanner.nextInt()];
		for(int i = 0; i < a.length ; i++) {
			a[i] = scanner.nextInt();
		}
		insertionSort(a);	
	}
		
	public static void insertionSort(int[] a) {
		for(int i = 1; i < a.length ; i++) {
			int key = a[i];
			int j = i;
			while(j > 0 && key < a[j - 1]) {
				j--;
				a[j+1] = a[j];
			}
			a[j] = key;
			for(int k = 0; k < a.length - 1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.print(a[a.length - 1]);
			System.out.println();
		}
	}
}



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

import java.util.Scanner;

public class InsertionSort {
	
	public static void main(String[] args) {	
		Scanner scanner = new Scanner(System.in);
		int[] a = new int[scanner.nextInt()];
		for(int i = 0; i < a.length ; i++) {
			a[i] = scanner.nextInt();
		}
		insertionSort(a);	
	}
		
	public static void insertionSort(int[] a) {
		for(int i = 1; i < a.length ; i++) {
			int key = a[i];
			int j = i;
			while(j > 0 && key < a[j - 1]) {
				j--;
				a[j+1] = a[j];
			}
			a[j] = key;
			for(int k = 0; k < a.length - 1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.print(a[a.length - 1]);
			System.out.println();
		}
	}
}



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

import java.util.Scanner;
public class main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=0;i<n;i++){
            int v=a[i];
            int j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=v;
        }
    }
}


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

import java.util.Scanner;
public class main.java{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=0;i<n;i++){
            int v=a[i];
            int j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=v;
        }
    }
}


Compiler output:
Main.java:2: error: '{' expected
public class main.java{
                 ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=v;
        }
        for(int k=0;k<n;k++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        system.out.println(""):
    }
}


Compiler output:
Main.java:28: error: ';' expected
        system.out.println(""):
                              ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=v;
        }
        for(int k=0;k<n;k++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println(""):
    }
}


Compiler output:
Main.java:28: error: ';' expected
        System.out.println(""):
                              ^
1 error
Language: Java

import java.util.Scanner;
public class main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k, v;
		int N = sc.nextInt();
		int A[] = new int[N];
		for(i = 0; i < N; i++){
			j = sc.nextInt();
			A[i] =j;
		}

		for(i = 1; i <= N - 1; i++){
			for(k = 0; k < N; k++){
				System.out.print(A[k]);
				if(k != N - 1) System.out.print(" ");
			}
			System.out.println();
			v = A[i];
			j = i - 1;
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;	
		}
		for(k = 0; k < N; k++){
			System.out.print(A[k]);
			if( k != N - 1) System.out.print(" ");
		}
	}
}


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

import java.util.Scanner;
public class main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k, v;
		int N = sc.nextInt();
		int A[] = new int[N];
		for(i = 0; i < N; i++){
			j = sc.nextInt();
			A[i] =j;
		}

		for(i = 1; i <= N - 1; i++){
			for(k = 0; k < N; k++){
				System.out.print(A[k]);
				if(k != N - 1) System.out.print(" ");
			}
			System.out.println();
			v = A[i];
			j = i - 1;
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;	
		}
		for(k = 0; k < N; k++){
			System.out.print(A[k]);
			if( k != N - 1) System.out.print(" ");
		}
		System.out.println();
	}
}


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

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Solve.run();
    }
}

class Solve {
    private static int N;
    private static int[] vec;
    static void run() {
        input();
        solve();
    }
    static void input() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        vec = new int[N];
        for (int i = 0; i < N; i++) {
            vec[i] = sc.nextInt();
        }
    }
    static void solve() {
        int tmp;
        for (int i = 0, j; i < N; i++) {
            tmp = vec[i];
            j = i - 1;
            while (j >= 0 && vec[j] > tmp) {
                vec[j + 1] = vec[j];
                j--;
            }
            vec[j + 1] = tmp;
            for (int i1 = 0; i1 < vec.length; i1++) {
                System.out.print(vec[i1]);
                if (i1 != vec.length) {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}


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

import java.io.IOException;
import java.util.Scanner;

/**
 * 挿入ソート
 * 
 * @author kawakami
 *
 */

public class InsertionSort {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	}
	
	public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
}


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

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    boolean sort = true;
    int v;
    int count = 0;
    while(sort) {
      sort = false;
      for(int i = n - 1; i > 0; i--) {
        if(a[i - 1] > a[i]) {
          v = a[i - 1];
          a[i - 1] = a[i];
          a[i] = v;
          sort = true;
          count++;
        }
      }
    }
    for(int i = 0; i < n; i++) {
      if(i == n - 1) {
        System.out.println(a[i]);
      } else {
        System.out.print(a[i] + " ");
      }
    }
    System.out.println(count);
  }
}
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    boolean sort = true;
    int v;
    int count = 0;
    while(sort) {
      sort = false;
      for(int i = n - 1; i > 0; i--) {
        if(a[i - 1] > a[i]) {
          v = a[i - 1];
          a[i - 1] = a[i];
          a[i] = v;
          sort = true;
          count++;
        }
      }
    }
    for(int i = 0; i < n; i++) {
      if(i == n - 1) {
        System.out.println(a[i]);
      } else {
        System.out.print(a[i] + " ");
      }
    }
    System.out.println(count);
  }
}



Compiler output:
Main.java:33: error: class, interface, enum, or record expected
import java.util.*;
^
1 error
Language: Java

/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scanner = new Scanner(System.in);
		
		int n = Integer.parseInt(scanner.nextLine());
		
		int[] A = new int[n];
		
		String[] arrayStr = scanner.nextLine().split(" ");
		
		for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(arrayStr[i]);
		}
		
		printArray(A);
		
		int v,j;
		for (int i = 1; i < n; i++) {
			v = A[i];
			j = i - 1;
			
			while (j >= 0 && A[j] > v) {
				A[j+1] = A[j];
				j--;
			}
			A[j+1] = v;
			
			printArray(A);	
		}
		
	}
	
	void printArray(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:24: error: non-static method printArray(int[]) cannot be referenced from a static context
		printArray(A);
		^
Main.java:37: error: non-static method printArray(int[]) cannot be referenced from a static context
			printArray(A);	
			^
Main.java:43: error: cannot find symbol
		for (int i = 0; i < array.length(); i++) {
		                         ^
  symbol:   method length()
  location: variable array of type int[]
3 errors
Language: Java

import java.util.Scanner;

class InsertionSort{
 public static void main(Stirng[] args){
  Scanner sc = new Scanner(System.in);
  
  int N = sc.nextInt();
  int[] a = new int[N];
  for(int i = 0; i < a.length; i++)
   a[i] = sc.nextInt();

  for(int i = 1; i <= N - 1; i++){
   int v = a[i];
   int j = i - 1;
   while((j >= 0) && (a[j] > v)){
    a[j + 1] = a[j];
    j --;
    a[j + 1] = v;
   }
  }
 }
}


Compiler output:
Main.java:4: error: cannot find symbol
 public static void main(Stirng[] args){
                         ^
  symbol:   class Stirng
  location: class InsertionSort
1 error
Language: Java

import java.util.Scanner;
 
class InsertionSort{
 public static void main(Stirng[] args){
  Scanner sc = new Scanner(System.in);
   
  int N = sc.nextInt();
  int[] a = new int[N];
  for(int i = 0; i < a.length; i++)
   a[i] = sc.nextInt();
 
  for(int i = 1; i <= N - 1; i++){
   int v = a[i];
   int j = i - 1;
   while((j >= 0) && (a[j] > v)){
    a[j + 1] = a[j];
    j --;
    a[j + 1] = v;
   }
   System.out.println(a);
  }
 }
}


Compiler output:
Main.java:4: error: cannot find symbol
 public static void main(Stirng[] args){
                         ^
  symbol:   class Stirng
  location: class InsertionSort
1 error
Language: Java

import java.util.Scanner;

public class problem_1{
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
}


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

import java.util.Scanner;

public class Problem_1{
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
}


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

import java.util.Scanner;

public class InsertionSort{
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
}


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

import java.util.Scanner;

public class InsertionSort {
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
}


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

import java.util.Scanner;

public class InsertSort1 {
  public static void main(String... args) {
      Scanner sc = new Scanner(System.in);
      int num = sc.nextInt();
      int[] array = new int[num];

      for (int i = 0; i < num; i++) {
          array[i] = sc.nextInt();
      }

      print(array);
      for (int i = 1; i < array.length; i++) {
          int key = array[i];
          int j = i - 1;
          while (j >= 0 && array[j] > key) {
              array[j+1] = array[j];
              j--;
          }
          array[j+1] = key;
          print(array);
      }

  }

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


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

package ex1;
import java.util.Scanner;
public class ProbremA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int i,j,key;
		int N;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		
		for(i=0; i<N; i++){
			System.out.print(A[i]+" ");
		}
		System.out.println();
		
		for(i=1; i<N; i++){
			key = A[i];
			for(j=i-1;j>=0;j--){
				if(key<A[j]){
					A[j+1] = A[j];
					A[j] = key;
				}
			}
			for(int r=0; r<N; r++){
				System.out.print(A[r]+" ");
			}
			System.out.println();

		}

	}

}


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


public class ProbremA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int i,j,key;
		int N;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		
		for(i=0; i<N; i++){
			System.out.print(A[i]+" ");
		}
		System.out.println();
		
		for(i=1; i<N; i++){
			key = A[i];
			for(j=i-1;j>=0;j--){
				if(key<A[j]){
					A[j+1] = A[j];
					A[j] = key;
				}
			}
			for(int r=0; r<N; r++){
				System.out.print(A[r]+" ");
			}
			System.out.println();

		}

	}

}


Compiler output:
Main.java:2: error: class ProbremA is public, should be declared in a file named ProbremA.java
public class ProbremA {
       ^
Main.java:8: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class ProbremA
Main.java:8: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class ProbremA
3 errors
Language: Java

#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,hz,hzi;
  int *hai;
  scanf("%d",&i);
  hai=(int *)malloc(sizeof(int));
  for(int j=0;j<i;j++){
    scanf("%ld",&hai[j]);
  }
  for(j=1;j<i;j++){
    hz=hai[j];
    hzi=j-1;
    while(hzi>0 && hai[i]>hz){
      hai[hzi+1]=hai[hzi];
      hzi=hzi-1;
    }
    hai[hzi+1]=hz;
    for(int k=0;k<i;k++){
      printf("%d",hai[k]);
    }
  }
}



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:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:5: error: class, interface, enum, or record expected
  int *hai;
  ^
Main.java:6: error: class, interface, enum, or record expected
  scanf("%d",&i);
  ^
Main.java:7: error: class, interface, enum, or record expected
  hai=(int *)malloc(sizeof(int));
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
              ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
                  ^
Main.java:10: error: class, interface, enum, or record expected
  }
  ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
          ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
              ^
Main.java:13: error: class, interface, enum, or record expected
    hzi=j-1;
    ^
Main.java:14: error: class, interface, enum, or record expected
    while(hzi>0 && hai[i]>hz){
    ^
Main.java:16: error: class, interface, enum, or record expected
      hzi=hzi-1;
      ^
Main.java:17: error: class, interface, enum, or record expected
    }
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
                ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
                    ^
Main.java:21: error: class, interface, enum, or record expected
    }
    ^
20 errors
Language: Java

package ex1;
import java.util.Scanner;
ProbremA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int i,j,key;
		int N;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		
		for(i=0; i<N; i++){
			System.out.print(A[i]+" ");
		}
		System.out.println();
		
		for(i=1; i<N; i++){
			key = A[i];
			for(j=i-1;j>=0;j--){
				if(key<A[j]){
					A[j+1] = A[j];
					A[j] = key;
				}
			}
			for(int r=0; r<N; r++){
				System.out.print(A[r]+" ");
			}
			System.out.println();

		}

	}

}


Compiler output:
Main.java:3: error: class, interface, enum, or record expected
ProbremA {
^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) {
	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:39: error: class, interface, enum, or record expected
}
^
Main.java:1: error: unnamed class should not have package declaration
package ex1;
^
4 errors
Language: Java

import java.util.Scanner;

public class ex1{
    
    int N;
    int key,j;
    int[] array = new int[1001];

    public void input(){
	Scanner sc = new Scanner(System.in);
	N = sc.nextInt();
	for(int i=0; i<N; i++){
	    array[i] = sc.nextInt();
	}
    }
    
    public void sort(){
	for(int i=1; i<=N-1; i++){
	    key = array[i];
	    j = i-1;
	    while(j >= 0 && array[j] > key){
		array[j+1] = array[j];
		j--;
	    }
	    array[j+1] = key;
	    for(int k=0; k<N; k++){
		System.out.print(array[k]+" ");
	    }
	    System.out.println();
	}
	for(int k=0; k<N; k++){
		System.out.print(array[k]+" ");
	    }
	    System.out.println();
    }
    
    public static void main(String[] args){
	ex1 obj = new ex1();
	obj.input();
	obj.sort();
    }
}



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

#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,hz,hzi;
  int *hai;
  scanf("%d",&i);
  hai=(int *)malloc(sizeof(int));
  for(int j=0;j<i;j++){
    scanf("%ld",&hai[j]);
  }
  for(j=1;j<i;j++){
    hz=hai[j];
    hzi=j-1;
    while(hzi>0 && hai[i]>hz){
      hai[hzi+1]=hai[hzi];
      hzi=hzi-1;
    }
    hai[hzi+1]=hz;
    for(int k=0;k<i;k++){
      printf("%d",hai[k]);
    }
  }
  free(hai);
  return 0;
}



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:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:5: error: class, interface, enum, or record expected
  int *hai;
  ^
Main.java:6: error: class, interface, enum, or record expected
  scanf("%d",&i);
  ^
Main.java:7: error: class, interface, enum, or record expected
  hai=(int *)malloc(sizeof(int));
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
              ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
                  ^
Main.java:10: error: class, interface, enum, or record expected
  }
  ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
          ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
              ^
Main.java:13: error: class, interface, enum, or record expected
    hzi=j-1;
    ^
Main.java:14: error: class, interface, enum, or record expected
    while(hzi>0 && hai[i]>hz){
    ^
Main.java:16: error: class, interface, enum, or record expected
      hzi=hzi-1;
      ^
Main.java:17: error: class, interface, enum, or record expected
    }
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
                ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
                    ^
Main.java:21: error: class, interface, enum, or record expected
    }
    ^
Main.java:24: error: class, interface, enum, or record expected
  return 0;
  ^
Main.java:25: error: class, interface, enum, or record expected
}
^
22 errors
Language: Java

package ex1;
import java.util.Scanner;
ProbremA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int i,j,key;
		int N;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		
		for(i=0; i<N; i++){
			System.out.print(A[i]+" ");
		}
		System.out.println();
		
		for(i=1; i<N; i++){
			key = A[i];
			for(j=i-1;j>=0;j--){
				if(key<A[j]){
					A[j+1] = A[j];
					A[j] = key;
				}
			}
			for(int r=0; r<N; r++){
				System.out.print(A[r]+" ");
			}
			System.out.println();

		}

	}

}



Compiler output:
Main.java:3: error: class, interface, enum, or record expected
ProbremA {
^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) {
	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:39: error: class, interface, enum, or record expected
}
^
Main.java:1: error: unnamed class should not have package declaration
package ex1;
^
4 errors
Language: Java

#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,hz,hzi;
  int *hai;
  scanf("%d",&i);
  hai=(int *)malloc(sizeof(int));
  for(int j=0;j<i;j++){
    scanf("%ld",&hai[j]);
  }
  for(j=1;j<i;j++){
    hz=hai[j];
    hzi=j-1;
    while(hzi>0 && hai[i]>hz){
      hai[hzi+1]=hai[hzi];
      hzi=hzi-1;
    }
    hai[hzi+1]=hz;
    for(int k=0;k<i;k++){
      printf("%d",hai[k]);
    }
  }
  free(hai);
  return 0;
}




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:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:5: error: class, interface, enum, or record expected
  int *hai;
  ^
Main.java:6: error: class, interface, enum, or record expected
  scanf("%d",&i);
  ^
Main.java:7: error: class, interface, enum, or record expected
  hai=(int *)malloc(sizeof(int));
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
              ^
Main.java:8: error: class, interface, enum, or record expected
  for(int j=0;j<i;j++){
                  ^
Main.java:10: error: class, interface, enum, or record expected
  }
  ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
          ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
              ^
Main.java:13: error: class, interface, enum, or record expected
    hzi=j-1;
    ^
Main.java:14: error: class, interface, enum, or record expected
    while(hzi>0 && hai[i]>hz){
    ^
Main.java:16: error: class, interface, enum, or record expected
      hzi=hzi-1;
      ^
Main.java:17: error: class, interface, enum, or record expected
    }
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
                ^
Main.java:19: error: class, interface, enum, or record expected
    for(int k=0;k<i;k++){
                    ^
Main.java:21: error: class, interface, enum, or record expected
    }
    ^
Main.java:24: error: class, interface, enum, or record expected
  return 0;
  ^
Main.java:25: error: class, interface, enum, or record expected
}
^
22 errors
Language: Java

import java.util.Scanner;
public class ProbremA {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int i,j,key;
		int N;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		
		for(i=0; i<N; i++){
			System.out.print(A[i]+" ");
		}
		System.out.println();
		
		for(i=1; i<N; i++){
			key = A[i];
			for(j=i-1;j>=0;j--){
				if(key<A[j]){
					A[j+1] = A[j];
					A[j] = key;
				}
			}
			for(int r=0; r<N; r++){
				System.out.print(A[r]+" ");
			}
			System.out.println();

		}

	}

}



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

#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,j,k,hz,hzi;
  int *hai;
  scanf("%d",&i);
  hai=(int *)malloc(sizeof(int));
  for(j=0;j<i;j++){
    scanf("%ld",&hai[j]);
  }
  for(j=1;j<i;j++){
    hz=hai[j];
    hzi=j-1;
    while(hzi>0 && hai[i]>hz){
      hai[hzi+1]=hai[hzi];
      hzi=hzi-1;
    }
    hai[hzi+1]=hz;
    for(k=0;k<i;k++){
      printf("%d",hai[k]);
    }
  }
  free(hai);
  return 0;
}



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:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:5: error: class, interface, enum, or record expected
  int *hai;
  ^
Main.java:6: error: class, interface, enum, or record expected
  scanf("%d",&i);
  ^
Main.java:7: error: class, interface, enum, or record expected
  hai=(int *)malloc(sizeof(int));
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(j=0;j<i;j++){
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(j=0;j<i;j++){
          ^
Main.java:8: error: class, interface, enum, or record expected
  for(j=0;j<i;j++){
              ^
Main.java:10: error: class, interface, enum, or record expected
  }
  ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
          ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
              ^
Main.java:13: error: class, interface, enum, or record expected
    hzi=j-1;
    ^
Main.java:14: error: class, interface, enum, or record expected
    while(hzi>0 && hai[i]>hz){
    ^
Main.java:16: error: class, interface, enum, or record expected
      hzi=hzi-1;
      ^
Main.java:17: error: class, interface, enum, or record expected
    }
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(k=0;k<i;k++){
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(k=0;k<i;k++){
            ^
Main.java:19: error: class, interface, enum, or record expected
    for(k=0;k<i;k++){
                ^
Main.java:21: error: class, interface, enum, or record expected
    }
    ^
Main.java:24: error: class, interface, enum, or record expected
  return 0;
  ^
Main.java:25: error: class, interface, enum, or record expected
}
^
22 errors
Language: Java

import java.util.Scanner;

class Main{
    
    int N;
    int key,j;
    int[] array = new int[1001];

    public void input(){
	Scanner sc = new Scanner(System.in);
	N = sc.nextInt();
	for(int i=0; i<N; i++){
	    array[i] = sc.nextInt();
	}
    }
    
    public void sort(){
	for(int i=1; i<=N-1; i++){
	    key = array[i];
	    j = i-1;
	    while(j >= 0 && array[j] > key){
		array[j+1] = array[j];
		j--;
	    }
	    array[j+1] = key;
	    for(int k=0; k<N; k++){
		System.out.print(array[k]+" ");
	    }
	    System.out.println();
	}
    
    public static void main(String[] args){
	Main obj = new Main();
	obj.input();
	obj.sort();
    }
}



Compiler output:
Main.java:32: error: illegal start of expression
    public static void main(String[] args){
    ^
1 error
Language: Java

package pA;

import java.util.Scanner;

public class Sort {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		/* initial */
		
		System.out.println("input length");
		Scanner scanner = new Scanner(System.in);
		int length = scanner.nextInt(); 
		
		int[] elem = null;
		
		for(int i = 0;i < length;i++){
			elem[i] = scanner.nextInt();
		}
		/* function */
		for(int i = 1;i<length;i++){
			int key = elem[i];
			int j = i - 1;
			
			while( j > 0 && elem[j] > key){
				elem[j+1] = elem[j];
				j = j -1;
				elem[j+1] = key;
				
			}
			
		}

	}

}



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

#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,j,k,key,hzi;
  int *hai;
  scanf("%d",&i);
  hai=(int *)malloc(sizeof(int));
  for(j=0;j<i;j++){
    scanf("%ld",&hai[j]);
  }
  for(j=1;j<i;j++){
    key=hai[j];
    hzi=j-1;
    while(hzi>=0 && hai[hzi]>key){
      hai[hzi+1]=hai[hzi];
      hzi--;
    }
    hai[hzi+1]=key;
    for(k=0;k<i;k++){
     printf("%d",hai[k]);
     if(k!=i-1){
       printf("  ");
     }
    }
   printf("\n");
  }
free(hai);
return 0;
}



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:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:5: error: class, interface, enum, or record expected
  int *hai;
  ^
Main.java:6: error: class, interface, enum, or record expected
  scanf("%d",&i);
  ^
Main.java:7: error: class, interface, enum, or record expected
  hai=(int *)malloc(sizeof(int));
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(j=0;j<i;j++){
  ^
Main.java:8: error: class, interface, enum, or record expected
  for(j=0;j<i;j++){
          ^
Main.java:8: error: class, interface, enum, or record expected
  for(j=0;j<i;j++){
              ^
Main.java:10: error: class, interface, enum, or record expected
  }
  ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
          ^
Main.java:11: error: class, interface, enum, or record expected
  for(j=1;j<i;j++){
              ^
Main.java:13: error: class, interface, enum, or record expected
    hzi=j-1;
    ^
Main.java:14: error: class, interface, enum, or record expected
    while(hzi>=0 && hai[hzi]>key){
    ^
Main.java:16: error: class, interface, enum, or record expected
      hzi--;
      ^
Main.java:17: error: class, interface, enum, or record expected
    }
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(k=0;k<i;k++){
    ^
Main.java:19: error: class, interface, enum, or record expected
    for(k=0;k<i;k++){
            ^
Main.java:19: error: class, interface, enum, or record expected
    for(k=0;k<i;k++){
                ^
Main.java:21: error: class, interface, enum, or record expected
     if(k!=i-1){
     ^
Main.java:23: error: class, interface, enum, or record expected
     }
     ^
Main.java:26: error: class, interface, enum, or record expected
  }
  ^
Main.java:28: error: class, interface, enum, or record expected
return 0;
^
Main.java:29: error: class, interface, enum, or record expected
}
^
24 errors