Language: C++

#include <vector>
using namespace std;

int cnt = 0;

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

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

void shellSort(int a[], int n)
{
    vector<int> G;
    for(int i=1; i<n; i=3*i+1)
    {
        if(i-1)
            cout << " ";
        cout << i;
        G.push_back(i);
    }
    cout << endl;
    
    for(int i=G.size()-1; i>=0; i--)
    {
        insertionSort(a, n, G[i]);
    }
    
}

int main() {
	int n;
	cin >> n;
	int* a = new int[n];
	for(int i = 0; i < n; i++)
	{
	    cin >> a[i];
	}
	
	
	shellSort(a, n);
	
	cout << cnt << endl;
	PrintfArray(a, n);
	
	
	return 0;
}

Compiler output:
a.cc: In function 'void PrintfArray(int*, int)':
a.cc:11:13: error: 'cout' was not declared in this scope
   11 |             cout << endl;
      |             ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:11:21: error: 'endl' was not declared in this scope
   11 |             cout << endl;
      |                     ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <vector>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:12:9: error: 'cout' was not declared in this scope
   12 |         cout << a[i];
      |         ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << endl;
      |     ^~~~
a.cc:14:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:13: error: 'endl' was not declared in this scope
   14 |     cout << endl;
      |             ^~~~
a.cc:14:13: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc: In function 'void shellSort(int*, int)':
a.cc:38:13: error: 'cout' was not declared in this scope
   38 |             cout << " ";
      |             ^~~~
a.cc:38:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:9: error: 'cout' was not declared in this scope
   39 |         cout << i;
      |         ^~~~
a.cc:39:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:42:5: error: 'cout' was not declared in this scope
   42 |     cout << endl;
      |     ^~~~
a.cc:42:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:42:13: error: 'endl' was not declared in this scope
   42 |     cout << endl;
      |             ^~~~
a.cc:42:13: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc: In function 'int main()':
a.cc:53:9: error: 'cin' was not declared in this scope
   53 |         cin >> n;
      |         ^~~
a.cc:53:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:63:9: error: 'cout' was not declared in this scope
   63 |         cout << cnt << endl;
      |         ^~~~
a.cc:63:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:63:24: error: 'endl' was not declared in this scope
   63 |         cout << cnt << endl;
      |                        ^~~~
a.cc:63:24: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'