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

#include<stdio.h>
#include<math.h>
int A[1000000],n,cnt=0;
void insertionSort(int A[],int g){
  int i,j;
  int v;
  for(i=g;i<n;i++){
    v = A[i];
    j = i - g;
    while(j >= 0 && A[j] > v){
      A[j+g] = A[j];
      j -= g;
      cnt++;
      A[j+g] = v;
    }
  }
}

main(){
  int i;
  int m;
  double prem;
  int G[100];
  scanf("%d",&n);
  m = floor(log2(n*1.0));
  printf("%d\n",m);
  for(i=0;i<=m;i++){
    G[i]=pow(2,m-i);
    printf("%d",G[i]);
    if(i==m){
      printf("\n");
    }else{
      printf(" ");
    }
  }
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<m;i++){
    insertionSort(A[],G[i]);
  }
  printf("%d",cnt);
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
}

Compiler output:
a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:40:21: error: expected primary-expression before ']' token
   40 |     insertionSort(A[],G[i]);
      |                     ^
Language: C++

#include <iostream>
#include <memory>
#include <cmath>

constexpr int max_size()
{
    return static_cast<int>(1e+6);
}

int insert(int* a, const int i, const int gear)
{
    if (i < gear) {
        return 0;
    }

    if (a[i - gear] <= a[i]) {
        return 0;
    }

    std::swap(a[i - gear], a[i]);
    return 1 + insert(a, i - gear, gear);
}

int insertion_sort(int* arr, const int n, const int gear)
{
    int insert_count = 0;
    for (int i = 0; i < n; i += gear) {
        insert_count += insert(arr, i, gear);
    }
    return insert_count;
}

int pow(const int a, const int x) {
    return x == 0 ? 1 : a * pow(a, x - 1);
}

void print(int* arr, const int n, char const delim) {
    int i = 0;
    for (; i < n - 1; ++i) {
        std::cout << arr[i] << delim;
    }
    std::cout << arr[i];
}

void shell_sort(int* arr, const int n) {
    static const double log3 = std::log(3);
    const int gear_index = static_cast<int>(std::log(2 * n + 1) / log3 - 1);
    int gear = (pow(3, gear_index + 1) - 1) >> 1;

    int gear_cache[100];
    int cache_idx = 0;
    int insert_count = 0;

    for (; gear > 0; gear = (gear - 1) / 3) {
        gear_cache[cache_idx] = gear;
        for (int i = 0; i < gear; ++i) {
            insert_count += insertion_sort(arr + i, n - i, gear);
        }
        ++cache_idx;
    }

    std::cout << cache_idx << std::endl;
    print(gear_cache, cache_idx, ' ');
    std::cout << std::endl;
    std::cout << insert_count << std::endl;

    return;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    std::cin >> n;

    constexpr int N = max_size();
    const auto r = std::make_unique<int[]>(N);
    for (int i = 0; i < n; ++i) {
        scanf_s("%d", &r[i]);
    }

    shell_sort(r.get(), n);
    print(r.get(), n, '\n');

    return 0;
}

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

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

constexpr int max_size()
{
    return static_cast<int>(1e+6);
}

int insert(int* a, const int i, const int gear)
{
    if (i < gear) {
        return 0;
    }

    if (a[i - gear] <= a[i]) {
        return 0;
    }

    std::swap(a[i - gear], a[i]);
    return 1 + insert(a, i - gear, gear);
}

int insertion_sort(int* arr, const int n, const int gear)
{
    int insert_count = 0;
    for (int i = 0; i < n; i += gear) {
        insert_count += insert(arr, i, gear);
    }
    return insert_count;
}

int pow(const int a, const int x) {
    return x == 0 ? 1 : a * pow(a, x - 1);
}

void print(int* arr, const int n, char const delim) {
    int i = 0;
    for (; i < n - 1; ++i) {
        std::cout << arr[i] << delim;
    }
    std::cout << arr[i];
}

void shell_sort(int* arr, const int n) {
    static const double log3 = std::log(3);
    const int gear_index = static_cast<int>(std::log(2 * n + 1) / log3 - 1);
    int gear = (pow(3, gear_index + 1) - 1) >> 1;

    int gear_cache[100];
    int cache_idx = 0;
    int insert_count = 0;

    for (; gear > 0; gear = (gear - 1) / 3) {
        gear_cache[cache_idx] = gear;
        for (int i = 0; i < gear; ++i) {
            insert_count += insertion_sort(arr + i, n - i, gear);
        }
        ++cache_idx;
    }

    std::cout << cache_idx << std::endl;
    print(gear_cache, cache_idx, ' ');
    std::cout << std::endl;
    std::cout << insert_count << std::endl;

    return;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    std::cin >> n;

    constexpr int N = max_size();
    const auto r = std::make_unique<int[]>(N);
    for (int i = 0; i < n; ++i) {
        scanf_s("%d", &r[i]);
    }

    shell_sort(r.get(), n);
    print(r.get(), n, '\n');

    return 0;
}

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

n = int(input())

A = []
for i in range(0, n):
    A.append(int(input()))

cnt = 0
def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v


def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i)

G = [4, 1]
B = A[:]
shell_sort(B, n)

print(len(G))
print(' '.join(str(x) for x in G))
print(cnt)
for i in B:
    print(i)

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

import sys
n = int(input())
A = list(map(int, sys.stdin))

cnt = 0
def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v


def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i)

G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
shell_sort(A, n)

print(len(G))
print(' '.join(str(x) for x in G))
print(cnt)
for i in B:
    print(i)

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

#include <bits/stdc++.h>
using namespace std;
int N, A[100], cnt;

void Out(const vector<int> G) {
	cout << G.size() << endl;
	cout << G[0];
	for (int i = 1; i < G.size(); i++) {
		cout << ' ' << G[i];
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < N; i++)
		cout << A[i] << endl;
}

void InsertionSort(int g) {
	for (int i = g; i < N; i++) {
		int v = A[i], j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
		Out();
	}
}
void ShellSort(const vector<int> G) {
	cnt = 0;
	for (int i = 0; i < G.size(); i++) {
		InsertionSort(G[i]);
	}
}

int main()
{
	vector<int> G = { 37876, 25251, 16834, 11222, 7481, 4987, 3325, 2216, 1477, 985, 656, 437, 291, 194, 129, 86, 57, 38, 25, 17, 11, 7, 5, 3, 2, 1 };
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
	ShellSort(G);
	Out();
	return 0;
}

Compiler output:
a.cc: In function 'void InsertionSort(int)':
a.cc:26:20: error: too few arguments to function 'void Out(std::vector<int>)'
   26 |                 Out();
      |                 ~~~^~
a.cc:5:6: note: declared here
    5 | void Out(const vector<int> G) {
      |      ^~~
a.cc: In function 'int main()':
a.cc:43:12: error: too few arguments to function 'void Out(std::vector<int>)'
   43 |         Out();
      |         ~~~^~
a.cc:5:6: note: declared here
    5 | void Out(const vector<int> G) {
      |      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N, A[100], cnt;

void Out(const vector<int> G) {
	cout << G.size() << endl;
	cout << G[0];
	for (int i = 1; i < G.size(); i++) {
		cout << ' ' << G[i];
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < N; i++)
		cout << A[i] << endl;
}

void InsertionSort(int g) {
	for (int i = g; i < N; i++) {
		int v = A[i], j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
		Out();
	}
}
void ShellSort(const vector<int> G) {
	cnt = 0;
	for (int i = 0; i < G.size(); i++) {
		InsertionSort(G[i]);
	}
}

int main()
{
	vector<int> G = { 37876, 25251, 16834, 11222, 7481, 4987, 3325, 2216, 1477, 985, 656, 437, 291, 194, 129, 86, 57, 38, 25, 17, 11, 7, 5, 3, 2, 1 };
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
	ShellSort(G);
	Out(G);
	return 0;
}

Compiler output:
a.cc: In function 'void InsertionSort(int)':
a.cc:26:20: error: too few arguments to function 'void Out(std::vector<int>)'
   26 |                 Out();
      |                 ~~~^~
a.cc:5:6: note: declared here
    5 | void Out(const vector<int> G) {
      |      ^~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l,n;
int A[1000000];
vector<int> G;


void insertion(int A[], int n,int g){
  int i,V,j;
  for ( i = g; i < n; i++ ){
  V=A[i];
  j=i-1;
  while (j>=0 && A[j]>V){
	  A[j+1]=A[j];
      j--;
      cnt++;
  }
  A[j+g]=V;
  }
}

void shellsort(int A[], int n){
  for(i=1;;){
  if(h>n) break;
  G.push_back(h);
  h=3*h+1;
  }
  for(int i= G.size()-1;i>=0;i--){
  insertion(A,n,G[i])
  }
}

int main(){
  int n, i, j;
  int A[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  cnt=0;
  shellsort(A,n);
  cout << G.size() << endl;
  for(int i= G.size()-1;i>=0;i--){
    printf("%d", G[i]);
    if ( i ) printf(" ");
  }
  print("\n");
  print("%d\n",cnt);
  for(int i=0;i<n;i++) printf("%d\n",A[i]);
  return 0;
}

Compiler output:
a.cc: In function 'void shellsort(int*, int)':
a.cc:30:7: error: 'i' was not declared in this scope
   30 |   for(i=1;;){
      |       ^
a.cc:31:6: error: 'h' was not declared in this scope
   31 |   if(h>n) break;
      |      ^
a.cc:32:15: error: 'h' was not declared in this scope
   32 |   G.push_back(h);
      |               ^
a.cc:36:22: error: expected ';' before '}' token
   36 |   insertion(A,n,G[i])
      |                      ^
      |                      ;
   37 |   }
      |   ~                   
a.cc: In function 'int main()':
a.cc:52:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   52 |   print("\n");
      |   ^~~~~
      |   rint
Language: C++

#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

size_t isort(vector<int> &A, size_t g) {
    size_t count_=0;
    for (size_t i=g; i<A.size(); ++i) {
        int v=A[i], j;
        for (j=i-g; j>=0&&v<A[j]; j-=g) {
            A[j+g] = A[j];
            ++count_;
        }
        A[j+g] = v;
    }
    return count_;
}

size_t shsort(vector<int> &A) {
    size_t count_=0;
    vector<size_t> g(min(100uLL, A.size()-1));
    for (size_t i=0; i<g.size(); ++i)
        g[i] = g.size()-i;

    printf("%zu\n", g.size());
    for (size_t i=0; i<g.size(); ++i)
        printf("%zu%c", g[i], i<g.size()-1? ' ':'\n');

    for (size_t d: g)
        count_ += isort(A, d);

    return count_;
}

int main() {
    size_t N;
    scanf("%zu", &N);

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

    size_t t=shsort(A);

    printf("%zu\n", t);
    for (size_t i=0; i<N; ++i)
        printf("%d\n", A[i]);

    return 0;
}

Compiler output:
a.cc: In function 'size_t shsort(std::vector<int>&)':
a.cc:22:25: error: no matching function for call to 'min(long long unsigned int, std::vector<int>::size_type)'
   22 |     vector<size_t> g(min(100uLL, A.size()-1));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:22:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   22 |     vector<size_t> g(min(100uLL, A.size()-1));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:22:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   22 |     vector<size_t> g(min(100uLL, A.size()-1));
      |                      ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

vector<int> G;

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

void shellSort(int a[], int n, int* cnt){
  for (int h = 1 ; h <= n;){
    G.push_back(h);
    h = 3 * h -1;
  }

  for(int i = G.size()-1; i >= 0; i --){
    insertionSort(a, n, G[i], cnt);
  }
}

int main(int argc, char* argv[])
{
  int n;
  int a[1000000];
  int i;
  int cnt;

  scanf("%d",&n);
  for(i=0;i < n; i++){
    scanf("%d", a+i);
  }
  cnt = 0;

  shellSort(a, n, &cnt);

  int g_size = G.size();
  printf("%d\n", g_size);

  for (i = g_size -1; i >= 0; i--){
    printf("%d", G[i]);
    if(i){
      printf(" ");
    }
  }
  printf("\n");
  printf("%d\n", cnt);
  for(i = 0; i < n; i++){
    printf("%d\n", a[i]);
  }
}

Compiler output:
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<int> G;
      | ^~~~~~
a.cc: In function 'void shellSort(int*, int, int*)':
a.cc:21:5: error: 'G' was not declared in this scope
   21 |     G.push_back(h);
      |     ^
a.cc:25:15: error: 'G' was not declared in this scope
   25 |   for(int i = G.size()-1; i >= 0; i --){
      |               ^
a.cc: In function 'int main(int, char**)':
a.cc:45:16: error: 'G' was not declared in this scope
   45 |   int g_size = G.size();
      |                ^
Language: C++

/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
	vector<int> G;
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: 'reverse' was not declared in this scope
   51 |         reverse(G.begin(), G.end());
      |         ^~~~~~~
Language: C++

/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
	vector<int> G;
	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

Compiler output:
a.cc: In function 'int main()':
a.cc:52:9: error: 'reverse' was not declared in this scope
   52 |         reverse(G.begin(), G.end());
      |         ^~~~~~~
Language: C++

/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
#include <argolithm>
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
	vector<int> G;
	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

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

/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
#include <algorithm>
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	cin.tie(0);
	sync_with_stdio(false);
	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
	vector<int> G;
//	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

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

/**************
*	Shell Sort
*************/

#include <cstdio>
#include <vector>	//??£?¨?
#include <algorithm>
using namespace std;
typedef vector<int> TList;	//??????????????????

void insertionSort(TList& A, int g, int& cnt ){

	for(unsigned int i=g ; i<(A.size()); i++){
		int v = A[i];
		int j = i-g;
		while(j>=0 && A[j]>v){
			A[j+g] = A[j];
			j = j-g;
			cnt++;
		}
		A[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(TList& A, TList& G, int& cnt){

	for(unsigned int i=0; i<(G.size()); i++){
		insertionSort(A, G[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??????????¨????
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	//??\???
	int n;
	scanf("%d\n",&n);
//	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
	//	cin >> A[i];
		scanf("%d\n", &A[i]);
	}
	
	//??????
	TList G;
//	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(A, G, cnt);

	//??????
//	cout << G.size() << endl;
	printf("%d", G.size());
	for(unsigned int i=0; i<(G.size()); i++){
		printf("%d", G[i]);
//		cout << G[i];
		if(i!=(G.size()-1)){
//			cout <<" " ;
			printf(" ");
		}
	}
//	cout << endl;
	printf("\n");
	printf("%d", cnt);
	cout << cnt << endl;
	for(int i=0; i< n; i++){
//		cout << A[i]<< endl;
		printf("%d\n", A[i]);
	}
	return 0;
}
//-----------------------------------------------

Compiler output:
a.cc: In function 'int main()':
a.cc:78:9: error: 'cout' was not declared in this scope
   78 |         cout << cnt << endl;
      |         ^~~~
a.cc:8:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include <algorithm>
  +++ |+#include <iostream>
    8 | using namespace std;
a.cc:78:24: error: 'endl' was not declared in this scope
   78 |         cout << cnt << endl;
      |                        ^~~~
a.cc:8:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    7 | #include <algorithm>
  +++ |+#include <ostream>
    8 | using namespace std;
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <bits\stdc++.h>
using namespace std;
int cnt;
vector<int> G;

void insertionSort(vector<int> &A, int n, int g)
{
	for (int i = g; i < n; i++)
	{
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v)
		{
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}
void shellsort(vector<int> &A, int n)
{
	for (int h = 1; h <= n; h = 3 * h + 1)
	{
		G.push_back(h);
	}
	for (int i = G.size() - 1; i >= 0; --i)
	{
		insertionSort(A, n, G[i]);
	}
}
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> v(n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &v[i]);
	}
	
	shellsort(v, n);

	printf("%d\n", G.size());
	for (int i = G.size() - 1; i >= 0; --i)
		printf("%d ", G[i]);
	printf("%d\n", cnt);
	for (int i = 0; i < n; ++i)
		printf("%d\n", v[i]);

	return 0;
}

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

#include <iostream>
#include <math.h>
#include <sstream>

using namespace std;
string shell_sort(string, int, int, int*);
int* insert_sort_4_shell(int*, int, int);
string intArrayToString(int*, int);

int main()
{
	string str;
	getline(cin, str);
	int num;
	stringstream num_ss(str);
	num_ss >> num;

	getline(cin, str);
	int counter = 0;
	int m = 3;
	int G[] = { 1, 2, 3 };
	str = shell_sort(str, num, m, G, counter);
	cout << m << endl;
	cout << intArrayToString(G, m) << endl;
	cout << counter << endl;
	cout << str << endl;

	return 0;
}

string shell_sort(string str, int ary_size, int m, int* G, int &counter) {
	int* ary = new int[ary_size];
	stringstream ss(str);
	string buff;
	int cnt = 0;
	while (getline(ss, buff, ' ')) {
		stringstream tss(buff);
		tss >> ary[cnt];
		cnt++;
	}

	// main.
	for (int i = 0; i < m; i++) {
		insert_sort_4_shell(ary, ary_size, G[i], counter);
	}

	return intArrayToString(ary, ary_size);
}

int* insert_sort_4_shell(int* ary, int ary_size, int g, int &counter) {

	// main.
	for (int i = g; i < ary_size; i++) {
		int v = ary[i];
		for (int j = i - g; j >= 0 && v < ary[j]; j -= g) {
			ary[j + g] = ary[j];
			ary[j] = v;
			counter++;
		}
	}

	return ary;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: too many arguments to function 'std::string shell_sort(std::string, int, int, int*)'
   22 |         str = shell_sort(str, num, m, G, counter);
      |               ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:8: note: declared here
    6 | string shell_sort(string, int, int, int*);
      |        ^~~~~~~~~~
a.cc: In function 'std::string shell_sort(std::string, int, int, int*, int&)':
a.cc:44:36: error: too many arguments to function 'int* insert_sort_4_shell(int*, int, int)'
   44 |                 insert_sort_4_shell(ary, ary_size, G[i], counter);
      |                 ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:7:6: note: declared here
    7 | int* insert_sort_4_shell(int*, int, int);
      |      ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <sstream>

using namespace std;
string shell_sort(string, int, int, int*);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int, int&);

int main()
{
	string str;
	getline(cin, str);
	int num;
	stringstream num_ss(str);
	num_ss >> num;

	getline(cin, str);
	int counter = 0;
	int m = 3;
	int G[] = { 1, 2, 3 };
	str = shell_sort(str, num, m, G, counter);
	cout << m << endl;
	cout << intArrayToString(G, m) << endl;
	cout << counter << endl;
	cout << str << endl;

	return 0;
}

string shell_sort(string str, int ary_size, int m, int* G, int &counter) {
	int* ary = new int[ary_size];
	stringstream ss(str);
	string buff;
	int cnt = 0;
	while (getline(ss, buff, ' ')) {
		stringstream tss(buff);
		tss >> ary[cnt];
		cnt++;
	}

	// main.
	for (int i = 0; i < m; i++) {
		insert_sort_4_shell(ary, ary_size, G[i], counter);
	}

	return intArrayToString(ary, ary_size);
}

int* insert_sort_4_shell(int* ary, int ary_size, int g, int &counter) {

	// main.
	for (int i = g; i < ary_size; i++) {
		int v = ary[i];
		for (int j = i - g; j >= 0 && v < ary[j]; j -= g) {
			ary[j + g] = ary[j];
			ary[j] = v;
			counter++;
		}
	}

	return ary;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: too many arguments to function 'std::string shell_sort(std::string, int, int, int*)'
   22 |         str = shell_sort(str, num, m, G, counter);
      |               ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:8: note: declared here
    6 | string shell_sort(string, int, int, int*);
      |        ^~~~~~~~~~
a.cc:24:33: error: too few arguments to function 'std::string intArrayToString(int*, int, int&)'
   24 |         cout << intArrayToString(G, m) << endl;
      |                 ~~~~~~~~~~~~~~~~^~~~~~
a.cc:8:8: note: declared here
    8 | string intArrayToString(int*, int, int&);
      |        ^~~~~~~~~~~~~~~~
a.cc: In function 'std::string shell_sort(std::string, int, int, int*, int&)':
a.cc:47:32: error: too few arguments to function 'std::string intArrayToString(int*, int, int&)'
   47 |         return intArrayToString(ary, ary_size);
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
a.cc:8:8: note: declared here
    8 | string intArrayToString(int*, int, int&);
      |        ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <sstream>

using namespace std;
string shell_sort(string, int, int, int*, int&);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int);

int main()
{
	string str;
	getline(cin, str);
	int num;
	stringstream num_ss(str);
	num_ss >> num;

	str = "";
	string buff;
	for (int i = 0; i < num; i++) {
		getline(cin, buff);
		if (i == num - 1) {
			str += buff;
		} else {
			str += buff + " ";
		}
	}
	int counter = 0;
        int m;
        int* G;
　　　　if (num == 1) {
            m = 1;
            int a[] = {1};
            G = a;
        } else {
            m = 2;
            int a[] = {4,1};
            G = a;
        }
	int G[] = { 3, 1 };
	str = shell_sort(str, num, m, G, counter);
	cout << m << endl;
	cout << intArrayToString(G, m) << endl;
	cout << counter << endl;
	cout << str << endl;

	return 0;
}

string shell_sort(string str, int ary_size, int m, int* G, int &counter) {
	int* ary = new int[ary_size];
	stringstream ss(str);
	string buff;
	int cnt = 0;
	while (getline(ss, buff, ' ')) {
		stringstream tss(buff);
		tss >> ary[cnt];
		cnt++;
	}

	// main.
	for (int i = 0; i < m; i++) {
		insert_sort_4_shell(ary, ary_size, G[i], counter);
	}

	return intArrayToString(ary, ary_size);
}

int* insert_sort_4_shell(int* ary, int ary_size, int g, int &counter) {

	// main.
	for (int i = g; i < ary_size; i++) {
		int v = ary[i];
		for (int j = i - g; j >= 0 && v < ary[j]; j -= g) {
			ary[j + g] = ary[j];
			ary[j] = v;
			counter++;
		}
	}

	return ary;
}

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

Compiler output:
a.cc:31:1: error: extended character 　 is not valid in an identifier
   31 | 　　　　if (num == 1) {
      | ^
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:31:1: error: '\U00003000\U00003000\U00003000\U00003000if' was not declared in this scope
   31 | 　　　　if (num == 1) {
      | ^~~~~~~~~~
a.cc:35:11: error: 'else' without a previous 'if'
   35 |         } else {
      |           ^~~~
a.cc:40:13: error: conflicting declaration 'int G []'
   40 |         int G[] = { 3, 1 };
      |             ^
a.cc:30:14: note: previous declaration as 'int* G'
   30 |         int* G;
      |              ^
Language: C++

#include <iostream>
#include <math.h>
#include <sstream>

using namespace std;
string shell_sort(string, int, int, int*, int&);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int);

int main()
{
	string str;
	getline(cin, str);
	int num;
	stringstream num_ss(str);
	num_ss >> num;

	str = "";
	string buff;
	for (int i = 0; i < num; i++) {
		getline(cin, buff);
		if (i == num - 1) {
			str += buff;
		} else {
			str += buff + " ";
		}
	}
	int counter = 0;
        int m;
        int* G;
　　　　if (num == 1) {
            m = 1;
            int a[] = {1};
            G = a;
        } else {
            m = 2;
            int a[] = {4,1};
            G = a;
        }
	
	str = shell_sort(str, num, m, G, counter);
	cout << m << endl;
	cout << intArrayToString(G, m) << endl;
	cout << counter << endl;
	cout << str << endl;

	return 0;
}

string shell_sort(string str, int ary_size, int m, int* G, int &counter) {
	int* ary = new int[ary_size];
	stringstream ss(str);
	string buff;
	int cnt = 0;
	while (getline(ss, buff, ' ')) {
		stringstream tss(buff);
		tss >> ary[cnt];
		cnt++;
	}

	// main.
	for (int i = 0; i < m; i++) {
		insert_sort_4_shell(ary, ary_size, G[i], counter);
	}

	return intArrayToString(ary, ary_size);
}

int* insert_sort_4_shell(int* ary, int ary_size, int g, int &counter) {

	// main.
	for (int i = g; i < ary_size; i++) {
		int v = ary[i];
		for (int j = i - g; j >= 0 && v < ary[j]; j -= g) {
			ary[j + g] = ary[j];
			ary[j] = v;
			counter++;
		}
	}

	return ary;
}

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

Compiler output:
a.cc:31:1: error: extended character 　 is not valid in an identifier
   31 | 　　　　if (num == 1) {
      | ^
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:31:1: error: '\U00003000\U00003000\U00003000\U00003000if' was not declared in this scope
   31 | 　　　　if (num == 1) {
      | ^~~~~~~~~~
a.cc:35:11: error: 'else' without a previous 'if'
   35 |         } else {
      |           ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <sstream>

using namespace std;
string shell_sort(string, int, int, int*, int&);
int* insert_sort_4_shell(int*, int, int, int&);
string intArrayToString(int*, int);

int main()
{
	string str;
	getline(cin, str);
	int num;
	stringstream num_ss(str);
	num_ss >> num;

	str = "";
	string buff;
	for (int i = 0; i < num; i++) {
		getline(cin, buff);
		if (i == num - 1) {
			str += buff;
		} else {
			str += buff + " ";
		}
	}
	int counter = 0;
        int m;
        int G[] = { 4, 1 }
　　　　if (num == 1) {
            m = 1;
            G = G + 1;
        }
	str = shell_sort(str, num, m, G, counter);
	cout << m << endl;
	cout << intArrayToString(G, m) << endl;
	cout << counter << endl;
	cout << str << endl;

	return 0;
}

string shell_sort(string str, int ary_size, int m, int* G, int &counter) {
	int* ary = new int[ary_size];
	stringstream ss(str);
	string buff;
	int cnt = 0;
	while (getline(ss, buff, ' ')) {
		stringstream tss(buff);
		tss >> ary[cnt];
		cnt++;
	}

	// main.
	for (int i = 0; i < m; i++) {
		insert_sort_4_shell(ary, ary_size, G[i], counter);
	}

	return intArrayToString(ary, ary_size);
}

int* insert_sort_4_shell(int* ary, int ary_size, int g, int &counter) {

	// main.
	for (int i = g; i < ary_size; i++) {
		int v = ary[i];
		for (int j = i - g; j >= 0 && v < ary[j]; j -= g) {
			ary[j + g] = ary[j];
			ary[j] = v;
			counter++;
		}
	}

	return ary;
}

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

Compiler output:
a.cc:31:1: error: extended character 　 is not valid in an identifier
   31 | 　　　　if (num == 1) {
      | ^
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc:31:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:31:1: error: expected ',' or ';' before '\U00003000\U00003000\U00003000\U00003000if'
   31 | 　　　　if (num == 1) {
      | ^~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int m=3;
int G[3] = {4,3,1};
	
void insertSort(int *a,int n,int g){
	int v,i,j;
	for(i=g;i<n;i++){
		v = a[i];
		j = i-g;
		while(j>=0&&a[j]>v){
			a[j+g] = a[j];
			j -= g;
			cnt++;
		}
		a[j+g] = v;
	}
}
void shellSort(int *a,int n){
	
	int m = 3,i;
	for(i=0;i<m;i++)
		insertSort(a,n,G[i]);
}
int main(){
	int n=0,cnt=0;
	scanf("%d",&n);
	int a[n],i;
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	shellSort(a,n);
	printf("%d\n",m);
	for(i=0;i<m-1;i++)
		printf("%d ",G[i]);
	printf("%d\n",G[i]);
	printf("%d\n",cnt);
	for(i=0;i<n;i++)
		printf("%d\n",a[i]);
	return 0;
}

Compiler output:
a.cc: In function 'void insertSort(int*, int, int)':
a.cc:15:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |                         cnt++;
      |                         ^~~
      |                         int
Language: C++

#include<iostream>
using namespace std;

int m=3;
int G[3] = {4,3,1};
	
int insertSort(int *a,int n,int g){
	int v,i,j,cnt;
	for(i=g;i<n;i++){
		v = a[i];
		j = i-g;
		while(j>=0&&a[j]>v){
			a[j+g] = a[j];
			j -= g;
			cnt++;
		}
		a[j+g] = v;
	}
	return cnt;
}
void shellSort(int *a,int n){
	
	int m = 3,i;
	for(i=0;i<m;i++)
		insertSort(a,n,G[i]);
}
int main(){
	int n=0,cnt;
	scanf("%d",&n);
	int a[n],i;
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	cnt = shellSort(a,n);
	printf("%d\n",m);
	for(i=0;i<m-1;i++)
		printf("%d ",G[i]);
	printf("%d\n",G[i]);
	printf("%d\n",cnt);
	for(i=0;i<n;i++)
		printf("%d\n",a[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:24: error: void value not ignored as it ought to be
   33 |         cnt = shellSort(a,n);
      |               ~~~~~~~~~^~~~~
Language: C++

cnt = 0
n = int(raw_input())
A = [int(raw_input()) for _ in range(n)]
G = [1]
while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1)
if n > 256: G.append(n/10*9)
G.reverse()

def insersionSort(g):
	global cnt
	for i in range(g, n):
		v = A[i]
		j = i - g
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j = j - g
			cnt += 1
		A[j+g] = v

def shellSort():
	for g in G:
		insersionSort(g)

shellSort()
print len(G)
print " ".join(map(str, G))
print cnt
print "\n".join(map(str, A))

Compiler output:
a.cc:1:1: error: 'cnt' does not name a type; did you mean 'int'?
    1 | cnt = 0
      | ^~~
      | int
Language: C++

#include <iostream>
#include <algorithm>
#include<vector>
int G(int num) {
	return static_cast<int>(std::pow(10, num));
}
int InsertionSort(std::vector <int> &Sequence, int g) {
	int cnt = 0;
	for (unsigned int i = g; i < Sequence.size(); ++i) {
		int  v = Sequence[i];
		int j = i - g;
		while(j >= 0 && Sequence[j] > v){
			Sequence[j + g] = Sequence[j];
			j = j - g;
			++cnt;
		}
		Sequence[j + g] = v;
	}
	return cnt;
}
int ShellSort(std::vector <int>& Sequence) {
	int cnt = 0;
		for (int i = 0; i < 18; ++i) {
		cnt+=InsertionSort(Sequence, G(i));
	}
	return cnt;
}
int main(void) {
	int N;
	std::cin >> N;
	std::vector<int>InputA(N);
	for (int i = 0; i < N; ++i) {
		std::cin >> InputA[i];
	}
	std::cout << N << std::endl;
	for (int i = 0; i < N; ++i) {
		std::cout << G(i);
		if (i < N-1) {
			std::cout << " ";
		}
				}
	std::cout << std::endl
		<< ShellSort(InputA)<<std::endl;
	for (unsigned int i = 0; i < InputA.size(); ++i) {
		std::cout << InputA[i];
		if (i < InputA.size()-1) {
			std::cout << " "<<std::endl;
		}
			}std::cout << std::endl;
		//system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int G(int)':
a.cc:5:38: error: 'pow' is not a member of 'std'
    5 |         return static_cast<int>(std::pow(10, num));
      |                                      ^~~
Language: C++

#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(){
  int S[100]
  int top=0;
  string s;
  while(cin>>s){
    if(s=="+") S[top-1]+=S[top--];
    else if(s=="-") S[top-1]-=S[top--];
    else if(s=="*") S[top-1]*=S[top--];
    else S[++top]=atoi(s.c_str());
  }
  cout<<S[top]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'int'
    7 |   int top=0;
      |   ^~~
a.cc:10:16: error: 'S' was not declared in this scope
   10 |     if(s=="+") S[top-1]+=S[top--];
      |                ^
a.cc:10:18: error: 'top' was not declared in this scope
   10 |     if(s=="+") S[top-1]+=S[top--];
      |                  ^~~
a.cc:11:21: error: 'S' was not declared in this scope
   11 |     else if(s=="-") S[top-1]-=S[top--];
      |                     ^
a.cc:11:23: error: 'top' was not declared in this scope
   11 |     else if(s=="-") S[top-1]-=S[top--];
      |                       ^~~
a.cc:12:21: error: 'S' was not declared in this scope
   12 |     else if(s=="*") S[top-1]*=S[top--];
      |                     ^
a.cc:12:23: error: 'top' was not declared in this scope
   12 |     else if(s=="*") S[top-1]*=S[top--];
      |                       ^~~
a.cc:13:10: error: 'S' was not declared in this scope
   13 |     else S[++top]=atoi(s.c_str());
      |          ^
a.cc:13:14: error: 'top' was not declared in this scope
   13 |     else S[++top]=atoi(s.c_str());
      |              ^~~
a.cc:15:9: error: 'S' was not declared in this scope
   15 |   cout<<S[top]<<endl;
      |         ^
a.cc:15:11: error: 'top' was not declared in this scope
   15 |   cout<<S[top]<<endl;
      |           ^~~
Language: C++

#include <iostream>
#include<vector>
 int insertion_sort(std::vector<int> a, int n, int gap) {
	int count = 0;
	for (int i = gap; i < n; ++i) {
		int v = a[i];
		int j = i - gap;
		while (j >= 0 && a[j] > v) {
			a[j + gap] = a[j];
			j -= gap;
			count++;
		}
		a[j + gap] = v;
	}
	return count;
}
void shell_sort(std::vector<int> a, int n) {
	int a[]= { 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
 std::vector< int>gaps(a, std::end(a));
 //{ 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
	// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)
	int gap_num = 0, count = 0;
	while (gaps[gap_num + 1] < n) { gap_num++; }
	for (int i = gap_num; i >= 0; --i) { count += insertion_sort(a, n, gaps[i]); }
	std::cout << (gap_num + 1) << '\n';
	for (int i = gap_num; i; --i) std::cout << gaps[i] << ' ';
	std::cout << gaps[0] << '\n';
	std::cout << count << '\n';
}
int main(void) {
	std::ios::sync_with_stdio(false);
	int n;
	std::cin >> n;
	std::vector<int> a(n, 0);
	for (int i = 0; i < n; ++i) {
		std::cin >> a[i];
	}
	shell_sort(a, n);
	for (int i = 0; i < n; ++i) { std::cout << a[i] << '\n'; }
}

Compiler output:
a.cc: In function 'void shell_sort(std::vector<int>, int)':
a.cc:18:13: error: declaration of 'int a []' shadows a parameter
   18 |         int a[]= { 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
      |             ^
a.cc:17:34: note: 'std::vector<int> a' previously declared here
   17 | void shell_sort(std::vector<int> a, int n) {
      |                 ~~~~~~~~~~~~~~~~~^
a.cc:24:70: error: could not convert '(int*)(& a)' from 'int*' to 'std::vector<int>'
   24 |         for (int i = gap_num; i >= 0; --i) { count += insertion_sort(a, n, gaps[i]); }
      |                                                                      ^
      |                                                                      |
      |                                                                      int*
Language: C++

#include <iostream>
#include<algorithm>
#include<vector>
 int insertion_sort(std::vector<int> a, int n, int gap) {
	int count = 0;
	for (int i = gap; i < n; ++i) {
		int v = a[i];
		int j = i - gap;
		while (j >= 0 && a[j] > v) {
			a[j + gap] = a[j];
			j -= gap;
			count++;
		}
		a[j + gap] = v;
	}
	return count;
}
void shell_sort(std::vector<int> a, int n) {
	int a[]= { 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
 std::vector< int>gaps(a, std::end(a));
 //{ 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
	// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)
	int gap_num = 0, count = 0;
	while (gaps[gap_num + 1] < n) { gap_num++; }
	for (int i = gap_num; i >= 0; --i) { count += insertion_sort(a, n, gaps[i]); }
	std::cout << (gap_num + 1) << '\n';
	for (int i = gap_num; i; --i) std::cout << gaps[i] << ' ';
	std::cout << gaps[0] << '\n';
	std::cout << count << '\n';
}
int main(void) {
	std::ios::sync_with_stdio(false);
	int n;
	std::cin >> n;
	std::vector<int> a(n, 0);
	for (int i = 0; i < n; ++i) {
		std::cin >> a[i];
	}
	shell_sort(a, n);
	for (int i = 0; i < n; ++i) { std::cout << a[i] << '\n'; }
}

Compiler output:
a.cc: In function 'void shell_sort(std::vector<int>, int)':
a.cc:19:13: error: declaration of 'int a []' shadows a parameter
   19 |         int a[]= { 1,8,23,77,281,1073,4193,16577,65921,262913,1050113 };
      |             ^
a.cc:18:34: note: 'std::vector<int> a' previously declared here
   18 | void shell_sort(std::vector<int> a, int n) {
      |                 ~~~~~~~~~~~~~~~~~^
a.cc:25:70: error: could not convert '(int*)(& a)' from 'int*' to 'std::vector<int>'
   25 |         for (int i = gap_num; i >= 0; --i) { count += insertion_sort(a, n, gaps[i]); }
      |                                                                      ^
      |                                                                      |
      |                                                                      int*
Language: C++

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

long long cnt;
int R[1000000];
vector<int> G;

void insertionSort(int R[],int n,int g){
	int key;
	int j;
	for (int i = g; i < n; i++){
		key = R[i];
		j = i - g;
		while (j >= 0; R[j] > key){
			R[j + g] = R[j];
			j -= g;
			cnt++;
		}
		R[j + g] = key;
	}
}

void shellSort(int R[], int n){
	for (int i = 1; ; ){
		if (i > n){
			break;
		}
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i++){
		insertionSort(A, n, G[i]);
	}
}

int main(){
	int R[200],n;
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		cin >> R[i];
	}
	int key;
	cnt = 0;
	shellSort(R, n);
	cout << G.size() << endl;
	for (int i = 0; i < n; i++){
		cout << G[i];
		if (i != 0)
			cout << " ";
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < n; i++){
		cout << R[i] << endl;
	}
}

Compiler output:
a.cc:8:1: error: 'vector' does not name a type
    8 | vector<int> G;
      | ^~~~~~
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:16:30: error: expected ')' before ';' token
   16 |                 while (j >= 0; R[j] > key){
      |                       ~      ^
      |                              )
a.cc:16:42: error: expected ';' before ')' token
   16 |                 while (j >= 0; R[j] > key){
      |                                          ^
      |                                          ;
a.cc: In function 'void shellSort(int*, int)':
a.cc:30:17: error: 'G' was not declared in this scope
   30 |                 G.push_back(h);
      |                 ^
a.cc:30:29: error: 'h' was not declared in this scope
   30 |                 G.push_back(h);
      |                             ^
a.cc:33:22: error: 'G' was not declared in this scope
   33 |         for (int i = G.size() - 1; i >= 0; i++){
      |                      ^
a.cc:34:31: error: 'A' was not declared in this scope
   34 |                 insertionSort(A, n, G[i]);
      |                               ^
a.cc: In function 'int main()':
a.cc:48:17: error: 'G' was not declared in this scope
   48 |         cout << G.size() << endl;
      |                 ^