Language: C++

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

int n,i,j,min;
int A[36],B[36];
char a[36],b[36];

string check() {
    for(i=0;i<n;i++) {
        if(a[i]==b[i] && A[i]==B[i]) {
            continue;
            return "Not stable";
        }
    }
    return "Stable";
}

int main(void)
{
    cin>>n;
    
    for(i=0;i<n;i++) {
        cin>>a[i]>>A[i];
        b[i]=a[i];
        B[i]=A[i]
    }
    for(i=0;i<n-1;i++) {
        for(j=n-1;j>i;j--) {
            if(A[j]<A[j-1]) {
                swap(a[j],a[j-1]);
                swap(A[j],A[j-1]);
            }
        }
    }
    for(i=0;i<n-1;i++) {
        min=i;
        for(j=i+1;j<n;j++) {
            if(B[j]<B[min]) {
                min=j;
            }
        }
        swap(b[i],b[min]);
        swap(B[i],B[min]);
    }
    for(i=0;i<n;i++) {
        if(i) {
            cout<<' ';
            cout<<a[i]<<A[i];
        }
    }
    cout<<endl<<"Stable"<<endl;
    for(i=0;<n;i++) {
        if(i) {
            cout<<' ';
            cout<<b[i]<<B[i];
        }
    }
    cout<<endl<<check()<<endl;
    return (0);
}    


Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: expected ';' before '}' token
   26 |         B[i]=A[i]
      |                  ^
      |                  ;
   27 |     }
      |     ~             
a.cc:37:9: error: reference to 'min' is ambiguous
   37 |         min=i;
      |         ^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:                 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
In file included 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,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:11: note:                 'int min'
    5 | int n,i,j,min;
      |           ^~~
a.cc:39:23: error: reference to 'min' is ambiguous
   39 |             if(B[j]<B[min]) {
      |                       ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:                 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:11: note:                 'int min'
    5 | int n,i,j,min;
      |           ^~~
a.cc:40:17: error: reference to 'min' is ambiguous
   40 |                 min=j;
      |                 ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:                 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:11: note:                 'int min'
    5 | int n,i,j,min;
      |           ^~~
a.cc:43:21: error: reference to 'min' is ambiguous
   43 |         swap(b[i],b[min]);
      |                     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:                 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:11: note:                 'int min'
    5 | int n,i,j,min;
      |           ^~~
a.cc:44:21: error: reference to 'min' is ambiguous
   44 |         swap(B[i],B[min]);
      |                     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:                 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:11: note:                 'int min'
    5 | int n,i,j,min;
      |           ^~~
a.cc:53:13: error: expected primary-expression before '<' token
   53 |     for(i=0;<n;i++) {
      |             ^