Language: C++

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

int main(){
    int N;
    cin >> N;

    vector<string> s(N);
    for(int i = 0; i < N; ++i) cin >> s[i];

    int a = 0, b = 0, c = 0;
    for(int i = 0; i < N; ++i){
        if(s[i][0] == 'B' && s[i][s[i].size()-1] != 'A') ++a;
        else if(s[i][0] != 'B' && s[i][s[i].size()-1] == 'A') ++b;
        else if(s[i][0] == 'B' && s[i][s[i].size()-1] == 'A') ++c;
    }

    int ans = max(min(a, b)+c, min(a-min({a, b, c}), b-min({a, b, c}))+c+min({a, b, c}));

    for(int i = 0; i < N; ++i){
        for(int j = 1; j < s[i].size(); ++j){
            if(s[i][j-1] == 'A' && s[i][j] == 'B') ++ans;
        }
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:41: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   20 |     int ans = max(min(a, b)+c, min(a-min({a, b, c}), b-min({a, b, c}))+c+min({a, b, c}));
      |                                      ~~~^~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: '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:281:5: note:   candidate expects 3 arguments, 1 provided
a.cc:20:59: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   20 |     int ans = max(min(a, b)+c, min(a-min({a, b, c}), b-min({a, b, c}))+c+min({a, b, c}));
      |                                                        ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: '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:281:5: note:   candidate expects 3 arguments, 1 provided
a.cc:20:77: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   20 |     int ans = max(min(a, b)+c, min(a-min({a, b, c}), b-min({a, b, c}))+c+min({a, b, c}));
      |                                                                          ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: '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:281:5: note:   candidate expects 3 arguments, 1 provided