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

#include<iostream>
using namespace std;
#define MAX 100

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

int main(){
   int i,j,n,v,a[MAX];

   cin >> n;

   for(i=0;i<n;i++)cin >> a[i];
   for(i=0;i<n;i++){
     if(i>0)cout << " ";
     cout << a[i];
   }
  
   insertionSort(a[],n);
   
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:20: error: expected primary-expression before ']' token
   34 |    insertionSort(a[],n);
      |                    ^
Language: C++

#include<iostream>
using namespace std;
#define MAX 100

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

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

   cin >> n;

   for(i=0;i<n;i++)cin >> a[i];
   for(i=0;i<n;i++){
     if(i>0)cout << " ";
     cout << a[i];
   }
  
   insertionSort(a,n);
   
   return 0;
}

Compiler output:
a.cc:5:6: error: variable or field 'trace' declared void
    5 | void trace(a[],n){
      |      ^~~~~
a.cc:5:12: error: 'a' was not declared in this scope
    5 | void trace(a[],n){
      |            ^
a.cc:5:14: error: expected primary-expression before ']' token
    5 | void trace(a[],n){
      |              ^
a.cc:5:16: error: 'n' was not declared in this scope
    5 | void trace(a[],n){
      |                ^
a.cc: In function 'void insertionSort(int*, int)':
a.cc:24:4: error: 'trace' was not declared in this scope
   24 |    trace(a,n);
      |    ^~~~~
Language: C++

#include <iostream>
#include <vector>


int main(){

	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);

	int n;
	std::cin>>n;

	std::vector<int> array(n);
	for(int i=0;i<n;i++)
		std::cin>>array[i];

	for(int i=1;i<n;i++){


		std::for_each( array.begin(), array.end(),
			[](int const & v)
				{ std::cout <<" "<< v; }
		);
		std::cout<<"\n";

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

	}

	std::for_each( array.begin(), array.end(),
		[](int const & v)
			{ std::cout <<" "<< v; }
	);
	std::cout<<"\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'for_each' is not a member of 'std'
   20 |                 std::for_each( array.begin(), array.end(),
      |                      ^~~~~~~~
a.cc:36:14: error: 'for_each' is not a member of 'std'
   36 |         std::for_each( array.begin(), array.end(),
      |              ^~~~~~~~
Language: C++

#include <iostream>
using namespace std;

static const int MAX = 100;

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

insertionSort(int A[], int N)
{
    int v, j;
	for(int i = 0; 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 A[MAX], 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:15:1: error: ISO C++ forbids declaration of 'insertionSort' with no type [-fpermissive]
   15 | insertionSort(int A[], int N)
      | ^~~~~~~~~~~~~
a.cc: In function 'int insertionSort(int*, int)':
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
Language: C++

#include<stdio.h>

int main(){
	int *A;
	int N = 0;
	scanf("%d", &N);
	A = new int[N];

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

	for( int i = 0; i < N; i++ ){
		int temp = A[i];
		for( int j = i - 1; j >= 0; j-- ){
			if( temp < A[j] ){
				A[j+1] = A[j];
			}
		}
		A[j] = temp;
		Output(A, N);
	}

	return 0;
}

void Output(int *A, int N){
	printf("%d", A[0]);
	for( int i = 1; i < N; i++ ){
		printf(" %d", A[i]);
	}
	printf("\n");
	return;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: 'j' was not declared in this scope
   20 |                 A[j] = temp;
      |                   ^
a.cc:21:17: error: 'Output' was not declared in this scope
   21 |                 Output(A, N);
      |                 ^~~~~~
Language: C++

#include<stdio.h>

void insertionSort(int,int);

int main()
{
    int A[101],N;
    scanf("%d",&N);
    scanf("%d",&A);
    insertionSort(A,N);

  // insertionSort(A, N) // N??????????´??????????0-?????????????????????A
//  for 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


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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   10 |     insertionSort(A,N);
      |                   ^
      |                   |
      |                   int*
a.cc:3:20: note:   initializing argument 1 of 'void insertionSort(int, int)'
    3 | void insertionSort(int,int);
      |                    ^~~
a.cc:23:1: error: a function-definition is not allowed here before '{' token
   23 | {
      | ^
a.cc:36:2: error: expected '}' at end of input
   36 | }
      |  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<stdio.h>

void insertionSort(int*,int);

int main()
{
    int A[101],N;
    scanf("%d",&N);
    scanf("%d",&A);
    insertionSort(A,N);

  // insertionSort(A, N) // N??????????´??????????0-?????????????????????A
//  for 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


void insertionSort(int a[],int n)
{
    int i,j,v;
    for(i=1;i<=n-1;i++)
        {
            v=a[i];
            j=i-1;
            while(j>=0&&a[j]>v)
                {
                      a[j+1]=a[j];
                      j--;
                }
            a[j+1]=v;
            printf("%101d\n",a);
        }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:1: error: a function-definition is not allowed here before '{' token
   23 | {
      | ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<stdio.h>

void insertionSort(int*,int);

int main()
{
int A[100],N,n;
scanf("%d",&N);
for(n=0;n<=N;n++) scanf("%d",&A[n]);

insertionSort(A,N);
return 0;
}

void insertionSort(int* a,int n)
{
    int i,j,k;
    for(i=0;i<=n-2;i++)
    {
         k=a[i];
         j=i+1;
         while(j>=1)
         {
             if(a[i]>a[j])
             {
                 a[i]=a[j];
                 a[j]=k;
             }
?????????   j--;
         }
         printf("%d",a);
    }

}

Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:29:1: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      | ^
a.cc:29:2: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |  ^
a.cc:29:3: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |   ^
a.cc:29:4: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |    ^
a.cc:29:5: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |     ^
a.cc:29:6: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |      ^
a.cc:29:7: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |       ^
a.cc:29:8: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |        ^
a.cc:29:9: error: expected primary-expression before '?' token
   29 | ?????????   j--;
      |         ^
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
a.cc:29:16: error: expected ':' before ';' token
   29 | ?????????   j--;
      |                ^
      |                :
a.cc:29:16: error: expected primary-expression before ';' token
Language: C++

#include<stdio.h>


#include<stdio.h>

void insertionSort(int*, int);

int main()
{
	int A[100], N, n;
	scanf_s("%d", &N);
	for (n = 0; n <= N; n++) scanf_s("%d", &A[n]);
	

	insertionSort(A, N);
	return 0;
}

void insertionSort(int*a, int n)
{
	int x;
	for (x = 0; x <= n - 2; x++)
		printf("%d ", a[x]);
	printf("%d\n", a[n - 1]);
	int i, j, k;
	for (i = 0; i <= n-2; i++)
	{
		j = i + 1;
		while (j <= n-1)
		{
			k = a[i];
			if (a[i]>a[j])
			{
				a[i] = a[j];
				a[j] = k;
			}
			j++;
		}
		
		for (x = 0; x <= n - 2;x++)
		printf("%d ", a[x]);
		printf("%d\n", a[n - 1]);
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   11 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stdio.h>
void insertionSort(int*, int);

int main()
{
	int A[101], N, n;
	scanf_s("%d", &N);
	for (n = 0; n <= N - 1; n++) scanf_s("%d", &A[n]);
	insertionSort(A, N);
	return 0;
}

void insertionSort(int*a, int n)
{
	int x;
	for (x = 0; x <= n - 2; x++)
		printf("%d ", a[x]);
	printf("%d\n", a[n - 1]);
	int i, j, k;
	for (i = 1; i <= n - 1; i++)
	{
		j = 0;
		while (j <= n-2)
		{
			k = a[i];
			if (a[i]<a[j])
			{
				a[i] = a[j];
				a[j] = k;
			}
			j++;
		}

		for (x = 0; x <= n - 2; x++) printf("%d ", a[x]);
		printf("%d\n", a[n - 1]);
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    7 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

h#include<stdio.h>
void insertionSort(int*, int);

int main()
{
	int A[101], N, n;
	scanf("%d", &N);
	for (n = 0; n <= N - 1; n++) scanf("%d", &A[n]);
	insertionSort(A, N);
	return 0;
}

void insertionSort(int*a, int n)
{
	int x;
	for (x = 0; x <= n - 2; x++)
		printf("%d ", a[x]);
	printf("%d\n", a[n - 1]);
	int i, j, k;
	for (i = 1; i <= n - 1; i++)
	{
		j = 0;
		while (j <= n-2)
		{
			k = a[i];
			if (a[i]<a[j])
			{
				a[i] = a[j];
				a[j] = k;
			}
			j++;
		}

		for (x = 0; x <= n - 2; x++) printf("%d ", a[x]);
		printf("%d\n", a[n - 1]);
	}

}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | h#include<stdio.h>
      |  ^
a.cc:1:1: error: 'h' does not name a type
    1 | h#include<stdio.h>
      | ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf' was not declared in this scope
    7 |         scanf("%d", &N);
      |         ^~~~~
a.cc:9:9: error: 'insertionSort' was not declared in this scope
    9 |         insertionSort(A, N);
      |         ^~~~~~~~~~~~~
a.cc: In function 'void insertionSort(int*, int)':
a.cc:17:17: error: 'printf' was not declared in this scope
   17 |                 printf("%d ", a[x]);
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | h#include<stdio.h>
a.cc:18:9: error: 'printf' was not declared in this scope
   18 |         printf("%d\n", a[n - 1]);
      |         ^~~~~~
a.cc:18:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<stdio.h>
void insertionSort(int*, int);

int main()
{
	int A[101], N, n;
	scanf_s("%d", &N);
	for (n = 0; n <= N - 1; n++) scanf_s("%d", &A[n]);
	insertionSort(A, N);
	return 0;
}

void insertionSort(int*a, int n)
{
	int x;
	for (x = 0; x <= n - 2; x++)
		printf("%d ", a[x]);
	printf("%d\n", a[n - 1]);
	int i, j, k;
	for (i = 1; i <= n - 1; i++)
	{
		j = 0;
		while (j <= i - 1)
		{
			k = a[i];
			if (a[i]<a[j])
			{
				a[i] = a[j];
				a[j] = k;
			}
			j++;
		}

		for (x = 0; x <= n - 2; x++) printf("%d ", a[x]);
		printf("%d\n", a[n - 1]);
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    7 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

input1 = N;
input2 = A[N];

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
    print "A[N]";

Compiler output:
a.cc:1:1: error: 'input1' does not name a type
    1 | input1 = N;
      | ^~~~~~
a.cc:2:1: error: 'input2' does not name a type
    2 | input2 = A[N];
      | ^~~~~~
a.cc:4:1: error: expected unqualified-id before 'for'
    4 | for i = 1 to A.length-1
      | ^~~
Language: C++

#include<iostream>

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: expected unqualified-id before 'int'
   12 |                 int v = a[i], int j = i - 1;
      |                               ^~~
a.cc:13:23: error: 'j' was not declared in this scope
   13 |                 while(j >= 0 && a[j] > v){
      |                       ^
a.cc:17:19: error: 'j' was not declared in this scope
   17 |                 a[j + 1] = v;
      |                   ^
Language: C++

#include <stdio.h>

int main()
{
	int N;
	int A[1000] = { 0 };
	int i, j;
	int v=0;

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

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

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

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

#include <stdio.h>

int main(){
 int *A,N=0;
 scanf("%d", N);
 for(int i=0;i<N;i++){
  scanf("%d", A[i]);
 }
 for(int i=0;i<N;i++){
  int v;
  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 i=0;i<N-1;i++){
   printf("%d ", A[i]);
  }
  printf("%d\n", A[N-1]);
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:9:22: note: to match this '{'
    9 |  for(int i=0;i<N;i++){
      |                      ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

int main(){
 int *A,N=0;
 scanf("%d", N);
 for(int i=0;i<N;i++){
  scanf("%d", A[i]);
 }
 for(int i=0;i<N;i++){
  int v;
  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 i=0;i<N-1;i++){
   printf("%d ", A[i]);
  }
  printf("%d\n", A[N-1]);
 }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:2: error: 'scanf' was not declared in this scope
    3 |  scanf("%d", N);
      |  ^~~~~
a.cc:17:4: error: 'printf' was not declared in this scope
   17 |    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 | int main(){
a.cc:19:3: error: 'printf' was not declared in this scope
   19 |   printf("%d\n", A[N-1]);
      |   ^~~~~~
a.cc:19:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <stdio.h>

int main(){
	int Num = 0;
	scanf_s("%d", &Num);

	int* Elem = new int[Num];
	for (int i = 0; i < Num; ++i){
		scanf_s("%d", &Elem[i]);
	}

	int v = 0, j = 0;
	for (int i = 1; i < Num; ++i){

		printf_s("%d", Elem[0]);//出力
		for (int c = 1; c < Num; ++c){
			printf_s(" %d", Elem[c]);
		}
		printf_s("\n");

		v = Elem[i];//ソート
		j = i - 1;
		while (j >= 0 && Elem[j]>v){
			Elem[j + 1] = Elem[j];
			--j;
		}
		Elem[j + 1] = v;
	}

	printf_s("%d", Elem[0]);//出力
	for (int c = 1; c < Num; ++c){
		printf_s(" %d", Elem[c]);
	}
	printf_s("\n");

	delete [] Elem;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    5 |         scanf_s("%d", &Num);
      |         ^~~~~~~
      |         scanf
a.cc:15:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   15 |                 printf_s("%d", Elem[0]);//出力
      |                 ^~~~~~~~
      |                 printf
a.cc:30:9: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   30 |         printf_s("%d", Elem[0]);//出力
      |         ^~~~~~~~
      |         printf
Language: C++

import java.util.Scanner;


public class Main {

	public static void main(String args[]){
		int n=100;
		int i,j,k,v,l;
		int a[]=new int[n+1];
		 Scanner sc = new Scanner(System.in);
		k=Integer.parseInt(sc.next());
		
		for(i=0;i<k;i++){
			a[i]=Integer.parseInt(sc.next());
		}
		for(i=0;i<k;i++){
			System.out.print(a[i]);
		}
		
		System.out.println();
		for(i=1;i<k;i++){
			v=a[i];
			j=i-1;
			while(j>=0&&a[j]>v){
				a[j+1]=a[j];
			
				j--;
			}
				a[j+1]=v;
			for(l=0;l<k;l++){
				System.out.print(a[l] );
			}
			System.out.println();
			
		}
		
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream >

int main (void) {
  int a[100];
  int a_length;

  std::cin >> a_length ;
  for ( int i = 0 ; i < a_length; a++) 
    std::cin >> a[i];

  int key;
  int j;

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

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

#include <iostream>
 
int main (void) {
  int a[100];
  int a_length;
 
  std::cin >> a_length ;
  for ( int i = 0 ; i < a_length; a++) 
    std::cin >> a[i];
 
  int key;
  int j;
 
  for ( int i = 0; i < a_length; a++) {
    key = a[i];
    j = i -1;
    while ( j >= 0 && a[j] > key) {
      a[j+1] = a[j];
      j--
    }
    a[j+1] = key;
   }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:35: error: lvalue required as increment operand
    8 |   for ( int i = 0 ; i < a_length; a++)
      |                                   ^
a.cc:14:34: error: lvalue required as increment operand
   14 |   for ( int i = 0; i < a_length; a++) {
      |                                  ^
a.cc:19:10: error: expected ';' before '}' token
   19 |       j--
      |          ^
      |          ;
   20 |     }
      |     ~
Language: C++

#include <iostream>
#include <algorithm>

void show(const int a[], const int N){
  for(int i =0; i<N;++i){
    std::cout << (i==0 ? "" : " ") << a[i];
  }
  std::cout << std::endl;
}

int main(){
  int N;
  int a[100];
  std::cin >> N;
  
  for (int i=0;i<N;++i){
    std::cin >> a[i];
  }
  
  for (int i=1; i<N; ++i){
    int k = a[i];
    j = i -1;
    while( j >= 0 && a[j] > k){
      a[j+1] = a[j];
      --j;
    }
    a[j+1] = k;
  }

  std::cout << std::flush;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'j' was not declared in this scope
   22 |     j = i -1;
      |     ^
Language: C++

#include <iostream>

using namespace std;

int a[100];
int N;

void print() {
    cout << a[0];
    for (int i = 1; i < N; i++) {
        cout << " " << a[i];
    }
    cout << endl;
}

void insertionSort() {
    print();
    for (int i = 1; i < N; i++) {
        int key = a[i];
        for (int j = i-1; j>=0; j--) {
            if(a[j] > key)
                a[j+1] = a[j];
            else
                break;
        }
        a[j+1] = key;
        print();
    }
}

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

Compiler output:
a.cc: In function 'void insertionSort()':
a.cc:26:11: error: 'j' was not declared in this scope
   26 |         a[j+1] = key;
      |           ^
Language: C++

#include <iostream>
 
using namespace std;
 
int a[100];
int N;
 
void print() {
    cout << a[0];
    for (int i = 1; i < N; i++) {
        cout << " " << a[i];
    }
    cout << endl;
}
 
void insertionSort() {
    print();
    for (int i = 1; i < N; i++) {
        int key = a[i];
        int j = i-1
        for (; j>=0; j--) {
            if(a[j] > key)
                a[j+1] = a[j];
            else
                break;
        }
        a[j+1] = key;
        print();
    }
}
 
int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    insertionSort();
    return 0;
}

Compiler output:
a.cc: In function 'void insertionSort()':
a.cc:21:9: error: expected ',' or ';' before 'for'
   21 |         for (; j>=0; j--) {
      |         ^~~
a.cc:21:25: error: expected ';' before ')' token
   21 |         for (; j>=0; j--) {
      |                         ^
      |                         ;
Language: C++

#include <iostream>
using namespace std;

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

    for(i = 0; i < N; i++){
      cout << A[i];
    }
  }
  
}

int main(){
  int N, A[];

  cin >> N;
  for(i = 0; i < N; i++) {
    cin >> A[i];
  }
  InSort(N, A);
}

Compiler output:
a.cc: In function 'int InSort(int, int*)':
a.cc:7:5: error: 'j' was not declared in this scope
    7 |     j = i-1;
      |     ^
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int main()':
a.cc:22:10: error: storage size of 'A' isn't known
   22 |   int N, A[];
      |          ^
a.cc:25:7: error: 'i' was not declared in this scope
   25 |   for(i = 0; i < N; i++) {
      |       ^
Language: C++

#include <iostream>
using namespace std;

int InSort(int N, int A[]){
  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 i = 0; i < N; i++){
      cout << A[i];
    }
  }
  
}

int main(){
  int N, A[];

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

Compiler output:
a.cc: In function 'int InSort(int, int*)':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int main()':
a.cc:22:10: error: storage size of 'A' isn't known
   22 |   int N, A[];
      |          ^
Language: C++

using namespace std;
static const int MAX = 100;

void trace(int N, int A[]){
  for(i = 1; i < N; i++){
    cout << A[i] << " ";
  }
  cout << \n;
}


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

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

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

Compiler output:
a.cc:8:11: error: stray '\' in program
    8 |   cout << \n;
      |           ^
a.cc: In function 'void trace(int, int*)':
a.cc:5:7: error: 'i' was not declared in this scope
    5 |   for(i = 1; i < N; i++){
      |       ^
a.cc:6:5: error: 'cout' was not declared in this scope
    6 |     cout << A[i] << " ";
      |     ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:8:3: error: 'cout' was not declared in this scope
    8 |   cout << \n;
      |   ^~~~
a.cc:8:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:12: error: 'n' was not declared in this scope
    8 |   cout << \n;
      |            ^
a.cc: In function 'int InSort(int, int*)':
a.cc:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
   24 | }
      | ^
a.cc: In function 'int main()':
a.cc:29:3: error: 'cin' was not declared in this scope
   29 |   cin >> N;
      |   ^~~
a.cc:29:3: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

void trace(int N, int A[]){
  for(int i = 1; i < N; i++){
    cout << A[i] << " ";
  }
  cout << \n;
}


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

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

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

Compiler output:
a.cc:9:11: error: stray '\' in program
    9 |   cout << \n;
      |           ^
a.cc: In function 'void trace(int, int*)':
a.cc:9:12: error: 'n' was not declared in this scope
    9 |   cout << \n;
      |            ^
a.cc: In function 'int InSort(int, int*)':
a.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
Language: C++

}


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

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

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

Compiler output:
a.cc:1:1: error: expected declaration before '}' token
    1 | }
      | ^
a.cc: In function 'void InSort(int, int*)':
a.cc:15:3: error: 'trace' was not declared in this scope
   15 |   trace(N, A);
      |   ^~~~~
a.cc: In function 'int main()':
a.cc:22:3: error: 'cin' was not declared in this scope
   22 |   cin >> 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");
}

void InSort(intA[], 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];

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

  trace(A, N);
  InSort(A,N);
}

Compiler output:
a.cc:12:6: error: variable or field 'InSort' declared void
   12 | void InSort(intA[], N){
      |      ^~~~~~
a.cc:12:13: error: 'intA' was not declared in this scope; did you mean 'int'?
   12 | void InSort(intA[], N){
      |             ^~~~
      |             int
a.cc:12:18: error: expected primary-expression before ']' token
   12 | void InSort(intA[], N){
      |                  ^
a.cc:12:21: error: 'N' was not declared in this scope
   12 | void InSort(intA[], N){
      |                     ^
a.cc: In function 'int main()':
a.cc:34:3: error: 'InSort' was not declared in this scope
   34 |   InSort(A,N);
      |   ^~~~~~
Language: C++

include<stdio.h>


int main(void)
{
  int i,j,v,n;
  int array[100];
  scanf("%d\n", &n);

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

  for(i=1; i<n; i++)
  {
    v = array[i];
    j = i-1;
    while (j>=0 && array[j] > v)
    {   
      array[j+1] = array[j];
      j--;
    }   
    array[j+1] = v;
    for(i=0; i<n; i++)
    {   
      printf("%d", array[i]);
      if(i!=n-1)
        printf(" ");
      else
        printf("\n");
    }   
  }
}
~               

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
a.cc:43:2: error: expected class-name at end of input
   43 | ~
      |  ^
Language: C++

import sys

lines = sys.stdin.readlines()

N = lines[0]
A = lines[1].strip().split(" ")

print " ".join(A)

for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    print " ".join(A)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int n;
  cin >> n;
  int * a = new int[n];
  for (int i = 0; i < n; i++)
  {
     cin >> a[i];
  }
  
  for (int i = 1; i < n; i++)
  {
    int key = a[i];
    int j = i - 1;
    while (j > 0 && key < a[j])
    {
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = key;
    for (int k = 0; k < n; k++)
    {
      if (k) << ' ';
      cout << a[k];
    }
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: expected primary-expression before '<<' token
   26 |       if (k) << ' ';
      |              ^~
Language: C++

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: expected ';' before 'int'
    6 |         cin>>n
      |               ^
      |               ;
    7 |         int A[1000]
      |         ~~~    
a.cc:8:22: error: 'i' was not declared in this scope
    8 |         for(int i=0; i<n; i++)
      |                      ^
a.cc:10:25: error: 'N' was not declared in this scope
   10 |         for(int i=1; i<=N-1; i++){
      |                         ^
a.cc:11:25: error: 'A' was not declared in this scope
   11 |                 int v = A[i];
      |                         ^
a.cc:15:28: error: expected ';' before 'A'
   15 |                         j--
      |                            ^
      |                            ;
   16 |                    A[j+1] = v
      |                    ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: expected ';' before 'int'
    6 |         cin>>n
      |               ^
      |               ;
    7 |         int A[1000]
      |         ~~~    
a.cc:8:22: error: 'i' was not declared in this scope
    8 |         for(int i=0; i<n; i++)
      |                      ^
a.cc:10:25: error: 'N' was not declared in this scope
   10 |         for(int i=1; i<=N-1; i++){
      |                         ^
a.cc:11:25: error: 'A' was not declared in this scope
   11 |                 int v = A[i];
      |                         ^
a.cc:15:28: error: expected ';' before 'A'
   15 |                         j--
      |                            ^
      |                            ;
   16 |                    A[j+1] = v
      |                    ~
Language: C++

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin>>n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:18:17: error: 'cout' was not declared in this scope
   18 |                 cout<<A[a]<<" ";
      |                 ^~~~
a.cc:18:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:13: error: 'cout' was not declared in this scope
   19 |             cout<<A[n-1]<<endl;
      |             ^~~~
a.cc:19:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:27: error: 'endl' was not declared in this scope
   19 |             cout<<A[n-1]<<endl;
      |                           ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <iostream>
using namespace std;

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

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

n = int(input())
l = [int(x) for x in input().split()]

for i in range(n):

    if i == 0:
        continue

    a = l[i]
    j = i - 1

    while j >= 0 and l[j] > a:
        l[j+1] = l[j]
        j = j - 1

    l[j+1] = a
    print(*l)
    # print(' '.join([str(x) for x in l]))

Compiler output:
a.cc:18:7: error: invalid preprocessing directive #print
   18 |     # print(' '.join([str(x) for x in l]))
      |       ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
  int j,v,n;
  cin>>n;
  int num[n];
  for(int i=0;i<n;i++)
  {
    cin >> num[i];
  }
  for(int i = 0;i < n-1;i++)
  {
    cout<<num[i]<<" ";
  }
  cout << num[n-1] << endl;
  }

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

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

}

Compiler output:
a.cc:20:3: error: expected unqualified-id before 'for'
   20 |   for (int i = 1; i < n; i++) {
      |   ^~~
a.cc:20:19: error: 'i' does not name a type
   20 |   for (int i = 1; i < n; i++) {
      |                   ^
a.cc:20:26: error: 'i' does not name a type
   20 |   for (int i = 1; i < n; i++) {
      |                          ^
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

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

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

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

    insertionSort(A, N);


    return 0;
}

Compiler output:
a.cc: In function 'void displayA(int*, int)':
a.cc:6:28: error: expected ';' before 'cout'
    6 |         cout << A[i] << " "
      |                            ^
      |                            ;
    7 |     cout << A[N] << endl;
      |     ~~~~
Language: C++

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

#define MAX_INPUT_SIZE  1024
#define INPUT_FROM_FILE

int* createArray(int size, char* input);
void insertionSort(int size, int *array);

int
main(int argc, char* argv[])
{
    char input[MAX_INPUT_SIZE];

    int size = atoi(fgets(input, sizeof(input), stdin));
    //printf("array size : %d\n", size);

    while ((fgets(input, sizeof(input), stdin)) != NULL) {
        int* array = createArray(size, input);
        insertionSort(size, array);

        if (array != NULL) {
            delete [] array;
        }
    }

    return 0;
}

int*
createArray(int size, char* input)
{
    int* array = new int[size];

    if (array != NULL) {
        for (int i http://judge.u-aizu.ac.jp/onlinejudge/= 0; i < size; i++) {
            array[i] = i == 0 ?
                atoi(strtok(input, " ")) : atoi(strtok(NULL," "));
        }
    }
    return array;
}

void
insertionSort(int size, int *array)
{
    for (int i = 0; i < size; i++) {
        int curNum = array[i];
        for (int j = i-1; j >= 0; j--) {
            if (curNum > array[j]) {
                array[j+1] = curNum;
                break;
            } else {
                array[j+1] = array[j];
                array[j] = curNum;
            }
        }
        for (int i = 0; i < size; i++) {
            printf("%d ", array[i]);
        }
        printf("\n");
    }
}

Compiler output:
a.cc: In function 'int* createArray(int, char*)':
a.cc:37:19: error: expected ';' before 'http'
   37 |         for (int i http://judge.u-aizu.ac.jp/onlinejudge/= 0; i < size; i++) {
      |                   ^~~~~
      |                   ;
a.cc:37:24: error: found ':' in nested-name-specifier, expected '::'
   37 |         for (int i http://judge.u-aizu.ac.jp/onlinejudge/= 0; i < size; i++) {
      |                        ^
      |                        ::
a.cc:37:20: error: 'http' has not been declared
   37 |         for (int i http://judge.u-aizu.ac.jp/onlinejudge/= 0; i < size; i++) {
      |                    ^~~~
a.cc:40:9: error: expected primary-expression before '}' token
   40 |         }
      |         ^
a.cc:39:67: error: expected ')' before '}' token
   39 |                 atoi(strtok(input, " ")) : atoi(strtok(NULL," "));
      |                                                                   ^
      |                                                                   )
   40 |         }
      |         ~                                                          
a.cc:37:13: note: to match this '('
   37 |         for (int i http://judge.u-aizu.ac.jp/onlinejudge/= 0; i < size; i++) {
      |             ^
a.cc:40:9: error: expected primary-expression before '}' token
   40 |         }
      |         ^
a.cc: At global scope:
a.cc:42:5: error: expected unqualified-id before 'return'
   42 |     return array;
      |     ^~~~~~
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
a.cc: In function 'int* createArray(int, char*)':
a.cc:41:5: warning: control reaches end of non-void function [-Wreturn-type]
   41 |     }
      |     ^
Language: C++

#include <iostream>
#include <stdio.h>
using namespace std;

int main_in(){
    int A[1001];
    int num;
    for(int i=0;i<1001;i++){
        A[i] = 0;
    }
    
    cin >>num;
    
    for(int i=0;i<num;i++){
        scanf("%d",&A[i]);
    }
    void insertionSort(int* A,int N);
    insertionSort(A,num);
    
    return 0;
}

void insertionSort(int* A,int N){
    int key,j;
    
    for(int k=0;k<N-1;k++){
        cout <<A[k] <<" ";
    }
    cout <<A[N-1];
    cout <<endl;
    
    for(int i=1;i<N;i++){
        key = A[i];
        j = i -1;
        while(j > 0 && A[j] > key){
            A[j+1] = A[j];
            j--;
        }
        A[j] = key;
        
        for(int k=0;k<N-1;k++){
            cout <<A[k] <<" ";
        }
        cout <<A[N-1];
        cout <<endl;
    }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <stdio.h>
using namespace std;

int main_in(){
    int A[1001];
    int num;
    for(int i=0;i<1001;i++){
        A[i] = 0;
    }
    
    cin >>num;
    
    for(int i=0;i<num;i++){
        scanf("%d",&A[i]);
    }
    void insertionSort(int* A,int N);
    insertionSort(A,num);
    
    return 0;
}

void insertionSort(int* A,int N){
    int key,j;
    
    for(int k=0;k<N-1;k++){
        cout <<A[k] <<" ";
    }
    cout <<A[N-1];
    cout <<endl;
    
    for(int i=1;i<N;i++){
        key = A[i];
        j = i -1;
        while(j >= 0 && A[j] > key){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = key;
        
        for(int k=0;k<N-1;k++){
            cout <<A[k] <<" ";
        }
        cout <<A[N-1];
        cout <<endl;
    }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>

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

int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	content(a, 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;
			content(a, n);
		}
	}
	return 0;
}

Compiler output:
a.cc:3:6: error: variable or field 'content' declared void
    3 | void content(a, n){
      |      ^~~~~~~
a.cc:3:14: error: 'a' was not declared in this scope
    3 | void content(a, n){
      |              ^
a.cc:3:17: error: 'n' was not declared in this scope
    3 | void content(a, n){
      |                 ^
a.cc: In function 'int main()':
a.cc:19:9: error: 'content' was not declared in this scope; did you mean 'const'?
   19 |         content(a, n);
      |         ^~~~~~~
      |         const
a.cc:24:40: error: expected ';' before 'j'
   24 |                         a[j + 1] = a[j]
      |                                        ^
      |                                        ;
   25 |                         j--;
      |                         ~
Language: C++

#include <stdio.h>

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

int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	content(a, 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;
			content(a, n);
		}
	}
	return 0;
}

Compiler output:
a.cc:3:6: error: variable or field 'content' declared void
    3 | void content(a, n){
      |      ^~~~~~~
a.cc:3:14: error: 'a' was not declared in this scope
    3 | void content(a, n){
      |              ^
a.cc:3:17: error: 'n' was not declared in this scope
    3 | void content(a, n){
      |                 ^
a.cc: In function 'int main()':
a.cc:19:9: error: 'content' was not declared in this scope; did you mean 'const'?
   19 |         content(a, n);
      |         ^~~~~~~
      |         const
Language: C++

#include <stdio.h>

void content(a, n){
	for(int j = 0; j < n - 1; j++){
		printf("%d ", a[j]);
	}
	printf("%d\n",a[n - 1]);
//	return;
}

int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	content(a, 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;
			content(a, n);
		}
	}
	return 0;
}

Compiler output:
a.cc:3:6: error: variable or field 'content' declared void
    3 | void content(a, n){
      |      ^~~~~~~
a.cc:3:14: error: 'a' was not declared in this scope
    3 | void content(a, n){
      |              ^
a.cc:3:17: error: 'n' was not declared in this scope
    3 | void content(a, n){
      |                 ^
a.cc: In function 'int main()':
a.cc:19:9: error: 'content' was not declared in this scope; did you mean 'const'?
   19 |         content(a, n);
      |         ^~~~~~~
      |         const
Language: C++

#include <stdio.h>

int content(a, n){
	for(int j = 0; j < n - 1; j++){
		printf("%d ", a[j]);
	}
	printf("%d\n",a[n - 1]);
	return 0;
}

int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	content(a, 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;
			content(a, n);
		}
	}
	return 0;
}

Compiler output:
a.cc:3:13: error: 'a' was not declared in this scope
    3 | int content(a, n){
      |             ^
a.cc:3:16: error: 'n' was not declared in this scope
    3 | int content(a, n){
      |                ^
a.cc:3:17: error: expression list treated as compound expression in initializer [-fpermissive]
    3 | int content(a, n){
      |                 ^
a.cc: In function 'int main()':
a.cc:19:16: error: 'content' cannot be used as a function
   19 |         content(a, n);
      |         ~~~~~~~^~~~~~
a.cc:27:32: error: 'content' cannot be used as a function
   27 |                         content(a, n);
      |                         ~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

static const int N = 1000;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
int main(void){
	int n,a[N];
	cin>>n;
	rep(i,n)cin>>a[i];

	rep(i,n){
		int v = a[i];
		for(int j = i-1 ; j >= 0  && a[j] > v; j --){
			swap(a[j],a[j+1]);
		}
		rep(j,n)cout<<a[j]<<(j==n-1?'\n':' ');if(j!=n-1)cout<<endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:58: error: 'j' was not declared in this scope
   19 |                 rep(j,n)cout<<a[j]<<(j==n-1?'\n':' ');if(j!=n-1)cout<<endl;
      |                                                          ^