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

#include <stdio.h>

/* ?????????????´??????????????????? */
void trace(int A[], int N) {
  int i;
  for ( i = 0; i < N, i++ ) {
    if ( i > 0) printf(" ");  /* ??£??\??????????´?????????????????????????????????? */
    printf("%d", A[i]);
  }
  printf("\n");
}

/* ?????\????????? (0??????????????????) */
void insertionSort(int[] A, int N) {
  int j, i, v;
  for ( 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;
    trace(A, N);
  }
}

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

  return 0;
}

Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:6:26: error: expected ';' before ')' token
    6 |   for ( i = 0; i < N, i++ ) {
      |                          ^~
      |                          ;
a.cc: At global scope:
a.cc:14:26: error: expected ',' or '...' before 'A'
   14 | void insertionSort(int[] A, int N) {
      |                          ^
a.cc: In function 'void insertionSort(int*)':
a.cc:16:20: error: 'N' was not declared in this scope
   16 |   for ( i = 1; i < N; i++) {
      |                    ^
a.cc:17:9: error: 'A' was not declared in this scope
   17 |     v = A[i];
      |         ^
a.cc:20:18: error: 'a' was not declared in this scope
   20 |       A[j + 1] = a[j];
      |                  ^
a.cc: In function 'int main()':
a.cc:36:16: error: too many arguments to function 'void insertionSort(int*)'
   36 |   insertionSort(A, N);
      |   ~~~~~~~~~~~~~^~~~~~
a.cc:14:6: note: declared here
   14 | void insertionSort(int[] A, int N) {
      |      ^~~~~~~~~~~~~
Language: C++

#include <stdio.h>

/* ?????????????´??????????????????? */
void trace(int A[], int N) {
  int i;
  for ( i = 0; i < N; i++ ) {
    if ( i > 0) printf(" ");  /* ??£??\??????????´?????????????????????????????????? */
    printf("%d", A[i]);
  }
  printf("\n");
}

/* ?????\????????? (0??????????????????) */
void insertionSort(int[] A, int N) {
  int j, i, v;
  for ( 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;
    trace(A, N);
  }
}

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

  return 0;
}

Compiler output:
a.cc:14:26: error: expected ',' or '...' before 'A'
   14 | void insertionSort(int[] A, int N) {
      |                          ^
a.cc: In function 'void insertionSort(int*)':
a.cc:16:20: error: 'N' was not declared in this scope
   16 |   for ( i = 1; i < N; i++) {
      |                    ^
a.cc:17:9: error: 'A' was not declared in this scope
   17 |     v = A[i];
      |         ^
a.cc:20:18: error: 'a' was not declared in this scope
   20 |       A[j + 1] = a[j];
      |                  ^
a.cc: In function 'int main()':
a.cc:36:16: error: too many arguments to function 'void insertionSort(int*)'
   36 |   insertionSort(A, N);
      |   ~~~~~~~~~~~~~^~~~~~
a.cc:14:6: note: declared here
   14 | void insertionSort(int[] A, int N) {
      |      ^~~~~~~~~~~~~
Language: C++

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

void trace(int A[], int N){
    int i;
    for(i = 0; i < N; i++){
        if(i > 0) cout << " " << endl;
        cout << A[i];
    }
}

void insertionSort(int A[], int N){

    for(int i = 1; i < N-1; i++){
        int v = A[i];
        int j = i - 1;

        while(j >=0 && v < A[j]){
            A[j+1] = A[j];
            j--;
        }

        A[j+1] = v;
        trace(A, N);
    }
}

int main(void){
    
    int A[100], n;
    cin >> n;

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

    trace(A, N)
    insertionSort(A, n);

    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:14: error: 'N' was not declared in this scope
   38 |     trace(A, N)
      |              ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int N; cin >> N;
	int* arr = new int[N];
	for (int i = 0; i < N; i++)
		cin >> arr[i];

	for (int i = 0; i < N; i++)
		cout << arr[i] << ' ' << flush;//????§???´????????????
	cout << endl;

	int comp;
	int j;

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

		for (int k = 0; k < N; k++) {
			cout << arr[k] << flush;
			if (k < N - 1)
				cout << ' ' << flush;
		}
		//if (i < N - 1)
			cout << endl;
		//}
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

include<iostream>
using namespace std;

void trace(int arr[], int N)
{
    for(int i=0; i<N; i++){
        if(i>0) cout<<' '<<flush;
        cout<<arr[i]<<flush;
    }
    cout<<endl;
}

int main()
{
    int N;
    cin>>N;
    int* arr=new int[N];
    int comp;
    int j;
    for(int i=0; i<N; i++){
        cin>>arr[i];
    }
    trace(arr,N);



    for(int i=1; i<N; i++){
        comp=arr[i];
        j=i-1;
        while( arr[j] > comp && j>=0 ){
            arr[j+1]=arr[j];
            j--;
        }
        arr[j+1]=comp;
        trace(arr,N);

    }
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'void trace(int*, int)':
a.cc:7:17: error: 'cout' was not declared in this scope
    7 |         if(i>0) cout<<' '<<flush;
      |                 ^~~~
a.cc:7:28: error: 'flush' was not declared in this scope
    7 |         if(i>0) cout<<' '<<flush;
      |                            ^~~~~
a.cc:8:9: error: 'cout' was not declared in this scope
    8 |         cout<<arr[i]<<flush;
      |         ^~~~
a.cc:8:23: error: 'flush' was not declared in this scope
    8 |         cout<<arr[i]<<flush;
      |                       ^~~~~
a.cc:10:5: error: 'cout' was not declared in this scope
   10 |     cout<<endl;
      |     ^~~~
a.cc:10:11: error: 'endl' was not declared in this scope
   10 |     cout<<endl;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope
   16 |     cin>>N;
      |     ^~~
Language: C++

#include <iostream>
#include <cstdio>

void isort(int a[],int n){
  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]=v;
  }
}

using namespace std;

int main() {

  int n;
  cin >> n;
  for(int i=0;i<n-1;++i)
    cout << a[i] << " ";
  cout << a[n-1] << endl;

  for(int i=0;i<n;++i){
    isort(a,n);
    for(int i=0;i<n-1;++i)
      cout << a[i] << " ";
    cout << a[n-1] << endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'a' was not declared in this scope
   23 |     cout << a[i] << " ";
      |             ^
a.cc:24:11: error: 'a' was not declared in this scope
   24 |   cout << a[n-1] << endl;
      |           ^
Language: C++


#include <iostream>
#include <cstdio>

void isort(int a[],int n){
  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]=v;
  }
}

using namespace std;

int main() {

  int n;
  cin >> n;
  for(int i=0;i<n-1;++i)
    cout << a[i] << " ";
  cout << a[n-1] << endl;

  for(int i=0;i<n;++i){
    isort(a,n);
    for(int i=0;i<n-1;++i)
      cout << a[i] << " ";
    cout << a[n-1] << endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: 'a' was not declared in this scope
   24 |     cout << a[i] << " ";
      |             ^
a.cc:25:11: error: 'a' was not declared in this scope
   25 |   cout << a[n-1] << endl;
      |           ^
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

void isort(int a[],int n){
  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]=v;
  }
}

int main() {

  int n;
  cin >> n;
  for(int i=0;i<n-1;++i)
    cout << a[i] << " ";
  cout << a[n-1] << endl;

  for(int i=0;i<n;++i){
    isort(a,n);
    for(int i=0;i<n-1;++i){
      if(i>0) cout << " ";
      cout << a[i];
    }
    putchar('\n');
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'a' was not declared in this scope
   23 |     cout << a[i] << " ";
      |             ^
a.cc:24:11: error: 'a' was not declared in this scope
   24 |   cout << a[n-1] << endl;
      |           ^
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

void isort(int a[],int n){
  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;
  }
}

int main() {
  
  int n;
  cin >> n;

  for(int i=0;i<n;++i)
    cin >> a[i];
  for(int i=0;i<n-1;++i){
    if(i>0) cout << " ";
    cout << a[i];

  for(int i=0;i<n;++i){
    isort(a,n);
    for(int i=0;i<n-1;++i){
      if(i>0) cout << " ";
      cout << a[i];
    }
    putchar('\n');
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: 'a' was not declared in this scope
   24 |     cin >> a[i];
      |            ^
a.cc:27:13: error: 'a' was not declared in this scope
   27 |     cout << a[i];
      |             ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:18:12: note: to match this '{'
   18 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

void trace(int a[],int n){
  for(int i=0;i<n;++i){
    if(i>0) cout << " ";
    cout << a[i];
  }
}

void isort(int a[],int n){
  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;
    trace(a,n);
  }
}

int main() {
  
  int n;
  cin >> n;
  int a[n];

  for(int i=0;i<n;++i)
    cin >> a[i];

  trace(a,n);
  isort(a,n);

    putchar('\n');
  }
}

Compiler output:
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++


using namespace std;

void output(int ar[], int sz){
    for (int i = 0; i < sz; i++) {
        cout << ar[i];
    }
    cout << endl;
}

int main(int argc, char const* argv[])
{
    int sz, ar[100];
    cin >> sz;
    for (int i = 0; i < sz; i++) {
        cin >> ar[i];
    }

    for (int i = 1; i < sz; i++) {
        output(ar, sz);
        int v = ar[i];
        int j = i - 1;
        while (j >= 0 && ar[j] > v) {
            ar[j+1] = ar[j];
            j--;
        }
        ar[j+1] = v;
    }
    output(ar, sz);
    return 0;
}

Compiler output:
a.cc: In function 'void output(int*, int)':
a.cc:6:9: error: 'cout' was not declared in this scope
    6 |         cout << ar[i];
      |         ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:8:5: error: 'cout' was not declared in this scope
    8 |     cout << endl;
      |     ^~~~
a.cc:8:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:13: error: 'endl' was not declared in this scope
    8 |     cout << endl;
      |             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | 
a.cc: In function 'int main(int, const char**)':
a.cc:14:5: error: 'cin' was not declared in this scope
   14 |     cin >> sz;
      |     ^~~
a.cc:14:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

void insertionSort(int A[], int N);
void showArray(int A[], int N);

int main() {
  int A[MAX], n;

  cin >> n;

  for ( int i = 0; i < n; i++ ) cin >> A[i];
  
  trace(A, n);
  insertionSort(A, n);

  return 0;
}

void insertionSort(int A[], int N) {
  for ( int i = 1; i < N; i++ ) {
    int j = i - 1, v = A[i];

    while ( j >= 0 || A[j] > v ) {
      A[j + 1] = A[j];
      j--;
      A[j + 1] = v;
    }
  showArray(A, N);
  }

  return;
}

void showArray(int A[], int N) {
  cout << A[0];
  for ( int i = 1; i < N; i++) cout << " " << A[i];
  cout << endl;
  return;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'trace' was not declared in this scope
   15 |   trace(A, n);
      |   ^~~~~
Language: C++

include <iostream>
using namespace std;
#include <stdio.h>
void insertionSort(int*, int);
void print(int*, int);
int main(void)
{
	int a[100], n,i;
	cin >> n;
	for (i = 0; i < n; i++){ cin >> a[i]; }
	insertionSort(a, n);
}
void insertionSort(int *A, int N) // N??????????´??????????0-?????????????????????A
{
	int i, v, j;
	for (i = 1; i < N; i++){//i ??? 1 ?????? N - 1 ?????§
		v = A[i];
		j = i-1;
		while (j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		print(A, N);
	}
}
void print(int *a, int n)
{
	int i;
	for (i = 0; i < n; i++)
	{
		printf("%d", a[i]);
		if (i != n - 1){ printf(" "); }
		else { printf("\n"); }
	}
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
Language: C++

int insertsort(int arr[], int n)
{

    int counter=0;
    int compindex;
    int comp;
    int j;
    for( int i=1; i < n; i++ ){

        compindex=i;
        comp=arr[compindex];
        j=1;
        for( ; compindex-j > -1; j++ ) {

            if(comp < arr[compindex-j])
                arr[compindex - j + 1] = arr[compindex - j];
            else
                break;

            counter++;
        }
        arr[compindex - j + 1] = comp;

        show(arr, N);


    }

    return counter;



}

Compiler output:
a.cc: In function 'int insertsort(int*, int)':
a.cc:24:19: error: 'N' was not declared in this scope
   24 |         show(arr, N);
      |                   ^
a.cc:24:9: error: 'show' was not declared in this scope
   24 |         show(arr, N);
      |         ^~~~
Language: C++

#include<iostream>

using namespace std;

void show(int arr[], int n){
    for(int i=0; i<n; i++)
        cout<<arr[i]<<' '<<flush;
    cout<<endl;
}


void swap(int& a, int& b){
    int t=a;
    a=b;
    b=t;
}


int insertsort(int[], int);

int main()
{
    int n;
    cin>>n;
    int arr[100];

    for(int i=0; i<n; i++)
        cin>>arr[i];
    show(arr, n);

    insertsort(arr, n);

    


}













int insertsort(int arr[], int n)
{

    int counter=0;
    int compindex;
    int comp;
    int j;
    for( int i=1; i < n; i++ ){

        compindex=i;
        comp=arr[compindex];
        j=1;
        for( ; compindex-j > -1; j++ ) {

            if(comp < arr[compindex-j])
                arr[compindex - j + 1] = arr[compindex - j];
            else
                break;

            counter++;
        }
        arr[compindex - j + 1] = comp;

        show(arr, N);


    }

    return counter;



}

Compiler output:
a.cc: In function 'int insertsort(int*, int)':
a.cc:73:19: error: 'N' was not declared in this scope
   73 |         show(arr, N);
      |                   ^
Language: C++

#include<iostream>

using namespace std;

void show(int arr[], int n){
    for(int i=0; i<n; i++)
        cout<<arr[i]<<' '<<flush;
    cout<<endl;
}


void swap(int& a, int& b){
    int t=a;
    a=b;
    b=t;
}


int insertsort(int[], int);

int main()
{
    int n;
    cin>>n;
    int arr[100];

    for(int i=0; i<n; i++)
        cin>>arr[i];
    show(arr, n);

    insertsort(arr, n);

    


}

Compiler output:
/usr/bin/ld: /tmp/ccjpSHpz.o: in function `main':
a.cc:(.text+0x133): undefined reference to `insertsort(int*, int)'
collect2: error: ld returned 1 exit status
Language: C++

#define MAX_INPUT 1000

// function
void inputArray(int a[], int *num);
void insertionSort(int a[], int num);
void outputArray(int a[], int num);

int main(void)
{
  int size;
  int input[MAX_INPUT];

  inputArray(input, &size);
  insertionSort(input, size);

  return 0;
}

void inputArray(int a[], int *num)
{
  //  printf("input array size =\n");
  scanf("%d", num);

  //  printf("input array = \n");
  for ( int i = 0; i < *num; i++ ) {
    scanf("%d", &a[i]);
  }
  outputArray(a, *num);
}

void insertionSort(int a[], int num)
{
  int v;
  int j;

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

void outputArray(int a[], int num)
{
  for (int i=0; i < num-1; i++) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[num-1]);
}

Compiler output:
a.cc: In function 'void inputArray(int*, int*)':
a.cc:22:3: error: 'scanf' was not declared in this scope
   22 |   scanf("%d", num);
      |   ^~~~~
a.cc: In function 'void outputArray(int*, int)':
a.cc:51:5: error: 'printf' was not declared in this scope
   51 |     printf("%d ", a[i]);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define MAX_INPUT 1000
a.cc:53:3: error: 'printf' was not declared in this scope
   53 |   printf("%d\n", a[num-1]);
      |   ^~~~~~
a.cc:53:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<iostream>
using namespace std;

int main(){
	int N,i;
	cin >> N;
	int A[N];
	for (i=0;i<=N-1;i++){
		cin >> A[i];
	}
	
	for (i=1;i<=N-1;i++){
		v=A[i];
		int j=i-1;
		while(j>=0 && A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		cout << A << endl;
	}
	return 0;
}

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

import Data.List
 
toDice :: [Int] -> [[Int]]
toDice [a,b,c,d,e,f] = [[a,f],[b,e],[c,d]]
 
pattern1 :: [Int] -> [String]
pattern1 x = map show [(x !! 0),(x !! 1),(x !! 5),(x !! 4),(x !! 0)]
 
pattern2 :: [Int] -> [String]
pattern2 x = map show [(x !! 1),(x !! 2),(x !! 4),(x !! 3),(x !! 1)]
 
pattern3 :: [Int] -> [String]
pattern3 x = map show [(x !! 2),(x !! 0),(x !! 3),(x !! 5),(x !! 2)]
 
solve :: [Int] -> String -> Int
solve list x
  | isInfixOf x (unwords $ pattern1 list) = list !! 2
  | isInfixOf x (unwords $ pattern2 list) = list !! 0
  | isInfixOf x (unwords $ pattern3 list) = list !! 1
  | isInfixOf x (unwords $ reverse $ pattern1 list) = list !! 3
  | isInfixOf x (unwords $ reverse $ pattern2 list) = list !! 5
  | isInfixOf x (unwords $ reverse $ pattern3 list) = list !! 4
  | otherwise = -1
 
check1 :: [[Int]] -> [[[Int]]]
check1 [] = []
check1 (i : is) = (sort . map sort . toDice) i : check1 is
 
check2 :: [[Int]] -> String -> [Int]
check2 [] _ = []
check2 (i : is) s = (solve i s) : check2 is s

diff :: [[Int]] -> String -> Bool
diff is s = ((length $ nub $ check1 is) == length is) && ((length $ nub $ check2 is s) == length is)
        
main = getContents >>= putStrLn . (\xs -> if diff xs (mkstr $ head xs) then "Yes" else "No") . map(map read . words) . tail . lines
  where mkstr = unwords . map show . take 2

Compiler output:
a.cc:36:36: error: stray '\' in program
   36 | main = getContents >>= putStrLn . (\xs -> if diff xs (mkstr $ head xs) then "Yes" else "No") . map(map read . words) . tail . lines
      |                                    ^
a.cc:1:1: error: 'import' does not name a type
    1 | import Data.List
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

for i = 1 to A.length-1
    key = A[i]
    /* insert A[i] into the sorted sequence A[0,...,j-1] */
    j = i - 1
    while j >= 0 and A[j] > key
        A[j+1] = A[j]
        j--
    A[j+1] = key

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'for'
    1 | for i = 1 to A.length-1
      | ^~~
Language: C++

#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j,v;
  int A[N+1];
  scanf("%d", &n); /*Input includes an integer n*/

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);/*Input the number of elements in the sequence*/
  
  trace(A, n);
  for(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;
    }

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

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N;
	vecter<int> A;
	
	cin >> N;
	for (int i = 0; i < N; ++i)
		cin >> A[i];

	for (int i = 1; i <= A.size() - 1; ++i)
	{
		int key = A[i];
		int j = i - 1;
		
		while (j >= 0 && A[j] > key) {
			A[j + 1] = A[j];
			j--;
		}
		
		A[j + 1] = key;
		
		for (int i = 0; i < N; ++i)
			cout << A[i];
		cout << endl;
	}
		
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vecter' was not declared in this scope
    9 |         vecter<int> A;
      |         ^~~~~~
a.cc:9:16: error: expected primary-expression before 'int'
    9 |         vecter<int> A;
      |                ^~~
a.cc:13:24: error: 'A' was not declared in this scope
   13 |                 cin >> A[i];
      |                        ^
a.cc:15:30: error: 'A' was not declared in this scope
   15 |         for (int i = 1; i <= A.size() - 1; ++i)
      |                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int MAX=100;

void trace(int a[],int N){
for(i=0;i<N;i++){
if(i>0)cout<<" ";
cout<<a[i];
}
cout<<endl;
}

void insertionSort(int a[],int N){
int j,i,v;
for(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;
trace(a,N);
}
}

int main(){
int n,a[MAX];
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
trace(a,N);
insertionSort(a,N);
return 0;
}

Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:6:5: error: 'i' was not declared in this scope
    6 | for(i=0;i<N;i++){
      |     ^
a.cc: In function 'void insertionSort(int*, int)':
a.cc:15:11: error: 'n' was not declared in this scope
   15 | for(i=1;i<n;i++){
      |           ^
a.cc: In function 'int main()':
a.cc:31:9: error: 'N' was not declared in this scope
   31 | trace(a,N);
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int MAX=100;

void trace(int a[],int n){
for(i=0;i<n;i++){
if(i>0)cout<<" ";
cout<<a[i];
}
cout<<endl;
}

void insertionSort(int a[],int n){
int j,i,v;
for(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;
trace(a,n);
}
}

int main(){
int n,a[MAX];
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
trace(a,n);
insertionSort(a,n);
return 0;
}

Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:6:5: error: 'i' was not declared in this scope
    6 | for(i=0;i<n;i++){
      |     ^
Language: C++

void intsertionSort(int a[],int n);

int main(){
	int a[1000],n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",a+i);
	
	intsertionSort(a,n);
	
	//output
	for(i=0;i<n;i++){
		printf("%d",a[i]);
		if(i!=(n-1))
			printf(" ");
	}
	printf("\n");
}

void intsertionSort(int a[],int n){
	int i,j,k;
	int v;
	
	for(i=1;i<=n-1;i++){
		
		//output
		for(k=0;k<n;k++){
		printf("%d",a[k]);
		if(k!=(n-1))
			printf(" ");
		}
		printf("\n");
		
		//sort
		v=a[i];
		j=i-1;
		while((j>=0)&&(v<a[j])){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=v;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf' was not declared in this scope
    5 |         scanf("%d",&n);
      |         ^~~~~
a.cc:13:17: error: 'printf' was not declared in this scope
   13 |                 printf("%d",a[i]);
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | void intsertionSort(int a[],int n);
a.cc:17:9: error: 'printf' was not declared in this scope
   17 |         printf("\n");
      |         ^~~~~~
a.cc:17:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'void intsertionSort(int*, int)':
a.cc:28:17: error: 'printf' was not declared in this scope
   28 |                 printf("%d",a[k]);
      |                 ^~~~~~
a.cc:28:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:32:17: error: 'printf' was not declared in this scope
   32 |                 printf("\n");
      |                 ^~~~~~
a.cc:32:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
 
void insertionSort(int A[], int N) {
 
    for(int k=0;k<N;k++) {
        cout << A[k];
        if(k!=N-1) {
            cout << " ";
        }
    }
        cout << endl;
 
    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 k=0;k<N;k++) {
            cout << A[k];
            if(k!=N-1) {
                cout << " ";
            }
        }
        cout << endl;
    }
}
 
 
int main(void) {
 
    int n;
    cin >> n;
 
    int a[n];
    for(int i=0;i<n;i++) {
        cin >> a[i];
    }
 
    insertionSort(a, n);
 

Compiler output:
a.cc: In function 'int main()':
a.cc:45:25: error: expected '}' at end of input
   45 |     insertionSort(a, n);
      |                         ^
a.cc:35:16: note: to match this '{'
   35 | int main(void) {
      |                ^
Language: C++

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

void trace(int A[], int N){
  int  i;
  for ( i = 0; i < N; i++){
    if ( i > 0 ) printf(" ");
    printf("%d",A[i] );
  }
  printf("\n" );
}

void insertionSort(int A[], int N){
  int j, i ,v;
  for (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;
    trace(A, N);
  }
}


int main (){]
  int N, i, j;
  int  A[100];
  cin >> N;

  for (int  i = 0 ; i < N ; i++) cin >> A[ i ];

  trace(A,N);
  insertionSort(A,N);
  
  return 0;
}

Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:16:26: error: expected ';' before ')' token
   16 |   for (i = 1, i < N, i ++){
      |                          ^
      |                          ;
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
a.cc:25:4: error: expected ';' before '}' token
   25 |   }
      |    ^
      |    ;
   26 | }
      | ~   
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
a.cc:25:4: error: expected ')' before '}' token
   25 |   }
      |    ^
      |    )
   26 | }
      | ~   
a.cc:16:7: note: to match this '('
   16 |   for (i = 1, i < N, i ++){
      |       ^
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
a.cc: In function 'int main()':
a.cc:29:13: error: expected primary-expression before ']' token
   29 | int main (){]
      |             ^
a.cc:32:10: error: 'N' was not declared in this scope
   32 |   cin >> N;
      |          ^
Language: C++

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

void trace(int A[], int N){
  int  i;
  for ( i = 0; i < N; i++){
    if ( i > 0 ) printf(" ");
    printf("%d",A[i] );
  }
  printf("\n" );
}

void insertionSort(int A[], int N){
  int j, i ,v;
  for (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;
    trace(A, N);
  }
}


int main (){
  int N, i, j;
  int  A[100];
  cin >> N;

  for (int  i = 0 ; i < N ; i++) cin >> A[ i ];

  trace(A,N);
  insertionSort(A,N);

  return 0;
}

Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:16:26: error: expected ';' before ')' token
   16 |   for (i = 1, i < N, i ++){
      |                          ^
      |                          ;
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
a.cc:25:4: error: expected ';' before '}' token
   25 |   }
      |    ^
      |    ;
   26 | }
      | ~   
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
a.cc:25:4: error: expected ')' before '}' token
   25 |   }
      |    ^
      |    )
   26 | }
      | ~   
a.cc:16:7: note: to match this '('
   16 |   for (i = 1, i < N, i ++){
      |       ^
a.cc:26:1: error: expected primary-expression before '}' token
   26 | }
      | ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

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

int main(){
	int n,a;
	cin >> n;
	vector<int> A;
	for(int i = 0 ; i < n;i++){
		cin >> a;
		A.push_back(a);
	}
	insertsort(A,n);
	return 0;
}

Compiler output:
a.cc:6:1: error: ISO C++ forbids declaration of 'insertsort' with no type [-fpermissive]
    6 | insertsort(vector<int> &A,int n){
      | ^~~~~~~~~~
a.cc: In function 'int insertsort(std::vector<int>&, int)':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
Language: C++

#include <cstdio>

int main(void)
{
    int i;
    int num;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j < 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                for (k = 0; k < n; k++) {
                    printf("%d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'j' was not declared in this scope
   15 |         if (j = i; j < 0; j--) {
      |             ^
a.cc:15:25: error: expected ')' before ';' token
   15 |         if (j = i; j < 0; j--) {
      |            ~            ^
      |                         )
a.cc:15:27: error: 'j' was not declared in this scope
   15 |         if (j = i; j < 0; j--) {
      |                           ^
Language: C++

#include <cstdio>

int main(void)
{
    int i, j, k;
    int num;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j < 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                for (k = 0; k < n; k++) {
                    printf("%d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: expected ')' before ';' token
   15 |         if (j = i; j < 0; j--) {
      |            ~            ^
      |                         )
a.cc:15:30: error: expected ';' before ')' token
   15 |         if (j = i; j < 0; j--) {
      |                              ^
      |                              ;
Language: C++

#include <cstdio>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j < 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                for (k = 0; k < n; k++) {
                    printf("%d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ')' before ';' token
   16 |         if (j = i; j < 0; j--) {
      |            ~            ^
      |                         )
a.cc:16:30: error: expected ';' before ')' token
   16 |         if (j = i; j < 0; j--) {
      |                              ^
      |                              ;
Language: C++

#include <cstdio>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j < 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                for (k = 0; k < n; k++) {
                    printf("%d", num[k]);
                }
                printf("\n");
//                continue;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ')' before ';' token
   16 |         if (j = i; j < 0; j--) {
      |            ~            ^
      |                         )
a.cc:16:30: error: expected ';' before ')' token
   16 |         if (j = i; j < 0; j--) {
      |                              ^
      |                              ;
Language: C++

#include <stdio.h>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j < 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                for (k = 0; k < n; k++) {
                    printf("%d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ')' before ';' token
   16 |         if (j = i; j < 0; j--) {
      |            ~            ^
      |                         )
a.cc:16:30: error: expected ';' before ')' token
   16 |         if (j = i; j < 0; j--) {
      |                              ^
      |                              ;
Language: C++

#include <stdio.h>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j < 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                for (k = 0; k < n; k++) {
                    printf("%d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ')' before ';' token
   16 |         if (j = i; j < 0; j--) {
      |            ~            ^
      |                         )
a.cc:16:30: error: expected ';' before ')' token
   16 |         if (j = i; j < 0; j--) {
      |                              ^
      |                              ;
Language: C++

#include <stdio.h>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        if (j = i; j > 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                printf("%d", num[0]);
                for (k = 1; k < n; k++) {
                    printf(" %d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ')' before ';' token
   16 |         if (j = i; j > 0; j--) {
      |            ~            ^
      |                         )
a.cc:16:30: error: expected ';' before ')' token
   16 |         if (j = i; j > 0; j--) {
      |                              ^
      |                              ;
Language: C++

#include <stdio.h>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        for (j = i; j > 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                printf("%d", num[0]);
                for (k = 1; k < n; k++) {
                    printf(" %d", num[k]);
                }
                printf("\n");
                continue;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: invalid types 'int[int]' for array subscript
   23 |                 printf("%d", num[0]);
      |                                 ^
a.cc:24:33: error: 'n' was not declared in this scope
   24 |                 for (k = 1; k < n; k++) {
      |                                 ^
a.cc:25:38: error: invalid types 'int[int]' for array subscript
   25 |                     printf(" %d", num[k]);
      |                                      ^
Language: C++

#include <stdio.h>

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    for (i = 1; i < num; i++) {
        for (j = i; j > 0; j--) {
            if (elem[j] < elem[j-1]) {
                tmp       = elem[j];
                elem[j]   = elem[j-1];
                elem[j-1] = tmp;
            }
            else {
                printf("%d", elem[0]);
                for (k = 1; k < n; k++) {
                    printf(" %d", elem[k]);
                }
                printf("\n");
                continue;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'n' was not declared in this scope
   24 |                 for (k = 1; k < n; k++) {
      |                                 ^
Language: C++

#include <stdio.h>

void DispArg(int elem[], int num)
{
    int i;

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

    return;
}

int main(void)
{
    int i, j, k;
    int num;
    int tmp;
    int elem[100];

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

    DispArg(elem, num);

    for (i = 1; i < num; i++) {
        int v = elem[i];
        for (j = i; j > 0; j--) {
            if (v < elem[j-1]) {
                elem[j] = elem[j-1]
            }
            else {
                elem[i] = v;
                break;
            }
        }
        DispArg(elem, num);
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:36: error: expected ';' before '}' token
   34 |                 elem[j] = elem[j-1]
      |                                    ^
      |                                    ;
   35 |             }
      |             ~
Language: C++

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

void print(const vector<int> & arr) {
printf("%d");
for(vector<int>::iterator itr=++(arr.begin()); itr!=arr.end(); ++itr){
printf(" %d");
}
printf("\n");
}

int main() {
vector<int> arr;
int n, tmp, i, j;

scanf("%d", &n);
for(i=0; i<n; ++i) {
scanf("%d", &tmp);
arr.push_back(tmp);
}

print(arr);

for(int i=1; i<n; ++i) {
tmp = arr[i];
for(j=i-1; j>=0 && arr[j]>tmp; --j) {
arr[j+1] = arr[j];
}
arr[j+1] = tmp;
print(arr);
}

return 0;
}

Compiler output:
a.cc: In function 'void print(const std::vector<int>&)':
a.cc:7:31: error: conversion from '__normal_iterator<const int*,[...]>' to non-scalar type '__normal_iterator<int*,[...]>' requested
    7 | for(vector<int>::iterator itr=++(arr.begin()); itr!=arr.end(); ++itr){
      |                               ^~~~~~~~~~~~~~~
Language: C++

void InsertSort(vector<int> A, int i){
	for(int i = 0; i < A.size(); 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;
	}
}

void Output(vector<int> A){
	int n = A.size() - 1;
	for(int i = 0; i < n; i++) cout << A[i] << ' ';
	cout << A[n] << endl;
}

int main(){
	int N;
	cin >> N;
	vector<int> A;
	for(int i = 0; i < N; i++){
		int a;
		cin >> a;
		A.push_back(a);
	}
	for(int i = 0; i < N; i++){
		InsertSort(A, i);
		Output(A);
	}
	return 0;
}

Compiler output:
a.cc:1:6: error: variable or field 'InsertSort' declared void
    1 | void InsertSort(vector<int> A, int i){
      |      ^~~~~~~~~~
a.cc:1:17: error: 'vector' was not declared in this scope
    1 | void InsertSort(vector<int> A, int i){
      |                 ^~~~~~
a.cc:1:24: error: expected primary-expression before 'int'
    1 | void InsertSort(vector<int> A, int i){
      |                        ^~~
a.cc:1:32: error: expected primary-expression before 'int'
    1 | void InsertSort(vector<int> A, int i){
      |                                ^~~
a.cc:13:6: error: variable or field 'Output' declared void
   13 | void Output(vector<int> A){
      |      ^~~~~~
a.cc:13:13: error: 'vector' was not declared in this scope
   13 | void Output(vector<int> A){
      |             ^~~~~~
a.cc:13:20: error: expected primary-expression before 'int'
   13 | void Output(vector<int> A){
      |                    ^~~
a.cc: In function 'int main()':
a.cc:21:9: error: 'cin' was not declared in this scope
   21 |         cin >> N;
      |         ^~~
a.cc:22:9: error: 'vector' was not declared in this scope
   22 |         vector<int> A;
      |         ^~~~~~
a.cc:22:16: error: expected primary-expression before 'int'
   22 |         vector<int> A;
      |                ^~~
a.cc:26:17: error: 'A' was not declared in this scope
   26 |                 A.push_back(a);
      |                 ^
a.cc:29:28: error: 'A' was not declared in this scope
   29 |                 InsertSort(A, i);
      |                            ^
a.cc:29:17: error: 'InsertSort' was not declared in this scope
   29 |                 InsertSort(A, i);
      |                 ^~~~~~~~~~
a.cc:30:17: error: 'Output' was not declared in this scope
   30 |                 Output(A);
      |                 ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
	int A[110],n,a;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	for(int i=0;i<n;i++){
		cout<<A[i]<<;
		if(i!=n-1)cout<<" ";
	}
	cout<<endl;
	for(int i=1;i<n;i++){
		for(int j=i;j>=1;j--){
			if(A[j]<A[j-1]){
				a=A[j];
				A[j]=A[j-1];
				A[j-1]=a;
			}
		}
		for(int j=0;j<n;j++){
			cout<<A[j];
			if(j!=n-1)cout<<" ";
		}
		cout<<endl;
		if(i==n-1)break;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: expected primary-expression before ';' token
   11 |                 cout<<A[i]<<;
      |                             ^
Language: C++

#include<iostream>
#include <cstdio>

using namespace std;

int main(){

	int i, j,k, N,a[100],v;
	cin >> N;
	for (i = 0; i < N; i++) cin >> a[i];

	for (i = 0; i < N; ++)
		printf("%d ", a[i]);
	putchar('\n');

	for (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;
		for (k = 0; k < N; k++)
			printf("%d ", a[k]);
		putchar('\n');
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: expected primary-expression before ')' token
   12 |         for (i = 0; i < N; ++)
      |                              ^
Language: C++

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

void trace(int a[], int n){
  int i;
  for( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", a[i]);
  }
  printf("\n");
}

void insertionSort(int a[], int n){
  int j, i, v;
  for(int i = 1; i < n; i++){
    v = a[i];
    for(j = i - 1; j >= 0 && a[j] > v; j = j - 1){
      a[j+1] = a[j];
    }
    a[j+1] = v;
  }
  trace(a, n);
}

int main(){
  int n, i, j;
  int a[MAX];
  
  scanf("%d", &n);
  for( i = 0; i < n; i++) scanf("%d", &a[i]);
  
  trace(a, n);
  insertionSort(a, n);
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'void trace(int*, int)':
a.cc:9:18: error: 'printf' was not declared in this scope
    9 |     if ( i > 0 ) printf(" ");
      |                  ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<iostream>
a.cc:10:5: error: 'printf' was not declared in this scope
   10 |     printf("%d", a[i]);
      |     ^~~~~~
a.cc:10:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:12:3: error: 'printf' was not declared in this scope
   12 |   printf("\n");
      |   ^~~~~~
a.cc:12:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'int main()':
a.cc:29:9: error: 'MAX' was not declared in this scope
   29 |   int a[MAX];
      |         ^~~
a.cc:31:3: error: 'scanf' was not declared in this scope
   31 |   scanf("%d", &n);
      |   ^~~~~
a.cc:32:40: error: 'a' was not declared in this scope
   32 |   for( i = 0; i < n; i++) scanf("%d", &a[i]);
      |                                        ^
a.cc:34:9: error: 'a' was not declared in this scope
   34 |   trace(a, n);
      |         ^
Language: C++

#include<stdio.h>
main(){
  int n;
  int A[100];
  int i,j,k,key;
  scanf("%d",&n);
  for(k=0;k<n;k++){
    scanf("%d",&A[k]);
  }
  for(i=1;i<n;i++){
    key = a[i];    /* insert A[i] into the sorted sequence A[0,...,j-1] */
    j = i - 1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    for(k=0;k<n;k++){
      printf("%d ",A[k]);
    }
    printf("\n");
  }
}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:11: error: 'a' was not declared in this scope
   11 |     key = a[i];    /* insert A[i] into the sorted sequence A[0,...,j-1] */
      |           ^
Language: C++

#include<stdio.h>
main(){
  int i,j,k,key;
  int A[100];
  for(i=1;i<n;i++){
    key = A[i];
    /* insert A[i] into the sorted sequence A[0,...,j-1] */
    j = i - 1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    printf(A);
  }
}

Compiler output:
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:13: error: 'n' was not declared in this scope
    5 |   for(i=1;i<n;i++){
      |             ^
a.cc:14:12: error: cannot convert 'int*' to 'const char*'
   14 |     printf(A);
      |            ^
      |            |
      |            int*
In file included from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~