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

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
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: In function 'void insertionSort(int*, int, int)':
a.cc:18:30: error: expected ')' before ';' token
   18 |                 while (j >= 0; R[j] > key){
      |                       ~      ^
      |                              )
a.cc:18:42: error: expected ';' before ')' token
   18 |                 while (j >= 0; R[j] > key){
      |                                          ^
      |                                          ;
a.cc: In function 'void shellSort(int*, int)':
a.cc:32:29: error: 'h' was not declared in this scope
   32 |                 G.push_back(h);
      |                             ^
a.cc:36:31: error: 'A' was not declared in this scope
   36 |                 insertionSort(A, n, G[i]);
      |                               ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
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 h = 1; ; ){
		if (h > n){
			break;
		}
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i++){
		insertionSort(R, 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: In function 'void insertionSort(int*, int, int)':
a.cc:18:30: error: expected ')' before ';' token
   18 |                 while (j >= 0; R[j] > key){
      |                       ~      ^
      |                              )
a.cc:18:42: error: expected ';' before ')' token
   18 |                 while (j >= 0; R[j] > key){
      |                                          ^
      |                                          ;
Language: C++

#include<stdio.h>
#include<camth>
#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;

void insertionSort(int R[],int n,int g){
	int key;
	int g;
	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 h = 1;;){
		if (h > n){
			breeak;
		}
		G.push_back(h);
		h = 3 + h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--){
		insertionSort(R, n, G[i]);
	}
}

int main(){
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		scanf("%d", &R[i]);
	}
	int key;
	cnt = 0;
	shellSort(R,n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--){
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++){
		printf("%d\n", R[i]);
	}

}

int main(){

}

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

#include<stdio.h>
#include<camth>
#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;

void insertionSort(int R[],int n,int g){
	int key;
	int g;
	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 h = 1;;){
		if (h > n){
			breeak;
		}
		G.push_back(h);
		h = 3 + h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--){
		insertionSort(R, n, G[i]);
	}
}

int main(){
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		scanf("%d", &R[i]);
	}
	int key;
	cnt = 0;
	shellSort(R,n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--){
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++){
		printf("%d\n", R[i]);
	}

}

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

#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;

void insertionSort(int R[],int n,int g){
	int key;
	int g;
	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 h = 1;;){
		if (h > n){
			breeak;
		}
		G.push_back(h);
		h = 3 + h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--){
		insertionSort(R, n, G[i]);
	}
}

int main(){
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		scanf("%d", &R[i]);
	}
	int key;
	cnt = 0;
	shellSort(R,n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--){
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++){
		printf("%d\n", R[i]);
	}

}

Compiler output:
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:15:13: error: declaration of 'int g' shadows a parameter
   15 |         int g;
      |             ^
a.cc:13:38: note: 'int g' previously declared here
   13 | void insertionSort(int R[],int n,int g){
      |                                  ~~~~^
a.cc:18:17: error: 'j' was not declared in this scope
   18 |                 j = i - g;
      |                 ^
a.cc: In function 'void shellSort(int*, int)':
a.cc:31:25: error: 'breeak' was not declared in this scope
   31 |                         breeak;
      |                         ^~~~~~
Language: C++

#include<stdio.h>
#include<camth>
#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;

void insertionSort(int R[],int n,int g){
	int key;
	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 h = 1;;){
		if (h > n){
			break;
		}
		G.push_back(h);
		h = 3 + h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--){
		insertionSort(R, n, G[i]);
	}
}

int main(){
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		scanf("%d", &R[i]);
	}
	int key;
	cnt = 0;
	shellSort(R,n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--){
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++){
		printf("%d\n", R[i]);
	}

}

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

#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;
long long cnt;
int n;
int R[1000000];
vector<int> G;

void insertionSort(int R[],int n,int g){
	int key;
	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 h = 1;;){
		if (h > n){
			break;
		}
		G.push_back(h);
		h = 3 + h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--){
		insertionSort(R, n, G[i]);
	}
}

int main(){
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		scanf("%d", &R[i]);
	}
	int key;
	cnt = 0;
	shellSort(R,n);
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--){
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++){
		printf("%d\n", R[i]);
	}

}

Compiler output:
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:17:17: error: 'j' was not declared in this scope
   17 |                 j = i - g;
      |                 ^
Language: C++

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

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

void insertionSort(int R[], int n, int g){
	int key, j;
	for (int i = 0, 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 h = 1;;){
		if (h > n)
			break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i <= 0; i--){
		shellSort(R, n, G[i]);
	}
}

int main(){
	cin >> n;
	int j;
	for (int i = 0; i < n; i++){
		scanf("%d", &R[i]);
	}
	int key;
	cnt = 0;
	cout << G.size() << endl;
	for (int i = G.size(); i <= 0; i--){
		printf("%d", G[i]);
		if (i != 0)
			printf(" ");
	}
	printf("\n");
	printf("%d,\n", cnt);
	for (int i = 0; i < n; i++){
		printf("%d\n", R[i]);
	}
}

Compiler output:
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:15:26: error: expected ';' before '<' token
   15 |         for (int i = 0, i < n; i++){
      |                          ^~
      |                          ;
a.cc:15:27: error: expected primary-expression before '<' token
   15 |         for (int i = 0, i < n; i++){
      |                           ^
a.cc: In function 'void shellSort(int*, int)':
a.cc:35:26: error: too many arguments to function 'void shellSort(int*, int)'
   35 |                 shellSort(R, n, G[i]);
      |                 ~~~~~~~~~^~~~~~~~~~~~
a.cc:27:6: note: declared here
   27 | void shellSort(int R[], int n){
      |      ^~~~~~~~~
Language: C++

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

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

void insertionSort(int R[], int n, int g){
	int key, j;
	for (int i = 0; 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 h = 1;;){
		if (h > n)
			break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i <= 0; i--){
		shellSort(R, n, G[i]);
	}
}

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

Compiler output:
a.cc: In function 'void shellSort(int*, int)':
a.cc:35:26: error: too many arguments to function 'void shellSort(int*, int)'
   35 |                 shellSort(R, n, G[i]);
      |                 ~~~~~~~~~^~~~~~~~~~~~
a.cc:27:6: note: declared here
   27 | void shellSort(int R[], int n){
      |      ^~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

long long 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)
{
	// ??°???G(0) = 1, G(n + 1) = 3G(n) + 1
	G.push_back(1);
	for (int i = 0;i < n;i++)
		G.push_back(3 * G[i] + 1);

	reverse(G.begin(), G.end());

	for (int i = 0;i < G.size();i++)
		InsertionSort(A, n, G[i]);
}

int main()
{
	int n;
	cnt = 0;

	// ??\???
	cin >> n;

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

	// ?????§????????????
	ShellSort(A, n);

	// ??????
	// ??´??°m
	cout << G.size() << endl;

	// G???????´?
	for (int i = 0;i < G.size();i++)
	{
		if (i > 0)
			cout << " ";
		cout << G[i];
	}
	cout << endl;

	// ????????????
	cout << cnt << endl;

	// ?????????????????°???
	for (int i = 0;i < n;i++)
		cout << A[i] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'void ShellSort(std::vector<int>&, int)':
a.cc:34:9: error: 'reverse' was not declared in this scope
   34 |         reverse(G.begin(), G.end());
      |         ^~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
static int cnt = 0;
void printArray(int a[],int n){
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1)
            cout << endl;
    }
}
void insertSort(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 = j - g;
            cnt = cnt + 1;
        }
        a[j+g] = v;
    }
}
void shellSort(int a[],int n){
    vector<int> G;
    int beginNum = 1;
    G.push_back(beginNum);
    while(3*beginNum+1 <= n){
        int temp = 3*beginNum+1;
        G.push_back(temp);
        beginNum = temp;
    }
    int m = G.size();
    cout << m << endl;
    for(int i=m-1;i>=0;i--){
        cout << G[i];
        if(i!=0)
            cout << " ";
    }
    cout << endl;
    for(int k=0;k<m;k++)
        insertSort(a,n,G[k]);

}
int main(){
    int n;
    cin >> n;
    int a[n];
    if(n>=1 && n<=100){
        for(int i=0;i<n;i++){
            cin >> a[i];
        }
        shellSort(a,n);
        printArray(a,n);
    }else{
        return 0;
    }
    return 0;
}

Compiler output:
a.cc: In function 'void shellSort(int*, int)':
a.cc:25:5: error: 'vector' was not declared in this scope
   25 |     vector<int> G;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:25:12: error: expected primary-expression before 'int'
   25 |     vector<int> G;
      |            ^~~
a.cc:27:5: error: 'G' was not declared in this scope
   27 |     G.push_back(beginNum);
      |     ^
Language: C++

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

int cnt,m;
vector<int> G;

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

void shellSort(vector<int>& a,int n) {
	cnt = 0;
	m=0;
	int d=n;
	G.resize(n);
	while(1) {
		d=2*d/3;
		if(d<2) {
			G[m]=d;
			++m;
			break;
		}
		G[m]=d;
		++m;
	}
	for(int i=0; i<m; ++i) {
		insertionSort(a, n, G[i]);
	}
}

int main() {
	int n;
	vector<int> a;
	scanf("&d",&n);
	a.resize(n);
	for(int i=0; i<n; ++i) {
		scanf("%d",&a[i]);
	}
	shellSort(a,n);
	cout << m << endl;
	for(int i=0; i<m-1; ++i) {
		printf("%d ",G[i]);
	}
	printf("%d\n%d\n",G[m-1],cnt);
	for(int i=0;i<n;++i) {
		printf("%d\n",a[i]);
	}
	return 0;
}

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



#include <iostream>
//#include <conio.h>
using namespace std;
int main()
{
	int n;
	int key;
	int h[10];
	h[0] =1;
	int dem = 0;
	cin>>n;
	int a[100000];
	for (int i = 0; i < n; i++)
		cin>>a[i];
	int	step,i,j, x,len, k = 0;
	int s = 0;
	while (k < n)
	{
		k = s*3 + 1;
		s++;
	}
	for (int i = 0; i < s - 1; i++)
	{
		if (k > 1)
		{
			h[i] = k - 3;
			k = k - 3;
		}
		else
		{
			h[i] = 1;
		}
	}
	for (step = 0 ; step < s - 1; step ++)
	{	
		len = h[step];
		for (i = len; i < n; i++)
		{	
			x = a[i]; 
			j = i-len; // a[j] ?????ng k??? tr?°???c a[i] trong c??ng d?£y con 
			while (( x < a[j] )&&( j >=0 ))// s???p x???p d?£y con ch???a  x 
			{		// b??±ng ph?°??ng ph??p ch?¨n tr??±c ti???p 
				a[j+len]  = a[j];
				j = j - len;
				dem++;
			}
			a[j+len] = x;
		}
	}
	
	if (h[0] == 1 && h[1] == NULL)
	{
		cout<<s<<endl;
		cout<<h[0]<<endl;
	}
	else
	{
		cout<<s - 1<<endl;
		for (int i =0; i < s - 1; i++)
		cout<<h[i]<<endl;
	}
	cout<< dem << endl;
	for (int k = 0; k < n; k++)
	{
		cout<<a[k]<<endl ;
	}
	cout <<endl;
	getch();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:34: warning: NULL used in arithmetic [-Wpointer-arith]
   53 |         if (h[0] == 1 && h[1] == NULL)
      |                                  ^~~~
a.cc:70:9: error: 'getch' was not declared in this scope; did you mean 'getc'?
   70 |         getch();
      |         ^~~~~
      |         getc
Language: C++



#include <iostream>
//#include <conio.h>
using namespace std;
int main()
{
	int n;
	int key;
	int h[10];
	h[0] =1;
	int dem = 0;
	cin>>n;
	int a[100000];
	for (int i = 0; i < n; i++)
		cin>>a[i];
	int	step,i,j, x,len, k = 0;
	int s = 0;
	while (k < n)
	{
		k = s*3 + 1;
		s++;
	}
	for (int i = 0; i < s - 1; i++)
	{
		if (k > 1)
		{
			h[i] = k - 3;
			k = k - 3;
		}
		else
		{
			h[i] = 1;
		}
	}
	for (step = 0 ; step < s - 1; step ++)
	{	
		len = h[step];
		for (i = len; i < n; i++)
		{	
			x = a[i]; 
			j = i-len; // a[j] ?????ng k??? tr?°???c a[i] trong c??ng d?£y con 
			while (( x < a[j] )&&( j >=0 ))// s???p x???p d?£y con ch???a  x 
			{		// b??±ng ph?°??ng ph??p ch?¨n tr??±c ti???p 
				a[j+len]  = a[j];
				j = j - len;
				dem++;
			}
			a[j+len] = x;
		}
	}
	
	if (h[0] == 1 && h[1] == NULL)
	{
		cout<<s<<endl;
		cout<<h[0]<<endl;
	}
	else
	{
		cout<<s - 1<<endl;
		for (int i =0; i < s - 1; i++)
		cout<<h[i]<<" ";
	}
	cout<<endl<< dem << endl;
	for (int k = 0; k < n; k++)
	{
		cout<<a[k]<<endl ;
	}
	cout <<endl;
	getch();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:34: warning: NULL used in arithmetic [-Wpointer-arith]
   53 |         if (h[0] == 1 && h[1] == NULL)
      |                                  ^~~~
a.cc:70:9: error: 'getch' was not declared in this scope; did you mean 'getc'?
   70 |         getch();
      |         ^~~~~
      |         getc
Language: C++

#include <iostream>

#define rep(i, first, to) for(ll i = first; i < to; ++i)
#define REP(i, first, to) for(ll i = first; i <= to; ++i)

using namespace std;
typedef long long ll;

int cnt = 0;
int a[1000001];
int n;
int g[1000001];

void show(int *p) {
	rep(i, 0, n - 1) {
		cout << p[i] << " ";
	}
	cout << p[n - 1] << endl;
}

void insertSort(int g) {
	//cout << "now" << g << endl;
	for (int i = g; i < n; ++i) {
		int v = a[i];
		int j = i - g;
		for (;j >= 0 && a[j] > v; j -= g) {
			a[j + g] = a[j];
			++cnt;
		}
		a[j + g] = v;
		//show(a);
	}
}

void shellSort() {
	int m = 0;
	for(int i = 0; 3 * g[m - 1] + 1 <= n; m++) {
		g[m] = 3 * g[m - 1] + 1;
	}
	for (int i = m - 1; i >= 0; --i) {
		insertSort(g[i]);
		//show(a);
	}
	//show(a);
	cout << m << endl;
	for (int i = m - 1; i > 0; --i) {
		cout << g[i] << " ";
	}
	cout << g[0] << endl;
	cout << cnt << endl;
	rep(i, 0, n) {
		cout << a[i] << endl;
	}
}

void solve() {
	cin >> n;
	rep(i, 0, n) {
		cin >> a[i];
	}

Compiler output:
a.cc: In function 'void solve()':
a.cc:60:10: error: expected '}' at end of input
   60 |         }
      |          ^
a.cc:56:14: note: to match this '{'
   56 | void solve() {
      |              ^
Language: C++

#include<cstdio>
#include<vector>

void insertionSort(std::vector<int> &A,int g,int &count){
  for(int i=g;i<A.size();i++){
    int tmp = A[i];
    int j=i-g;
    
    while(j>=0 && A[j]>tmp){
      A[j+g]=A[j];
      j-=g;
      count++;
    }
    A[j+g]=tmp;
  }
}


std::vector<int> shellsort(std::vector<int> &A,int &count){
  std::vector<int> G;
  int i=0;
  while(3*i+1<A.size()-1){
    G.push_back(3*i+1);
    i++;
  }
  
  for(i=G.size()-1;i>=0;i--){
    insertionSort(A,G[i],count);
  }
  
  return G;
}

int main(){
  int count = 0;
  int n;
  scanf("%d",&n);
  std::vector<int> A;
  for(int i=0;i<5;i++){
    int tmp;
    scanf("%d",&tmp);
    A.push_back(tmp);
  }
  
  auto tmp = shellsort(A,count);
  printf("%d\n",tmp.size());
  for(i=G.size()-1;i>=0;i--){
    printf("%d",G[i]);
    if(i!){printf(" ");}else{printf("\n")}
  }
  
  printf("&d\n",count);
  
  for(int i=0;i<A.size();i++){
    printf("%d\n",A[i]);
  }
  
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:7: error: 'i' was not declared in this scope
   47 |   for(i=G.size()-1;i>=0;i--){
      |       ^
a.cc:47:9: error: 'G' was not declared in this scope
   47 |   for(i=G.size()-1;i>=0;i--){
      |         ^
a.cc:49:9: error: expected ')' before '!' token
   49 |     if(i!){printf(" ");}else{printf("\n")}
      |       ~ ^
      |         )
a.cc:49:42: error: expected ';' before '}' token
   49 |     if(i!){printf(" ");}else{printf("\n")}
      |                                          ^
      |                                          ;
Language: C++

#include<cstdio>
#include<vector>

void insertionSort(std::vector<int> &A,int g,int &count){
  for(int i=g;i<A.size();i++){
    int tmp = A[i];
    int j=i-g;
    
    while(j>=0 && A[j]>tmp){
      A[j+g]=A[j];
      j-=g;
      count++;
    }
    A[j+g]=tmp;
  }
}


std::vector<int> shellsort(std::vector<int> &A,int &count){
  std::vector<int> G;
  int i=0;
  while(3*i+1<A.size()-1){
    G.push_back(3*i+1);
    i++;
  }
  
  for(i=G.size()-1;i>=0;i--){
    insertionSort(A,G[i],count);
  }
  
  return G;
}

int main(){
  int count = 0;
  int n;
  scanf("%d",&n);
  std::vector<int> A;
  for(int i=0;i<5;i++){
    int tmp;
    scanf("%d",&tmp);
    A.push_back(tmp);
  }
  
  auto tmp = shellsort(A,count);
  printf("%d\n",tmp.size());
  for(int i=G.size()-1;i>=0;i--){
    printf("%d",G[i]);
    if(i!){printf(" ");}else{printf("\n")}
  }
  
  printf("&d\n",count);
  
  for(int i=0;i<A.size();i++){
    printf("%d\n",A[i]);
  }
  
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:13: error: 'G' was not declared in this scope
   47 |   for(int i=G.size()-1;i>=0;i--){
      |             ^
a.cc:49:9: error: expected ')' before '!' token
   49 |     if(i!){printf(" ");}else{printf("\n")}
      |       ~ ^
      |         )
a.cc:49:42: error: expected ';' before '}' token
   49 |     if(i!){printf(" ");}else{printf("\n")}
      |                                          ^
      |                                          ;
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

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

void insertionSort(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(int A[],int n){
	for(int h=1;;){
		if(h>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(){
	cin >> n
	
	for(int 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(" ");
	}
	
	printf("\n");
	
	printf("%d\n",cnt);
	
	for(int i=0;i<n;i++){
		printf("%d\n",A[i]);
	}
	
	
	return 0;
}

Compiler output:
a.cc:15:34: error: expected ',' or '...' before 'int'
   15 | void insertionSort(int A[],int n int g){
      |                                  ^~~
a.cc: In function 'void insertionSort(int*, int)':
a.cc:16:19: error: 'g' was not declared in this scope
   16 |         for(int i=g;i<n;i++){
      |                   ^
a.cc: In function 'void shellsort(int*, int)':
a.cc:37:30: error: too many arguments to function 'void insertionSort(int*, int)'
   37 |                 insertionSort(A,n,G[i]);
      |                 ~~~~~~~~~~~~~^~~~~~~~~~
a.cc:15:6: note: declared here
   15 | void insertionSort(int A[],int n int g){
      |      ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:43:17: error: expected ';' before 'for'
   43 |         cin >> n
      |                 ^
      |                 ;
   44 | 
   45 |         for(int i=0;i<n;i++){
      |         ~~~      
a.cc:45:21: error: 'i' was not declared in this scope
   45 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

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

void insertionSort(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(int A[],int n){
	for(int h=1;;){
		if(h>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(){
	cin >> n
	
	for(int 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(" ");
	}
	
	printf("\n");
	
	printf("%d\n",cnt);
	
	for(int i=0;i<n;i++){
		printf("%d\n",A[i]);
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: expected ';' before 'for'
   43 |         cin >> n
      |                 ^
      |                 ;
   44 | 
   45 |         for(int i=0;i<n;i++){
      |         ~~~      
a.cc:45:21: error: 'i' was not declared in this scope
   45 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

import math

def insertionSort(A,n,g,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
	return A,cnt

def shellSort(A,n):
	cnt = 0
	#m = n//2 + 1
	#G = [2*i + 1*(i==0) for i in range(m)[::-1]]
	m = int(math.log(n,2)) + 1
	G = [2**i for i in range(m)[::-1]]
	for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	return A,m,G,cnt

if __name__ == '__main__':
	
	n = int(input())
	A = []
	[A.append(int(input())) for i in range(n)]
	A,m,G,cnt = shellSort(A,n)
	print(m)
	print(' '.join([str(i) for i in G]))
	print(cnt)
	[print(a) for a in A]
	print(A == sorted(data))

Compiler output:
a.cc:16:10: error: invalid preprocessing directive #m
   16 |         #m = n//2 + 1
      |          ^
a.cc:17:10: error: invalid preprocessing directive #G
   17 |         #G = [2*i + 1*(i==0) for i in range(m)[::-1]]
      |          ^
a.cc:24:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   24 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

#define M 5

int shellSort(int a[], int n, int m);
int insertionSort(int a[], int n, int g);

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

int shellSort(int a[], int n, int m)
{
	cout << m << endl;
	
	int g, cnt = 0;
	for (int i = 0; i < m; i++) {
		g = (int)(n - (double)n * i / (m - 1));
		
		cout << g;
		if (i < m - 1) cout << " ";
		else cout << endl;
		
		cnt += insertionSort(a, n, g);
	}
	
	cout << cnt << endl;
	
	for (int i = 0; i < n; i++) {
		cout << a[i] << endl;
	}
	
	return cnt;
}

int insertionSort(int a[], int n, int g)
{
	int cnt = 0;
	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 = j - g;
			cnt++
		}
		a[j+g] = v;
	}
	return cnt;
}

Compiler output:
a.cc: In function 'int insertionSort(int*, int, int)':
a.cc:55:30: error: expected ';' before '}' token
   55 |                         cnt++
      |                              ^
      |                              ;
   56 |                 }
      |                 ~
Language: C++

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

int shellSort(int a[], int n);
int insertionSort(int a[], int n, int g);

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

int shellSort(int a[], int n)
{
	int m = n + 1;
	
	cout << m << endl;
	
	int g, cnt = 0;
	for (int i = 0; i < m; i++) {
		g = (int)(n - (double)n * i / (m - 1));
		
		cout << g;
		if (i < m - 1) cout << " ";
		else cout << endl;
		
		cnt += insertionSort(a, n, g);
	}
	
	cout << cnt << endl;
	
	for (int i = 0; i < n; i++) {
		cout << a[i] << endl;
	}
	
	return cnt;
}

int insertionSort(int a[], int n, int g)
{
	int cnt = 0;
	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 = j - g;
			cnt++;
		}
		a[j+g] = v;
	}
	return cnt;
}

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

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

int shellSort(int a[], int n);
int insertionSort(int a[], int n, int g);

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

int shellSort(int a[], int n)
{	
	int *g = new int[n];!!!!!!
	g[0] = 1;
	int m, i = 1;
	while (1) {
		g[i] = g[i-1] * 3 + 1;
		if (g[i] > n) {
			m = i;
			break;
		}
		i++;
	}
	
	cout << m << endl;
	
	int cnt = 0;
	for (int i = m - 1; i >= 0; i++) {
		cout << g[i];
		if (i > 0) cout << " ";
		else cout << endl;
		
		cnt += insertionSort(a, n, g[i]);
	}
	
	cout << cnt << endl;
	
	for (int i = 0; i < n; i++) {
		cout << a[i] << endl;
	}
	
	return cnt;
}

int insertionSort(int a[], int n, int g)
{
	int cnt = 0;
	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 = j - g;
			cnt++;
		}
		a[j+g] = v;
	}
	return cnt;
}

Compiler output:
a.cc: In function 'int shellSort(int*, int)':
a.cc:22:29: error: lvalue required as left operand of assignment
   22 |         int *g = new int[n];!!!!!!
      |                             ^~~~~~
   23 |         g[0] = 1;
      |         ~~~~
Language: C++

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

long long cnt;
int;:
int A[1000000];
int n;
vector<int> G;
void inssort(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(int A[], int n) {
	for (int h = 1; ;)
	{
		if (h > n) break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size()-1; i >= 0; i--)
	{
		inssort(A, n, G[i]);
	}
}

int main() {
	cin >> n;
	for (int 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(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++) printf("%d\n", A[i]);

	return 0;
}

Compiler output:
a.cc:9:1: error: declaration does not declare anything [-fpermissive]
    9 | int;:
      | ^~~
a.cc:9:5: error: expected unqualified-id before ':' token
    9 | int;:
      |     ^
a.cc: In function 'void inssort(int*, int, int)':
a.cc:18:28: error: expected primary-expression before '>' token
   18 |                 while (j = > 0 && A[j] > v)
      |                            ^
a.cc: In function 'int main()':
a.cc:43:50: error: 'A' was not declared in this scope
   43 |         for (int i = 0; i < n; i++) scanf("%d", &A[i]);
      |                                                  ^
a.cc:45:19: error: 'A' was not declared in this scope
   45 |         shellsort(A, n);
      |                   ^
Language: C++

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

long long cnt;
int;
int A[1000000];
int n;
vector<int> G;
void inssort(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(int A[], int n) {
	for (int h = 1; ;)
	{
		if (h > n) break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size()-1; i >= 0; i--)
	{
		inssort(A, n, G[i]);
	}
}

int main() {
	cin >> n;
	for (int 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(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++) printf("%d\n", A[i]);

	return 0;
}

Compiler output:
a.cc:9:1: error: declaration does not declare anything [-fpermissive]
    9 | int;
      | ^~~
Language: C++

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

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

void insert(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 shell(int A[],int n){
for(int h=1; ;){
if(h>n)break;
G.push_back(h);
h=3*h+1;
}

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

int main(){
cin>>n;

for(int i=0;i<n;i++)scanf("%d",&A[i]);
c=0;

shell(A,n);

cout<<G.size()<<endl;
for(int i=G.size()-1;i>=0;i--){
printf("%d",G[i]);
if(i)printf(" ");
}
printf("\n");
printf("%d\n",c);
for(int i=0;i<n;i++){
printf("%d\n",A[i]);

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:1: error: 'c' was not declared in this scope
   43 | c=0;
      | ^
a.cc:58:2: error: expected '}' at end of input
   58 | }
      |  ^
a.cc:39:11: note: to match this '{'
   39 | int main(){
      |           ^
Language: C++

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

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

void insert(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;
c++;
}
A[j+g]=v;
}
}

void shell(int A[],int n){
for(int h=1; ;){
if(h>n)break;
G.push_back(h);
h=3*h+1;
}

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

int main(){
cin>>n;

for(int i=0;i<n;i++)scanf("%d",&A[i]);
c=0;

shell(A,n);

cout<<G.size()<<endl;
for(int i=G.size()-1;i>=0;i--){
printf("%d",G[i]);
if(i)printf(" ");
}
printf("\n");
printf("%d\n",c);
for(int i=0;i<n;i++)printf("%d\n",A[i]);

return 0;
}

Compiler output:
a.cc: In function 'void insert(int*, int, int)':
a.cc:21:1: error: 'c' was not declared in this scope
   21 | c++;
      | ^
a.cc: In function 'int main()':
a.cc:43:1: error: 'c' was not declared in this scope
   43 | c=0;
      | ^
Language: C++

#Include <Iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

void insertionSort(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(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() {
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    scanf("%d", &A[i]);
  }
  cnt = 0;
  shellSort(A,n);
  printf("%ld\n", G.size());
  for (int i=G.size()-1; i>0; i--){
    printf("%d ", G[i]);
  }
  printf("%d\n", G[0]);
  printf("%lld\n", cnt);
  for (int i = 0; i < n; ++i){
    printf("%d\n", A[i]);
  }

  return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include <Iostream>
      |  ^~~~~~~
      |  include
Language: C++

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

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

void insertionSort(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(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() {
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    scanf("%d", &A[i]);
  }
  cnt = 0;
  shellSort(A,n);
  printf("%ld\n", G.size());
  for (int i=G.size()-1; i>0; i--){
    printf("%d ", G[i]);
  }
  printf("%d\n", G[0]);
  printf("%lld\n", cnt);
  for (int i = 0; i < n; ++i){
    printf("%d\n", A[i]);
  }

  return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include <iostream>
      |  ^~~~~~~
      |  include
Language: C++


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


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

void shellSort(int*p, int n,int *cnt) {
	int d = n;
	while (d >= 1)
	{if(d==n)
		insertionSort(p, n, d-1, cnt);
	else
		insertionSort(p, n, d, cnt);
		d = d / 2;
	}
}

int main()
{
	int *cnt = 0;
	int n;
	int*seq;
	scanf_s("%d", &n);
	seq = new int[n];
	for (int i = 0; i < n; i++)
		scanf_s("%d", &seq[i]);


	shellSort(seq, n, cnt);
	for (int i = 0; i < n; i++)
		printf("%d\n", seq[i]);



    return 0;
}

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


#include <stdio.h>
using namespace std;


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

void shellSort(int*p, int n,int *cnt) {
	int d = n;
	while (d >= 1)
	{if(d==n)
		insertionSort(p, n, d-1, cnt);
	else
		insertionSort(p, n, d, cnt);
		d = d / 2;
	}
}

int main()
{
	int *cnt = 0;
	int n;
	int*seq;
	scanf_s("%d", &n);
	seq = new int[n];
	for (int i = 0; i < n; i++)
		scanf_s("%d", &seq[i]);


	shellSort(seq, n, cnt);
	for (int i = 0; i < n; i++)
		printf("%d\n", seq[i]);



    return 0;
}

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

#include "stdafx.h"
#include <stdio.h>
using namespace std;
int G[1500000];
long long cnt = 0;
void insertionSort(int*p, int n, int g) {
	for (int i = g; i < n; i++) {
		int v = p[i];
		int j = i - g;
		while (j >= 0 && p[j] > v) {
			p[j + g] = p[j];
			j -= g;
			cnt++;
		}
		p[j + g] = v;
	}
}
void shellSort(int*p, int n) {
	int  x = 0, zlq = n;
	while (zlq>0)
	{
		G[x] = zlq >> 1;
		zlq = zlq >> 1;
		x++;
	}
	x--;
	if (x == 0)
	{
		printf("1\n1\n0\n1\n");
		return;
	}
	for (int i = 0; i < x; i++)insertionSort(p, n, G[i]);
	printf("%d\n", x);
	for (int i = 0; i < x; i++)printf("%d ", G[i]);
	printf("\n");
}
int main()
{
	int n;
	int*seq;
	scanf_s("%d", &n);
	seq = new int[n];
	for (int i = 0; i < n; i++)
		scanf_s("%d", &seq[i]);

	shellSort(seq, n);
	if (n == 1)return 0;
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++)
		printf("%d\n", seq[i]);

	return 0;
}

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

// ShellSort.cpp : Defines the entry point for the console application.
//

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

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

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

int main()
{
	int n;
	int*seq;
	scanf("%d", &n);
	seq = new int[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &seq[i]);


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



    return 0;
}

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

// ShellSort.cpp : Defines the entry point for the console application.
//

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

vector<int> G;
int cnt = 0;
int pow(int j, int k) {
	if (k == 0)
		return 1;
	else return j*pow(j, k - 1);
}
void insertionSort(int*p,int n,int g) {
	for (int i = g; i < n; i++) {
		int v = p[i];
		int j = i - g;
		while (j >= 0 && p[j] > v) {
			p[j + g] = p[j];
			j -= g;
			cnt=cnt+1;
		}
		p[j + g] = v;
	}
}

void shellSort(int*p, int n) {
	int h = 0;
	for (int i=0;;i++) {
		if (h > n) break;
		h = 9 * pow(4, i) - 9 * pow(2, i) + 1;
		G.push_back(h);
		
	}
	
    for (int i= G.size()-1;i>=0;i--)
	{
		insertionSort(p, n, G[i]);
	}
}

int main()
{
	int n;
	int*seq;
	scanf("%d", &n);
	seq = new int[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &seq[i]);


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



    return 0;
}

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

#include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;

TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i];
    }
    return List;
}
int insertionSort(TList& A, int g)
{
    int cnt = 0;
    for(int i = g; i < A.size(); ++i){
        TInt 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;

Compiler output:
a.cc: In function 'int insertionSort(TList&, int)':
a.cc:28:20: error: expected '}' at end of input
   28 |         A[j+g] = v;
      |                    ^
a.cc:20:38: note: to match this '{'
   20 |     for(int i = g; i < A.size(); ++i){
      |                                      ^
a.cc:28:20: error: expected '}' at end of input
   28 |         A[j+g] = v;
      |                    ^
a.cc:18:1: note: to match this '{'
   18 | {
      | ^
a.cc:28:20: warning: no return statement in function returning non-void [-Wreturn-type]
   28 |         A[j+g] = v;
      |                    ^
Language: C++

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

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

void insertionSort(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(int A[],int n){
  for(int h=1; ; ){
    if(h>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(){
  cin>>n;
  for(int i=G.size()-1;i>=0;i--){
    printf("%d",G[i]);
    if(i)printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  for(int i=0;i<n;i++)printf("%d\n",A[i]);

  return 0;
}

Compiler output:
a.cc: In function 'void insertionSort(int*, int, int)':
a.cc:22:5: error: expected primary-expression before ']' token
   22 |     ]
      |     ^
a.cc:27:30: error: a function-definition is not allowed here before '{' token
   27 | void shellSort(int A[],int n){
      |                              ^
a.cc:38:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   38 | int main(){
      |         ^~
a.cc:38:9: note: remove parentheses to default-initialize a variable
   38 | int main(){
      |         ^~
      |         --
a.cc:38:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:38:11: error: a function-definition is not allowed here before '{' token
   38 | int main(){
      |           ^
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:14:40: note: to match this '{'
   14 | void insertionSort(int A[],int n,int g){
      |                                        ^
Language: C++

def insetion_sort(A, n, g, cnt) :
        cnt = 0
        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
        return cnt


def shell_sort(A, n) :
        cnt = 0
        count = 0
        G_sub = []
        index = 0
        while 3 * index + 1 <= n :
                G_sub.append(3 * index + 1)
                index += 1
        m = len(G_sub)
        G = G_sub[::-1]

        for i in range(m) :
                count = insetion_sort(A, n, G[i], cnt)

        print(m)
        if len(G) == 1 :
                print(G[0])
        else :
                print(" ".join(map(str, G)))
        print(count)


def main() :
        n = int(input())
        nums = []
        for i in range(n) :
                nums.append(int(input()))

        shell_sort(nums, n)
        for i in range(n) :
                print(nums[i])

if __name__ == '__main__' :
        main()

Compiler output:
a.cc:46:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   46 | if __name__ == '__main__' :
      |                ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def insetion_sort(A, n, g, cnt) :
      | ^~~