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

#include <iostream>

using namespace std;

void insertionSort(int*, int);
void trace(int*, int);

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

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

int main(){
  int n;
  int a[100];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:35:3: error: 'trance' was not declared in this scope; did you mean 'trace'?
   35 |   trance(a, n);
      |   ^~~~~~
      |   trace
Language: C++

#include <stdio.h>
void insertionsort(int numbers[],int size);
void swap(int *p_from,int *p_to);
int A[100];
void main(){
  int N,i,j;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf(" %d",&A[i]);
  }
  for(i=0;i<N;i++){
    printf("%d ",A[i]);
  }
  printf("\n");
  insertionsort(A,N);
  for(i=0;i<N;i++){
    printf("%d ",A[i]);
  }
  printf("\n");
}
void insertionsort(int A[],int size){
  int i,j,k;
  for(i=1;i<size;i++){
    j=i;
    while((j>0)&&(A[j-1]>A[j])){
      swap(&A[j-1],&A[j]);
      j--;
    }
    for(k=0;k<size;k++){
      printf("%d ",A[k]);
    }
    printf("\n");
  }
}
void swap(int *p_from,int *p_to){
  int t;
  t=*p_from;
  *p_from=*p_to;
  *p_to=t;
}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main(){
      | ^~~~
Language: C++

#coding: UTF-8

k=[26,5,6,95,1]

def insert_sort(buff):
    k = len(buff)
    for i in xrange(1, k):
        temp = buff[i]
        j = i - 1
        while j >= 0 and temp < buff[j]:
            buff[j + 1] = buff[j]
            j -= 1
        buff[j + 1] = temp
print k

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #coding
    1 | #coding: UTF-8
      |  ^~~~~~
a.cc:3:1: error: 'k' does not name a type
    3 | k=[26,5,6,95,1]
      | ^
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 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+i]=v;
    trace(A,N);
  }
}

intmain(){
  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:26:1: error: ISO C++ forbids declaration of 'intmain' with no type [-fpermissive]
   26 | intmain(){
      | ^~~~~~~
Language: C++

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

for i in range(n-1):
  key = l[i + 1]
  j = i
  while j >= 0 and l[j] > key:
    l[j+1] = l[j]
    j -= 1
  l[j+1] = key



print(" ".join([str(k) for k in l]))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
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 insertionSort(int A[], int N){
	int i,j,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 argc, char const *argv[])
{
	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 'int main(int, const char**)':
a.cc:32:35: error: expected ';' before '}' token
   32 |                 scanf("%d", &A[i])
      |                                   ^
      |                                   ;
   33 |         }
      |         ~
Language: C++

int main() {

	int v, i, j,k, N;
	int A[100];

	cin >> N;

	for (i = 0; i < N ; i++)
		cin >> A[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;
		cout << A[0];
		for (k = 1; k < N; k++)
			cout << " " << A[k];
		cout << "\n";
	}

	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> N;
      |         ^~~
a.cc:20:17: error: 'cout' was not declared in this scope
   20 |                 cout << A[0];
      |                 ^~~~
Language: C++

#include <stdio.h>
#include<iostream>
using namespace std;
int main() {

	int v, i, j,k, N;
	int A[100];

	cin >> N;

	for (i = 0; i < N ; i++)
		cin >> A[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;
		cout << A[0];
		for (k = 1; k < N; k++)
			cout << " " << A[k];
		cout << "\n";
	}

	rturn 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'rturn' was not declared in this scope
   29 |         rturn 0;
      |         ^~~~~
Language: C++

using namespace std;
 
int main() {
 
    int v, i, j,k, N;
    int A[100];
 
    cin >> N;
 
    for (i = 0; i < N ; i++)
        cin >> A[i];

    cout << A[0];

    for (k = 1; k < N; k++)
        cout << " " << A[k];
    cout << endl;

 
    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;
        cout << A[0];
        for (k = 1; k < N; k++)
            cout << " " << A[k];
        cout << "\n";
    }
    cout << A[0];
    for (k = 1; k < N; k++)
        cout << " " << A[k];
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     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:13:5: error: 'cout' was not declared in this scope
   13 |     cout << A[0];
      |     ^~~~
a.cc:13:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:13: error: 'endl' was not declared in this scope
   17 |     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 | using namespace std;
Language: C++

#include "stdafx.h"


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

    int j;
    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 (j = 0; j < N - 1; j++)
        printf("%d ", A[j]);

    printf("%d\n", A[N - 1]);
    return 0;
}

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

#include <stdio.h>
#include <stdlib.h>
 
int main(){
int n,i,j,x,k;
scanf("%d",&n);
int a[n-1];
for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
}
printf("%d\n",a[n-1]);
 
for(j=0;j<n;j++){
    for(i=0;i<n;i++){
        if(a[i]>a[j]){
              x=a[j];
           a[j]=a[i];
           a[i]=x;
      }
   }
for(k=0;k<n-1;k++){
    printf("%d ",a[k]);
       }
printf("%d\n",a[n-1]);
    }
retrun 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:1: error: 'retrun' was not declared in this scope
   29 | retrun 0;
      | ^~~~~~
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
void insertionSort(int A[],N){
	int v,j;
	for(int 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(int k=0;k<N;k++){
			printf("%d ",A[k]);
		}
		printf("\n");
	}
}
int main(){
	int A[100],N;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	insertionSort(A,N);
	return 0;
}

Compiler output:
a.cc:4:28: error: 'N' has not been declared
    4 | void insertionSort(int A[],N){
      |                            ^
a.cc: In function 'void insertionSort(int*, int)':
a.cc:6:23: error: 'N' was not declared in this scope
    6 |         for(int i=1;i<N-1;i++){
      |                       ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;


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

int sort(int* a,int N)
{
    dump(a, N);
    for( int i=1; i<N; i++ ){
        int k = a[i];
        int j;
        for( j=i-1;j>=0 && a[j] > k ;j--){
            a[j+1] = a[j];
        }
        a[j+1] = k;
        dump(a, N);
    }
}

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

    sort(a,N);
}

Compiler output:
a.cc: In function 'void dump(int*, int)':
a.cc:10:17: error: expected ';' before 'for'
   10 |     cout << a[0]
      |                 ^
      |                 ;
   11 |     for( int i=0; i<N; i++ ){
      |     ~~~          
a.cc:11:19: error: 'i' was not declared in this scope
   11 |     for( int i=0; i<N; i++ ){
      |                   ^
a.cc: In function 'int sort(int*, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
Language: C++

// ALDS1_1_A.cpp
// Insertion Sort
#include <cstdio>
#include <vector>
using namespace std;

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

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

void insertSort(vector<int> &nums, int n)
{
	for (int i = 1; i < n; i++) {
		int key = nums[i];
		int j = i - 1;
		while (j >= 0 && nums[j] > key) {
			nums[j + 1] = nums[j];
			j--;
		}
		nums[j + 1] = key;
		trace(nums, n);
	}
}

int main()
{
	int n;
	scanf_s("%d", &n);
	vector<int> nums(n);
	for (int i = 0; i < n; i++)
		scanf_s("%d", &nums[i]);
	// trace(nums, n);
	insertSort(nums, n);
	return 0;
}

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

#include<stdio.h>
void insertionsort(int num[], int array_size);

int main(){
  int N,i,j;
  scanf("%d",&N);
  int A[N];
  for(i=0; i<N;i++){
    scanf("%d",&A[N]);
  }
  for(i =1;i<N;i++){
    int v = A[i];
    j = i-1;
    while(j>=0){
        if(A[j]>v){
          A[j+1]=A[j];
          j--;
          A[j] = v;
        }
      }
      return 0;
  }

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

#include<stdio.h>

int main(){
  int N,i,j;
  scanf("%d",&N);
  int A[N];
  for(i=0; i<N;i++){
    scanf("%d",&A[N]);
  }
  for(i =1;i<N;i++){
    int v = A[i];
    j = i-1;
    while(j>=0){
        if(A[j]>v){
          A[j+1]=A[j];
          j--;
          A[j] = v;
        }
      }
      return 0;
  }

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

#include <iostream>

/**
 * @brief Result Output
 * @param [in] A[] Data
 * @param [in] N   DataNumber
 * @return none
 */
void output(int A[], int N)
{
	for( int i = 0; i < N; i++ )
	{
		if(i != 0)
		{
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;
	return;
}

/**
 * @brief Execute InserSort
 * @param [in]  A[] Data
 * @param [in]  N   DataNumber
 * @param [out] A[] Data
 * @return none
 */
void insertionSort(int A[], int N)
{
	output(A,N);
	int v;
	int j;
	for( int 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;
		}
		output(A,N);
	}
	return;
}
 
int main(void)
{
	using namespace std;
	
	int input[1000];
	int rows;
	 
	cin >> rows;
	int inputNum = 0;
	while( cin >> input[inputNum] )
	{
		inputNum++;
	}
	 
	insertionSort(input,rows);
	return 0;
}

Compiler output:
a.cc: In function 'void output(int*, int)':
a.cc:15:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |                         cout << " ";
      |                         ^~~~
      |                         std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |                 cout << A[i];
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:19:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |         cout << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:19:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |         cout << endl;
      |                 ^~~~
      |                 std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

def insertionSort(A,N):
    for i in range(1,len(A)):
        v = A[i]
        j=i-1
        while(j>=0 and A[j] > v):
            A[j+1] = A[j]
            j-=1
        A[j+1]=v
        print(*A)

def main():
    print("??°????????\???")
    A = list(map(int,input().split()))
    N = len(A)
    insertionSort(A,N)

if __name__ == '__main__':
    main()

Compiler output:
a.cc:17:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   17 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def insertionSort(A,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]);
  }
  pringf("\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() {
  int N, i, j;
  int A[100]l

  scanf("%d", &N);
  for ( i = 0l i < Nl 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:10:3: error: 'pringf' was not declared in this scope; did you mean 'printf'?
   10 |   pringf("\n")
      |   ^~~~~~
      |   printf
a.cc: In function 'int main()':
a.cc:30:13: error: expected initializer before 'l'
   30 |   int A[100]l
      |             ^
a.cc:33:15: error: expected ';' before 'i'
   33 |   for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
      |               ^~
      |               ;
a.cc:35:9: error: 'A' was not declared in this scope
   35 |   trace(A, N);
      |         ^
a.cc:36:22: error: expected ')' before ';' token
   36 |   insertionSort(A, N);
      |                      ^
      |                      )
a.cc:33:7: note: to match this '('
   33 |   for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
      |       ^
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() {
  int N, i, j;
  int A[100]l
 
  scanf("%d", &N);
  for ( i = 0l i < Nl 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:10:15: error: expected ';' before '}' token
   10 |   printf("\n")
      |               ^
      |               ;
   11 | }
      | ~              
a.cc: In function 'int main()':
a.cc:30:13: error: expected initializer before 'l'
   30 |   int A[100]l
      |             ^
a.cc:33:15: error: expected ';' before 'i'
   33 |   for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
      |               ^~
      |               ;
a.cc:35:9: error: 'A' was not declared in this scope
   35 |   trace(A, N);
      |         ^
a.cc:36:22: error: expected ')' before ';' token
   36 |   insertionSort(A, N);
      |                      ^
      |                      )
a.cc:33:7: note: to match this '('
   33 |   for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
      |       ^
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() {
  int N, i, j;
  int A[100];
  
  scanf("%d", &N);
  for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
  
  trace(A, N);
  insertionSort(A, N);
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: expected ';' before 'i'
   33 |   for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
      |               ^~
      |               ;
a.cc:35:8: error: could not convert 'trace(((int*)(& A)), N)' from 'void' to 'bool'
   35 |   trace(A, N);
      |   ~~~~~^~~~~~
      |        |
      |        void
a.cc:36:22: error: expected ')' before ';' token
   36 |   insertionSort(A, N);
      |                      ^
      |                      )
a.cc:33:7: note: to match this '('
   33 |   for ( i = 0l i < Nl i ++ ) scanf("%d", &A[i]);
      |       ^
Language: C++

#include<iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int A[100],N,v;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    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;
    }
    for(int i=0;i<N;i++){
        cout << A[i]<<" ";
    }
    cout << "\n";
}


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

#include<iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int A[100],N,v,j;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    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;
    for(int i=0;i<N;i++){
        cout << A[i];
        if(i!=N-1)   cout << " "
    }
    cout << "\n";
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:33: error: expected ';' before '}' token
   20 |         if(i!=N-1)   cout << " "
      |                                 ^
      |                                 ;
   21 |     }
      |     ~
Language: C++

#include <iostream>
#icnldue <cstdio>
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 i, j, v;
	for (i = 1; i < N; i++) {
		v = A[i];
	
		for (j = i - 1; j >= 0 && A[j] > v;j--) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
	}
	trace(A, N);
}

int main()
{
	int A[100];
	int N, i, j;
	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:2:2: error: invalid preprocessing directive #icnldue; did you mean #include?
    2 | #icnldue <cstdio>
      |  ^~~~~~~
      |  include
Language: C++

#include <iostream>
#icnlude <cstdio>
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 i, j, v;
	for (i = 1; i < N; i++) {
		v = A[i];
	
		for (j = i - 1; j >= 0 && A[j] > v;j--) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
	}
	trace(A, N);
}

int main()
{
	int A[100];
	int N, i, j;
	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:2:2: error: invalid preprocessing directive #icnlude; did you mean #include?
    2 | #icnlude <cstdio>
      |  ^~~~~~~
      |  include
Language: C++

a = gets.to
for i in 1 .. n-1
  key = a[i]
  j = i-1
  print a
  print "\n"
  while j >= 0 and a[j] > key
    a[j+1] = a[j]
    a[j] = key
    j -= 1
  end
end
print a



Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a = gets.to
      | ^
Language: C++

a = gets.to
for i in 1 .. n-1
  key = a[i]
  j = i-1
  print (a)
  print "\n"
  while j >= 0 and a[j] > key
    a[j+1] = a[j]
    a[j] = key
    j -= 1
  end
end
print (a)



Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a = gets.to
      | ^
Language: C++

#include <iostream>
using namespace std;

void trace(int A[], int N) {
  int i;
  for(i = 0; i < N; ++i) {
    if(i > 0) {
      cout << " " << flush;
    }
    cout << A[i] << flush;
  }
  cout << endl;
}
void insertionSort(int A[],int N) {
  int i, j, 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[];
  cin >> N;
  for(int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  trace(A, N)
  insertionSort(A, N)
}


Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:24:16: error: expected ';' before '}' token
   24 |     trace(A, N)
      |                ^
      |                ;
   25 |   }
      |   ~             
a.cc: In function 'int main()':
a.cc:28:10: error: storage size of 'A' isn't known
   28 |   int N, A[];
      |          ^
Language: C++

#include <iostream>
using namespace std;

void trace(int A[], int N) {
  int i;
  for(i = 0; i < N; ++i) {
    if(i > 0) {
      cout << " " << flush;
    }
    cout << A[i] << flush;
  }
  cout << endl;
}
void insertionSort(int A[],int N) {
  int i, j, 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[];
  cin >> N;
  for(int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  trace(A, N);
  insertionSort(A, N);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:10: error: storage size of 'A' isn't known
   28 |   int N, A[];
      |          ^
Language: C++

#include<cstdio>                                          
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(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:41:2: error: expected class-name at end of input
   41 | ~
      |  ^
Language: C++

#include <iostream>
#include <vector>

std::vector<int> insertionSort(std::vector<int>,int);

int main(int argc, char const *argv[]){

	int N;
	std::cin >> N;
	std::vector<int> fig(N);

	for (int i = 0; i < N; ++i){
		std::cin >> fig[i];
	}

	std::vector<int> ans = insertionSort(fig,N);
	return 0;
}

std::vector<int> insertionSort(std::vector<int> fig, int N){

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

		for (int k=0; k<N; ++k){
			std::cout << fig[k] << " ";
		}
		std::cout << endl;

	}
	return fig;
}


Compiler output:
a.cc: In function 'std::vector<int> insertionSort(std::vector<int>, int)':
a.cc:34:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 |                 std::cout << endl;
      |                              ^~~~
      |                              std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>

std::vector<int> insertionSort(std::vector<int>,int);

int main(int argc, char const *argv[]){

	int N;
	std::cin >> N;
	std::vector<int> fig(N);

	for (int i = 0; i < N; ++i){
		std::cin >> fig[i];
	}

	for (int i=0; i<N; ++i){
		std::cout << fig[i];
		if(k>N-1)std::cout << " ";
	}

	std::vector<int> ans = insertionSort(fig,N);
	return 0;
}

std::vector<int> insertionSort(std::vector<int> fig, int N){



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

		for (int k=0; k<N; ++k){
			std::cout << fig[k];
			if(k>N-1)std::cout << " ";
		}
		std::cout << std::endl;
	}
	return fig;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:18:20: error: 'k' was not declared in this scope
   18 |                 if(k>N-1)std::cout << " ";
      |                    ^
Language: C++

#include <iostream>
#include <vector>

std::vector<int> insertionSort(std::vector<int>,int);

int main(int argc, char const *argv[]){

	int N;
	std::cin >> N;
	std::vector<int> fig(N);

	for (int i = 0; i < N; ++i){
		std::cin >> fig[i];
	}

	for (int i=0; i<N; ++i){
		std::cout << fig[i];
		if(i>N-1)std::cout << " ";
	}
	std::cout << endl;

	std::vector<int> ans = insertionSort(fig,N);
	return 0;
}

std::vector<int> insertionSort(std::vector<int> fig, int N){



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

		for (int k=0; k<N; ++k){
			std::cout << fig[k];
			if(k>N-1)std::cout << " ";
		}
		std::cout << std::endl;
	}
	return fig;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:20:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   20 |         std::cout << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

def insertinSort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j-=1
        A[j+1] = v
        for i in range(N-1):
            print(A[i],end=' ')
        print(A[N-1])


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def insertinSort(A,N):
      | ^~~
Language: C++

def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j-=1
        A[j+1] = v
        for i in range(N-1):
            print(A[i],end=' ')
        print(A[N-1])


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def insertionSort(A,N):
      | ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <limits>

int main()
{
	unsigned int N = 0;
	std::cin >> N;

	std::vector<int> A(N);
	for (auto& a : A) { std::cin >> a; }

	for (unsigned int i = 1; i < N; i++)
	{
		unsigned int cand = i;
		while (cand > 0)
		{
			if(A[cand-1] < A[i]) { break; }
			A[cand] = A[cand-1];
			cand--;
		}
		A[cand] = A[i];

		std::cout << A[0];
		for (unsigned int j = 1; j < N; j++){ std::cout << " " << A[j]; }
		std::cout << std::endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'vector' is not a member of 'std'
   10 |         std::vector<int> A(N);
      |              ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <limits>
  +++ |+#include <vector>
    4 | 
a.cc:10:21: error: expected primary-expression before 'int'
   10 |         std::vector<int> A(N);
      |                     ^~~
a.cc:11:24: error: 'A' was not declared in this scope
   11 |         for (auto& a : A) { std::cin >> a; }
      |                        ^
a.cc:18:28: error: 'A' was not declared in this scope
   18 |                         if(A[cand-1] < A[i]) { break; }
      |                            ^
a.cc:19:25: error: 'A' was not declared in this scope
   19 |                         A[cand] = A[cand-1];
      |                         ^
a.cc:22:17: error: 'A' was not declared in this scope
   22 |                 A[cand] = A[i];
      |                 ^
Language: C++

// ConsoleApplication1.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
/*
void insertionSort(int a[], int n) {
	int i;
	int v;
	int j;
	int k;
	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]);

		}
		printf("\b\n");
	}


}*/

int main(void)
{
	int a[101];
	int n;
	int i;
	int k;
	int v;
	int j;
	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) {
			a[j + 1] = a[j];
			j--;
			a[j + 1] = v;

		}
		for (k = 0; k<n; k++) {

			printf("%d ", a[k]);

		}
		printf("\b\n");
	}


	return 0;
}




Compiler output:
a.cc:3:10: fatal error: stdafx.h: No such file or directory
    3 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

// ALDS1_1_A
#include <stdio.h>

void insertionSort(int* pAryA, int aryN)
{
	// insertion sort
	// first value sorted
	for(int i = 1; i < aryN - 1; i++)
	{
		int value = pAryA[i];
		int j = i - 1;
		while((j >= 0) && (pAryA[j] > value))
		{
			pAryA[j+1] = pAryA[j];
			j--;
		}
		pAryA[j+1] = value;
		
		// output
		int k = 0;
		while(k < aryN)
		{
			printf("%d", pAryA[k]);
			k++;
			if(k >= aryN)
			{
				printf("\n");
			}
			else
			{
				printf(" ");
			}
		}
	}
}

void main()
{
	int aryN;
	int aryA[100];

	// input
	scanf("%d", &aryN);
	for(int i = 0; i < aryN; i++)
	{
		scanf("%d", &aryA[i]);
	}
	
	insertionSort(&aryA[0], aryN);
	
	return;
}



Compiler output:
a.cc:37:1: error: '::main' must return 'int'
   37 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:51:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   51 |         return;
      |         ^~~~~~
Language: C++

#include <iostream>

using namespace std;

void insertionsort(int* A,int n)
{
	for (int i = 1; i < n; ++i)
	{
		for (int i = 0; i < n; ++i)
		{
			cout<<A[i]<<" ";
		}
		cout<<endl;

		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 argc, char const *argv[])
{
	int n;
	cin>>n;
	int A[n];

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

	insertionsort(A,n);

	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:34:24: error: 'i66' was not declared in this scope
   34 |                 cin>>A[i66];
      |                        ^~~
Language: C++

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

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

 insertionSort(A,N);
}

void insertionSort(vector<int>& A, N){
 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(int k = 0; k < N; k++){
   if k = (N-1) cout<<A[k]<<endl;
   else cout<<A[k]<<" ";
}
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:2: error: 'insertionSort' was not declared in this scope
   11 |  insertionSort(A,N);
      |  ^~~~~~~~~~~~~
a.cc: At global scope:
a.cc:14:36: error: 'N' has not been declared
   14 | void insertionSort(vector<int>& A, N){
      |                                    ^
a.cc: In function 'void insertionSort(std::vector<int>&, int)':
a.cc:15:21: error: 'N' was not declared in this scope
   15 |  for(int i = 1; i < N; i++){
      |                     ^
a.cc:17:3: error: 'j' was not declared in this scope
   17 |   j = i - 1;
      |   ^
a.cc:25:7: error: expected '(' before 'k'
   25 |    if k = (N-1) cout<<A[k]<<endl;
      |       ^
      |       (
a.cc:26:4: error: 'else' without a previous 'if'
   26 |    else cout<<A[k]<<" ";
      |    ^~~~
Language: C++

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

void insertionSort(vector<int>& A, N){
 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(int k = 0; k < N; k++){
   if k = (N-1) cout<<A[k]<<endl;
   else cout<<A[k]<<" ";
}
}
}

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

 insertionSort(A,N);
}




Compiler output:
a.cc:5:36: error: 'N' has not been declared
    5 | void insertionSort(vector<int>& A, N){
      |                                    ^
a.cc: In function 'void insertionSort(std::vector<int>&, int)':
a.cc:6:21: error: 'N' was not declared in this scope
    6 |  for(int i = 1; i < N; i++){
      |                     ^
a.cc:8:3: error: 'j' was not declared in this scope
    8 |   j = i - 1;
      |   ^
a.cc:16:7: error: expected '(' before 'k'
   16 |    if k = (N-1) cout<<A[k]<<endl;
      |       ^
      |       (
a.cc:17:4: error: 'else' without a previous 'if'
   17 |    else cout<<A[k]<<" ";
      |    ^~~~
Language: C++

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

void insertionSort(vector<int>& A, int N){
 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(int k = 0; k < N; k++){
   if k = (N-1) cout<<A[k]<<endl;
   else cout<<A[k]<<" ";
}
}
}

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

 insertionSort(A,N);
}



Compiler output:
a.cc: In function 'void insertionSort(std::vector<int>&, int)':
a.cc:8:3: error: 'j' was not declared in this scope
    8 |   j = i - 1;
      |   ^
a.cc:16:7: error: expected '(' before 'k'
   16 |    if k = (N-1) cout<<A[k]<<endl;
      |       ^
      |       (
a.cc:17:4: error: 'else' without a previous 'if'
   17 |    else cout<<A[k]<<" ";
      |    ^~~~
Language: C++

def insertionSort(A,N):
    for i in range(N):
        v = A [i]
        j = i-1
        while j>=0 and A[j] > v:
            A[j+1] = A[j]
            j = j -1
        A[j+1] = v
        print(A)


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def insertionSort(A,N):
      | ^~~
Language: C++

#include<iostream>
using namespace std;
int main(void){
	int a[99],j,n,v=0;
	cin>>n;
	for(int s=0;s<n;s++)
	{
	cin>>a[s];
	}
	for(int s=0;s<n;s++)
	{
		if(s!=0&&s!=n-1){
	cout<<" ";
			cout<<a[s];
	 else cout<<a[s]<<endl;
	}
	
	for(int 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(int e=0;e<n;e++)
		{
			if(e!=0&&e!=n-1){
	      	cout<<" ";
				cout<<a[e];
			else cout<<a[e]<<endl;
	}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: expected '}' before 'else'
   15 |          else cout<<a[s]<<endl;
      |          ^~~~
a.cc:12:33: note: to match this '{'
   12 |                 if(s!=0&&s!=n-1){
      |                                 ^
a.cc:32:25: error: expected '}' before 'else'
   32 |                         else cout<<a[e]<<endl;
      |                         ^~~~
a.cc:29:41: note: to match this '{'
   29 |                         if(e!=0&&e!=n-1){
      |                                         ^
Language: C++

n=int(input())
*a,=map(int,input().split())

for i in range(n):
	v=a[i]
	j=i-1
	while j>=0 and a[j]>v:
		a[j+1]=a[j]
		j-=1
	a[j+1]=v

	print(*a)



Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

#include <iostream>
#include <cstring>
#include <sstream>
#include <cctype>
#include <cmath>
#include <cstdio>
using namespace std;

void print(int* a,int n){
	for (int s = 0;;){
		cout << a[s];
		s++;
		if (s >= n)break;
		cout << ' ';
	}
}

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

		print(a,n);

		i++;
		cout << endl;
	}
}

int main(){

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

	print(a, n);　cout << endl;

	InsertionSort(a, n);

	return 0;
}


Compiler output:
a.cc:42:21: error: extended character 　 is not valid in an identifier
   42 |         print(a, n);　cout << endl;
      |                     ^
a.cc: In function 'int main()':
a.cc:42:21: error: '\U00003000cout' was not declared in this scope
   42 |         print(a, n);　cout << endl;
      |                     ^~~~~~
Language: C++

#include<cstdio>
int main(){
  int n; scanf("%d", &n);
  int a[10000];
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
if(a[i] > a[j]){
  int tmp = a[j];
  a[j] = a[i];
  a[i] = tmp;
}
}
for(int j = 0; j < n; j++) printf("%d ", a[j]);
printf("\n");
}


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

#include <iostream>

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

int main()
{
    int maxN = 100;
    int A[maxN+1];

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

    trace(A, N);

    // insertion sort
    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);
    }
    return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   22 |         cin >> A[i];
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:28:25: error: 'n' was not declared in this scope
   28 |     for (int i = 1; i < n; i++)
      |                         ^
a.cc:30:17: error: 'a' was not declared in this scope
   30 |         int v = a[i];
      |                 ^
Language: C++

#include <iostream>
using namespace std;

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

int main()
{
    int maxN = 1000;
    int A[maxN];

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

    trace(A, N);

    //insertion sort
    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);
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: expected '(' before '\U0000ff08j'
   33 |         while （j >= 0 && A[j] > v)
      |               ^~~
      |               (
a.cc:33:15: error: '\U0000ff08j' was not declared in this scope
   33 |         while （j >= 0 && A[j] > v)
      |               ^~~
Language: C++

#include <iostream>


using namespace std;

int main(){
 int n,i,j,temp;
 cin >> n;
 int a[n];
 for (i=0;i<n;++i) {
   cin >> a[i];
 }

 for (i=0;i<n;++i) {
   temp=a[i];
   for (j=i-1;j>-1;--aj) {
     if (a[j]>temp) {
       a[j+1]=a[j];
     } else {
       break;
     }
   }
   a[j+1]=temp;
   for (j=0;j<n;++j) {
     cout << a[j];
     if (j<n-1) {
       cout << " ";
     } else {
       cout << endl;
     }
   }
 }
 return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'aj' was not declared in this scope; did you mean 'a'?
   16 |    for (j=i-1;j>-1;--aj) {
      |                      ^~
      |                      a
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    
    int num;
    int *arr;

    cin >> num;
    arr = new int[num];
    for(int i = 0; i < num; i++)
        cin >> arr[i];

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

    for(int i = 0; i < num; i++) {
        cout << arr[i] << " ";
    cout << endl;

    delete[] arr;

    return 0;
}


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

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    
    int num;
    int *arr;

    cin >> num;
    arr = new int[num];
    for(int i = 0; i < num; i++)
        cin >> arr[i];

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

    for(int i = 0; i < num; i++) {
        cout << arr[i] << " ";
    cout << endl;

    delete [] arr;

    return 0;
}


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

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    
    int num;
    int *arr;

    cin >> num;
    arr = new int[num];
    for(int i = 0; i < num; i++)
        cin >> arr[i];

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

    for(int i = 0; i < num; i++) {
        cout << arr[i] << " ";
    cout << endl;

    //delete [] arr;

    return 0;
}


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

#include "stdafx.h"

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

		printf("%d", &A[i]);
	}
	printf("\r\n");
}

void insertSort(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 N, A[100];

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

    return 0;
}



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

void trace(int A[], int N) 
{
    for (int i = 0; i < N; i++)
    {
        if (i > 0)
        {
            printf(" ");
        }
 
        printf("%d", &A[i]);
    }
    printf("\r\n");
}
 
void insertSort(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 N, A[100];
 
    scanf_s("%d", &N);
     
    for (int i = 0; i < N; i++)
    {
        scanf_s("%d", &A[i]);
    }
    trace(A , N);
    insertSort(A, N);
 
    return 0;
}


Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:7:13: error: 'printf' was not declared in this scope
    7 |             printf(" ");
      |             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | void trace(int A[], int N)
a.cc:10:9: error: 'printf' was not declared in this scope
   10 |         printf("%d", &A[i]);
      |         ^~~~~~
a.cc:10:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:12:5: error: 'printf' was not declared in this scope
   12 |     printf("\r\n");
      |     ^~~~~~
a.cc:12:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'int main()':
a.cc:37:5: error: 'scanf_s' was not declared in this scope
   37 |     scanf_s("%d", &N);
      |     ^~~~~~~
Language: C++

#include <stdio.h>

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

		printf("%d", &A[i]);
	}
	printf("\r\n");
}

void insertSort(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 N, A[100];

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

    return 0;
}


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

#include <stdio.h>

void trace(int A[], int N){ to continue
   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 i, j, 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);
   InsertionSort(A, N);

   return 0;
}



Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:3:29: error: 'to' was not declared in this scope
    3 | void trace(int A[], int N){ to continue
      |                             ^~
a.cc:5:8: error: 'i' was not declared in this scope
    5 |    for(i = 0 ; i < N ; i++){
      |        ^
Language: C++

#include <iostream>

using namespace std;

void insertSort(int Array[],int n) {
	
	for (int i = 1; i < n; i++) {

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

		for (int k = 0; k < n; k++) {
			cout << Array[k] << ((k == n - 1) ? "\n" : " ");
		}
	}
}

int main(void){
	int n;
	cin >> n;
	int *Array = new int[n];
	if (Array != NULL) memset(Array, 0, sizeof(Array));

	for (int i = 0; i < n; i++) {
		cin >> Array[i];
		cout << Array[i] << ((i == n - 1) ? "\n" : " ");
	}

	insertSort(Array, n);

	delete[] Array;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:28: error: 'memset' was not declared in this scope
   28 |         if (Array != NULL) memset(Array, 0, sizeof(Array));
      |                            ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |