Language: C++

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_6_C&lang=jp
#include <iostream>
#include <map>
using namespace std;

int partition(int A[], int l, int r){
  const int x = A[r]; //????????¨?????????
  int i = l-1; //??§???????????????????????¨??????????????????-1
  for(int j = l; j < r; j++){
    //j?????????????????£???????????¨??????????????????????????¨????????????
     if (A[j] <= x){
       i += 1;
       //??´??????????????????????????¨???
       swap(A,i,j);
     }
  }
  swap(A,i+1,r);
  return i+1;
}

void quickSort(int A[], int p, int r){
  if(p < r){
    q = partition(A,p,r);
    quickSort(A,p,q-1);
    quickSort(A,q+1, p);
  }
}

int main(){
  int n;
  cin >> n;
  int S[n];
  string str1 = "Stable", str2 = "Not stable";

  for(int i=0; i<n; i++){
    cin >> S[i] >> ;
  }//????????????????????????
  //S[n] = 123456;
  for(int i=0; i<n-1; i++){
  cout << S[i] << " ";
  }

  cout << S[n-1] << endl;
  cout << counter << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int partition(int*, int, int)':
a.cc:14:12: error: no matching function for call to 'swap(int*&, int&, int&)'
   14 |        swap(A,i,j);
      |        ~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  250 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/14/bits/move.h:250:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
 1089 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
 1106 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 4039 |     swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)'
 2805 |     swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
      |     ^~~~
/usr/include/c++/14/tuple:2805:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted)
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
/usr/include/c++/14/tuple:2823:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/map:62,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_tree.h:1675:5: note: candidate: 'template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> void std::swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)'
 1675 |     swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/14/bits/stl_tree.h:1675:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/map:63:
/usr/include/c++/14/bits/stl_map.h:1586:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(map<_Key, _Tp, _Compare, _Allocator>&, map<_Key, _Tp, _Compare, _Allocator>&)'
 1586 |     swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/14/bits/stl_map.h:1586:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/map:64:
/usr/include/c++/14/bits/stl_multimap.h:1208:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(multimap<_Key, _Tp, _Compare, _Allocator>&, multimap<_Key, _Tp, _Compare, _Allocator>&)'
 1208 |     swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/14/bits/stl_multimap.h:1208:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   candidate expects 2 arguments, 3 provided
a.cc:17:7: error: no matching function for call to 'swap(int*&, int, int&)'
   17 |   swap(A,i+1,r);
      |   ~~~~^~~~~~~~~
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  250 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/14/bits/move.h:250:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
 1089 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
 1106 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 4039 |     swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/tuple:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)'
 2805 |     swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
      |     ^~~~
/usr/include/c++/14/tuple:2805:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted)
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
/usr/include/c++/14/tuple:2823:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_tree.h:1675:5: note: candidate: 'template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> void std::swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)'
 1675 |     swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/14/bits/stl_tree.h:1675:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_map.h:1586:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(map<_Key, _Tp, _Compare, _Allocator>&, map<_Key, _Tp, _Compare, _Allocator>&)'
 1586 |     swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/14/bits/stl_map.h:1586:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_multimap.h:1208:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(multimap<_Key, _Tp, _Compare, _Allocator>&, multimap<_Key, _Tp, _Compare, _Allocator>&)'
 1208 |     swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~
/usr/include/c++/14/bits/stl_multimap.h:1208:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   candidate expects 2 arguments, 3 provided
a.cc: In function 'void quickSort(int*, int, int)':
a.cc:23:5: error: 'q' was not declared in this scope
   23 |     q = partition(A,p,r);
      |     ^
a.cc: In function 'int main()':
a.cc:36:20: error: expected primary-expression before ';' token
   36 |     cin >> S[i] >> ;
      |                    ^
a.cc:44:11: er