Language: C++

// Last Change: 04/20/2019 23:32:20.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

const char black = '#';
const char white = '.';

int main() {
  ll N;
  string S;
  cin >> N >> S;

  vector<pair<ll, ll>> ruiseki(N + 1);
  ruiseki[0].first = 0;
  for (ll i = 0, tmp = 0; i < N; ++i) {
    if (S[i] == black) {
      ++tmp;
    }
    ruiseki[i + 1].first = tmp;
  }

  ruiseki[N].second = 0;
  for (ll i = N - 1, tmp = 0; i >= 0; --i) {
    if (S[i] == white) {
      ++tmp;
    }
    ruiseki[i].second = tmp;
  }

  int64_t ans = INT64_MAX;
  for (ll i = 0; i <= N; ++i) {
    ans = min(ans, ruiseki[i].first + ruiseki[i].second);
  }

  cout << ans << endl;

  //NS::LoopUntilZeroInpput();
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:14: error: no matching function for call to 'min(int64_t&, long long int)'
   57 |     ans = min(ans, ruiseki[i].first + ruiseki[i].second);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/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:   template argument deduction/substitution failed:
a.cc:57:14: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   57 |     ans = min(ans, ruiseki[i].first + ruiseki[i].second);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: '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:5696:5: note:   template argument deduction/substitution failed:
a.cc:57:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   57 |     ans = min(ans, ruiseki[i].first + ruiseki[i].second);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~