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

#include <cstdio>
#include <iostream>
#include <algorithm>

int n;
int a[1000000];

void quickSort(int l, int r)
{
	if (r - l < 1) return;
	
	int i = l, j = r;
	int m = (l + r) / 2;
	int piv = a[m];
	while (true){
		assert(i > r || j < l);
		while (a[i] < piv) i++;
		while (a[j] > piv) j--;
		if (i >= j) break;
		std::swap(a[i], a[j]);
		i++;
		j--;
	}
	
	quickSort(l, i - 1);
	quickSort(j + 1, r);
}

int main()
{
	//std::scanf("%d", &n);
	std::cin >> n;
	for (int i = 0; i < n; i++){
		//std::scanf("%d", &a[i]);
		std::cin >> a[i];
	}
	
	quickSort(0, n - 1);
	
	for (int i = 0; i < n; i++){
		//if (i) std::printf(" ");
		if (i) std::cout << " ";
		//std::printf("%d", a[i]);
		std::cout << a[i];
	}
	//std::puts("");
	std::cout << std::endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'void quickSort(int, int)':
a.cc:16:17: error: 'assert' was not declared in this scope
   16 |                 assert(i > r || j < l);
      |                 ^~~~~~
a.cc:4:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    3 | #include <algorithm>
  +++ |+#include <cassert>
    4 |
Language: C++

#include <iostream>

int main(){
  
  int n;

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

  for(int i = 0; i < n; i++){
    std::cout << arr[i];
    if(i!=n)std::cout << " ";
  }
  std::cout << std::endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |   std::sort(arr, arr+n);
      |        ^~~~
      |        qsort
Language: C++

#include <iostream>
#include <algorythm>

int main(){
  
  int n;

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

  for(int i = 0; i < n; i++){
    std::cout << arr[i];
    if(i!=n)std::cout << " ";
  }
  std::cout << std::endl;
  
  return 0;
}

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

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

int main(void){
int n;
cin>>n;
vector<int> in(n);
for(int i = 0 ; i < n ; i ++)cin>>in[i];
sort(in.begin(),in.end())
for(int i  = 0 ; i < n ; i ++){
cout<<in[i];
if(i)cout<<" ";
}
cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: expected ';' before 'for'
   11 | sort(in.begin(),in.end())
      |                          ^
      |                          ;
   12 | for(int i  = 0 ; i < n ; i ++){
      | ~~~                       
a.cc:12:18: error: 'i' was not declared in this scope; did you mean 'in'?
   12 | for(int i  = 0 ; i < n ; i ++){
      |                  ^
      |                  in
Language: C++

#include<stdio.h>


int a[1000000];

void Merge(int *Begin,int *Mid,int *End){
    int i;
    
    int n1=Mid-Begin;
    int n2=End-Mid;

    int *L=(int*)malloc((n1+1)*sizeof(int));
    int *R=(int*)malloc((n2+1)*sizeof(int));

    for(i=0;i<n1;i++)L[i]=*(Begin+i);
    for(i=0;i<n2;i++)R[i]=*(Mid+i);

    L[n1]=R[n2]=2000000000;///Japanese Banpei

    int l=0,r=0;
    
    for(i=0;i<n1+n2;i++){
        if(L[l]<=R[r])*(Begin+i)=L[l++];
        else *(Begin+i)=R[r++];
    }

    free(L);
    free(R);
}

void MergeSort(int *Begin,int *End){
    if(End-Begin<=1)return;
    int *Mid=(End-Begin)/2+Begin;
    MergeSort(Begin,Mid);
    MergeSort(Mid,End);
    Merge(Begin,Mid,End);
}

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

    MergeSort(a,a+n);

    for(i=0;i<n;i++){
        if(i)printf(" ");
        printf("%d",a[i]);
    }
    puts("");

    return 0;
}

Compiler output:
a.cc: In function 'void Merge(int*, int*, int*)':
a.cc:12:18: error: 'malloc' was not declared in this scope
   12 |     int *L=(int*)malloc((n1+1)*sizeof(int));
      |                  ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include<stdio.h>
  +++ |+#include <cstdlib>
    2 | 
a.cc:27:5: error: 'free' was not declared in this scope
   27 |     free(L);
      |     ^~~~
a.cc:27:5: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
Language: C++

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

int main(){
  int size=0;
  cin >> size;
  int nums[size];
  for(int i=0;i<size;i++){
    cin >> nums[i];
  }
  sort(nums,nums+size);

  for(int i=0;i<size;i++){
    cout << nums[i];
  }
  cout <<\n;
  
  return 0;
}

Compiler output:
a.cc:17:10: error: stray '\' in program
   17 |   cout <<\n;
      |          ^
a.cc: In function 'int main()':
a.cc:17:11: error: 'n' was not declared in this scope
   17 |   cout <<\n;
      |           ^
Language: C++

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

int main(){
  int size=0;
  cin >> size;
  int nums[size];
  for(int i=0;i<size;i++){
    cin >> nums[i];
  }
  sort(nums,nums+size);

  for(int i=0;i<size-1;i++){
    cout<<nums[i]<<" ";
  }
cout << nums[size-1]
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: expected ';' before 'return'
   17 | cout << nums[size-1]
      |                     ^
      |                     ;
   18 |   return 0;
      |   ~~~~~~
Language: C++

#include<studio.h>
int main(){
  int n,i,j,work;
  int a[1000001];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j]){
	work=a[i];
	a[i]=a[j];
	a[j]=work;
      }
    }
  }
  for(i=0;i<n-1;i++){
    printf("%d",a[i]);
  }
  printf("%d\n",a[n-1]);
  return 0;}

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

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
??
template<typename T>
void qsort(T *l, T *r){
????????struct range { T *l, *r; };
????????static range s[300];
????????auto partition = [](T *l, T *r){
????????????????r--;
????????????????T *m = l + (r - l)/2;
????????????????if(*l > *m) swap(*l, *m);
????????????????if(*l > *r) swap(*l, *r);
????????????????if(*m > *r) swap(*m, *r);
????????????????swap(*l, *m);
????????????????T piv = *l;
????????????????while(l != r){
????????????????????????while(*r >= piv && l < r) r--;
????????????????????????if(l < r) *l++ = *r;
????????????????????????while(*l <= piv && l < r) l++;
????????????????????????if(l < r) *r-- = *l;
????????????????}
????????????????*l = piv;
????????????????return l;
????????};
????????int sz = 0;
????????s[sz++] = { l, r };
????????while(sz){
????????????????l = s[--sz].l;
????????????????r = s[sz].r;
????????????????if(l == r) continue;
????????????????T *p = partition(l, r);
????????????????s[sz++] = { p + 1, r };
????????????????s[sz++] = { l, p };
????????????????if(s[sz - 1].r - s[sz - 1].l > s[sz - 2].r - s[sz - 2].l){
????????????????????????swap(s[sz - 1], s[sz - 2]);
????????????????}
????????}
}
??
int main(){
????????cin.tie(0);
????????ios::sync_with_stdio(0);
????????int n;
????????cin >> n;
????????int static a[1000010];
????????for(int i = 0; i < n; i++) cin >> a[i];
????????qsort(a,a+n);
????????for(int i = 0; i < n; i++) cout << a[i] << (i == n-1 ? '\n' : ' ');
}

Compiler output:
a.cc:7:1: error: expected unqualified-id before '?' token
    7 | ??
      | ^
a.cc:43:1: error: expected unqualified-id before '?' token
   43 | ??
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
int n;
cin>>n;
vi a(n);
cin>>a[i];
sort(ALL(a));
cout<<a[0];
REPR(i,n)cout<<" "<<a[i];
cout<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:8: error: 'i' was not declared in this scope
   26 | cin>>a[i];
      |        ^
Language: C++

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

int main() {
	long long int n;
	int array[1000000]

	cin >> n;
	for(long long int i = 0; i < n; i++) {
		cin >> array[i];
	}
	sort(array, array + n);
	for(long long int i = 0; i < n; i++) {
		cout << array[i];
		if(i == n - 1) {
			cout << endl;
		} else {
			cout << " ";
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected initializer before 'cin'
    9 |         cin >> n;
      |         ^~~
a.cc:11:29: error: missing template arguments before '[' token
   11 |                 cin >> array[i];
      |                             ^
a.cc:13:19: error: missing template arguments before ',' token
   13 |         sort(array, array + n);
      |                   ^
a.cc:13:27: error: missing template arguments before '+' token
   13 |         sort(array, array + n);
      |                           ^
a.cc:15:30: error: missing template arguments before '[' token
   15 |                 cout << array[i];
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, t;
vector<int> v;
int main() {
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf("%d", &t);
        v.push_back(t);
    }
    sort(v.begin(), v.end())
    for (int i=0; i<n-1; i++) {
        printf("%d ",v[i]);
    }
    puts(v[n-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: expected ';' before 'for'
   11 |     sort(v.begin(), v.end())
      |                             ^
      |                             ;
   12 |     for (int i=0; i<n-1; i++) {
      |     ~~~                      
a.cc:12:19: error: 'i' was not declared in this scope
   12 |     for (int i=0; i<n-1; i++) {
      |                   ^
a.cc:15:9: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const char*' [-fpermissive]
   15 |     puts(v[n-1]);
      |     ~~~~^~~~~~~~
      |         |
      |         __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/stdio.h:714:30: note:   initializing argument 1 of 'int puts(const char*)'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, t;
vector<int> v;
int main() {
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf("%d", &t);
        v.push_back(t);
    }
    sort(v.begin(), v.end());
    for (int i=0; i<n-1; i++) {
        printf("%d ",v[i]);
    }
    printf("%d\n",v[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: 'i' was not declared in this scope
   15 |     printf("%d\n",v[i]);
      |                     ^
Language: C++

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

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

Compiler output:
a.cc:6:1: error: expected initializer before 'int'
    6 | int main() {
      | ^~~
Language: C++

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

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

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

#define REP(i,n) for (int i=0;i<(n);i++)
#include <algorithm>
#include <iostream>
using namespace std;

int main(){
        int n;
        cin >> n;
        int a[n];
        REP(i,n)
                cin >> a[i];

        sort(a,a+n);

        REP(i,n)
                cout << (i?" ":"") << a[i];
        cout << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:17:22: error: expected '}' at end of input
   17 |         cout << endl;
      |                      ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

import Control.Applicative
import Data.List

main = do
  n    <- getLine
  nums <- fmap (read :: String -> Int) . words <$> getLine
  putStrLn
    $ unwords
    $ fmap show
    $ sort nums

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

#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int data[1000005]
for(int i = 0;i < n;i++){
cin >> data[i];
}
sort(data.begin(),data.end());
for(int i = 0;i < n - 1;i++){
cout << data[i] << " ";
}cout << data[n - 1] << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: expected initializer before 'for'
    6 | for(int i = 0;i < n;i++){
      | ^~~
a.cc:6:15: error: 'i' was not declared in this scope
    6 | for(int i = 0;i < n;i++){
      |               ^
a.cc:9:11: error: overloaded function with no contextual type information
    9 | sort(data.begin(),data.end());
      |           ^~~~~
a.cc:9:24: error: overloaded function with no contextual type information
    9 | sort(data.begin(),data.end());
      |                        ^~~
a.cc:11:13: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 | cout << data[i] << " ";
      |             ^
a.cc:12:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 | }cout << data[n - 1] << endl;
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int data[1000005];
for(int i = 0;i < n;i++){
cin >> data[i];
}
sort(data.begin(),data.end());
for(int i = 0;i < n - 1;i++){
cout << data[i] << " ";
}cout << data[n - 1] << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: request for member 'begin' in 'data', which is of non-class type 'int [1000005]'
    9 | sort(data.begin(),data.end());
      |           ^~~~~
a.cc:9:24: error: request for member 'end' in 'data', which is of non-class type 'int [1000005]'
    9 | sort(data.begin(),data.end());
      |                        ^~~
Language: C++

#include <iostream>
#include <vector>

int main(){
  int N;
  std::cin>>N;
  std::vector<int> array(N);
  for(int i=0;i<N;++i)
    std::cin>>array[i];
  std::sort(array.begin(),array.end());
  for(int i=0;i<N;++i){
    std::cout<<array[i];
    if(i!=N-1)
      std::cout<<' ';
    else
      std::cout<<'\n';
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   10 |   std::sort(array.begin(),array.end());
      |        ^~~~
      |        qsort
Language: C++

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

const int inf = 1001001001;

void radix_sort(vector<int> &v) {
  vector<int> g[2][10];
  for (long long k = 1; k < inf; k *= 10) {
    for (int i = 0; i < v.size(); ++i) {
      g[v[i] < 0][(abs(v[i]) / k) % 10].push_back(v[i]);
    }
    v.clear();
    for (int i = 0; i < 10; ++i) {
      v.insert(v.begin(), g[1][i].begin(), g[1][i].end());
      v.insert(v.end(), g[0][i].begin(), g[0][i].end());
      g[1][i].clear(); g[0][i].clear();
    }
  }
}

int main() {
  int n;

  cin >> n;
  vector<int> v(n);

  for (int i = 0; i < n; ++i) {
    scanf("%d", &v[i]);
  }

  radix_sort(v);

  for (int i = 0; i < n; ++i) {
    printf("%d%c", v[i], (i + 1 == n ? '\n' : ' ');
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:51: error: expected ')' before ';' token
   34 |     printf("%d%c", v[i], (i + 1 == n ? '\n' : ' ');
      |           ~                                       ^
      |                                                   )
Language: C++

#include <iostream>

using namespace std;
int main() {
	int N, A[1000000+10];
	int main() {
	cin >> N;
	for (int i=0; i<N; ++i) cin >> A[i]; // A ?????\???
	sort(A,A+N);
	for (int i=0; i<N; ++i)
	cout << (i?" ":"") << A[i]; // A ?????????
	cout << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    6 |         int main() {
      |                 ^~
a.cc:6:17: note: remove parentheses to default-initialize a variable
    6 |         int main() {
      |                 ^~
      |                 --
a.cc:6:17: note: or replace parentheses with braces to value-initialize a variable
a.cc:6:20: error: a function-definition is not allowed here before '{' token
    6 |         int main() {
      |                    ^
Language: C++

#include <iostream>

using namespace std;
int main()
{
	int N, A[1000000+10];
	cin >> N;
	for (int i=0; i<N; ++i) cin >> A[i]; // A ?????\???
	sort(A,A+N);
	for (int i=0; i<N; ++i)
	cout << (i?" ":"") << A[i]; // A ?????????
	cout << endl;
	return 0;
}

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

#include <iostream>

using namespace std;

int main() {
	int n;
	int A[1000000 + 10];
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> A[i];
	}	
	sort(A,A+n);
	for(int i = 0;i < n; i++){
		cout << A[i] << " ";
	}
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |         sort(A,A+n);
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(void){
  int i,n;
  vector<int> sy;

  cin >> n;

  for(i=0;i<n;i++){
    x.push_back(i);
    cin >> sy[i];
  }

  sort(sy.begin(),sy.end());

  for(i=0;i<n;i++){
    if(i==n-1){
      cout << sy[i] << endl;
    }else{
      cout << sy[i] << " ";
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'x' was not declared in this scope
   14 |     x.push_back(i);
      |     ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>

int x[1000000];
using namespace std;

int main(void){
  int i,n;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    x.push_back(i);
    scanf("%d",&x[i]);
  }

  sort(x.begin(),x.end());

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

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: request for member 'push_back' in 'x', which is of non-class type 'int [1000000]'
   14 |     x.push_back(i);
      |       ^~~~~~~~~
a.cc:18:10: error: request for member 'begin' in 'x', which is of non-class type 'int [1000000]'
   18 |   sort(x.begin(),x.end());
      |          ^~~~~
a.cc:18:20: error: request for member 'end' in 'x', which is of non-class type 'int [1000000]'
   18 |   sort(x.begin(),x.end());
      |                    ^~~
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<assort.h>
using namespace std;
void main(){
	int n,a[1000000];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(i!=0)cout<<' ';
		cout<<a[i];
	}
	cout<<endl;
}

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

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

int main()
{
	int n,in[1000000];
	cin >> n;
	
	for(int i=0;i<n;++i)
		cin >> in[i];
	
	sort(in,in+n);
	
	for(int i=0;i<n;++i){
		cout << in[i];
		

	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

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

void Qsort(int number[],int left,int right) ;

int main()
{
	int i,n;
	cin >> n ;
	int number[MAX];

	for(i=0;i<n;i++){
		cin >> number[i] ;
	}

	Qsort(number,0,n-1) ;

	for(i=0;i<n;i++){     
		if(i<(n-1)) cout << number[i] << ' '  ;
		if(i==(n-1)) cout << number[i] << endl ;
	}

	return 0 ;
}

void QSort(int x[ ], int left, int right)
{
    int i, j,k;
    int half;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    half = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < half)       /* half より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (half < x[j])       /* half より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

		k = x[i] ;
		x[i] = x[i+1] ;
		x[i+1] = k ;
		i++;                       /* 次のデータ */
        j--;
    }
    //ShowData(x, 10);               /* 途中経過を表示 */

    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

Compiler output:
/usr/bin/ld: /tmp/ccdkIGaC.o: in function `main':
a.cc:(.text+0x72): undefined reference to `Qsort(int*, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

#include<stdio.h>
#include<algorithm>
using std::sort;
int x[1000000];
main(){int i,n
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&x[i]);
sort(x,x+n);
for(i=0;i<n-1;i++)
printf("%d ",x[i]);
printf("%d\n",x[n-1]);
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){int i,n
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:1: error: expected initializer before 'scanf'
    6 | scanf("%d",&n);
      | ^~~~~
a.cc:7:11: error: 'n' was not declared in this scope
    7 | for(i=0;i<n;i++)
      |           ^
a.cc:9:10: error: 'n' was not declared in this scope
    9 | sort(x,x+n);
      |          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int n;
    vecotr<int> num;
    int tmp;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        num.push_back(tmp);
    }

    sort(num.begin(), num.end());

    for (int i = 0; i < num.size() - 1; i++)
        cout << num[i] << " ";
    cout << num[n - 1] << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'vecotr' was not declared in this scope
   10 |     vecotr<int> num;
      |     ^~~~~~
a.cc:10:12: error: expected primary-expression before 'int'
   10 |     vecotr<int> num;
      |            ^~~
a.cc:16:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   16 |         num.push_back(tmp);
      |         ^~~
      |         enum
a.cc:19:10: error: 'num' was not declared in this scope; did you mean 'enum'?
   19 |     sort(num.begin(), num.end());
      |          ^~~
      |          enum
Language: C++

#include <iostream>

#define BANTEI (1 << 20)
#define N_MAX  1000000

void mergeSort(int a[], int l, int r);
void merge(int a[], int l, int mid, int r);

int main(void) {
  int n, a[N_MAX];
  cin >> n;

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

  return 0;
}


void mergeSort(int a[], int l, int r) {
  int mid = (l + r) / 2;
  
  mergeSort(a, l, mid);
  mergeSort(a, mid, r);
  merge(a, l, mid, r);
}

void merge(int a[], int l, int mid, int r) {
  int aIndexLeft = l, aIndexRight = mid;
  int aLeft[N_MAX], aRight[M_MAX];

  for(int i = 0; i < mid; i++) {
    aLeft[i] = a[aIndexLeft++];
  }

  for(int i = 0; i < r-mid; i++) {
    aRight[i] = a[aIndexRight++];
  }

  int i = 0, j = 0;
  int k = l;

  while (k < r) {
    if (aLeft[i] < aRight[j])
      a[k++] = aLeft[i++];
    else
      a[k++] = aRight[j++];
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:33:28: error: 'M_MAX' was not declared in this scope; did you mean 'N_MAX'?
   33 |   int aLeft[N_MAX], aRight[M_MAX];
      |                            ^~~~~
      |                            N_MAX
a.cc:40:5: error: 'aRight' was not declared in this scope; did you mean 'daylight'?
   40 |     aRight[i] = a[aIndexRight++];
      |     ^~~~~~
      |     daylight
a.cc:47:20: error: 'aRight' was not declared in this scope; did you mean 'daylight'?
   47 |     if (aLeft[i] < aRight[j])
      |                    ^~~~~~
      |                    daylight
Language: C++

#include <iostream>

using namespace std;

#define BANTEI (1 << 20)
#define N_MAX  1000000

void mergeSort(int a[], int l, int r);
void merge(int a[], int l, int mid, int r);

int main(void) {
  int n, a[N_MAX];
  cin >> n;

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

  return 0;
}


void mergeSort(int a[], int l, int r) {
  int mid = (l + r) / 2;
  
  mergeSort(a, l, mid);
  mergeSort(a, mid, r);
  merge(a, l, mid, r);
}

void merge(int a[], int l, int mid, int r) {
  int aIndexLeft = l, aIndexRight = mid;
  int aLeft[N_MAX], aRight[N_MAX];

  for(int i = 0; i < mid; i++) {
    aLeft[i] = a[aIndexLeft++];
  }

  for(int i = 0; i < r-mid; i++) {
    aRight[i] = a[aIndexRight++];
  }
#include <iostream>

using namespace std;

#define BANTEI (1 << 20)
#define N_MAX  1000000

void mergeSort(int a[], int l, int r);
void merge(int a[], int l, int mid, int r);

int main(void) {
  int n, a[N_MAX];
  cin >> n;

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

  return 0;
}


void mergeSort(int a[], int l, int r) {
  int mid = (l + r) / 2;
  
  mergeSort(a, l, mid);
  mergeSort(a, mid, r);
  merge(a, l, mid, r);
}

void merge(int a[], int l, int mid, int r) {
  int aIndexLeft = l, aIndexRight = mid;
  int aLeft[N_MAX], aRight[N_MAX];

  for(int i = 0; i < mid; i++) {
    aLeft[i] = a[aIndexLeft++];
  }

  for(int i = 0; i < r-mid; i++) {
    aRight[i] = a[aIndexRight++];
  }

  int i = 0, j = 0;
  int k = l;

  while (k < r) {
    if (aLeft[i] < aRight[j])
      a[k++] = aLeft[i++];
    else
      a[k++] = aRight[j++];
  }
}

  int i = 0, j = 0;
  int k = l;

  while (k < r) {
    if (aLeft[i] < aRight[j])
      a[k++] = aLeft[i++];
    else
      a[k++] = aRight[j++];
  }
}

Compiler output:
a.cc: In function 'void merge(int*, int, int, int)':
a.cc:54:16: error: a function-definition is not allowed here before '{' token
   54 | int main(void) {
      |                ^
a.cc:68:39: error: a function-definition is not allowed here before '{' token
   68 | void mergeSort(int a[], int l, int r) {
      |                                       ^
a.cc:76:44: error: a function-definition is not allowed here before '{' token
   76 | void merge(int a[], int l, int mid, int r) {
      |                                            ^
Language: C++

#include <iostream>

using namespace std;

#define BANHEI (1 << 20)
#define N_MAX  1000000

int a[N_MAX];

void mergeSort(int l, int r);
void merge(int l, int mid, int r);

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

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


  //cout << "merged: " << endl;
  for(int i=0; i<n-1; i++){
    cout << a[i] << " ";
  }
  cout << a[i] << endl;

  return 0;
}


void mergeSort(int l, int r) {
  int mid = (l + r) / 2;

  if(l == mid) return;

  //cout << "test0 l: " << l << " mid:" << mid << " r:" << r << endl;
  mergeSort(l, mid);
  //cout << "test1 l: " << l << " mid:" << mid << " r:" << r << endl;
  mergeSort(mid, r);
  //cout << "test2 l: " << l << " mid:" << mid << " r:" << r << endl;
  merge(l, mid, r);
  //cout << "test3 l: " << l << " mid:" << mid << " r:" << r << endl;

  
}

void merge(int l, int mid, int r) {
  int aIndexLeft = l, aIndexRight = mid;
  int aLeft[N_MAX], aRight[N_MAX];
  int i = 0;

  for(i = 0; i < mid - l; i++) {
    aLeft[i] = a[aIndexLeft++];
  }
  aLeft[i] = BANHEI;

  for(i = 0; i < r - mid; i++) {
    aRight[i] = a[aIndexRight++];
  }
  aRight[i] = BANHEI;

  i = 0;
  int j = 0;
  int k = l;

  while (k < r) {
    if (aLeft[i] < aRight[j]){
      a[k++] = aLeft[i++];
    }else {
      a[k++] = aRight[j++];
    }
  }


}

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

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

int main()
{
	int n,inp;
	vector<int> num;
	cin>>n;
	for(int i=0;i<n;i++)2
	{
		cin>>inp;
		num.push_back(inp);
	}

	sort(num.begin(),num.end());
	cout<<num[1];
	for(int i=1;i<num.size();i++)
		cout<<' '<<num[i];
	cout<<endl;
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
			if(inp[i]>='A' && inp[i]<='Z')
				inp[i]+='a'-'A';
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: expected ';' before '{' token
   11 |         for(int i=0;i<n;i++)2
      |                              ^
      |                              ;
   12 |         {
      |         ~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<ctime>

using namespace std;


void quicksort(vector<int> &a, int l, int r) {
  if (l < r) {
  	int p = a[l];
    int i = l-1, j = r+1;
    while (1) {
      while (a[++i] < p);
      while (a[--j] > p);
      if (i >= j) break;
      swap(a[i], a[j]);
    }
    quicksort(a, l, i-1);
    quicksort(a, j+1, r);
  }
}
void quicksort(vector<int> &a) {
  quicksort(a, 0, a.size()-1);
}

int main(void){
	 clock_t start, end;
	start = clock();
	int n;
	
	cin >> n;
	
	vector<int>v(n);
	
	for(int i=0;i<n;i++)cin >> v[i];
	quicksort(v);
	
	for(int i=0;i<n;i++){
		cout << v[i];
		else cout << endl;
		if(i<v.size()-1)cout << " ";
	}
	
	end = clock();
	//cout << end-start <<"[ms]" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'else' without a previous 'if'
   41 |                 else cout << endl;
      |                 ^~~~
Language: C++

#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main()
{
  int n,i;
  multiset<int> a;
  cin >> n;
  for(i=0;i<n;i++) a.push_back(i);
  for(i=0;i<n-1;i++) cout << a[i] << " ";
  cout << a[n-1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: 'class std::multiset<int>' has no member named 'push_back'
   11 |   for(i=0;i<n;i++) a.push_back(i);
      |                      ^~~~~~~~~
a.cc:12:31: error: no match for 'operator[]' (operand types are 'std::multiset<int>' and 'int')
   12 |   for(i=0;i<n-1;i++) cout << a[i] << " ";
      |                               ^
a.cc:13:12: error: no match for 'operator[]' (operand types are 'std::multiset<int>' and 'int')
   13 |   cout << a[n-1] << endl;
      |            ^
Language: C++

#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main()
{
  int n,i;
  multiset<int> a;
  cin >> n;
  for(i=0;i<n;i++) a.insert(i%2);
  for(i=0;i<n-1;i++) cout << a[i] << " ";
  cout << a[n-1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: no match for 'operator[]' (operand types are 'std::multiset<int>' and 'int')
   12 |   for(i=0;i<n-1;i++) cout << a[i] << " ";
      |                               ^
a.cc:13:12: error: no match for 'operator[]' (operand types are 'std::multiset<int>' and 'int')
   13 |   cout << a[n-1] << endl;
      |            ^
Language: C++

#include<stdio.h>
void QuickSort(int array[],int left,int right)
{
 int i=left+1,k=right,temp; 
 while(i<k){
 for(; i<right && array[i] < array[left]; i++) //基準値以上の数字を見つける処理。
 ;
 for(; k>left && array[k] >= array[left]; k--) //基準値未満の数字を見つける処理。
 ;
 if(i<k){
 temp = array[i];
 array[i] = array[k];
 array[k] = temp;    //基準値未満と以上を入れ替える。
 }
 }
 if(right-left!=1 || array[left] > array[k]){ 
 temp = array[left];
 array[left] = array[k];
 array[k] = temp;
 }                   //基準値を真ん中にする。

 if(left<k-1)
 QuickSort(array,left,k-1);
 if(k+1<right)
 QuickSort(array,k+1,right);
}

int main(void)
{
 int n,i;
 int x[1000000];
 scanf("%d",&n);
 for(i=0; i<n; i++){
 scanf("%d ",&x[i]);
 }
 QuickSort(x,0,n-1);
 for(i=0; i<n; i++){
 printf("%d ",x[i]);
 }
 putvhar('\n');
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: 'putvhar' was not declared in this scope; did you mean 'putchar'?
   40 |  putvhar('\n');
      |  ^~~~~~~
      |  putchar
Language: C++

#include<iostream>
void QuickSort(int array[],int left,int right)
{
 int i=left+1,k=right,temp; 
 while(i<k){
 for(; i<right && array[i] < array[left]; i++)
  ;
 for(; k>left && array[k] >= array[left]; k--)
  ;
 if(i<k){
 temp = array[i];
 array[i] = array[k];
 array[k] = temp;  
 }
 }
 if(right-left!=1 || array[left] > array[k]){ 
 temp = array[left];
 array[left] = array[k];
 array[k] = temp;
 }                   

 if(left<k-1)
 QuickSort(array,left,k-1);
 if(k+1<right)
 QuickSort(array,k+1,right);
}

 int x[1000000],n,i;
int main(void)
{
 using namespace std;
 cin >> n;
 for(i=0; i<n; i++){
 cin >> x[i]);
 }
 QuickSort(x,0,n-1);
 for(i=0; i<n; i++){
 cout << x[i] << " " ;
 }
 cout << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: expected ';' before ')' token
   34 |  cin >> x[i]);
      |             ^
      |             ;
Language: C++

#include<iostream>
void QuickSort(int array[],int left,int right)
{
 int i=left+1,k=right,temp; 
 while(i<k){
 for(; i<right && array[i] < array[left]; i++)
  ;
 for(; k>left && array[k] >= array[left]; k--)
  ;
 if(i<k){
 temp = array[i];
 array[i] = array[k];
 array[k] = temp;  
 }
 }
 if(right-left!=1 || array[left] > array[k]){ 
 temp = array[left];
 array[left] = array[k];
 array[k] = temp;
 }                   

 if(left<k-1)
 QuickSort(array,left,k-1);
 if(k+1<right)
 QuickSort(array,k+1,right);
}

 int x[1000000],n,i;
int main()
{
 using namespace std;
 cin >> n;
 for(i=0; i<n; i++){
 cin >> x[i]);
 }
 QuickSort(x,0,n-1);
 for(i=0; i<n; i++){
 cout << x[i] << " " ;
 }
 cout << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: expected ';' before ')' token
   34 |  cin >> x[i]);
      |             ^
      |             ;
Language: C++

#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;
//merge_sort

//merge_sort

template<class _T>inline _T MIN(_T a,_T b)
{
	return a<b?a:b;
}

template<class _RanIt,class _Range>inline void _merge(_RanIt _Array,_Range _Begin,_Range _Mid,_Range _End,_RanIt _work)
{
    _Range i,j,k;
 
    for(i = _Begin; i < _Mid; i++)
        *(_work + i) = *(_Array + i);

    for(i = _Mid + 1, j = _End; i < _End; i++,j--)
        *(_work + i) = *(_Array + j);
 
    i = _Begin;
    j = _End;
 
    for(k = _Begin; k < _End; k++)
    {
        if(*(_work + i) <= *(_work + j))
        {
            *(_Array + k) = *(_work + i);
            i++;
        }
        else
        {
            *(_Array + k) = *(_work + j);
            j--;
        }
    }
 
}

template<class _RanIt,class _Range>inline void _merge_sort_rec(_RanIt _Array,_Range _Begin,_Range _End,_RanIt _work)
{
	_Range _Mid;
	if(_Begin >= _End)
		return;

	_Mid = (_Begin + _End) / 2;
	_merge_sort_rec(_Array,_Begin,_Mid,_work);
	_merge_sort_rec(_Array,_Mid,_End,_work);

	_merge(_Array,_Begin,mid,_End,_work);
}

template<class _RanIt,class _Range>inline void _merge_sort_loop(_RanIt _Array,_Range _Begin,_Range _End,_RanIt _work)
{
	for(_Range i = 1; i <= _End -_Begin; i *= 2)
	{
		for(_Range j = _Begin; j <= _End - i; j += i * 2)
		{
			merge(_Array,j,MIN(j + i * 2 -1,_End),j + i - 1,_work);
		}
	}

}

template<class _RanIt,class _Diff,class _Ty>inline void _merge_sort(_RanIt _Array,_Diff _Count,_Ty)
{	

	_Ty *work = new _Ty[_Count];
	_merge_sort_rec(_Array,_Diff(0),_Count,work);
	delete [] work;
}

template<class _RanIt>inline void merge_sort(_RanIt _First,_RanIt _Last)
{
	_merge_sort(_First,_Last-_First,*(_First));
}

int a[1000001];

int main()
{
	int n;
	cin>>n;
	rep(i,n) cin>>a[i];

	merge_sort(a,a+n);

	rep(i,n)if(i) cout<<" "<<a[i];else cout<<a[i];
	cout<<endl;
	

	return 0;
}

Compiler output:
a.cc: In function 'void _merge_sort_rec(_RanIt, _Range, _Range, _RanIt)':
a.cc:83:30: error: 'mid' was not declared in this scope
   83 |         _merge(_Array,_Begin,mid,_End,_work);
      |                              ^~~
Language: C++

#include <deque>

using namespace std;

int main(void)
{
	deque<int> a;
	int n;
	while (n--){
		int v;
		scanf("%d", &v);
		a.insert(upper_bound(a.begin(), a.end()), v);
	}

	printf("%d", *a.begin());
	for (auto it = a.begin() + 1, e = a.end(); it != e; ++it){
		printf(" %d", *it);
	}
	puts("");
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'scanf' was not declared in this scope
   11 |                 scanf("%d", &v);
      |                 ^~~~~
a.cc:12:26: error: 'upper_bound' was not declared in this scope
   12 |                 a.insert(upper_bound(a.begin(), a.end()), v);
      |                          ^~~~~~~~~~~
a.cc:15:9: error: 'printf' was not declared in this scope
   15 |         printf("%d", *a.begin());
      |         ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <deque>
  +++ |+#include <cstdio>
    2 | 
a.cc:19:9: error: 'puts' was not declared in this scope
   19 |         puts("");
      |         ^~~~
Language: C++

#include <deque>
#include <cstdio>

using namespace std;

int main(void)
{
	deque<int> a;
	int n;
	while (n--){
		int v;
		scanf("%d", &v);
		a.insert(upper_bound(a.begin(), a.end()), v);
	}

	printf("%d", *a.begin());
	for (auto it = a.begin() + 1, e = a.end(); it != e; ++it){
		printf(" %d", *it);
	}
	puts("");
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: 'upper_bound' was not declared in this scope
   13 |                 a.insert(upper_bound(a.begin(), a.end()), v);
      |                          ^~~~~~~~~~~
Language: C++

#include <deque>
#include <cstdio>
#include <algorthm>

using namespace std;

int main(void)
{
	deque<int> a;
	int n;
	while (n--){
		int v;
		scanf("%d", &v);
		a.insert(upper_bound(a.begin(), a.end()), v);
	}

	printf("%d", *a.begin());
	for (auto it = a.begin() + 1, e = a.end(); it != e; ++it){
		printf(" %d", *it);
	}
	puts("");
	return (0);
}

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

#include<argorithm>
#include<cstdio>
main(){
int n,i=0;
for(scanf("%d",&n),int x[n];i<n;i++)scanf("%d",&x[i]);
for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);
}

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

#include<algorithm>
#include<cstdio>
main(){
int n,i=0;
for(scanf("%d",&n),int x[n];i<n;i++)scanf("%d",&x[i]);
for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:20: error: expected primary-expression before 'int'
    5 | for(scanf("%d",&n),int x[n];i<n;i++)scanf("%d",&x[i]);
      |                    ^~~
a.cc:5:49: error: 'x' was not declared in this scope
    5 | for(scanf("%d",&n),int x[n];i<n;i++)scanf("%d",&x[i]);
      |                                                 ^
a.cc:6:10: error: 'x' was not declared in this scope
    6 | for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);
      |          ^
a.cc:6:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    6 | for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<algorithm>
#include<cstdio>
main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:53: error: expected ';' before ')' token
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      |                                                     ^
      |                                                     ;
a.cc:3:76: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);for(sort(x,x+n),i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      |                                                                            ^~~~
      |                                                                            std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<algorithm>
#include<cstdio>
main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:53: error: expected ';' before ')' token
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      |                                                     ^
      |                                                     ;
a.cc:3:72: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      |                                                                        ^~~~
      |                                                                        std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<algorithm>
#include<cstdio>
main(){int n,i=0;scanf("%d",&n);int x[n];for(;i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(;i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:73: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(;i<n;i++)scanf("%d",&x[i]);sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);}
      |                                                                         ^~~~
      |                                                                         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<algorithm>
#include<cstdio>
main(){int n,i=0;scanf("%d",&n);int x[n];for(;i<n;i++)scanf("%d",&x[i]);std::sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);puts();}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(;i<n;i++)scanf("%d",&x[i]);std::sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);puts();}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:141: error: too few arguments to function 'int puts(const char*)'
    3 | main(){int n,i=0;scanf("%d",&n);int x[n];for(;i<n;i++)scanf("%d",&x[i]);std::sort(x,x+n);for(i=0;i<n;i++)printf(i!=n-1?"$d ":"%d",x[i]);puts();}
      |                                                                                                                                         ~~~~^~
In file included from /usr/include/c++/14/cstdio:42,
                 from a.cc:2:
/usr/include/stdio.h:714:12: note: declared here
  714 | extern int puts (const char *__s);
      |            ^~~~
Language: C++

#include <stdio.h>

int main(void)
{
	static int a[1000000], n;
	int i, j, st;
	int h = 1;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", a + i);
	
	while (h * 3 + 1 < n / 9){
		h *= 3;
		h += 1;
	}
	fprintf(stderr, "h = %d\n", h);
	
	s = clock();
	for (; h; h = (h - 1) / 3){
		for (st = 0; st <= h - 1; st++){
			for (i = st; i < n; i += h){
				for (j = i; j >= h; j -= h){
					if (a[j] < a[j - h]){
						a[j] ^= a[j - h];
						a[j - h] ^= a[j];
						a[j] ^= a[j - h];
					}
					else break;
				}
			}
		}
	}
	
	for (i = 0; i < n; i++) printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 's' was not declared in this scope
   18 |         s = clock();
      |         ^
a.cc:18:13: error: 'clock' was not declared in this scope
   18 |         s = clock();
      |             ^~~~~
a.cc:2:1: note: 'clock' is defined in header '<ctime>'; this is probably fixable by adding '#include <ctime>'
    1 | #include <stdio.h>
  +++ |+#include <ctime>
    2 |