Language: C++

#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <vector>

int main() {
  long long H, W;
  scanf("%lld", &H);
  scanf("%lld", &W);
  long long ans = 1e15;
  for (int i = 0; i < 2; i++) {

    //横に2回切る
    if (H % 3 == 0) {
      ans = std::min(0, ans);
    } else {
      ans = std::min(W, ans);
    }
    // 横に切った残りを縦に切る
    if (W % 2 == 0) {
      if (H % 3 == 0) {
        ans = std::min(0, ans);
      } else {
        ans = std::min(W/2, ans);
      }
    } else {
      ans = std::min(ans, ((W + 1) / 2 * H) % ((3 * W + 1) / 2));
      ans = std::min(ans, (W * H) % ((3 * W - 1) / 2));
    }
    std::swap(H, W);
  }
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: no matching function for call to 'min(int, long long int&)'
   24 |       ans = std::min(0, ans);
      |             ~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:   template argument deduction/substitution failed:
a.cc:24:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   24 |       ans = std::min(0, ans);
      |             ~~~~~~~~^~~~~~~~
/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:24:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   24 |       ans = std::min(0, ans);
      |             ~~~~~~~~^~~~~~~~
a.cc:31:23: error: no matching function for call to 'min(int, long long int&)'
   31 |         ans = std::min(0, ans);
      |               ~~~~~~~~^~~~~~~~
/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:31:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   31 |         ans = std::min(0, ans);
      |               ~~~~~~~~^~~~~~~~
/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
/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:31:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   31 |         ans = std::min(0, ans);
      |               ~~~~~~~~^~~~~~~~