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

include <iostream>
using namespace std;

int A[1000];
int N;

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

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


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

	for (int i = 1; i < N ; ++i) {
		if (i == 1) {
			Show(A, N);
		}
		j = i - 1;
		insertionSort(A, N, i, j);
		Show(A, N);
	}

}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'void Show(int*, int)':
a.cc:10:25: error: 'cout' was not declared in this scope
   10 |                         cout << " ";
      |                         ^~~~
a.cc:12:17: error: 'cout' was not declared in this scope
   12 |                 cout << A[i];
      |                 ^~~~
a.cc:14:9: error: 'cout' was not declared in this scope
   14 |         cout << endl;
      |         ^~~~
a.cc:14:17: error: 'endl' was not declared in this scope
   14 |         cout << endl;
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:30:9: error: 'cin' was not declared in this scope
   30 |         cin >> N;
      |         ^~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

void printarr(vector<int> arr,int n){
    for(int i=0;i<arr.size()-1;i++){
        cout<<arr[i]<<" ";
    }
    cout<<arr[arr.size()-1]<<endl;
    return;
}


int main() {
    int n;
    vector<int> arr;
    cin>>n;
    for(int i=0,t;i<n;i++){
        cin>>t;
        arr.push_back(t);
    }
    for(int i=0;i<n;i++){
        int temp=arr[i];
        int j;
        for(j=i-1;j>=0;j--){
            if(arr[j]>temp){
                arr[j+1]=arr[j];
            }
        }
        arr[j+1]=temp;
        printarr(arr,n);
    }
    return 0;
}



Compiler output:
a.cc:6:6: error: variable or field 'printarr' declared void
    6 | void printarr(vector<int> arr,int n){
      |      ^~~~~~~~
a.cc:6:15: error: 'vector' was not declared in this scope
    6 | void printarr(vector<int> arr,int n){
      |               ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:6:22: error: expected primary-expression before 'int'
    6 | void printarr(vector<int> arr,int n){
      |                      ^~~
a.cc:6:31: error: expected primary-expression before 'int'
    6 | void printarr(vector<int> arr,int n){
      |                               ^~~
a.cc: In function 'int main()':
a.cc:17:5: error: 'vector' was not declared in this scope
   17 |     vector<int> arr;
      |     ^~~~~~
a.cc:17:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:17:12: error: expected primary-expression before 'int'
   17 |     vector<int> arr;
      |            ^~~
a.cc:21:9: error: 'arr' was not declared in this scope
   21 |         arr.push_back(t);
      |         ^~~
a.cc:24:18: error: 'arr' was not declared in this scope
   24 |         int temp=arr[i];
      |                  ^~~
a.cc:32:9: error: 'printarr' was not declared in this scope; did you mean 'printf'?
   32 |         printarr(arr,n);
      |         ^~~~~~~~
      |         printf
Language: C++

#include<iostream>
int main(){
  int n,A[100];
  std::cin>>n;
  for(int i=0;i<n;i++){
    std::cin>>A[i];
  }
  for(int i=0;i<n;i++){
    if(i!=0){
      for(int j=0;j<i;j++){
	if(A[i-j]<A[i-j-1]){
	  int ex=A[i-j];
	  A[i-j]=A[i-j-1];
	  A[i-j-1]=ex;
	}//入れ替え
      }
    }
    for(int k=0;k<n;k++){
      std::cout<<A[k]<<;//出力
      if(k<n-1)std::cout<<' ';
    }
    std::cout<<'\n';
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: expected primary-expression before ';' token
   19 |       std::cout<<A[k]<<;//出力
      |                        ^
Language: C++

void Insertionsort(int A[],int N)
{
	int v;
	int j;
	for(int i=0;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 i=0;i<=N-1;i++){
			std::cout << A[i] << " " ;
		}
		if(i!=N-1){
			std::cout << "\n" ;
		}
	}

}

int main()
{

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



Compiler output:
a.cc: In function 'void Insertionsort(int*, int)':
a.cc:14:30: error: 'cout' is not a member of 'std'
   14 |                         std::cout << A[i] << " " ;
      |                              ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | void Insertionsort(int A[],int N)
a.cc:17:30: error: 'cout' is not a member of 'std'
   17 |                         std::cout << "\n" ;
      |                              ^~~~
a.cc:17:30: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc: In function 'int main()':
a.cc:27:14: error: 'cin' is not a member of 'std'
   27 |         std::cin >> N;
      |              ^~~
a.cc:27:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:22: error: 'cin' is not a member of 'std'
   30 |                 std::cin >> A[i];
      |                      ^~~
a.cc:30:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>

void insertion(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;
        std::cout << A;
    }
}


int main(){
    int n;
    std::cin >> n;
    int A[n] = {0};
    for(int i=0;i<n;i++){
        std::cin >> A[i];
    }
    insertion(&A,n);
    return 0;
}


Compiler output:
a.cc:3:22: error: expected ',' or '...' before 'A'
    3 | void insertion(int[] A, int n){
      |                      ^
a.cc: In function 'void insertion(int*)':
a.cc:4:19: error: 'n' was not declared in this scope
    4 |     for(int i=0;i<n;i++){
      |                   ^
a.cc:5:17: error: 'A' was not declared in this scope
    5 |         int v = A[i];
      |                 ^
a.cc:7:23: error: 'a' was not declared in this scope
    7 |         while(j>=0 && a[j]>v){
      |                       ^
a.cc: In function 'int main()':
a.cc:24:15: error: cannot convert 'int (*)[n]' to 'int*'
   24 |     insertion(&A,n);
      |               ^~
      |               |
      |               int (*)[n]
a.cc:3:16: note:   initializing argument 1 of 'void insertion(int*)'
    3 | void insertion(int[] A, int n){
      |                ^~~~~
Language: C++

#include <iostream>

void insertion(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;
        std::cout << A;
    }
}


int main(){
    int n;
    std::cin >> n;
    int A[n] = {0};
    for(int i=0;i<n;i++){
        std::cin >> A[i];
    }
    insertion(A,n);
    return 0;
}


Compiler output:
a.cc:3:22: error: expected ',' or '...' before '&' token
    3 | void insertion(int[] &A, int n){
      |                      ^
a.cc: In function 'void insertion(int*)':
a.cc:4:19: error: 'n' was not declared in this scope
    4 |     for(int i=0;i<n;i++){
      |                   ^
a.cc:5:17: error: 'A' was not declared in this scope
    5 |         int v = A[i];
      |                 ^
a.cc:7:23: error: 'a' was not declared in this scope
    7 |         while(j>=0 && a[j]>v){
      |                       ^
a.cc: In function 'int main()':
a.cc:24:14: error: too many arguments to function 'void insertion(int*)'
   24 |     insertion(A,n);
      |     ~~~~~~~~~^~~~~
a.cc:3:6: note: declared here
    3 | void insertion(int[] &A, int n){
      |      ^~~~~~~~~
Language: C++

#include <iostream>

void inpt_array(int a[], int n){
    for(int i=0; i<n; i++){
        std::cin >> a[i];
    }
}

void print_array(int a[], int n){
    for(int i=0; i<n; i++){
        std::cout << a[i];
        if(i<n-1){
            std::cout << " ";
        }
    }
    std::cout << '\n';
}

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

int main(){

    int N;
    std::cin >> N;
    int A[N];
    input_array(A,N);
    sort(A,N);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'input_array' was not declared in this scope; did you mean 'inpt_array'?
   38 |     input_array(A,N);
      |     ^~~~~~~~~~~
      |     inpt_array
Language: C++

n=int(input())
l=list(map(int,input().split()))
print(*l)

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

    print(*l)



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

#include<iostream>
#include<vector>
int main(){
  int n;
  std::cin>>n;
  std::vector<int> a［n］;
  for(int i=0;i<=n;i++)｛
    int x;
    std::cin>>x;
    a.append(x);
  }
  for(int i=1;i<=n-1;i++)｛
    int v=a［i］,j=i-1;
    while(j>=0&&a［j］>v){
      a［i］=a［j］;
      j--;
      a［j］=v;
    }
  }
  std::cout<<a;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: '\U0000ff5b' was not declared in this scope
    7 |   for(int i=0;i<=n;i++)｛
      |                        ^~
a.cc:9:15: error: 'x' was not declared in this scope
    9 |     std::cin>>x;
      |               ^
a.cc:10:5: error: 'a' was not declared in this scope
   10 |     a.append(x);
      |     ^
a.cc: At global scope:
a.cc:12:3: error: expected unqualified-id before 'for'
   12 |   for(int i=1;i<=n-1;i++)｛
      |   ^~~
a.cc:12:15: error: 'i' does not name a type
   12 |   for(int i=1;i<=n-1;i++)｛
      |               ^
a.cc:12:22: error: 'i' does not name a type
   12 |   for(int i=1;i<=n-1;i++)｛
      |                      ^
a.cc:14:5: error: expected unqualified-id before 'while'
   14 |     while(j>=0&&a［j］>v){
      |     ^~~~~
a.cc:19:3: error: expected declaration before '}' token
   19 |   }
      |   ^
a.cc:20:8: error: 'cout' in namespace 'std' does not name a type
   20 |   std::cout<<a;
      |        ^~~~
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:21:3: error: expected unqualified-id before 'return'
   21 |   return 0;
      |   ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

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


int main() {
	int n;
	vector<int> a(100);
	int v;
	int j;
	cin >> n;
	for (int i = 0; i<n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i<n; i++)
	{
		cout << a[i] << ' ';
	}
	cout << "\n" ;
	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 k = 0; k<n; k++)
		{
			cout << a[k] << ' ';
		}
		cout << "\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++

#include <iostream>
 int main() {
  int N,
  std::vector<int> A[N];
  std::cin >> N >> A;
   insertionSort(A, N);
   for (int i = 0; i <= N; i++;) {
    int v = A[N];
    int j = i - 1;
     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:4:14: error: qualified-id in declaration before '<' token
    4 |   std::vector<int> A[N];
      |              ^
a.cc:5:20: error: 'A' was not declared in this scope
    5 |   std::cin >> N >> A;
      |                    ^
a.cc:6:4: error: 'insertionSort' was not declared in this scope
    6 |    insertionSort(A, N);
      |    ^~~~~~~~~~~~~
a.cc:7:31: error: expected ')' before ';' token
    7 |    for (int i = 0; i <= N; i++;) {
      |        ~                      ^
      |                               )
a.cc:7:32: error: expected primary-expression before ')' token
    7 |    for (int i = 0; i <= N; i++;) {
      |                                ^
Language: C++

#pragma once
#include <array>
#include "ISorter.h"

class MySorter
{
private:
    ISorter *sorter;
public:
    MySorter(ISorter *sorter);
    ~MySorter();
    bool Sort(std::vector<int> array);
};

#pragma once
#include <vector>
#include "ISorter.h"
class InsertionSort : public ISorter
{
public:
    bool Sort(std::vector<int>&);
    InsertionSort();
    ~InsertionSort();
};

#pragma once
#include <vector>
#include "ISorter.h"
class InsertionSort : public ISorter
{
public:
    bool Sort(std::vector<int>&);
    InsertionSort();
    ~InsertionSort();
};

// InsertionSort.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <memory>
#include "InsertionSort.h"
#include "MySorter.h"
#include "ISorter.h"

void printArray(const std::vector<int> &array);
std::vector<int> readArray(void);

int main()
{
    int n = 0;
    std::string input;
    std::getline(std::cin, input);
    n = std::stoi(input);

    std::vector<int> array = readArray();

    std::unique_ptr<InsertionSort> algorithm = std::make_unique<InsertionSort>();
    std::unique_ptr<MySorter> sorter = std::make_unique<MySorter>(algorithm.get());

    sorter->Sort(array);

    return 0;
}


void printArray(const std::vector<int> &array)
{
    for (unsigned int k = 0; k < array.size(); k++) {
        std::cout << array[k];
        if (k != array.size() - 1) {
            std::cout << " ";
        }
    }
    std::cout << std::endl;
}

std::vector<int> readArray(void)
{
    std::string input;
    std::vector<int> array;

    std::getline(std::cin, input);
    std::stringstream ss(input);

    std::string buf;
    while (ss >> buf) {
        array.push_back(std::stoi(buf));
    }

    return array;
}


#include <memory>
#include "MySorter.h"
#include "ISorter.h"

MySorter::MySorter(ISorter *sorter)
{
    this->sorter = sorter;
}

MySorter::~MySorter()
{
}

bool MySorter::Sort(std::vector<int> array)
{
    return sorter->Sort(array);
}
#include "InsertionSort.h"
#include <iostream>

InsertionSort::InsertionSort()
{
}

InsertionSort::~InsertionSort()
{
}

bool InsertionSort::Sort(std::vector<int> &array)
{
    int n = array.size();

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

        for (unsigned int k = 0; k < array.size(); k++) {
            std::cout << array[k];
            if (k != array.size() - 1) {
                std::cout << " ";
            }
        }
        std::cout << std::endl;
    }

    return true;
}


Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc:3:10: fatal error: ISorter.h: No such file or directory
    3 | #include "ISorter.h"
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++


#include <vector>

class ISorter
{
public:
    virtual bool Sort(std::vector<int>&) = 0;
};

#include <array>


class MySorter
{
private:
    ISorter *sorter;
public:
    MySorter(ISorter *sorter);
    ~MySorter();
    bool Sort(std::vector<int> array);
};


#include <vector>

class InsertionSort : public ISorter
{
public:
    bool Sort(std::vector<int>&);
    InsertionSort();
    ~InsertionSort();
};


#include <vector>

class InsertionSort : public ISorter
{
public:
    bool Sort(std::vector<int>&);
    InsertionSort();
    ~InsertionSort();
};

// InsertionSort.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <memory>


void printArray(const std::vector<int> &array);
std::vector<int> readArray(void);

int main()
{
    int n = 0;
    std::string input;
    std::getline(std::cin, input);
    n = std::stoi(input);

    std::vector<int> array = readArray();

    std::unique_ptr<InsertionSort> algorithm = std::make_unique<InsertionSort>();
    std::unique_ptr<MySorter> sorter = std::make_unique<MySorter>(algorithm.get());

    sorter->Sort(array);

    return 0;
}


void printArray(const std::vector<int> &array)
{
    for (unsigned int k = 0; k < array.size(); k++) {
        std::cout << array[k];
        if (k != array.size() - 1) {
            std::cout << " ";
        }
    }
    std::cout << std::endl;
}

std::vector<int> readArray(void)
{
    std::string input;
    std::vector<int> array;

    std::getline(std::cin, input);
    std::stringstream ss(input);

    std::string buf;
    while (ss >> buf) {
        array.push_back(std::stoi(buf));
    }

    return array;
}


#include <memory>

MySorter::MySorter(ISorter *sorter)
{
    this->sorter = sorter;
}

MySorter::~MySorter()
{
}

bool MySorter::Sort(std::vector<int> array)
{
    return sorter->Sort(array);
}
#include "InsertionSort.h"
#include <iostream>

InsertionSort::InsertionSort()
{
}

InsertionSort::~InsertionSort()
{
}

bool InsertionSort::Sort(std::vector<int> &array)
{
    int n = array.size();

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

        for (unsigned int k = 0; k < array.size(); k++) {
            std::cout << array[k];
            if (k != array.size() - 1) {
                std::cout << " ";
            }
        }
        std::cout << std::endl;
    }

    return true;
}


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


#include<iostream>

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

int main()
{
  int n,i,j;
  std::cin>>n;

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

  for(j=1;j<=n;++j){
    insertionSort(a,j);
    for(i=0;i<n-1;++i){
      std::cout<<a[i]<<" ";
    }
    std::cout<<a[n-1]<<"\n";
  }


  return 0;
}
  for(j=1;j<=n;++j){
    insertionSort(a,j);
    for(i=0;i<n-1;++i){
      std::cout<<a[i]<<" ";
    }
    std::cout<<a[n-1]<<"\n";
  }


  return 0;
}


Compiler output:
a.cc:39:3: error: expected unqualified-id before 'for'
   39 |   for(j=1;j<=n;++j){
      |   ^~~
a.cc:39:11: error: 'j' does not name a type
   39 |   for(j=1;j<=n;++j){
      |           ^
a.cc:39:16: error: expected unqualified-id before '++' token
   39 |   for(j=1;j<=n;++j){
      |                ^~
a.cc:48:3: error: expected unqualified-id before 'return'
   48 |   return 0;
      |   ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++


#include <vector>

class ISorter
{
public:
    virtual bool Sort(std::vector<int>&) = 0;
};

#include <array>


class MySorter
{
private:
    ISorter *sorter;
public:
    MySorter(ISorter *sorter);
    ~MySorter();
    bool Sort(std::vector<int> array);
};


#include <vector>

class InsertionSort : public ISorter
{
public:
    bool Sort(std::vector<int>&);
    InsertionSort();
    ~InsertionSort();
};


#include <vector>

class InsertionSort : public ISorter
{
public:
    bool Sort(std::vector<int>&);
    InsertionSort();
    ~InsertionSort();
};

// InsertionSort.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <memory>


void printArray(const std::vector<int> &array);
std::vector<int> readArray(void);

int main()
{
    int n = 0;
    std::string input;
    std::getline(std::cin, input);
    n = std::stoi(input);

    std::vector<int> array = readArray();

    std::unique_ptr<InsertionSort> algorithm = std::make_unique<InsertionSort>();
    std::unique_ptr<MySorter> sorter = std::make_unique<MySorter>(algorithm.get());

    sorter->Sort(array);

    return 0;
}


void printArray(const std::vector<int> &array)
{
    for (unsigned int k = 0; k < array.size(); k++) {
        std::cout << array[k];
        if (k != array.size() - 1) {
            std::cout << " ";
        }
    }
    std::cout << std::endl;
}

std::vector<int> readArray(void)
{
    std::string input;
    std::vector<int> array;

    std::getline(std::cin, input);
    std::stringstream ss(input);

    std::string buf;
    while (ss >> buf) {
        array.push_back(std::stoi(buf));
    }

    return array;
}


#include <memory>

MySorter::MySorter(ISorter *sorter)
{
    this->sorter = sorter;
}

MySorter::~MySorter()
{
}

bool MySorter::Sort(std::vector<int> array)
{
    return sorter->Sort(array);
}

#include <iostream>

InsertionSort::InsertionSort()
{
}

InsertionSort::~InsertionSort()
{
}

bool InsertionSort::Sort(std::vector<int> &array)
{
    int n = array.size();

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

        for (unsigned int k = 0; k < array.size(); k++) {
            std::cout << array[k];
            if (k != array.size() - 1) {
                std::cout << " ";
            }
        }
        std::cout << std::endl;
    }

    return true;
}


Compiler output:
a.cc:37:7: error: redefinition of 'class InsertionSort'
   37 | class InsertionSort : public ISorter
      |       ^~~~~~~~~~~~~
a.cc:26:7: note: previous definition of 'class InsertionSort'
   26 | class InsertionSort : public ISorter
      |       ^~~~~~~~~~~~~
Language: C++

// ALDS1_1_A
#include <stdio.h>

int main(void)
{
    int aryN;
    int aryA[1000] = {};
    int i, j, k;
    int value;

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

    return;
}



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

#include <iostream>
 
using namespace std;
int n;
 
void sort(int a[]){
 
    int p,j;
    for(int i=1;i<=n;i++){
 
    for(int k=0;k<n;k++){
        cout << a[k];
        if(k < n-1) cout << " ";
    }
    cout << endl;
 
    if(i == n) break;
 
    key = a[i];
    j = i - 1;
    while(j >= 0 && p < a[j]){
        a[j+1] = a[j];
        a[j] = p;
        j--;
    }
 
    }
 
}
     
 
 
int main(){
 
    int a[100];
    cin >> n;
    for(int i=0;i<n;i++){
    cin >> a[i];
    }
 
    sort(a);
 
    return 0;
}


Compiler output:
a.cc: In function 'void sort(int*)':
a.cc:19:5: error: 'key' was not declared in this scope; did you mean 'key_t'?
   19 |     key = a[i];
      |     ^~~
      |     key_t
Language: C++

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

int main()
{
	const int N = 1000;//配列の最大値
	int el[N] = {};//配列
	int num;//数字が何個あるか
	cin >> num;//入力
	for (int i = 0; i < num; i++)cin >> el[i];//配列に入れていく
	for (int i = 0; i < num; i++)cout << el[i] << " ";
	cout << endl;
	for (int i = 1; i < num; i++) {
		int v = el[i];
		int j = i - 1;
		while (0 <= j && v < el[j]) {
			el[j + 1] = el[j];
			j--;
		}
			el[j + 1] = v;
			for (int k = 0; k < num; k++) {
				cout << el[k] << " ";
			}
			cout << endl;
	}

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

1 insertionSort(A, N) // N個の要素を含む0-オリジンの配列A
2   for i が 1 から N-1 まで
3     v = A[i]
4     j = i - 1
5     while j >= 0 かつ A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1 insertionSort(A, N) // N個の要素を含む0-オリジンの配列A
      | ^
Language: C++

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


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

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



Compiler output:
a.cc:6:4: error: expected initializer before 'for'
    6 |    for (int i=1;i<N;i++){
      |    ^~~
a.cc:6:17: error: 'i' does not name a type
    6 |    for (int i=1;i<N;i++){
      |                 ^
a.cc:6:21: error: 'i' does not name a type
    6 |    for (int i=1;i<N;i++){
      |                     ^
a.cc: In function 'int main()':
a.cc:31:3: error: 'insertionSort' was not declared in this scope
   31 |   insertionSort(a,n);
      |   ^~~~~~~~~~~~~
Language: C++

invalid type argument of unary '*' (have 'int')
      int v=*(A+i);



Compiler output:
a.cc:1:42: warning: multi-character character constant [-Wmultichar]
    1 | invalid type argument of unary '*' (have 'int')
      |                                          ^~~~~
a.cc:1:1: error: 'invalid' does not name a type
    1 | invalid type argument of unary '*' (have 'int')
      | ^~~~~~~
Language: C++

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


void sort(int* A,int N){
   for(int i=1;i<N;i++){
     int v=*(A+i);
     int j=i-1;
     while(j>=0 && *(A+j)>v){
       *(A+j+1)=*(A+j);
       j--;
       *(A+j+1)=v;
     }
     for(int t=0;t<N;t++){
       cout<<A[i];
       if(t!=N-1){cout<<" ";}
     }
     cout<<endl;
   }}

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cout<<a[i];
    if(i!=n-1){cout<<" ";}
  }
cout<<enbdl;
  sort(a,n);
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: 'enbdl' was not declared in this scope
   32 | cout<<enbdl;
      |       ^~~~~
Language: C++

#include "stdio.h"

int main()
{
	int N,v,j;
	int A[100];
	scanf("%d",&N);
	for (int i=0; i < N; i++) {
		scanf_s("%d", &A[i]);
	}
	for (int i = 1; i < N; i++) {
		for (int k = 0; k < N; k++)printf("%d ", A[k]);
		printf("\n");
		v = A[i];
		j = i - 1;
		while (j >= 0 and 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");
	
	
	return 0;
}


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

#include <iostream>
#include <vector>

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

using namespace std;

void printVec(vector<int> v){
    int size = v.sive()-1;
    REP(i,size){
        if(i==v.size()) cout << v[i];
        else cout << v[i] << " " ;
    }
    cout << v[size] << endl;
}

void insertionSort(vector<int> vector, int n){ // N個の要素を含む0-オリジンの配列A
//   for i が 1 から N-1 まで
    FOR(i,0,n){
//      v = A[i]
        int v = vector[i];
//      j = i - 1
        int j = i-1;
//      while j >= 0 かつ A[j] > v
        while(j>=0 && vector[j]>v){
//        A[j+1] = A[j]
            vector[j+1] = vector[j];
            //printVec(vector);
//        j--
            j--;
        }

//      A[j+1] = v
        vector[j+1] = v;
        printVec(vector);
    }

}

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

    vector<int> v;
    REP(_,n){
        int temp;
        cin >> temp;
        v.push_back(temp);
    }

    insertionSort(v, n); 
    
}


Compiler output:
a.cc: In function 'void printVec(std::vector<int>)':
a.cc:10:18: error: 'class std::vector<int>' has no member named 'sive'; did you mean 'size'?
   10 |     int size = v.sive()-1;
      |                  ^~~~
      |                  size
Language: C++

// ConsoleApplication4.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

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

int main()
{
	int k;
	int a[1000];
	cin >> k;
	for (int i = 0; i < k; i++){
		cin >> a[i];
	}
	for (int i = 0; i < k; i++){
		for (int j = 0; j<i; j++){
			int h = a[i];
			if (a[i] < a[j]){
				for (int s = i; s > j; s--){
					a[s] = a[s - 1];
				}
				a[j] = h;
				break;
			}
		}
		for (int z = 0; z < k; z++){
			cout << a[z] << ' ';
		}cout << endl;
	}
	return 0;
}




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

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
     long long N,A[10000];
     cin>>N;
     for(long long i=0;i<N;i++){
     cin>>A[i];
 }
	 for(long long i=1;i<N;i++){
		 long long v=A[i];
		 long long j=i-1;
		 while(j>=0&&A[j]>v){
			 A[j+1]=A[j];
			 j--;
		 }
		 A[j+1]=v;
		 
	 for(long long i=0;i<N;i++){
		 if(i==N-1){
		 cout<<a[i];
	 }
	 else{
		 cout<<a[i]<<" " ;
	 }
   }
   cout<<endl; 
 }
}



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

"""
挿入ソート
"""
def insertion_sort(args):
    results = []
    for i in range(0, len(args)):
        v = args[i]
        j = i - 1
        while (j >= 0 and args[j] > v):
            args[j+1] = args[j]
            j -= 1
        args[j+1] = v
        results.append(args[:])
    return results

if __name__ == '__main__':
    n = int(input())
    args = list(map(int, input().split()))[0:n]
    results = insertion_sort(args)
    for result in results:
        print(' '.join(map(str, result)))



Compiler output:
a.cc:1:3: warning: missing terminating " character
    1 | """
      |   ^
a.cc:1:3: error: missing terminating " character
a.cc:3:3: warning: missing terminating " character
    3 | """
      |   ^
a.cc:3:3: error: missing terminating " character
a.cc:16:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   16 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before string constant
    1 | """
      | ^~
Language: C++

#include <stdio.h>
using namespace std;
insertionSort(int[],int);
int main()
{   
    int N;
    int arr[110];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
    }
    insertionSort(arr,N);
    return 0;
}
insertionSort(int arr[],int N)
{   
        for(int i=1;i<N;i++){
        int v=arr[i];
        int j=i-1;
        while(j>=0&&arr[j]>v){
            arr[j+1]=arr[j];
            j--
        }
        A[j+1]=v;
        for(int k=0;k<N-1;k++) printf("%d ",arr[k]);
        printf("%d\n",arr[N-1]);

    }
}


Compiler output:
a.cc:3:25: error: expected constructor, destructor, or type conversion before ';' token
    3 | insertionSort(int[],int);
      |                         ^
a.cc: In function 'int main()':
a.cc:12:5: error: 'insertionSort' was not declared in this scope
   12 |     insertionSort(arr,N);
      |     ^~~~~~~~~~~~~
a.cc: At global scope:
a.cc:15:1: error: ISO C++ forbids declaration of 'insertionSort' with no type [-fpermissive]
   15 | insertionSort(int arr[],int N)
      | ^~~~~~~~~~~~~
a.cc: In function 'int insertionSort(int*, int)':
a.cc:22:16: error: expected ';' before '}' token
   22 |             j--
      |                ^
      |                ;
   23 |         }
      |         ~       
a.cc:24:9: error: 'A' was not declared in this scope
   24 |         A[j+1]=v;
      |         ^
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
Language: C++

#include <stdio.h>
using namespace std;
void insertionSort(int[],int);
int main()
{   
    int N;
    int arr[110];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
    }
    insertionSort(arr,N);
    return 0;
}
insertionSort(int arr[],int N)
{   
        for(int i=1;i<N;i++){
        int v=arr[i];
        int j=i-1;
        while(j>=0&&arr[j]>v){
            arr[j+1]=arr[j];
            j--
        }
        A[j+1]=v;
        for(int k=0;k<N-1;k++) printf("%d ",arr[k]);
        printf("%d\n",arr[N-1]);

    }
}


Compiler output:
a.cc:15:1: error: ISO C++ forbids declaration of 'insertionSort' with no type [-fpermissive]
   15 | insertionSort(int arr[],int N)
      | ^~~~~~~~~~~~~
a.cc:15:1: error: ambiguating new declaration of 'int insertionSort(int*, int)'
a.cc:3:6: note: old declaration 'void insertionSort(int*, int)'
    3 | void insertionSort(int[],int);
      |      ^~~~~~~~~~~~~
a.cc: In function 'int insertionSort(int*, int)':
a.cc:22:16: error: expected ';' before '}' token
   22 |             j--
      |                ^
      |                ;
   23 |         }
      |         ~       
a.cc:24:9: error: 'A' was not declared in this scope
   24 |         A[j+1]=v;
      |         ^
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
Language: C++

#include <stdio.h>
using namespace std;
void insertionSort(int[],int);
int main()
{   
    int N;
    int arr[110];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
    }
    insertionSort(arr,N);
    return 0;
}
void insertionSort(int arr[],int N)
{   
        for(int i=1;i<N;i++){
        int v=arr[i];
        int j=i-1;
        while(j>=0&&arr[j]>v){
            arr[j+1]=arr[j];
            j--
        }
        A[j+1]=v;
        for(int k=0;k<N-1;k++) printf("%d ",arr[k]);
        printf("%d\n",arr[N-1]);

    }
}


Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:22:16: error: expected ';' before '}' token
   22 |             j--
      |                ^
      |                ;
   23 |         }
      |         ~       
a.cc:24:9: error: 'A' was not declared in this scope
   24 |         A[j+1]=v;
      |         ^
Language: C++

#include <stdio.h>
using namespace std;
void insertionSort(int[],int);
int main()
{   
    int N;
    int arr[110];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
    }
    insertionSort(arr,N);
    return 0;
}
void insertionSort(int arr[],int N)
{   
        for(int i=1;i<N;i++){
        int v=arr[i];
        int j=i-1;
        while(j>=0&&arr[j]>v){
            arr[j+1]=arr[j];
            j--;
        }
        Arr[j+1]=v;
        for(int k=0;k<N-1;k++) printf("%d ",arr[k]);
        printf("%d\n",arr[N-1]);

    }
}


Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:24:9: error: 'Arr' was not declared in this scope; did you mean 'arr'?
   24 |         Arr[j+1]=v;
      |         ^~~
      |         arr
Language: C++

#include<iostream>
using namespace std;

main(){
  int n;
  cin >> n;
  int x[n];
  for (int i=0; i<n; i++){
    cin >> x[i];
  }
  
  for (int j=1; j<n-1; j++){
     int key = x[j];
     int k = j-1;
     while( k >= 0 && x[k] > key){
       x[k+1]=x[k];
     }
  x[k+1] = key;
  cout << x << endl;
  }
  


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:20:4: error: expected '}' at end of input
   20 |   }
      |    ^
a.cc:4:7: note: to match this '{'
    4 | main(){
      |       ^
Language: C++

#include <iostream>

using namespace std;

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


Compiler output:
a.cc: In function 'void print(int*, int)':
a.cc:8:19: error: 'i' was not declared in this scope
    8 |     printf("%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(" ");
		print("%d,A[i]);;
	}
	
	printf("\n");
	}
	
void insertionSort(int A[],intN[]){
	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,&);
	for(i=0;i<N;i++)scanf("%d,&A[i]");
	
	trace(A,N);
	insertionSort(A,N);
	
	return 0;
}


Compiler output:
a.cc:8:23: warning: missing terminating " character
    8 |                 print("%d,A[i]);;
      |                       ^
a.cc:8:23: error: missing terminating " character
    8 |                 print("%d,A[i]);;
      |                       ^~~~~~~~~~~
a.cc:33:15: warning: missing terminating " character
   33 |         scanf("%d,&);
      |               ^
a.cc:33:15: error: missing terminating " character
   33 |         scanf("%d,&);
      |               ^~~~~~~
a.cc: In function 'void trace(int*, int*)':
a.cc:6:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    6 |         for(i=0;i<=N;i++){
      |                 ~^~~
a.cc:9:9: error: expected primary-expression before '}' token
    9 |         }
      |         ^
a.cc: At global scope:
a.cc:14:28: error: 'intN' has not been declared
   14 | void insertionSort(int A[],intN[]){
      |                            ^~~~
a.cc: In function 'void insertionSort(int*, int*)':
a.cc:16:19: error: 'N' was not declared in this scope
   16 |         for(i=1;i<N;i++){
      |                   ^
a.cc: In function 'int main()':
a.cc:34:9: error: expected primary-expression before 'for'
   34 |         for(i=0;i<N;i++)scanf("%d,&A[i]");
      |         ^~~
a.cc:34:24: error: expected ';' before ')' token
   34 |         for(i=0;i<N;i++)scanf("%d,&A[i]");
      |                        ^
      |                        ;
a.cc:36:17: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   36 |         trace(A,N);
      |                 ^
      |                 |
      |                 int
a.cc:3:24: note:   initializing argument 2 of 'void trace(int*, int*)'
    3 | void trace(int A[],int N[]){
      |                    ~~~~^~~
a.cc:37:25: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   37 |         insertionSort(A,N);
      |                         ^
      |                         |
      |                         int
a.cc:14:28: note:   initializing argument 2 of 'void insertionSort(int*, int*)'
   14 | void insertionSort(int A[],intN[]){
      |                            ^~~~~~
Language: C++

#include<stdio.h>

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


Compiler output:
a.cc:8:23: warning: missing terminating " character
    8 |                 print("%d,A[i]);
      |                       ^
a.cc:8:23: error: missing terminating " character
    8 |                 print("%d,A[i]);
      |                       ^~~~~~~~~~
a.cc:33:15: warning: missing terminating " character
   33 |         scanf("%d,&);
      |               ^
a.cc:33:15: error: missing terminating " character
   33 |         scanf("%d,&);
      |               ^~~~~~~
a.cc: In function 'void trace(int*, int*)':
a.cc:6:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    6 |         for(i=0;i<=N;i++){
      |                 ~^~~
a.cc:9:9: error: expected primary-expression before '}' token
    9 |         }
      |         ^
a.cc: At global scope:
a.cc:14:28: error: 'intN' has not been declared
   14 | void insertionSort(int A[],intN[]){
      |                            ^~~~
a.cc: In function 'void insertionSort(int*, int*)':
a.cc:16:19: error: 'N' was not declared in this scope
   16 |         for(i=1;i<N;i++){
      |                   ^
a.cc: In function 'int main()':
a.cc:34:9: error: expected primary-expression before 'for'
   34 |         for(i=0;i<N;i++)scanf("%d,&A[i]");
      |         ^~~
a.cc:34:24: error: expected ';' before ')' token
   34 |         for(i=0;i<N;i++)scanf("%d,&A[i]");
      |                        ^
      |                        ;
a.cc:36:17: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   36 |         trace(A,N);
      |                 ^
      |                 |
      |                 int
a.cc:3:24: note:   initializing argument 2 of 'void trace(int*, int*)'
    3 | void trace(int A[],int N[]){
      |                    ~~~~^~~
a.cc:37:25: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   37 |         insertionSort(A,N);
      |                         ^
      |                         |
      |                         int
a.cc:14:28: note:   initializing argument 2 of 'void insertionSort(int*, int*)'
   14 | void insertionSort(int A[],intN[]){
      |                            ^~~~~~
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 insertionSort(int*, int*)':
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         for(i=1;i<N;i++){
      |                 ~^~
a.cc:25:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   25 |                 trace(A,N);
      |                         ^
      |                         |
      |                         int*
a.cc:3:24: note:   initializing argument 2 of 'void trace(int*, int)'
    3 | void trace(int A[],int N){
      |                    ~~~~^
a.cc: In function 'int main()':
a.cc:37:25: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   37 |         insertionSort(A,N);
      |                         ^
      |                         |
      |                         int
a.cc:14:32: note:   initializing argument 2 of 'void insertionSort(int*, int*)'
   14 | void insertionSort(int A[],int N[]){
      |                            ~~~~^~~
Language: C++

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

void trace(const vector<int>& A) {
    for(int i = 0; i < A.size(); k++) {
      if (i > 0) {
        cout << " ";
      }
      cout << << A[i];
    }
    cout << endl;
}

int main(){
  vector<int> A;
  A.reserve(100);

  int N, a;
  cin >> N;
  while(N--){
    cin >> a;
    A.push_back(a);
  }

  trace(A);

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


Compiler output:
a.cc: In function 'void trace(const std::vector<int>&)':
a.cc:6:34: error: 'k' was not declared in this scope
    6 |     for(int i = 0; i < A.size(); k++) {
      |                                  ^
a.cc:10:15: error: expected primary-expression before '<<' token
   10 |       cout << << A[i];
      |               ^~
Language: C++

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

void trace(const vector<int>& A) {
    for(int i = 0; i < A.size(); k++) {
      if (i > 0) {
        cout << " ";
      }
      cout << A[i];
    }
    cout << endl;
}

int main(){
  vector<int> A;
  A.reserve(100);

  int N, a;
  cin >> N;
  while(N--){
    cin >> a;
    A.push_back(a);
  }

  trace(A);

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


Compiler output:
a.cc: In function 'void trace(const std::vector<int>&)':
a.cc:6:34: error: 'k' was not declared in this scope
    6 |     for(int i = 0; i < A.size(); k++) {
      |                                  ^
Language: C++

int main(){
    int N;
    vector<int> arr;
    
    int tmp;
    cin >> N;
    while(cin>>tmp){
        arr.push_back(tmp);
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'vector' was not declared in this scope
    3 |     vector<int> arr;
      |     ^~~~~~
a.cc:3:12: error: expected primary-expression before 'int'
    3 |     vector<int> arr;
      |            ^~~
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> N;
      |     ^~~
a.cc:8:9: error: 'arr' was not declared in this scope
    8 |         arr.push_back(tmp);
      |         ^~~
Language: C++

#include <vector>
int main(){
    int N;
    vector<int> arr;
    
    int tmp;
    cin >> N;
    while(cin>>tmp){
        arr.push_back(tmp);
        cout << tmp;
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> arr;
      |     ^~~~~~
a.cc:4:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> arr;
      |            ^~~
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> N;
      |     ^~~
a.cc:9:9: error: 'arr' was not declared in this scope
    9 |         arr.push_back(tmp);
      |         ^~~
a.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout << tmp;
      |         ^~~~
Language: C++

#include <vector>
using namespace std;

int main(){
    int N;
    vector<int> arr;
    
    int tmp;
    cin >> N;
    while(cin>>tmp){
        arr.push_back(tmp);
        cout << tmp;
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> N;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:12:9: error: 'cout' was not declared in this scope
   12 |         cout << tmp;
      |         ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'