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

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

void insertionsort(int A[], int N){
    int j,i,v;
    for(i=1;i<N;i++)
    {
        v=A[i];
        j=i-1;
        while(j>=0 &&A[j]>v)
        A[j+1]=A[j];
        j--;
    }
    A[j+1]=v;
    trace(A,N);
        
    }
        }
        
        int main(){
            int N,i,j;
            int 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:31:9: error: expected declaration before '}' token
   31 |         }
      |         ^
Language: C++

#include<cstdio>

using namespace std;

int a[100];

void insertionSort( int n )
{
    for( int i = 1; i <= n - 1; i++ )
    {
        int value = a[i];

        int j = i - 1;
        for( int j = n - 1; i < j, a[j] < key; j--  )
        {
            a[j] = a[j - 1];
        }
        a[j + 1] = value;
    }
    for( int i = 0; i < n; i++ ){
        if( i == 0 )
        {
            printf( "%d", a[i] );
        }
        else
        {
            printf( " %d", a[i] );
        }
    }
    printf( "\n" );
}

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


Compiler output:
a.cc: In function 'void insertionSort(int)':
a.cc:14:43: error: 'key' was not declared in this scope
   14 |         for( int j = n - 1; i < j, a[j] < key; j--  )
      |                                           ^~~
Language: C++

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


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

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

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


Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:8:28: error: expected primary-expression before '<<' token
    8 |         if(i>0)cout<<a[i]<<<<" "<<endl;
      |                            ^~
a.cc: In function 'int main()':
a.cc:31:11: error: cannot convert 'std::vector<int>' to 'int*'
   31 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:6:16: note:   initializing argument 1 of 'void trace(int*, int)'
    6 | void trace(int a[],int n){
      |            ~~~~^~~
a.cc:32:19: error: cannot convert 'std::vector<int>' to 'int*'
   32 |     insertionSort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:12:24: note:   initializing argument 1 of 'void insertionSort(int*, int)'
   12 | void insertionSort(int a[],int n){
      |                    ~~~~^~~
Language: C++

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


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

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

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


Compiler output:
a.cc: In function 'void trace(int*, int)':
a.cc:9:25: error: expected primary-expression before '<<' token
    9 |             cout<<a[i]<<<<" "<<endl;
      |                         ^~
a.cc: In function 'int main()':
a.cc:33:11: error: cannot convert 'std::vector<int>' to 'int*'
   33 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:6:16: note:   initializing argument 1 of 'void trace(int*, int)'
    6 | void trace(int a[],int n){
      |            ~~~~^~~
a.cc:34:19: error: cannot convert 'std::vector<int>' to 'int*'
   34 |     insertionSort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:14:24: note:   initializing argument 1 of 'void insertionSort(int*, int)'
   14 | void insertionSort(int a[],int n){
      |                    ~~~~^~~
Language: C++

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


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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: cannot convert 'std::vector<int>' to 'int*'
   33 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:6:16: note:   initializing argument 1 of 'void trace(int*, int)'
    6 | void trace(int a[],int n){
      |            ~~~~^~~
a.cc:34:19: error: cannot convert 'std::vector<int>' to 'int*'
   34 |     insertionSort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:14:24: note:   initializing argument 1 of 'void insertionSort(int*, int)'
   14 | void insertionSort(int a[],int n){
      |                    ~~~~^~~
Language: C++

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


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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: expected initializer before 'for'
   30 |     for(int i=0;i<n;i++){
      |     ^~~
a.cc:30:17: error: 'i' was not declared in this scope
   30 |     for(int i=0;i<n;i++){
      |                 ^
a.cc:33:11: error: 'a' was not declared in this scope
   33 |     trace(a,n);
      |           ^
Language: C++

int main(){
	int n;

	cin >> n;
	int* a = new int[n];
	for(int i = 0;i < n;i++){
		scanf("%d ",&a[i]);
	}
	for(int i = 0;i < n - 1;i++){
		int v = a[i];
		int j = i - 1;
		while(j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		for(int x = 0;x < n;x++){
			cout << a[x] << " " << flush;
		}
		cout << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> n;
      |         ^~~
a.cc:7:17: error: 'scanf' was not declared in this scope
    7 |                 scanf("%d ",&a[i]);
      |                 ^~~~~
a.cc:18:25: error: 'cout' was not declared in this scope
   18 |                         cout << a[x] << " " << flush;
      |                         ^~~~
a.cc:18:48: error: 'flush' was not declared in this scope
   18 |                         cout << a[x] << " " << flush;
      |                                                ^~~~~
a.cc:20:17: error: 'cout' was not declared in this scope
   20 |                 cout << endl;
      |                 ^~~~
a.cc:20:25: error: 'endl' was not declared in this scope
   20 |                 cout << endl;
      |                         ^~~~
Language: C++

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

int main() {
  int n, j, k;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  // calc
  for (i = 0; i < n; i++) {
    cout << a[i];
  }
  cout << endl;
  for (int i = 1; i < n; i++) {
    j = i - 1;
    k = a[i];
    while (j >= 0 && a[j] > k) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = k;
    for (l = 0; l < n; l++) {
      cout << a[l];
    }
    cout << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'i' was not declared in this scope
   12 |   for (i = 0; i < n; i++) {
      |        ^
a.cc:24:10: error: 'l' was not declared in this scope
   24 |     for (l = 0; l < n; l++) {
      |          ^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

void insertionsort(){
    int j,v;
    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;
        trace(a,n);
    }
}

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



Compiler output:
a.cc: In function 'void trace()':
a.cc:9:19: error: 'n' was not declared in this scope
    9 |     for(int i=0;i<n;i++){
      |                   ^
a.cc:10:32: error: 'a' was not declared in this scope
   10 |         if(i>0) cout << " " << a[i];
      |                                ^
a.cc: In function 'void insertionsort()':
a.cc:17:19: error: 'n' was not declared in this scope
   17 |     for(int i=1;i<n;i++){
      |                   ^
a.cc:18:11: error: 'a' was not declared in this scope
   18 |         v=a[i];
      |           ^
a.cc: In function 'int main()':
a.cc:34:10: error: too many arguments to function 'void trace()'
   34 |     trace(a,n);
      |     ~~~~~^~~~~
a.cc:8:6: note: declared here
    8 | void trace(){
      |      ^~~~~
a.cc:35:18: error: too many arguments to function 'void insertionsort()'
   35 |     insertionsort(a,n);
      |     ~~~~~~~~~~~~~^~~~~
a.cc:15:6: note: declared here
   15 | void insertionsort(){
      |      ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

void insertionsort(int a(),int n){
    int j,v;
    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;
        trace(a,n);
    }
}

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



Compiler output:
a.cc: In function 'void trace(int (*)(), int)':
a.cc:10:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   10 |         if(i>0) cout << " " << a[i];
      |                                   ^
a.cc: In function 'void insertionsort(int (*)(), int)':
a.cc:18:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |         v=a[i];
      |              ^
a.cc:18:14: error: invalid conversion from 'int (*)()' to 'int' [-fpermissive]
   18 |         v=a[i];
      |           ~~~^
      |              |
      |              int (*)()
a.cc:20:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   20 |         while(j>=0&&a[j]>v){
      |                        ^
a.cc:20:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         while(j>=0&&a[j]>v){
      |                     ~~~~^~
a.cc:21:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |             a[j+1]=a[j];
      |                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:21:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |             a[j+1]=a[j];
      |                       ^
a.cc:21:19: error: assignment of read-only location '*(a + (((sizetype)j) + 1))'
   21 |             a[j+1]=a[j];
      |             ~~~~~~^~~~~
a.cc:24:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |         a[j+1]=v;
      |              ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:15: error: assignment of read-only location '*(a + (((sizetype)j) + 1))'
   24 |         a[j+1]=v;
      |         ~~~~~~^~
a.cc: In function 'int main()':
a.cc:34:11: error: cannot convert 'std::vector<int>' to 'int (*)()'
   34 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:8:16: note:   initializing argument 1 of 'void trace(int (*)(), int)'
    8 | void trace(int a(),int n){
      |            ~~~~^~~
a.cc:35:19: error: cannot convert 'std::vector<int>' to 'int (*)()'
   35 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:24: note:   initializing argument 1 of 'void insertionsort(int (*)(), int)'
   15 | void insertionsort(int a(),int n){
      |                    ~~~~^~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

void insertionsort(int n){
    int j,v;
    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;
        trace(a,n);
    }
}

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



Compiler output:
a.cc: In function 'void trace(int)':
a.cc:10:32: error: 'a' was not declared in this scope
   10 |         if(i>0) cout << " " << a[i];
      |                                ^
a.cc: In function 'void insertionsort(int)':
a.cc:18:11: error: 'a' was not declared in this scope
   18 |         v=a[i];
      |           ^
a.cc: In function 'int main()':
a.cc:34:11: error: cannot convert 'std::vector<int>' to 'int'
   34 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:8:16: note:   initializing argument 1 of 'void trace(int)'
    8 | void trace(int n){
      |            ~~~~^
a.cc:35:19: error: cannot convert 'std::vector<int>' to 'int'
   35 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:24: note:   initializing argument 1 of 'void insertionsort(int)'
   15 | void insertionsort(int n){
      |                    ~~~~^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

void insertionsort(int a,int n){
    int j,v;
    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;
        trace(a,n);
    }
}

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



Compiler output:
a.cc: In function 'void trace(int, int)':
a.cc:10:33: error: invalid types 'int[int]' for array subscript
   10 |         if(i>0) cout << " " << a[i];
      |                                 ^
a.cc: In function 'void insertionsort(int, int)':
a.cc:18:12: error: invalid types 'int[int]' for array subscript
   18 |         v=a[i];
      |            ^
a.cc:20:22: error: invalid types 'int[int]' for array subscript
   20 |         while(j>=0&&a[j]>v){
      |                      ^
a.cc:21:14: error: invalid types 'int[int]' for array subscript
   21 |             a[j+1]=a[j];
      |              ^
a.cc:21:21: error: invalid types 'int[int]' for array subscript
   21 |             a[j+1]=a[j];
      |                     ^
a.cc:24:10: error: invalid types 'int[int]' for array subscript
   24 |         a[j+1]=v;
      |          ^
a.cc: In function 'int main()':
a.cc:34:11: error: cannot convert 'std::vector<int>' to 'int'
   34 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:8:16: note:   initializing argument 1 of 'void trace(int, int)'
    8 | void trace(int a,int n){
      |            ~~~~^
a.cc:35:19: error: cannot convert 'std::vector<int>' to 'int'
   35 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:24: note:   initializing argument 1 of 'void insertionsort(int, int)'
   15 | void insertionsort(int a,int n){
      |                    ~~~~^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

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



Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: error: cannot convert 'std::vector<int>' to 'int*'
   34 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:8:16: note:   initializing argument 1 of 'void trace(int*, int)'
    8 | void trace(int a[],int n){
      |            ~~~~^~~
a.cc:35:19: error: cannot convert 'std::vector<int>' to 'int*'
   35 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:24: note:   initializing argument 1 of 'void insertionsort(int*, int)'
   15 | void insertionsort(int a[],int n){
      |                    ~~~~^~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

void insertionsort(a(),n){
    int j,v;
    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;
        trace(a,n);
    }
}

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



Compiler output:
a.cc:8:6: error: variable or field 'trace' declared void
    8 | void trace(a(),n){
      |      ^~~~~
a.cc:8:12: error: 'a' was not declared in this scope
    8 | void trace(a(),n){
      |            ^
a.cc:8:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 | void trace(a(),n){
      |                ^
      |                yn
a.cc:15:6: error: variable or field 'insertionsort' declared void
   15 | void insertionsort(a(),n){
      |      ^~~~~~~~~~~~~
a.cc:15:20: error: 'a' was not declared in this scope
   15 | void insertionsort(a(),n){
      |                    ^
a.cc:15:24: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 | void insertionsort(a(),n){
      |                        ^
      |                        yn
a.cc: In function 'int main()':
a.cc:34:5: error: 'trace' was not declared in this scope
   34 |     trace(a,n);
      |     ^~~~~
a.cc:35:5: error: 'insertionsort' was not declared in this scope
   35 |     insertionsort(a,n);
      |     ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

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



Compiler output:
a.cc:8:6: error: variable or field 'trace' declared void
    8 | void trace(a[],n){
      |      ^~~~~
a.cc:8:12: error: 'a' was not declared in this scope
    8 | void trace(a[],n){
      |            ^
a.cc:8:14: error: expected primary-expression before ']' token
    8 | void trace(a[],n){
      |              ^
a.cc:8:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 | void trace(a[],n){
      |                ^
      |                yn
a.cc:15:6: error: variable or field 'insertionsort' declared void
   15 | void insertionsort(a[],n){
      |      ^~~~~~~~~~~~~
a.cc:15:20: error: 'a' was not declared in this scope
   15 | void insertionsort(a[],n){
      |                    ^
a.cc:15:22: error: expected primary-expression before ']' token
   15 | void insertionsort(a[],n){
      |                      ^
a.cc:15:24: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 | void insertionsort(a[],n){
      |                        ^
      |                        yn
a.cc: In function 'int main()':
a.cc:34:5: error: 'trace' was not declared in this scope
   34 |     trace(a,n);
      |     ^~~~~
a.cc:35:5: error: 'insertionsort' was not declared in this scope
   35 |     insertionsort(a,n);
      |     ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

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

    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;
        trace(a,n);
    }
    return 0;
}



Compiler output:
a.cc: In function 'int trace()':
a.cc:9:19: error: 'n' was not declared in this scope
    9 |     for(int i=0;i<n;i++){
      |                   ^
a.cc:10:32: error: 'a' was not declared in this scope
   10 |         if(i>0) cout << " " << a[i];
      |                                ^
a.cc:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | }
      | ^
a.cc: In function 'int main()':
a.cc:27:9: error: 'v' was not declared in this scope
   27 |         v=a[i];
      |         ^
a.cc:34:14: error: too many arguments to function 'int trace()'
   34 |         trace(a,n);
      |         ~~~~~^~~~~
a.cc:8:5: note: declared here
    8 | int trace(){
      |     ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

    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 k=0;k<n;k++){
            if(k>0) cout << " " << a[k];
        }
        cout << endl;
    }
    return 0;
}



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

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

    trace();

    int v;
    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 k=0;k<n;k++){
            if(k>0) cout << " " << a[k];
        }
        cout << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int trace()':
a.cc:9:19: error: 'n' was not declared in this scope
    9 |     for(int i=0;i<n;i++){
      |                   ^
a.cc:11:17: error: 'a' was not declared in this scope
   11 |         cout << a[i];
      |                 ^
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

    trace();

    int v;
    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 k=0;k<n;k++){
            if(k>0) cout << " " << a[k];
        }
        cout << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int trace()':
a.cc:12:17: error: 'a' was not declared in this scope
   12 |         cout << a[i];
      |                 ^
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

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

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



Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> a(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> a(n);
      |          ^~~
a.cc:8:29: error: 'a' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin>>a[i];
      |                             ^
a.cc:11:11: error: 'a' was not declared in this scope
   11 |     int v=a[i];
      |           ^
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

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

    trace(a,n);
    insertionsort(a,n);

    return 0;
}



Compiler output:
a.cc: In function 'void insertionsort(int*, int)':
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     for(i=1;i<n;i++){
      |         ^
a.cc:19:19: error: expected ')' before ';' token
   19 |         while(j>=0;&&a[j]>v){
      |              ~    ^
      |                   )
a.cc:19:23: error: expected ';' before '[' token
   19 |         while(j>=0;&&a[j]>v){
      |                       ^
      |                       ;
a.cc:19:22: error: label 'a' used but not defined
   19 |         while(j>=0;&&a[j]>v){
      |                      ^
a.cc: In function 'int main()':
a.cc:34:11: error: cannot convert 'std::vector<int>' to 'int*'
   34 |     trace(a,n);
      |           ^
      |           |
      |           std::vector<int>
a.cc:8:16: note:   initializing argument 1 of 'void trace(int*, int)'
    8 | void trace(int a[],int n){
      |            ~~~~^~~
a.cc:35:19: error: cannot convert 'std::vector<int>' to 'int*'
   35 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:24: note:   initializing argument 1 of 'void insertionsort(int*, int)'
   15 | void insertionsort(int a[],int n){
      |                    ~~~~^~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

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

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

    insertionsort(a,n);

    return 0;
}



Compiler output:
a.cc: In function 'void insertionsort(int*, int)':
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     for(i=1;i<n;i++){
      |         ^
a.cc:19:19: error: expected ')' before ';' token
   19 |         while(j>=0;&&a[j]>v){
      |              ~    ^
      |                   )
a.cc:19:23: error: expected ';' before '[' token
   19 |         while(j>=0;&&a[j]>v){
      |                       ^
      |                       ;
a.cc:19:22: error: label 'a' used but not defined
   19 |         while(j>=0;&&a[j]>v){
      |                      ^
a.cc: In function 'int main()':
a.cc:34:19: error: cannot convert 'std::vector<int>' to 'int*'
   34 |     insertionsort(a,n);
      |                   ^
      |                   |
      |                   std::vector<int>
a.cc:15:24: note:   initializing argument 1 of 'void insertionsort(int*, int)'
   15 | void insertionsort(int a[],int n){
      |                    ~~~~^~~
Language: C++

#include <iostream>
static const int maxN = 100;

void printarray(int* array,int length)
{
  for(i = 0; i < length; i++)
  {
    printf("%d",array[i]);
  }
  printf("\n");
}

void insertionSort(int* array, int length)
{
  for(i = 1; i < length; i++)
  {
    key = array[i];
    int j = i - 1;
    for(; j >= 0 & array[j] <= key; j--  )
    {
      array[j+1] = array[i];
    }
    array[j+1] = key;

    printarray(array,length);
  }
  return ;
}
int main()
{
  int N;
  int A[maxN];

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

  insertionSort(A,N);


}



Compiler output:
a.cc: In function 'void printarray(int*, int)':
a.cc:6:7: error: 'i' was not declared in this scope
    6 |   for(i = 0; i < length; i++)
      |       ^
a.cc: In function 'void insertionSort(int*, int)':
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i = 1; i < length; i++)
      |       ^
a.cc:17:5: error: 'key' was not declared in this scope; did you mean 'key_t'?
   17 |     key = array[i];
      |     ^~~
      |     key_t
a.cc: In function 'int main()':
a.cc:34:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   34 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:35:7: error: 'i' was not declared in this scope
   35 |   for(i = 0; i < N ; i++)
      |       ^
Language: C++

#include <iostream>

using namespace std;

static const int maxN = 100;

void printarray(int* array,int length)
{
  for(int i = 0; i < length; i++)
  {
    printf("%d",array[i]);
  }
  printf("\n");
}

void insertionSort(int* array, int length)
{
  printarray(array,length);
  
  for(int i = 1; i < length; i++)
  {
    int key = array[i];
    int j = i - 1;
    for(; j >= 0 & array[j] > key; j--  )
    {
      array[j+1] = array[j];
    }
    array[j+1] = key;

    printarray(array,length);
  }
  return ;
}
int main()
{
  int N;
  int A[maxN];

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

  insertionSort(A,N);
  return ;

}



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

#include <iostream>
#include <stdio.h>

using namespace std;

static const int maxN = 100;

void printarray(int* array,int length)
{
  for(int i = 0; i < length; i++)
  {
    printf("%d",array[i]);
  }
  printf("\n");
}

void insertionSort(int* array, int length)
{
  printarray(array,length);

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

    printarray(array,length);
  }
  return ;
}
int main()
{
  int N;
  int A[maxN];

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

  insertionSort(A,N);

  return ;

}



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

#include <iostream>
using namespace std;

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

void print_A(int *A, int N)
{
    REP(i, N)
    {
        cout << A[i];
        if (i != N-1) cout << " "
    }
    cout << endl;
    return;
}

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

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

    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }

    print_A(A, N);
    insertionSort(A, N);
}


Compiler output:
a.cc: In function 'void print_A(int*, int)':
a.cc:12:34: error: expected ';' before '}' token
   12 |         if (i != N-1) cout << " "
      |                                  ^
      |                                  ;
   13 |     }
      |     ~
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 'int main()':
a.cc:32:18: error: expected ';' before '}' token
   32 | scanf("%d",&A[i])
      |                  ^
      |                  ;
   33 | }
      | ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v(N,0);
    for(auto&& x: v){
        cin >> x;
    }
    for(int i=1; i<n; ++i){
        int x = v[i];
        int j=i-1;
        while( j>=0 and v[j]>x ){
            v[j+1]=v[j];
            --j;
        }
        v[j+1] = x;

        for(int i=0; i<n; ++i){
            cout << v[i];
            if( i != n){
                cout << ' ';
            }
        }
        cout << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: 'N' was not declared in this scope
   10 |     vector<int> v(N,0);
      |                   ^
Language: C++

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


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

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

}


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

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


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

#include<iostream.h>
int main()
{	int A[100],i_1=0,i_2=0,i_3=0,i_4=0,key=0,k;
	cin>>i_1;
	i_3=i_1;
	while(i_1>0)
	{	cin>>A[i_2++];
		i_1--;
	}
	for(i_1=1;i_1<i_3;i_1++)
	{	key=A[i_1];
		i_2=i_1-1;
		while(i_2>=0 && A[i_2]>key)
		{	A[i_2+1]=A[i_2];
			i_2--;
		}
		A[i_2+1]=key;
		while(i_4<i_3)
			cout<<A[i_4++]<<" ";
		i_4=0;
		cout<<endl;
	}
	return 0;
}


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

#include <iostream>

using namespace std;

int main() {
    int array[100],q,i,j,k;
    cin >> q;
    for(i=0;i<q;i++)
        cin >> array[i];
    for(i=1;i<array.length-1;i++){
        key = array[i];
        j = i-1;
        while(j>=0&&array[j]>key){
            array[j+1]=array[j];
            j--;
            a[j+1]=key;
        }
    for(k=0;k<q;k++) {
        if(k=q-1) cout << array[k] << endl;
        else   
             cout<< array[k] << " ";
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: request for member 'length' in 'array', which is of non-class type 'int [100]'
   10 |     for(i=1;i<array.length-1;i++){
      |                     ^~~~~~
a.cc:11:9: error: 'key' was not declared in this scope
   11 |         key = array[i];
      |         ^~~
a.cc:16:13: error: 'a' was not declared in this scope
   16 |             a[j+1]=key;
      |             ^
Language: C++

#include <iostream>

using namespace std;

int main() {
    int q,i,j,k,key;
    char array[100];
    cin >> q;
    for(i=0;i<q;i++)
        cin >> array[i];
    for(i=1;i<array.length-1;i++){
        key = array[i];
        j = i-1;
        while(j>=0&&array[j]>key){
            array[j+1]=array[j];
            j--;
            array[j+1]=key;
        }
    for(k=0;k<q;k++) {
        if(k=q-1) cout << array[k] << endl;
        else   
             cout<< array[k] << " ";
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: request for member 'length' in 'array', which is of non-class type 'char [100]'
   11 |     for(i=1;i<array.length-1;i++){
      |                     ^~~~~~
Language: C++

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

int main() {
    int q,i,j,k,key;
    string array;
    cin >> q;
    for(i=0;i<q;i++)
        cin >> array[i];
    for(i=1;i<array.length-1;i++){
        key = array[i];
        j = i-1;
        while(j>=0&&array[j]>key){
            array[j+1]=array[j];
            j--;
            array[j+1]=key;
        }
    for(k=0;k<q;k++) {
        if(k=q-1) cout << array[k] << endl;
        else   
             cout<< array[k] << " ";
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   11 |     for(i=1;i<array.length-1;i++){
      |               ~~~~~~^~~~~~
      |                           ()
Language: C++

#include <iostream>
#include <stdio.h>

using namespace std;

static const int N = 100;

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


int main(void){
	int n,input[N],selectNumber;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> input[i];

	}

	output(input,p);
	for(int i = 1; i < n; i++ ){
		selectNumber = input[i];
		int j = i - 1;
		while(j >= 0 && input[j] > selectNumber){
			input[j+1] = input[j];
			j--;
		}
		input[j+1] = selectNumber;
		output(input,n);
	}


	return 0;

	// for(int i = 1; i < n; i++ ){
	// 	selectNumber = input[i];
	// 	for(int j = 0; j < i; j++ ){
	// 		if(selectNumber < input[j]){
	// 			for(int k = i; k > j; k-- ){
	// 				input[k] = input[k-1];
	// 			}
	// 			input[j] = selectNumber;
	// 		}
	// 	}
	// }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: 'p' was not declared in this scope
   25 |         output(input,p);
      |                      ^
Language: C++

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

void fnInsertionSort(vector<int>&, int);
void fnTrace(vector<int>);

int main()
{
  vector<int> viSort;
  int iMaxSize;
  
  cin >> iMaxSize;
  viSort.resize( iMaxSize );
  for (int i = 0; i < iMaxSize; i++) cin >> viSort[i];

  fnTrace(viSort, iMaxSize);
  insertionSort(viSort, iMaxSize);

  return 0;
}

void insertionSort(vector<int> &argviSort, int argiSize)
{
  for (int i = 1; i < argiSize; i++)
  {
    int iTarget = argviSort[i];
    int j = i - 1;
    while (iTarget < argviSort[j] &&
           j       >= 0            )
    {
      argviSort[j + 1] = argviSort[j];
      j--;
    }
    argviSort[j + 1] = iTarget;
    fnTrace(argviSort, argiSize);
  }
}

void fnTrace(vector<int> argviSort, int argiSize)
{
  for (int i = 0; i < argiSize; i++)
  {
    if (i) cout << " ";
    cout << argviSort[i];
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: too many arguments to function 'void fnTrace(std::vector<int>)'
   17 |   fnTrace(viSort, iMaxSize);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void fnTrace(vector<int>);
      |      ^~~~~~~
a.cc:18:3: error: 'insertionSort' was not declared in this scope; did you mean 'fnInsertionSort'?
   18 |   insertionSort(viSort, iMaxSize);
      |   ^~~~~~~~~~~~~
      |   fnInsertionSort
a.cc: In function 'void insertionSort(std::vector<int>&, int)':
a.cc:36:12: error: too many arguments to function 'void fnTrace(std::vector<int>)'
   36 |     fnTrace(argviSort, argiSize);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void fnTrace(vector<int>);
      |      ^~~~~~~
Language: C++

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

void fnInsertionSort(vector<int>&, int);
void fnTrace(vector<int>);

int main()
{
  vector<int> viSort;
  int iMaxSize;
  
  cin >> iMaxSize;
  viSort.resize( iMaxSize );
  for (int i = 0; i < iMaxSize; i++) cin >> viSort[i];

  fnTrace(viSort, iMaxSize);
  insertionSort(viSort, iMaxSize);

  return 0;
}

void fnInsertionSort(vector<int> &argviSort, int argiSize)
{
  for (int i = 1; i < argiSize; i++)
  {
    int iTarget = argviSort[i];
    int j = i - 1;
    while (iTarget < argviSort[j] &&
           j       >= 0            )
    {
      argviSort[j + 1] = argviSort[j];
      j--;
    }
    argviSort[j + 1] = iTarget;
    fnTrace(argviSort, argiSize);
  }
}

void fnTrace(vector<int> argviSort, int argiSize)
{
  for (int i = 0; i < argiSize; i++)
  {
    if (i) cout << " ";
    cout << argviSort[i];
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: too many arguments to function 'void fnTrace(std::vector<int>)'
   17 |   fnTrace(viSort, iMaxSize);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void fnTrace(vector<int>);
      |      ^~~~~~~
a.cc:18:3: error: 'insertionSort' was not declared in this scope; did you mean 'fnInsertionSort'?
   18 |   insertionSort(viSort, iMaxSize);
      |   ^~~~~~~~~~~~~
      |   fnInsertionSort
a.cc: In function 'void fnInsertionSort(std::vector<int>&, int)':
a.cc:36:12: error: too many arguments to function 'void fnTrace(std::vector<int>)'
   36 |     fnTrace(argviSort, argiSize);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void fnTrace(vector<int>);
      |      ^~~~~~~
Language: C++

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

void fnInsertionSort(vector<int>&, int);
void fnTrace(vector<int>, int);

int main()
{
  vector<int> viSort;
  int iMaxSize;
  
  cin >> iMaxSize;
  viSort.resize( iMaxSize );
  for (int i = 0; i < iMaxSize; i++) cin >> viSort[i];

  fnTrace(viSort, iMaxSize);
  fnInsertionSort(viSort, iMaxSize);

  return 0;
}

void fnInsertionSort(vector<int> &argviSort, int argiSize)
{
  for (int i = 1; i < argiSize; i++)
  {
    int iTarget = argviSort[i];
    int j = i - 1;
    while (iTarget < argviSort[j] &&
           j       >= 0            )
    {
      argviSort[j + 1] = argviSort[j];
      j--;
    }
    argviSort[j + 1] = iTarget;
    fnTrace(argviSort, argiSize);
  }
}

void fnTrace(vector<int> argviSort, int argiSize)
{
  for (int i = 0; i < argiSize; i++)
  {
    if (i) cout << " ";
    cout << argviSort[i];
  }
  cout << endl;
}-

Compiler output:
a.cc:48:2: error: expected unqualified-id before '-' token
   48 | }-
      |  ^
Language: C++

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

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

void fnInsertionSort(vector<int> &argviSort)
{
  for (int ixSorting = 1; ixSorting < argviSort.size(); ixSorting++)
  {
    int iTarget = argviSort[ixSorting];
    int ixSorted = ixSorting - 1;
    while (iTarget < argviSort[iSorted] &&
           iSorted   >= 0            )
    {
      argviSort[iSorted + 1] = argviSort[iSorted];
      iSorted--;
    }
    argviSort[iSorted + 1] = iTarget;
    fnTrace(argviSort);
  }
}

int main()
{
  vector<int> viSort;
  int iMaxSize;
  
  cin >> iMaxSize;
  for (int i = 0; i < iMaxSize; i++)
  {
    int iNum;
    cin >> iNum;
    viSort.push_back(iNum);
  }

  fnTrace(viSort);
  fnInsertionSort(viSort);

  return 0;
}

Compiler output:
a.cc: In function 'void fnInsertionSort(std::vector<int>&)':
a.cc:21:32: error: 'iSorted' was not declared in this scope; did you mean 'ixSorted'?
   21 |     while (iTarget < argviSort[iSorted] &&
      |                                ^~~~~~~
      |                                ixSorted
a.cc:27:15: error: 'iSorted' was not declared in this scope; did you mean 'ixSorted'?
   27 |     argviSort[iSorted + 1] = iTarget;
      |               ^~~~~~~
      |               ixSorted
Language: C++

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

void insertionSort(int a[],int 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(j=0;j<n;j++){
     if(j>0) cout << " ";
     cout << a[j];
     }
     cout << endl;
   }
}

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

   cin >> n;

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

Compiler output:
a.cc: In function 'void insertionSort(int*, int)':
a.cc:6:8: error: 'i' was not declared in this scope
    6 |    for(i=1;i<n-1;i++){
      |        ^
a.cc:7:6: error: 'v' was not declared in this scope
    7 |      v = a[i];
      |      ^
a.cc:8:6: error: 'j' was not declared in this scope
    8 |      j = i - 1;
      |      ^
a.cc: In function 'int main()':
a.cc:33:20: error: expected primary-expression before ']' token
   33 |    insertionSort(a[],n);
      |                    ^