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


import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	static int cnt = 0;
	static PrintWriter out =new PrintWriter(System.out);
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	
    	int n = sc.nextInt();
    	int array[] = new int[n];
    	for(int i=0;i<n;i++) {
    		array[i] = sc.nextInt();
    	}
    	bubble(array);
    	out.print(array[0]);
    	for(int i=1;i<n;i++) {
    		out.print(" "+array[i]);
    	}
    	out.println();
    	out.println(cnt);
    	out.flush();
    }
    
    static void bubble(int[] a) {
    	for(int i=0;i<a.length();i++) {
    		for(int j=a.length-1;j>=i+1;j--) {
    			if(a[j]<a[j-1]) {
    				int temp = a[j];
    				a[j] = a[j-1];
    				a[j-1] =temp;
    				cnt++;
    			}
    				
    		}
    	}
    }
    	
}


Compiler output:
Main.java:27: error: cannot find symbol
    	for(int i=0;i<a.length();i++) {
    	               ^
  symbol:   method length()
  location: variable a of type int[]
1 error
Language: Java

package icpc;

import java.io.PrintWriter;
import java.util.Scanner;

public class icpc {
	static int cnt = 0;
	static PrintWriter out =new PrintWriter(System.out);
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	
    	int n = sc.nextInt();
    	int array[] = new int[n];
    	for(int i=0;i<n;i++) {
    		array[i] = sc.nextInt();
    	}
    	bubble(array);
    	out.print(array[0]);
    	for(int i=1;i<n;i++) {
    		out.print(" "+array[i]);
    	}
    	out.println();
    	out.println(cnt);
    	out.flush();
    }
    
    static void bubble(int[] a) {
    	for(int i=0;i<a.length;i++) {
    		for(int j=a.length-1;j>=i+1;j--) {
    			if(a[j]<a[j-1]) {
    				int temp = a[j];
    				a[j] = a[j-1];
    				a[j-1] =temp;
    				cnt++;
    			}
    				
    		}
    	}
    }
    	
}


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

#include<stdio.h>

int main(){
  int A[100], n, i, j, t, sw = 0;

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

  for ( i = 0; i < n; i++ ){
    for ( j = n-1; j >= i+1; j-- ){
      if ( A[j] < A[j-1] ){
	t = A[j]; A[j] = A[j-1]; A[j-1] = t;
	sw++;
      }
    }
  }

  for ( i = 0; i < n; i++ ){
    if (i) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);

  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:6: error: class, interface, enum, or record expected
  scanf("%d", &n);
  ^
Main.java:7: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  ^
Main.java:7: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
               ^
Main.java:7: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
                      ^
Main.java:9: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ){
  ^
Main.java:9: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ){
               ^
Main.java:9: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ){
                      ^
Main.java:10: error: class, interface, enum, or record expected
    for ( j = n-1; j >= i+1; j-- ){
                   ^
Main.java:10: error: class, interface, enum, or record expected
    for ( j = n-1; j >= i+1; j-- ){
                             ^
Main.java:12: error: class, interface, enum, or record expected
	t = A[j]; A[j] = A[j-1]; A[j-1] = t;
	          ^
Main.java:12: error: class, interface, enum, or record expected
	t = A[j]; A[j] = A[j-1]; A[j-1] = t;
	                         ^
Main.java:13: error: class, interface, enum, or record expected
	sw++;
	^
Main.java:14: error: class, interface, enum, or record expected
      }
      ^
Main.java:18: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ){
               ^
Main.java:18: error: class, interface, enum, or record expected
  for ( i = 0; i < n; i++ ){
                      ^
Main.java:20: error: class, interface, enum, or record expected
    printf("%d", A[i]);
    ^
Main.java:21: error: class, interface, enum, or record expected
  }
  ^
Main.java:23: error: class, interface, enum, or record expected
  printf("%d\n", sw);
  ^
Main.java:25: error: class, interface, enum, or record expected
  return 0;
  ^
Main.java:26: error: class, interface, enum, or record expected
}
^
22 errors
Language: Java

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

import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class pr_2_A_bubble_sort {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n;i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		
		int ans = bubblesort_swap_num(arr);
		System.out.println(ans);
	}
	public static int bubblesort_swap_num(int[] arr){
		int n = arr.length;
		int ans = 0;
		for(int i=0; i<n; i++){
			for(int j=i+1; j<n; j++){
				if(arr[i] > arr[j]){
					int tmp = arr[i];
					arr[i] = arr[j];
					arr[j] = tmp;
					ans++;
				}
			}	
		}
		return ans;
	}	
}



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

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

import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class pr_2_A_bubble_sort {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n;i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		
		bubblesort_swap_num(arr);
	}
	public static void bubblesort_swap_num(int[] arr){
		int n = arr.length;
		int ans = 0;
		for(int i=0; i<n; i++){
			for(int j=i+1; j<n; j++){
				if(arr[i] > arr[j]){
					int tmp = arr[i];
					arr[i] = arr[j];
					arr[j] = tmp;
					ans++;
				}
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}
}



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

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

import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class pr_2_A_bubble_sort {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n;i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		
		bubblesort_swap_num(arr);
	}
	public static void bubblesort_swap_num(int[] arr){
		int n = arr.length;
		int ans = 0;
		for(int i=0; i<n; i++){
			for(int j=1; j<n-i; j++){
				if(arr[j-1] > arr[j]){
					int tmp = arr[j-1];
					arr[j-1] = arr[j];
					arr[j] = tmp;
					ans++;
				}
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}
}



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

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

import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class _Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n;i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		
		bubblesort_swap_num(arr);
	}
	public static void bubblesort_swap_num(int[] arr){
		int n = arr.length;
		int ans = 0;
		for(int i=0; i<n; i++){
			for(int j=1; j<n-i; j++){
				if(arr[j-1] > arr[j]){
					int tmp = arr[j-1];
					arr[j-1] = arr[j];
					arr[j] = tmp;
					ans++;
				}
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}
}



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

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

import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;

public class main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n;i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		
		bubblesort_swap_num(arr);
	}
	public static void bubblesort_swap_num(int[] arr){
		int n = arr.length;
		int ans = 0;
		for(int i=0; i<n; i++){
			for(int j=1; j<n-i; j++){
				if(arr[j-1] > arr[j]){
					int tmp = arr[j-1];
					arr[j-1] = arr[j];
					arr[j] = tmp;
					ans++;
				}
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}
}



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

package ex2;
import java.util.Scanner;
public class BubbleSort {

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

	}

}


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

import java.util.Scanner;
public class BubbleSort {

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

	}

}


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

public class Solution{
    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }
}



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

import java.util.Scanner;
public class Solution{
    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }
}



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

import java.util.*;
public class Solution{
    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }
}



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

import java.util.*;

    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }




Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
    public static void main(String[] ar){
                  ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.util.*;
public static class Solution{
    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }
}



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

import java.util.*;
public static class Solution {
    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }
}



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

import java.util.*;
public class Solution {
    public static void main(String[] ar){
        int i,j,N,tmp,cnt;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
	
		int [] A = new int [N];
		
		for(i=0; i<N; i++){
			A[i] =sc.nextInt();
		}
		cnt =0;
		for(i=0;i<N-1;i++){
			for(j=0;j<N-(i+1);j++){
				if(A[j] > A[j+1]){
					tmp  = A[j];
					A[j] = A[j+1];
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);
    }
}



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

package ex2;
import java.util.Scanner;
public class BubbleSort {

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

	}

}



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

package ex2;
import java.util.Scanner;
public static class BubbleSort {

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

	}

}



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

import java.util.Scanner;
public class BubbleSort {

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

	}

}
					A[j+1] = tmp;
					cnt++;
				}
			}
		}
		
		for(int r=0; r<N; r++){
			System.out.print(A[r]+" ");
		}
		System.out.println("\r\n"+cnt);

	}

}



Compiler output:
Main.java:35: error: class, interface, enum, or record expected
					A[j+1] = tmp;
					^
Main.java:36: error: class, interface, enum, or record expected
					cnt++;
					^
Main.java:37: error: class, interface, enum, or record expected
				}
				^
Main.java:41: error: class, interface, enum, or record expected
		for(int r=0; r<N; r++){
		             ^
Main.java:41: error: class, interface, enum, or record expected
		for(int r=0; r<N; r++){
		                  ^
Main.java:43: error: class, interface, enum, or record expected
		}
		^
Main.java:46: error: class, interface, enum, or record expected
	}
	^
7 errors
Language: Java

#include <stdio.h>

int main(){
  int n, a[100], i, count=0, flag=1, b;
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &a[i]);
  }

  while(flag==1){
    flag=0;
    for(i=n-1; i>0; i--){
      if(a[i]<a[i-1]){
	b=a[i];
	a[i]=a[i-1];
	a[i-1]=b;
	count++;
	flag=1;
      }
    }
  }

  for(i=0; i<n-1; i++){
    printf("%-2d", a[i]);
  }
  printf("%d",a[n-1]);
  printf("\n%d\n", count);
  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:5: error: class, interface, enum, or record expected
  scanf("%d", &n);
  ^
Main.java:6: error: class, interface, enum, or record expected
  for(i=0; i<n; i++){
  ^
Main.java:6: error: class, interface, enum, or record expected
  for(i=0; i<n; i++){
           ^
Main.java:6: error: class, interface, enum, or record expected
  for(i=0; i<n; i++){
                ^
Main.java:8: error: class, interface, enum, or record expected
  }
  ^
Main.java:12: error: class, interface, enum, or record expected
    for(i=n-1; i>0; i--){
    ^
Main.java:12: error: class, interface, enum, or record expected
    for(i=n-1; i>0; i--){
               ^
Main.java:12: error: class, interface, enum, or record expected
    for(i=n-1; i>0; i--){
                    ^
Main.java:15: error: class, interface, enum, or record expected
	a[i]=a[i-1];
	^
Main.java:16: error: class, interface, enum, or record expected
	a[i-1]=b;
	^
Main.java:17: error: class, interface, enum, or record expected
	count++;
	^
Main.java:18: error: class, interface, enum, or record expected
	flag=1;
	^
Main.java:19: error: class, interface, enum, or record expected
      }
      ^
Main.java:23: error: class, interface, enum, or record expected
  for(i=0; i<n-1; i++){
           ^
Main.java:23: error: class, interface, enum, or record expected
  for(i=0; i<n-1; i++){
                  ^
Main.java:25: error: class, interface, enum, or record expected
  }
  ^
Main.java:27: error: class, interface, enum, or record expected
  printf("\n%d\n", count);
  ^
Main.java:28: error: class, interface, enum, or record expected
  return 0;
  ^
Main.java:29: error: class, interface, enum, or record expected
}
^
21 errors
Language: Java

import java.util.*;

/**
 * A
 */

// bubble sort

public class A {
    public static void main(String[] args) {
        
        Scanner sc  = new Scanner(System.in);

        int n = sc.nextInt();
        int count=0;
        int array[] = new int[n];

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

        sc.close();

        /**
        * 1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
        * 2   flag = 1 // 逆の隣接要素が存在する
        * 3   while flag
        * 4     flag = 0
        * 5     for j が N-1 から 1 まで
        * 6       if A[j] < A[j-1]
        * 7         A[j] と A[j-1] を交換
        * 8         flag = 1
        */

        boolean flag = true;

        while(flag) {

            flag = false;
            
            for(int j=n-1; j>=1; j--) {

                if(array[j] < array[j-1]) {

                    int tmp = array[j];
                    array[j] = array[j-1];
                    array[j-1] = tmp;

                    count++;
                    flag = true;
                    
                }

            }

        }

        for(int i=0; i<n; i++) {
            
            System.out.print(array[i]);

            if(i != n-1) {
                System.out.print(" ");
            }

        }

        System.out.println();
        System.out.println(count);
    
    }
}


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

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

class test01{
    public static void main(String[] args){
        int count;
        int[] array = new int[100];
        int key;
        int counter = 0;

        try{
            Scanner scan = new Scanner(System.in);
            String str = scan.next();

            count = Integer.parseInt(str);

            for(int i = 0; i < count; i++){
                str = scan.next();
                array[i] = Integer.parseInt(str);
            }

            //Sort Part
            for(int i = 0; i < count - 1; i++){
                for(int j = count - 1; j > i; j--){
                    //System.out.println("---OK");
                    if(array[j] < array[j-1]){
                        key = array[j-1];
                        array[j-1] = array[j];
                        array[j] = key;
                        counter++;
                    }
                }
                //System.out.println("OK");
            }

            for(int i = 0; i < count; i++){
                System.out.print(array[i] + " ");
            }

            System.out.println();

            System.out.println(counter);

        }catch(Exception e){
            System.out.println("ERROR");
        }

        return(0);
    }
}


Compiler output:
Main.java:48: error: incompatible types: unexpected return value
        return(0);
              ^
Main.java:48: error: incompatible types: int cannot be converted to void
        return(0);
               ^
2 errors
Language: Java

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

class Main{
    public static void main(String[] args) throws Exception{
	int i = 0;
	int tmp;
	int Count_Sort = 0;
	boolean flag = true;
	
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String N_str = br.readLine();
	int N = Integer.parseInt(N_str);

	int[] A;
	A = new int[N];
	
	String A_str = br.readLine();
	Scanner sc = new Scanner(A_str).useDelimiter("\\s* \\s*");
	
	while(sc.hasNext()){
	    A[i] = sc.nextInt();
	    i++;
	}

	i = 0;
	
	while(flag){
	    flag = false;
	    for(int j=N-1;i<j;j--){
		if(A[j]<A[j-1]){
		    tmp = A[j];
		    A[j] = A[j-1];
		    A[j-1] = tmp;
		    flag = true;
		    Count_Sort++;
		}
	    }
	    i++;
	}
	
	for(i=0;i<N;i++){
	    System.out.print(A[i] + " ");
	}
	
	System.out.println("");
	System.out.print(Count_Sort);
    }
    return ;
}



Compiler output:
Main.java:50: error: illegal start of type
    return ;
    ^
1 error
Language: Java

#include<stdio.h>
#include<stdlib.h>
int main(void) {
	int temp, i, cnt = 0, flag, j;
  	int numbers[100];
 
  scanf("%d", &j);
   
  for(i = 0;i < j;i++){
    scanf("%d", &numbers[i]);
  }

  flag = 1;
  while(flag) {
  	flag = 0;

  	for( i = j-1; i>=1; i--) {
  		if(numbers[j] < numbers[j-1] ) {
  			temp = numbers[j-1];
  			numbers[j-1] = numbers[j];
  			numbers[j] - temp;
  			flag = 1;
  			cnt++;
  		}
  	}
  }
  for(i = 0;i < j-1;i++){
    printf("%d ", numbers[i]);
  }
  printf("%d\n", numbers[i]);
  printf("%d\n", cnt);
  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 numbers[100];
  	^
Main.java:7: error: class, interface, enum, or record expected
  scanf("%d", &j);
  ^
Main.java:9: error: class, interface, enum, or record expected
  for(i = 0;i < j;i++){
  ^
Main.java:9: error: class, interface, enum, or record expected
  for(i = 0;i < j;i++){
            ^
Main.java:9: error: class, interface, enum, or record expected
  for(i = 0;i < j;i++){
                  ^
Main.java:11: error: class, interface, enum, or record expected
  }
  ^
Main.java:14: error: class, interface, enum, or record expected
  while(flag) {
  ^
Main.java:17: error: class, interface, enum, or record expected
  	for( i = j-1; i>=1; i--) {
  	^
Main.java:17: error: class, interface, enum, or record expected
  	for( i = j-1; i>=1; i--) {
  	              ^
Main.java:17: error: class, interface, enum, or record expected
  	for( i = j-1; i>=1; i--) {
  	                    ^
Main.java:20: error: class, interface, enum, or record expected
  			numbers[j-1] = numbers[j];
  			^
Main.java:21: error: class, interface, enum, or record expected
  			numbers[j] - temp;
  			^
Main.java:22: error: class, interface, enum, or record expected
  			flag = 1;
  			^
Main.java:23: error: class, interface, enum, or record expected
  			cnt++;
  			^
Main.java:24: error: class, interface, enum, or record expected
  		}
  		^
Main.java:27: error: class, interface, enum, or record expected
  for(i = 0;i < j-1;i++){
            ^
Main.java:27: error: class, interface, enum, or record expected
  for(i = 0;i < j-1;i++){
                    ^
Main.java:29: error: class, interface, enum, or record expected
  }
  ^
Main.java:31: error: class, interface, enum, or record expected
  printf("%d\n", cnt);
  ^
Main.java:32: error: class, interface, enum, or record expected
  return 0;
  ^
Main.java:33: error: class, interface, enum, or record expected
}
^
24 errors
Language: Java

public class BubbleSort{
    
    static int[] A;

    public void bubblesort(int[] A){

	for(int i = 0;i<A.length ;i++){

	    for(int j = A.length-1;j >=i+1;j--){
		if(A[j]<A[j-1]){
		    swap(j,j-1);
		}
	    }
	}
	
    }

    public void swap(int x,int y){
	int m = 0;
	int n = 0;
	m = A[x];
	n = A[y];
	A[x] = n;
	A[y] = m;

    }

    public void call(){
	int i =0;
	while(true){
	    System.out.print(A[i]);
	    i++;
	    if(i==5)break;
	}
    }

}

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

import java.util.Scanner;
public class BubbleSort{
    
    static int[] A;


    public static void main(String[] args){
	int i = 0;
	BubbleSort bubble = new BubbleSort();
	Scanner scan = new Scanner(System.in);
	while(i<5){
	    BubbleSort.A[i] = scan.nextInt();
	    i++;
	}
	bubble.bubblesort(BubbleSort.A);
	bubble.call();
    }



    public void bubblesort(int[] A){

	for(int i = 0;i<A.length ;i++){

	    for(int j = A.length-1;j >=i+1;j--){
		if(A[j]<A[j-1]){
		    swap(j,j-1);
		}
	    }
	}
	
    }

    public void swap(int x,int y){
	int m = 0;
	int n = 0;
	m = A[x];
	n = A[y];
	A[x] = n;
	A[y] = m;

    }

    public void call(){
	int i =0;
	while(true){
	    System.out.print(A[i]);
	    i++;
	    if(i==5)break;
	}
    }

}

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

#include <stdio.h>

int main () {
	int c,d,n,m,count;
	scanf("%d", &n);

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

	min = a[0];
	count = 0;
	for (c = 0; c < (n -1); c++) {
		d =c;
		while () {
			if (a[d + 1] < a[d]) {
				m = a[d + 1];
				a[d + 1] = a[d];
				a[d] = m;
				d--;
				count++;
			}
		}
	}

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

	printf("%d", count);

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:9: error: 'min' undeclared (first use in this function); did you mean 'main'?
   12 |         min = a[0];
      |         ^~~
      |         main
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:24: error: expected expression before ')' token
   16 |                 while () {
      |                        ^
Language: C

import java.util.Arrays;public class Main { 
	int[] random(int n) {  
		int[] a = new int[n];  
		for(int i = 0; i < n; i++) {   
			a[i] = (int)(Math.random() * 1000);  
			}       return a;   
			} 
	void swap(int[] a, int i, int j) {  
		int temp = a[i];  a[i] = a[j];  a[j] = temp; }
	void bubbleSort(int[] a) {  
		// バブルソート 未完成  for(int f =1; f<a.length; f++)
		{  
			for(int j=1; j<a.length; j++) {
			for(int i = 1; i < a.length; i++) {   
				if(a[i-1] > a[i]) {    swap(a, i-1, i);  
				}  
				}  
			} 
		}
		} 
	void quickSort(int[] a) { 
		// クイックソートを作ります 
		} 
	void main() {  
		int[] a = {5, 3, 1, 9, 8, 0, 4, 2, 7, 6}; 
		//int[] a = random(100); 
		System.out.println("Before: " + Arrays.toString(a)); 
		
		bubbleSort(a);  
		System.out.println("After " + Arrays.toString(a)); 
			public static void main(String[] args) {  
		new Main().main();
		}
	
	}



Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Arrays;public class Main {
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Arrays;public class Main {
      |            ^
main.c:1:25: error: unknown type name 'public'
    1 | import java.util.Arrays;public class Main {
      |                         ^~~~~~
main.c:1:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    1 | import java.util.Arrays;public class Main {
      |                                      ^~~~
Language: C

#include <stdio.h>

int main(void){
   int N, i, j, k, x, m;

   scanf("%d", &N);

   int A[N];

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

   m = 0;

   flag = 1;
   while(flag) {
     flag = 0;
     for(j = N - 1; N > 0; N--){
        if (A[j] < A[j - 1]){
          x = A[j];
          A[j] = A[j - 1];
          A[j - 1] = x;
        }
        m++;
        flag = 1;
   }

   for(k = 0; k < N - 1; k++) {
      printf("%d ", A[k]);
   }
   printf("%d\n", A[N - 1]);


   return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:4: error: 'flag' undeclared (first use in this function)
   16 |    flag = 1;
      |    ^~~~
main.c:16:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:36:1: error: expected declaration or statement at end of input
   36 | }
      | ^
Language: C

#include <stdio.h>

int main(void){
   int N, i, j, k, x, m, flag;

   scanf("%d", &N);

   int A[N];

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

   m = 0;

   flag = 1;
   while(flag == 1) {
     flag = 0;
     for(j = N - 1; N > 0; N--){
        if (A[j] < A[j - 1]){
          x = A[j];
          A[j] = A[j - 1];
          A[j - 1] = x;
        }
        m++;
        flag = 1;
   }

   for(k = 0; k < N - 1; k++) {
      printf("%d ", A[k]);
   }
   printf("%d\n", A[N - 1]);


   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>

int main(void){
   int N, i, j, k, x, m, f;

   scanf("%d", &N);

   int A[N];

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

   m = 0;

   f = 1;
   while(f == 1) {
     f = 0;
     for(j = N - 1; N > 0; N--){
        if (A[j] < A[j - 1]){
          x = A[j];
          A[j] = A[j - 1];
          A[j - 1] = x;
        }
        m++;
        f = 1;
   }

   for(k = 0; k < N - 1; k++) {
      printf("%d ", A[k]);
   }
   printf("%d\n", A[N - 1]);

   printf("%d\n", m);


   return 0;
}


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

#include <stdio.h>

int main(void){
   int N, i, j, k, x, m, f;

   scanf("%d", &N);

   int A[N];

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

   m = 0;

   f = 1;
   while(f == 1) {
     f = 0;
     for(j = N - 1; N > 0; N--){
        if (A[j] < A[j - 1]){
          x = A[j];
          A[j] = A[j - 1];
          A[j - 1] = x;
        }
        m++;
        f = 1;
   };

   for(k = 0; k < N - 1; k++) {
      printf("%d ", A[k]);
   }
   printf("%d\n", A[N - 1]);

   printf("%d\n", m);


   return 0;
}


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

#include <stdio.h>

int main(){
    int i,j,k,n;
    scanf("%",&n);
    int a[n];
    for (int i = 0; i <n ; ++i) {
        scanf("%",&a[i]);
    }
    int count,temp,check;
    for (int j = 0; j < n; ++j) {
        if(check==0)brake;
        for (int k = (n-1); 0 < k;k--) {
            check=0;
            if (a[k]<a[k-1]){
                temp=a[k-1];
                a[k-1]=a[k];
                a[k]=temp;
                count++;
                check++;

            }
        }
    }
    for(i=0;i<n;i++){
    printf("%d ",a[i]);
    }
    printf("\n");
    printf("&d",count);
    
}


Compiler output:
main.c: In function 'main':
main.c:12:21: error: 'brake' undeclared (first use in this function)
   12 |         if(check==0)brake;
      |                     ^~~~~
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){
    int i,j,k,n;
    scanf("%",&n);
    int a[n];
    for (int i = 0; i <n ; ++i) {
        scanf("%",&a[i]);
    }
    int count,temp,check;
    for (int j = 0; j < n; ++j) {
        if(check==0)brake;
        for (int k = (n-1); 0 < k;k--) {
            check=0;
            if (a[k]<a[k-1]){
                temp=a[k-1];
                a[k-1]=a[k];
                a[k]=temp;
                count++;
                check++;

            }
        }
    }
    for(i=0;i<n;i++){
    printf("%d ",a[i]);
    }
    printf("\n");
    printf("&d",count);
    return 0;
    
}


Compiler output:
main.c: In function 'main':
main.c:12:21: error: 'brake' undeclared (first use in this function)
   12 |         if(check==0)brake;
      |                     ^~~~~
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){
    int i,j,k,n;
    scanf("%d",&n);
    int a[n];
    for (int i = 0; i <n ; ++i) {
        scanf("%d",&a[i]);
    }
    int count,temp,check;
    count=0;
    check=1;
    for (int j = 0; j < n; j++) {
        if(check==0) break;
        for (int k = (n-1); j < k;k--) {
            check=0;
            if (a[k]<a[k-1]){
                temp=a[k-1];
                a[k-1]=a[k];
                a[k]=temp;
                count++;
                check++;

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


Compiler output:
main.c:32:12: error: expected declaration specifiers or '...' before string constant
   32 |     printf("\n");
      |            ^~~~
main.c:33:12: error: expected declaration specifiers or '...' before string constant
   33 |     printf("%d",count);
      |            ^~~~
main.c:33:17: error: unknown type name 'count'
   33 |     printf("%d",count);
      |                 ^~~~~
main.c:34:5: error: expected identifier or '(' before 'return'
   34 |     return 0;
      |     ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

#include <stdio.h>

int main(){
    int i,j,k,n;
    scanf("%d",&n);
    int a[n];
    for (int i = 0; i <n ; ++i) {
        scanf("%d",&a[i]);
    }
    int count,temp,check;
    count=0;
    check=1;
    for (int j = 0; j < n; j++) {
        if(check==0) break;
        for (int k = (n-1); j < k;k--) {
            check=0;
            if (a[k]<a[k-1]){
                temp=a[k-1];
                a[k-1]=a[k];
                a[k]=temp;
                count++;
                check++;

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

    printf("\n");
    printf("%d",count);
    return 0;
    


Compiler output:
main.c: In function 'main':
main.c:35:5: error: expected declaration or statement at end of input
   35 |     return 0;
      |     ^~~~~~
Language: C

#include<stdio.h>

void bubbleSort(int a[100], int N);
void swap(int *a, int *b){
    int c;
    c=*a;
    *a=*b;
    *b=c;

}

int main(void){
    int a[100],N,i,j;
    scanf("%d",&N);
    
    for(i=0;i<N;i++){
        scanf("%d ",&a[i]);
    }

    bubbleSort(a,N);


}

void bubbleSort(int a[100], int N){
    int i,flag,count;
    flag = 1;
    count = 0:

    while(flag){
    flag = 0;
    
        for(j=N-1;j>0;j--){
            if(a[j] < a[j-1]){
                swap(&a[j],&a[j-1]);
                flag=1;
                count++;
            }
        }
    }
    printf("%d",a[0]);
    for(i=1;i<N;i++)
        printf(" %d",a[i])
    printf("\n"); 
    printf("%d",count);
}


Compiler output:
main.c: In function 'bubbleSort':
main.c:28:14: error: expected ';' before ':' token
   28 |     count = 0:
      |              ^
      |              ;
main.c:43:27: error: expected ';' before 'printf'
   43 |         printf(" %d",a[i])
      |                           ^
      |                           ;
   44 |     printf("\n");
      |     ~~~~~~
Language: C

#include<stdio.h>

void bubbleSort(int a[100], int N);
void swap(int *a, int *b){
    int c;
    c=*a;
    *a=*b;
    *b=c;

}

int main(void){
    int a[100],N,i,j;
    scanf("%d",&N);
    
    for(i=0;i<N;i++){
        scanf("%d ",&a[i]);
    }

    bubbleSort(a,N);


}

void bubbleSort(int a[100], int N){
    int i,flag,count;
    flag = 1;
    count = 0;

    while(flag){
    flag = 0;
    
        for(j=N-1;j>0;j--){
            if(a[j] < a[j-1]){
                swap(&a[j],&a[j-1]);
                flag=1;
                count++;
            }
        }
    }
    printf("%d",a[0]);
    for(i=1;i<N;i++)
        printf(" %d",a[i])
    printf("\n"); 
    printf("%d",count);
}


Compiler output:
main.c: In function 'bubbleSort':
main.c:33:13: error: 'j' undeclared (first use in this function)
   33 |         for(j=N-1;j>0;j--){
      |             ^
main.c:33:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:43:27: error: expected ';' before 'printf'
   43 |         printf(" %d",a[i])
      |                           ^
      |                           ;
   44 |     printf("\n");
      |     ~~~~~~
Language: C

#include<stdio.h>

void bubbleSort(int a[100], int N);
void swap(int *a, int *b){
    int c;
    c=*a;
    *a=*b;
    *b=c;

}

int main(void){
    int a[100],N,i,j;
    scanf("%d",&N);
    
    for(i=0;i<N;i++){
        scanf("%d ",&a[i]);
    }

    bubbleSort(a,N);


}

void bubbleSort(int a[100], int N){
    int i,j,flag,count;
    flag = 1;
    count = 0;

    while(flag){
    flag = 0;
    
        for(j=N-1;j>0;j--){
            if(a[j] < a[j-1]){
                swap(&a[j],&a[j-1]);
                flag=1;
                count++;
            }
        }
    }
    printf("%d",a[0]);
    for(i=1;i<N;i++)
        printf(" %d",a[i])
    printf("\n"); 
    printf("%d",count);
}


Compiler output:
main.c: In function 'bubbleSort':
main.c:43:27: error: expected ';' before 'printf'
   43 |         printf(" %d",a[i])
      |                           ^
      |                           ;
   44 |     printf("\n");
      |     ~~~~~~
Language: C

#include<stdio.h>

void bubbleSort(int a[100], int N);
void swap(int *a, int *b){
    int c;
    c=*a;
    *a=*b;
    *b=c;

}

int main(void){
    int a[100],N,i,j;
    scanf("%d",&N);
    
    for(i=0;i<N;i++){
        scanf("%d ",&a[i]);
    }

    bubbleSort(a,N);


}

void bubbleSort(int a[100], int N){
    int i,j,flag,count;
    flag = 1;
    count = 0;

    while(flag){
    flag = 0;
    
        for(j=N-1;j>0;j--){
            if(a[j] < a[j-1]){
                swap(&a[j],&a[j-1]);
                flag=1;
                count++;
            }
        }
    }
    printf("%d",a[0]);
    if(N>1){
        for(i=1;i<N;i++)
            printf(" %d",a[i]);
    }
    printf("\n"); 
    printf("%d",count\n);
}


Compiler output:
main.c: In function 'bubbleSort':
main.c:47:22: error: stray '\' in program
   47 |     printf("%d",count\n);
      |                      ^
main.c:47:22: error: expected ')' before 'n'
   47 |     printf("%d",count\n);
      |           ~          ^~
      |                      )
Language: C

#include<stdio.h>
void bubbleSort(int A[],int N){
int flag=1;
int j,c,e;
while(flag){
flag=0;
for(j=N-1;j>1;j--){
if(A[j]<A[j-1]){
a=A[j];
A[j]=A[j-1];
A[j-1]=a;  
flag=1;
c++; 
        }
     }
   }
for(e=0;e<N;e++){
printf("%d",A[e]);
}
printf("%d",c);
}

int main(){
int a,b[100],d;
scanf("%d",&a);
for(d=0;d<a;d++){
scanf("%d",&b[d]);
}
bubbleSort(b[],a);










Compiler output:
main.c: In function 'bubbleSort':
main.c:9:1: error: 'a' undeclared (first use in this function)
    9 | a=A[j];
      | ^
main.c:9:1: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:29:14: error: expected expression before ']' token
   29 | bubbleSort(b[],a);
      |              ^
main.c:29:14: error: expected declaration or statement at end of input
Language: C

#include <iostream>
using namespace std;

int bubbleSort(int A[],int N) {
    int sw = 0;
    bool flag = 1;
    for(int i=0;flag;i++) {
        flag = 0;
        for(int j=N-1;j>=i+1;j--) {
            if(A[j]<A[j-1]) {
                swap(A[j],A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}

int main(void) {
    int A[100], N, sw;
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];

    sw = bubbleSort(A,N);

    for(int i=0;i<N;i++) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout <<sw << 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>

int main(){
 int n;
 int count;
 scanf("%d",&n);
 int arr[n];
 for(int i = 0; i < n; i++)scanf("%d",&arr[i]);
 for(int i = 0; i < n-1; i++){
  for(int j = i; j < n-1; j++){
   if(arr[j] > arr[j+1]){
    int temp = arr[j];
    arr[j] = arr[j+1];
    arr[j+1] = arr[j];
    count++;
   }
  }
 }
 printf("%d",&arr[i]);
 for(int i = 1; i < n; i++)printf("%d",&arr[i]);
 printf("\n%d",count);
}


Compiler output:
main.c: In function 'main':
main.c:19:19: error: 'i' undeclared (first use in this function)
   19 |  printf("%d",&arr[i]);
      |                   ^
main.c:19:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdioi.h>
int swap(int a*,int b*){
    int temp = a*;
    a* = *b;
    b* = temp;
}
int bubbleSort(intA[], intN)
{
int i,j,sw=0;
int flag = 1
for(i =0;flag;i++){
    flag =0;
    for(j=N-1;j=>i+1;j--){
        if(A[j]<a[j-1]){
            swap(&A[j],A[j-1]);
            sw++;
        }
    }
}
return sw;
}
int main(void)
{
    int i,A[100],N,sw;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&a[i]);
        sw=bubbleSort(A,N);
        for(i=0;i<N;i++){
            if(i){
                printf(" ");
                printf("%d"&A[i]);
            }
        }
    }
    printf("\n%d\n",sw);
    return 0;
}


Compiler output:
main.c:1:9: fatal error: stdioi.h: No such file or directory
    1 | #include<stdioi.h>
      |         ^~~~~~~~~~
compilation terminated.