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;
//odd_even_sort

template<class T> inline void swap(T& a,T& b)
{
	T tmp;
	tmp = a;
	a = b;
	b = tmp;
}
template<class _RanIt,class _Diff> inline void _odd_even_sort(_RanIt _Array,_Diff _Count)
{
	bool flag = true;
	while(flag)
	{
		flag = false;
		for(_Diff i = 0; i < _Count - 1; i+=2)
		{
			if(*(_Array + i) > *(_Array + i + 1))
			{
				swap(*(_Array + i),*(_Array + i + 1));
				flag = true;
			}
		}

		for(_Diff i = 1; i < _Count - 1; i+=2)
		{
			if(*(_Array + i) > *(_Array + i + 1))
			{
				swap(*(_Array + i),*(_Array + i + 1));
				flag = true;
			}
		}
	}
}
template<class _RanIt,class _Diff,class _Pr> inline void _odd_even_sort(_RanIt _Array,_Diff _Count,_Pr _Pred)
{
	bool flag = true;
	while(flag)
	{
		flag = false;
		for(_Diff i = 0; i < _Count - 1; i+=2)
		{
			if(_Pred(*(_Array + i) , *(_Array + i + 1)))
			{
				swap(*(_Array + i),*(_Array + i + 1));
				flag = true;
			}
		}

		for(_Diff i = 1; i < _Count - 1; i+=2)
		{
			if(_Pred(*(_Array + i) , *(_Array + i + 1)))
			{
				swap(*(_Array + i),*(_Array + i + 1));
				flag = true;
			}
		}
	}
}


template<class _RanIt> inline void odd_even_sort(_RanIt _First,_RanIt _Last)
{
	_odd_even_sort(_First,_Last - _First);
}

template<class _RanIt,class _Pr> inline void odd_even_sort(_RanIt _First,_RanIt _Last,_Pr _Pred)
{
	_odd_even_sort(_First,_Last - _First,_Pred);
}
int main()
{
	int a[1001];
	int n;
	cin>>n;
	rep(i,n) cin>>a[i];

	odd_even_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 instantiation of 'void _odd_even_sort(_RanIt, _Diff) [with _RanIt = int*; _Diff = long int]':
a.cc:98:16:   required from 'void odd_even_sort(_RanIt, _RanIt) [with _RanIt = int*]'
   98 |         _odd_even_sort(_First,_Last - _First);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:112:15:   required from here
  112 |         odd_even_sort(a,a+n);
      |         ~~~~~~~~~~~~~^~~~~~~
a.cc:54:37: error: call of overloaded 'swap(int&, int&)' is ambiguous
   54 |                                 swap(*(_Array + i),*(_Array + i + 1));
      |                                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:37:31: note: candidate: 'void swap(T&, T&) [with T = int]'
   37 | template<class T> inline void swap(T& a,T& b)
      |                               ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
a.cc:63:37: error: call of overloaded 'swap(int&, int&)' is ambiguous
   63 |                                 swap(*(_Array + i),*(_Array + i + 1));
      |                                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:37:31: note: candidate: 'void swap(T&, T&) [with T = int]'
   37 | template<class T> inline void swap(T& a,T& b)
      |                               ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~