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]; //数字はA,アルファベットはaに格納
        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: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++) { //選択ソート結果表示部
      |             ^