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

#include static const int N = 1000;
void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
      printf("%d", A[i]);
    }
  printf("\n");
  }
 
int main(){ int n, i, j; int A[N+1]; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); trace(A, n); /* your code */ return 0; } 

Compiler output:
a.cc:1:10: error: #include expects "FILENAME" or <FILENAME>
    1 | #include static const int N = 1000;
      |          ^~~~~~
a.cc: In function 'void trace(int*, int)':
a.cc:5:18: error: 'printf' was not declared in this scope
    5 |     if ( i > 1 ) printf(" ");
      |                  ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #include static const int N = 1000;
a.cc:6:7: error: 'printf' was not declared in this scope
    6 |       printf("%d", A[i]);
      |       ^~~~~~
a.cc:6:7: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:8:3: error: 'printf' was not declared in this scope
    8 |   printf("\n");
      |   ^~~~~~
a.cc:8:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'int main()':
a.cc:11:32: error: 'N' was not declared in this scope
   11 | int main(){ int n, i, j; int A[N+1]; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); trace(A, n); /* your code */ return 0; }
      |                                ^
a.cc:11:38: error: 'scanf' was not declared in this scope
   11 | int main(){ int n, i, j; int A[N+1]; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); trace(A, n); /* your code */ return 0; }
      |                                      ^~~~~
a.cc:11:95: error: 'A' was not declared in this scope
   11 | int main(){ int n, i, j; int A[N+1]; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); trace(A, n); /* your code */ return 0; }
      |                                                                                               ^
a.cc:11:108: error: 'A' was not declared in this scope
   11 | int main(){ int n, i, j; int A[N+1]; scanf("%d", &n); for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]); trace(A, n); /* your code */ return 0; }
      |                                                                                                            ^
Language: C++

#include<stdio.h>

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

void trace(int A[],int N){
	for(int i=0;i < N;i++)
	{

	if(i > 0)printf (" ");
	printf("%d",A[i]);
	
	}
	printf("\n");
}

void main(){
	int N,i;
	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 InsertionSort(int*, int)':
a.cc:9:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 while(j >= && A[j]>v)
      |                       ~~^~~~~~~
a.cc:9:32: error: expected ')' before '[' token
    9 |                 while(j >= && A[j]>v)
      |                      ~         ^
      |                                )
a.cc: In lambda function:
a.cc:9:35: error: expected '{' before '>' token
    9 |                 while(j >= && A[j]>v)
      |                                   ^
a.cc: In function 'void InsertionSort(int*, int)':
a.cc:9:35: error: no match for 'operator>' (operand types are 'InsertionSort(int*, int)::<lambda()>' and 'int')
    9 |                 while(j >= && A[j]>v)
      |                                ~~~^~
      |                                |   |
      |                                |   int
      |                                InsertionSort(int*, int)::<lambda()>
a.cc:15:17: error: 'trace' was not declared in this scope
   15 |                 trace(A,N);
      |                 ^~~~~
a.cc:9:31: error: label 'A' used but not defined
    9 |                 while(j >= && A[j]>v)
      |                               ^
a.cc: At global scope:
a.cc:30:1: error: '::main' must return 'int'
   30 | void main(){
      | ^~~~
Language: C++

#include<stdio.h>

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

void trace(int A[],int N){
	for(int i=0;i < N;i++)
	{

	if(i > 0) printf (" ");
	printf("%d",A[i]);
	
	}
	printf("\n");
}

void main(){
	int N,i;
	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 InsertionSort(int*, int)':
a.cc:15:17: error: 'trace' was not declared in this scope
   15 |                 trace(A,N);
      |                 ^~~~~
a.cc: At global scope:
a.cc:30:1: error: '::main' must return 'int'
   30 | void main(){
      | ^~~~
Language: C++

#include<stdio.h>

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

void trace(int A[],int N){
	for(int i=0;i < N;i++)
	{

	if(i > 0) printf (" ");
	printf("%d",A[i]);
	
	}
	printf("\n");
}

int main(){
	int N,i;
	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 InsertionSort(int*, int)':
a.cc:15:17: error: 'trace' was not declared in this scope
   15 |                 trace(A,N);
      |                 ^~~~~
Language: C++

#include <iostream>

namespace myspace{
	
	class vector{
	public:
		void push_back(int);
		int size();
		int &operator[](int);
		void resize(int);
		vector();
		vector(const vector&);
		~vector();
	private:
		int s;
		int* box;
		int capa;
	};
	
	vector::vector()
	{
		box = NULL;
		s = 0;
		capa = 0;
	}
	
	vector::vector(const vector &X)
	{
		s = X.s;
		box = new int[X.s];
		for(int i=0; i<X.s; i++)box[i] = X.box[i];
	}
	
	vector::~vector()
	{
		if(box)delete[] box;
	}
	
	int &vector::operator[](int i)
	{
		return box[i];
	}
	
	int vector::size()
	{
		return s;
	}
	
	void vector::resize(int input)
	{	
		if(capa < input)reserve(input);
		s = input;
	}
	
	void vector::reserve(int input)
	{	
		if(input <= capa)return;
		
		int* box2 = box;
		box = new int[input];
		for(int i=0; i<s; i++)box[i] = box2[i];
		delete[] box2;
		capa = input;
	}
	
	void vector::push_back(int input)
	{
		if(s+1 > capa){
			reserve(s * 2)
		}
		
		resize(s+1);	
		box[s] = input;
	}
}//??????????????????myspac

using namespace myspace;
using namespace std;

void Output(vector A)
{
    int i;
    for(i=0;i<A.size()-1;i++){
        cout << A[i] << " ";
    }
    cout << A[i] << endl;
}
 
void InsertionSort(vector A,int n)
{
    for(int i=0;i<n;i++)
    {
        int v = A[i];
        int j = i - 1;
        while(j>=0 && A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        Output(A);
    }
}
 
int main()
{   
    int n;
    cin >> n;
     
    vector A;
	A.resize(n);
	for(int i=0;i<n;i++){
		int a;
		cin >> A[i];
	}
    InsertionSort(A, n);
     
    return 0;
}

Compiler output:
a.cc: In member function 'void myspace::vector::resize(int)':
a.cc:51:33: error: 'reserve' was not declared in this scope
   51 |                 if(capa < input)reserve(input);
      |                                 ^~~~~~~
a.cc: At global scope:
a.cc:55:14: error: no declaration matches 'void myspace::vector::reserve(int)'
   55 |         void vector::reserve(int input)
      |              ^~~~~~
a.cc:55:14: note: no functions named 'void myspace::vector::reserve(int)'
a.cc:5:15: note: 'class myspace::vector' defined here
    5 |         class vector{
      |               ^~~~~~
a.cc: In member function 'void myspace::vector::push_back(int)':
a.cc:69:25: error: 'reserve' was not declared in this scope
   69 |                         reserve(s * 2)
      |                         ^~~~~~~
Language: C++


#include "stdafx.h"
#include<cstdio>
#include<iostream>
#include<cctype>
#include<algorithm>
using namespace std;

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

void insertSort(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;
		trace(N, A);
	}
}

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

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

#include <iostream>

namespace myspace{

	template<typename Type>
	class vector{
	public:
		void push_back(T);
		int size();
		Type &operator[](int);
		void resize(int);
		void reserve(int);
		vector();
		vector(const vector&);
		~vector();
	private:
		int s;
		int* box;
		int capa;
	};
	
	template<typename Type>
	vector<Type>::vector()
	{
		box = NULL;
		s = 0;
		capa = 0;
	}
	
	template<typename Type>
	vector<Type>::vector(const vector &X)
	{
		s = X.s;
		capa = X.capa;
		box = new int[X.s];
		for(int i=0; i<X.s; i++)box[i] = X.box[i];
	}
	
	template<typename Type>
	vector<Type>::~vector()
	{
		if(box)delete[] box;
	}
	
	template<typename Type>
	Type &vector<Type>::operator[](int i)
	{
		return box[i];
	}
	
	template<typename Type>
	int vector<Type>::size()
	{
		return s;
	}
	
	template<typename Type>
	void vector<Type>::resize(int input)
	{	
		if(capa < input)reserve(input);
		s = input;
	}
	
	template<typename Type>
	void vector<Type>::reserve(int input)
	{	
		if(input <= capa)return;
		
		int* box2 = box;
		box = new int[input];
		for(int i=0; i<s; i++)box[i] = box2[i];
		delete[] box2;
		capa = input;
	}
	
	template<typename Type>
	void vector<Type>::push_back(int input)
	{
		if(s+1 > capa){
			reserve(s * 2);
		}
		
		resize(s+1);	
		box[s] = input;
	}
}//??????????????????myspac

using namespace myspace;
using namespace std;


void Output(vector<int> A)
{
    int i;
    for(i=0;i<A.size()-1;i++){
        cout << A[i] << " ";
    }
    cout << A[i] << endl;
}
 
void InsertionSort(vector<int> A,int n)
{
    for(int i=0;i<n;i++)
    {
        int v = A[i];
        int j = i - 1;
        while(j>=0 && A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        Output(A);
    }
}
 
int main()
{   
    int n;
    cin >> n;
     
    vector<int> A;
	A.resize(n);
	for(int i=0;i<n;i++){
		int a;
		cin >> A[i];
	}
    InsertionSort(A, n);
     
    return 0;
}

Compiler output:
a.cc:8:32: error: 'T' has not been declared
    8 |                 void push_back(T);
      |                                ^
Language: C++

#include <cstdio>

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

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;
    trace(A, N);
  }
}

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

  scanf("%d", &N);
  for (int 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:8:15: error: expected ';' before '}' token
    8 |   printf("/n")
      |               ^
      |               ;
    9 | }
      | ~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdlib>

using namespace std;

void display(vector<int> ary_i) {
  for (int i = 0; i < ary_i.size(); i++) {
    if (i > 0) cout << " ";
    cout << ary_i[i];
  }

  cout << endl;
}

void insertSort(vector<int> ary) {
  int v, i, j;
  for (i = 0; i < ary.size(); i++) {
    v = ary[i];
    j = i - 1;
    while (j >= 0 && v < ary[j]) {
      ary[j + 1] = ary[j];
      j--;
    }
    ary[j + 1] = v;
    display(ary);
  }
}

int main(void) {
  int len, buf;
  vector<int> ary_i;
  char s[2000];

  cin >> len;

  for (int i = 0; i < len; i++) {
    cin >> s;
    ary_i.push_back(atoi(s));
  }

  insertSort(ary_i);

  return 0;
}

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

def InsertionSort(A , N):
	for i in range(1,N):
		v =  A[i]
		j = i -1 
		while j > -1 and A[j] > v:
			A[j+1] = A[j]
			j = j -1
		A[j+1] = v 
		print " ".join(map(str, A))

def main():
	N = int( raw_input() )
	A = map(int, raw_input().split())
	print " ".join(map(str, A))
	InsertionSort(A, N)

if __name__=='__main__':
	main()

Compiler output:
a.cc:17:14: 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++

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=Integer.valueOf(sc.next());
		int[] arr= new int[n];
		for(int i=0;i<n;i++){
			arr[i]=Integer.valueOf(sc.next());
		}
		sc.close();
		for(int i=1;i<n;i++){
			print(arr);
			int t=arr[i];
			int j=i-1;
			while(j>=0&&t<arr[j]){
				arr[j+1]=arr[j];
				j--;
			}
			arr[j+1]=t;
		}
		print(arr);
	}
	public static void print(int[] arr){
		System.out.print(arr[0]);
		for(int i= 1;i<arr.length;i++)
			System.out.print(" "+arr[i]);

		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:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <bits\stdc++.h>
#define rep(i,o,u) for(int i = o;i <= u; i++)
using namespace std;

int a[101];
int b[1001];
int main(){
	int n;
	cin >> n;
	rep(i,1,n){
		cin >> a[i];
	}
	memset(b,0,sizeof(b));
	rep(i,1,n){
		b[a[i]]++;
		int k = 0;
		rep(j,1,1001){
			int l = b[j];
			while(l > 0){
				cout << j << " ";
				l--;
				k++;
			}
		}
		if(k < n){
			rep(j,i+1,n-1) cout << a[j] << " ";
			cout << a[n] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
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; i++){
                for ( int k = 0; k < n; k++){
                        cout << A[k] << " ";
                }   
                cout << endl;
                int v = A[i];
                int j = i - 1;
                while( j >= 0 and A[j] > v){ 
                        A[j+1] = A[j];
                        j--;
                }   
                A[j+1] = v;
        }   

return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:16: error: 'cin' was not declared in this scope
    6 |         int n; cin >> n;
      |                ^~~
a.cc:15:25: error: 'cout' was not declared in this scope
   15 |                         cout << A[k] << " ";
      |                         ^~~~
a.cc:17:17: error: 'cout' was not declared in this scope
   17 |                 cout << endl;
      |                 ^~~~
a.cc:17:25: error: 'endl' was not declared in this scope
   17 |                 cout << endl;
      |                         ^~~~
Language: C++

#include <iostream>
using namespace std;
int k;
int cnt[102];
void print(int kj){
    for(int i=0;i<kj-1;i++){
        cout<<cnt[i]<<' ';
    }
    cout<<cnt[kj-1]<<'\n';
}
int main(){
    cin>>k;
    for (int i=0;i<k;++i){
        cin>>cnt[i];
    }
    print(k)
    for (int j=1,j<k;++j){
        int key = cnt[j];
        int idx = j-1;
        while(idx>=0 && key<cnt[idx]){
            cnt[idx+1]=cnt[idx];
            idx--;
        }
        cnt[idx+1]=key;
        print(k)
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: expected ';' before 'for'
   16 |     print(k)
      |             ^
      |             ;
   17 |     for (int j=1,j<k;++j){
      |     ~~~      
a.cc:17:24: error: 'j' was not declared in this scope
   17 |     for (int j=1,j<k;++j){
      |                        ^
Language: C++

#include <iostream>
using namespace std;
int k;
int cnt[102];
void print(int kj){
    for(int i=0;i<kj-1;i++){
        cout<<cnt[i]<<' ';
    }
    cout<<cnt[kj-1]<<'\n';
}
int main(){
    cin>>k;
    for (int i=0;i<k;++i){
        cin>>cnt[i];
    }
    print(k)
    for (int j=1;j<k;++j){
        int key = cnt[j];
        int idx = j-1;
        while(idx>=0 && key<cnt[idx]){
            cnt[idx+1]=cnt[idx];
            idx--;
        }
        cnt[idx+1]=key;
        print(k)
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: expected ';' before 'for'
   16 |     print(k)
      |             ^
      |             ;
   17 |     for (int j=1;j<k;++j){
      |     ~~~      
a.cc:17:18: error: 'j' was not declared in this scope
   17 |     for (int j=1;j<k;++j){
      |                  ^
Language: C++

#include<stdio.h>

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


int 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=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:9:16: error: expected ';' before '}' token
    9 |    printf("\n")
      |                ^
      |                ;
   10 | }
      | ~               
a.cc: In function 'int insertionSort(int*, int)':
a.cc:22:19: error: 'a' was not declared in this scope
   22 |       while(j>=0&&a[j]>v){
      |                   ^
a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
Language: C++

#include<stdio.h>

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


int 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=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:9:16: error: expected ';' before '}' token
    9 |    printf("\n")
      |                ^
      |                ;
   10 | }
      | ~               
a.cc: In function 'int insertionSort(int*, int)':
a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
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")
}


int 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=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:9:16: error: expected ';' before '}' token
    9 |    printf("\n")
      |                ^
      |                ;
   10 | }
      | ~               
a.cc: In function 'int insertionSort(int*, int)':
a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
Language: C++

#include <stdio.h>

int main(void)
{

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: expected ';' before 'while'
   16 |    j = i - 1
      |             ^
      |             ;
   17 |     while (j >= 0 && A[j] > v) {
      |     ~~~~~    
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <stdio.h>

int main(void)
{

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

  scanf ("%d\n", &N);

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

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

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

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

  
   } 
return 0;
}

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

#include<stdio.h>

int main (void) {
	int i, n, j, a[1000], b[1000][1000] = 0, k = 0, v, temp;
	
	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 (j = 0; j < n; ++j)
		{
			b[k][j] = a[j];
		}
		++k;
	}
	
	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < n; ++j)
		{
			printf("%d ", b[i][j]);
		}
		printf("\n");
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:47: error: array must be initialized with a brace-enclosed initializer
    4 |         int i, n, j, a[1000], b[1000][1000] = 0, k = 0, v, temp;
      |                                               ^
Language: C++

#include<stdio.h>

int main(void) {
	int i, n, j, a[1000], b[1000][1000] = 0, k = 0, v, temp;
	
	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 (j = 0; j < n; ++j)
		{
			b[k][j] = a[j];
		}
		++k;
	}
	
	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < n; ++j)
		{
			printf("%d ", b[i][j]);
		}
		printf("\n");
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:47: error: array must be initialized with a brace-enclosed initializer
    4 |         int i, n, j, a[1000], b[1000][1000] = 0, k = 0, v, temp;
      |                                               ^
Language: C++

#include<stdio.h>

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:42: error: expected ';' before '}' token
   15 |                 if (j != n-1) printf(" ")
      |                                          ^
      |                                          ;
   16 |         }
      |         ~                                 
a.cc:35:50: error: expected ';' before '}' token
   35 |                         if (j != n-1) printf(" ")
      |                                                  ^
      |                                                  ;
   36 |                 }
      |                 ~
Language: C++

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

void split(int * array){
    string strhozon, str;
    getline(cin, strhozon);
    stringstream ss(strhozon);
    int i =0;
    while(getline(ss, str, ' ')){
        array[i] = stoi(str);
        i++;
    }
}
void show(int * array, int x){
    for (int i=0; i < x-1; i++) {
	cout << array[i] << " " ;
    }
    cout << array[x] << endl;
    return ;
}

int main(int argc, char *argv[])
{
    string str ;
    cin >> str ;
    int x = stoi(str) ;
    int * a = new int [x] ;
    sprit(a) ;
    for (int i=1; i < x; i++) {
	show(a,x);
	int v = a[i] ;
	int j = i-1 ;
	while (a[j]>v && j >= 0) {
	    a[j+1] = a[j] ;
	    j-- ;
	}
	a[j+1] = v ;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:29:5: error: 'sprit' was not declared in this scope; did you mean 'split'?
   29 |     sprit(a) ;
      |     ^~~~~
      |     split
Language: C++

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

void split(int * array){
    string strhozon, str;
    getline(cin, strhozon);
    stringstream ss(strhozon);
    int i =0;
    while(getline(ss, str, ' ')){
        array[i] = stoi(str);
        i++;
    }
}
void show(int * array, int x){
    for (int i=0; i < x-1; i++) {
	cout << array[i] << " " ;
    }
    cout << array[x] << endl;
    return ;
}

int main(int argc, char *argv[])
{
    int x ;
    cin >> x ;
    int * a = new int [x] ;
    sprit(a) ;
    for (int i=1; i < x; i++) {
	show(a,x);
	int v = a[i] ;
	int j = i-1 ;
	while (a[j]>v && j >= 0) {
	    a[j+1] = a[j] ;
	    j-- ;
	}
	a[j+1] = v ;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:28:5: error: 'sprit' was not declared in this scope; did you mean 'split'?
   28 |     sprit(a) ;
      |     ^~~~~
      |     split
Language: C++

import java.io.IOException;
import java.util.Scanner;
class Test {
    public static void main(String args[]) throws IOException {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];
    	int val;


    	for(int i=0;i<n;i++){
    		val = scan.nextInt();
//    		System.out.println(val);
    		a[i]=val;
    	}


    	int v;
    	int j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;
        	for(int f=0;f<n;f++){
        		System.out.print(a[f]+" ");

        	}
        	System.out.println();
    	}

    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.IOException;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:11: error: expected ':' before 'static'
    4 |     public static void main(String args[]) throws IOException {
      |           ^~~~~~~
      |           :
a.cc:4:29: error: 'String' has not been declared
    4 |     public static void main(String args[]) throws IOException {
      |                             ^~~~~~
a.cc:4:42: error: expected ';' at end of member declaration
    4 |     public static void main(String args[]) throws IOException {
      |                                          ^
      |                                           ;
a.cc:4:44: error: 'throws' does not name a type
    4 |     public static void main(String args[]) throws IOException {
      |                                            ^~~~~~
a.cc:36:2: error: expected ';' after class definition
   36 | }
      |  ^
      |  ;
Language: C++

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

int main(void){
  int i = 0;
  int k = 0;
  int j = 0;
  int n;
  int input;
  int *num;
  int temp;

  scanf("%d", &n);
  num = (int *)malloc(n * sizeof(int));

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:22: error: expected ';' before '}' token
   26 |         num[k] = temp
      |                      ^
      |                      ;
   27 |       }
      |       ~
Language: C++

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

int main(void){
  int i = 0;
  int k = 0;
  int j = 0;
  int n;
  int input;
  int *num;
  int temp;

  scanf("%d", &n);
  num = (int *)malloc(n * sizeof(int));

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

  for(i = 1; i < n; i++){
    for(k = i; k >= 0; k++){
      if(num[k] < num[k-1]){
        temp = num[k-1];
        num[k-1] = num[k];
        num[k] = temp;
      }
      for(j = 0; j < n; j++){
        print("%d ", num[j]);
      }
      printf("");
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'print' was not declared in this scope; did you mean 'printf'?
   29 |         print("%d ", num[j]);
      |         ^~~~~
      |         printf
Language: C++

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

int main(void){
  int i = 0;
  int k = 0;
  int j = 0;
  int n;
  int input;
  int *num;
  int temp;

  scanf("%d", &n);
  num = (int *)malloc(n * sizeof(int));

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'pintf' was not declared in this scope; did you mean 'printf'?
   24 |     pintf(" ");
      |     ^~~~~
      |     printf
a.cc:26:3: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   26 |   prinf("\n")
      |   ^~~~~
      |   printf
a.cc:28:24: error: expected ';' before ')' token
   28 |   for(i = 1; i < n; i++){
      |                        ^
      |                        ;
Language: C++

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

int main(void){
  int i = 0;
  int k = 0;
  int j = 0;
  int n;
  int input;
  int *num;
  int temp;

  scanf("%d", &n);
  num = (int *)malloc(n * sizeof(int));

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   26 |   prinf("\n")
      |   ^~~~~
      |   printf
a.cc:28:24: error: expected ';' before ')' token
   28 |   for(i = 1; i < n; i++){
      |                        ^
      |                        ;
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <stdio.h>
#include <tchar.h>

using namespace std;

string intArrayToString(int* ary, int ary_size);
void insert_sort(string ary, int ary_size);

int main()
{
	string str;
	getline(cin, str);
	stringstream ss_size(str);
	int ary_size;
	ss_size >> ary_size;

	getline(cin, str);

	insert_sort(str, ary_size);

    return 0;
}

void insert_sort(string ary, int ary_size) {
	// pram div into int array
	stringstream ss(ary);
	string buff;
	int* tar_ary = new int[ary_size];
	int cnt = 0;

	while (getline(ss, buff, ' ')) {
		stringstream num_ss(buff);
		num_ss >> tar_ary[cnt];
		cnt++;
	}

	for (int i = 1; i < ary_size; i++) {
		int v = tar_ary[i];
		int cnt = 0;
		for (int j = i - 1; j >= 0 && tar_ary[j] > v; j--) {			
			tar_ary[j + 1] = tar_ary[j];
			cnt = j;
			tar_ary[cnt] = v;
		}
		cout << intArrayToString(tar_ary, ary_size) << endl;
	}
	delete(tar_ary);

	return;
}

string intArrayToString(int* ary, int ary_size) {
	string str = "";
	for (int i = 0; i < ary_size; i++) {
		if (i == ary_size - 1) {
			str += to_string(ary[i]);
		}
		else {
			str += to_string(ary[i]) + " ";
		}
	}
	return str;
}

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

#include <iostream>
using namespace std;

int main() {
	int N,s; 
	cin >> N;
	int A[N];
	cin >> A[N];
	
	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 (s=0; s<=N-2; s++)
		cout<<A[s]<<" ";
		
		cout<<A[N-1]<<'\n';
	}
	
	
	// your code goes here
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'i' was not declared in this scope
   10 |         for (i=1; i<=N-1; i++) {
      |              ^
a.cc:11:17: error: 'v' was not declared in this scope
   11 |                 v=A[i];
      |                 ^
a.cc:12:17: error: 'j' was not declared in this scope
   12 |                 j=i-1;
      |                 ^
Language: C++

#include <iostream>
using namespace std;

int main() {
	int N, i, v, j, s; 
	cin >> N;
	int A[N];
	cin >> A[N];
	
	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 (s=0; s<=N-2; s++)
		cout<<A[s]<<" ";
		
		cout<<A[N-1]<<'\n';
	}
	
	
	// your code goes here
	return 0;
}
	
	
	// your code goes here
	return 0;
}

Compiler output:
a.cc:32:9: error: expected unqualified-id before 'return'
   32 |         return 0;
      |         ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: C++

#include <iostream>
void traceALDS11A(int arr[], int max) {
	for (int i = 0; i < max; ++i) {
		if (i)
			std::cout << " ";
		std::cout << arr[i];
	}
	std::cout << std::endl;
}

int ALDS11A() {

	int N;
	std::cin >> N;

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

	traceALDS11A(arr, N);

	for (int i = 1; i < N; ++i) {
		int v = arr[i];
		for (int j = i - 1; j >= 0; --j) {
			if (v < arr[j]) {
				std::swap(arr[j], arr[j + 1]);
			} else {
				break;
			}
		}
		traceALDS11A(arr, N);
	}

	return 0;
}

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++

int main(void) {
	int N;
	int A[1000];
	int v;
	int j;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);
	//for (int j = 0; j < N; j++) printf("%d", A[j]);
	for (int i = 0; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j>=0) {
			if (A[j] <= v) break;
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
	}
	for (int k = 0; k < N; k++) printf("%d\n", A[k]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
    6 |         scanf("%d", &N);
      |         ^~~~~
a.cc:19:37: error: 'printf' was not declared in this scope
   19 |         for (int k = 0; k < N; k++) printf("%d\n", A[k]);
      |                                     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void) {
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+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:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
a.cc: In function 'void insertionSort(int*, int)':
a.cc:23:17: error: 'trace' was not declared in this scope
   23 |                 trace(A,N);
      |                 ^~~~~
a.cc: In function 'int main()':
a.cc:32:9: error: 'scanf' was not declared in this scope
   32 |         scanf("%d", &N);
      |         ^~~~~
a.cc:35:9: error: 'trace' was not declared in this scope
   35 |         trace(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]);
 }
printf("\n");
}

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

}

int main(){
	int N,i,j;
	int A[100];
	
	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:5:2: error: declaration does not declare anything [-fpermissive]
    5 |  int;i
      |  ^~~
a.cc:5:6: error: 'i' was not declared in this scope
    5 |  int;i
      |      ^
Language: C++

import java.util.Scanner;

class InsertionSort {
  static void arrayContents(int[] a){
    for(int i = 0;i < a.length;i++){
      if(i < a.length - 1){
        System.out.print(a[i] + " ");
      }
        else{
          System.out.print(a[i]);
        }
    }
    System.out.println();
  }
  public static void main(String[] args){
  Scanner scan = new Scanner(System.in);
  int n = scan.nextInt();
  int[] A = new int[n];
  for(int i = 0; i<n;i++){
    A[i] = scan.nextInt();
  }
  for(int i = 1; i < n; i++){
    int v = A[i];
    int j = i-1;
    while(j >= 0 && A[j] > v){
      int t = A[j + 1];
      A[j + 1] = A[j];
      A[j] = t;
      j--;
      arrayContents(A);
    }
  }
  }
}

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:35: error: expected ',' or '...' before 'a'
    4 |   static void arrayContents(int[] a){
      |                                   ^
a.cc:15:9: error: expected ':' before 'static'
   15 |   public static void main(String[] args){
      |         ^~~~~~~
      |         :
a.cc:15:27: error: 'String' has not been declared
   15 |   public static void main(String[] args){
      |                           ^~~~~~
a.cc:15:36: error: expected ',' or '...' before 'args'
   15 |   public static void main(String[] args){
      |                                    ^~~~
a.cc:34:2: error: expected ';' after class definition
   34 | }
      |  ^
      |  ;
a.cc: In static member function 'static void InsertionSort::arrayContents(int*)':
a.cc:5:23: error: 'a' was not declared in this scope
    5 |     for(int i = 0;i < a.length;i++){
      |                       ^
a.cc:7:9: error: 'System' was not declared in this scope
    7 |         System.out.print(a[i] + " ");
      |         ^~~~~~
a.cc:10:11: error: 'System' was not declared in this scope
   10 |           System.out.print(a[i]);
      |           ^~~~~~
a.cc:13:5: error: 'System' was not declared in this scope
   13 |     System.out.println();
      |     ^~~~~~
a.cc: In static member function 'static void InsertionSort::main(int*)':
a.cc:16:3: error: 'Scanner' was not declared in this scope
   16 |   Scanner scan = new Scanner(System.in);
      |   ^~~~~~~
a.cc:17:11: error: 'scan' was not declared in this scope
   17 |   int n = scan.nextInt();
      |           ^~~~
a.cc:18:6: error: structured binding declaration cannot have type 'int'
   18 |   int[] A = new int[n];
      |      ^~
a.cc:18:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:18:6: error: empty structured binding declaration
a.cc:18:9: error: expected initializer before 'A'
   18 |   int[] A = new int[n];
      |         ^
a.cc:20:5: error: 'A' was not declared in this scope
   20 |     A[i] = scan.nextInt();
      |     ^
a.cc:23:13: error: 'A' was not declared in this scope
   23 |     int v = A[i];
      |             ^
Language: C++

#define REP(i,n) for (int i=0;i<(n);i++)

using namespace std;

int N,v,j;

void insertionSort(int *list, int size);
void print(int *list, int size);

int main()
{
    scanf("%d", &N);
    int list[N];
    REP(i, N){
      scanf("%d", &list[i]);
    }
    insertionSort(list, N);
    return 0;
}

void insertionSort(int *list, int size)
{
    print(list, size);
    FOR(i, 1, size){
        v = list[i];
        j = i - 1;
        while( j >= 0 && list[j] > v) {
            list[j+1] = list[j];
            j--;
        }
        list[j+1] = v;
        print(list, size);
    }
}

void print(int *list, int size) {
    REP(i, size){
      if (i == size - 1) {
        cout << list[i] << endl;
      } else {
        cout << list[i] << " ";
      }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'scanf' was not declared in this scope
   12 |     scanf("%d", &N);
      |     ^~~~~
a.cc: In function 'void insertionSort(int*, int)':
a.cc:24:9: error: 'i' was not declared in this scope
   24 |     FOR(i, 1, size){
      |         ^
a.cc:24:5: error: 'FOR' was not declared in this scope
   24 |     FOR(i, 1, size){
      |     ^~~
a.cc: In function 'void print(int*, int)':
a.cc:39:9: error: 'cout' was not declared in this scope
   39 |         cout << list[i] << endl;
      |         ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define REP(i,n) for (int i=0;i<(n);i++)
a.cc:39:28: error: 'endl' was not declared in this scope
   39 |         cout << list[i] << endl;
      |                            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define REP(i,n) for (int i=0;i<(n);i++)
a.cc:41:9: error: 'cout' was not declared in this scope
   41 |         cout << list[i] << " ";
      |         ^~~~
a.cc:41:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>
#define REP(i,n) for (int i=0;i<(n);i++)

using namespace std;

int N,v,j;

void insertionSort(int *list, int size);
void print(int *list, int size);

int main()
{
    scanf("%d", &N);
    int list[N];
    REP(i, N){
      scanf("%d", &list[i]);
    }
    insertionSort(list, N);
    return 0;
}

void insertionSort(int *list, int size)
{
    print(list, size);
    FOR(i, 1, size){
        v = list[i];
        j = i - 1;
        while( j >= 0 && list[j] > v) {
            list[j+1] = list[j];
            j--;
        }
        list[j+1] = v;
        print(list, size);
    }
}

void print(int *list, int size) {
    REP(i, size){
      if (i == size - 1) {
        cout << list[i] << endl;
      } else {
        cout << list[i] << " ";
      }
    }
}

Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:25:9: error: 'i' was not declared in this scope
   25 |     FOR(i, 1, size){
      |         ^
a.cc:25:5: error: 'FOR' was not declared in this scope
   25 |     FOR(i, 1, size){
      |     ^~~
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <time.h>
using namespace std;

void insertSort(int arr[], int n){
    for(int i = 1;i < n;i++){
        int temp = arr[i];
        int j = i-1;
        for(;j>=0;j--){
            if(temp < arr[j]){
                arr[j+1] = arr[j];
            } else {
                break;
            }
        }
        arr[j+1] = temp;

        for(int q = 0;q< n;q++){

            cout<<arr[q];
            if(q != n-1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
}


int main(){
    int n;
    int arr[110];
    cin>>n;
    for (int i = 0; i < n;i++) {
        cin>>arr[i];
    }
    for(int q = 0;q< n;q++){

        cout<<arr[q];
        if(q != n-1){
            cout<<" ";
        }
    }
    cout<<endl;
    insertSort(arr, n);




}


int main(){
    int n;
    int arr[110];
    cin>>n;
    for (int i = 0; i < n;i++) {
        cin>>arr[i];
    }
    for(int q = 0;q< n;q++){
        cout<<arr[q]<<" ";
    }
    cout<<endl;
    insertSort(arr, n);




}

Compiler output:
a.cc:57:5: error: redefinition of 'int main()'
   57 | int main(){
      |     ^~~~
a.cc:34:5: note: 'int main()' previously defined here
   34 | int main(){
      |     ^~~~
Language: C++


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

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

     A[j+1] = v;
     {
       int k;
       for (k = 0; k < N; k++) {
         if (k > 0) printf(" ");
         printf("%d", A[k]);
       }
       printf("\n");
     }
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:4: error: 'scanf' was not declared in this scope
    6 |    scanf("%d", &N);
      |    ^~~~~
a.cc:23:21: error: 'printf' was not declared in this scope
   23 |          if (k > 0) printf(" ");
      |                     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | 
a.cc:24:10: error: 'printf' was not declared in this scope
   24 |          printf("%d", A[k]);
      |          ^~~~~~
a.cc:24:10: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:26:8: error: 'printf' was not declared in this scope
   26 |        printf("\n");
      |        ^~~~~~
a.cc:26:8: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++


#include "stdafx.h"
#include<iostream>
using namespace std;

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

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

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

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

 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int arr[100+5];
 
 int main()
 {
   int n;
   cin>>n;
   for(int i=0;i<n;i++) cin>>arr[i];
   for(int i=0;i<n-1;i++) cout<<arr[i]<<" ";
   cout<<arr[n-1]<<endl;
   for(int i=1;i<n;i++)
   {
     int key=arr[i];
     int j=i-1;
     while(j>=0&&arr[j]>key)
     {
       arr[j+1]=arr[j];
       j--;                     
     }     
     j++;
     arr[j]=key;   
     for(int k=0;k<n-1;k++) cout<<arr[k]<<" ";
     cout<<arr[k-1]<<endl;
   }
   //while(1);
   return 0;
 }
 
 

Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: 'k' was not declared in this scope
   39 |      cout<<arr[k-1]<<endl;
      |                ^