Language: C++

#include<iostream>
using namespace std;


int main(){
 
  long int H,W;
  cin>>H>>W;
  long int minn=1000000000;
  long int s1,s2,s3;
  if(H%3==0||W%3==0) {cout<<0<<endl; return 0;}
  
 for(int i = 1; i < W; ++i)
	{
		 s1 = i * H;
		 s2 = max(((W - i) / 2) * H, (W - i) * (H/ 2));
		 s3 = (W - i) * H - s2;
 
		minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3}));
	}
 
	swap(H, W);
 
	 for(int i = 1; i < W; ++i)
	{
		 s1 = i * H;
		 s2 = max(((W - i) / 2) * H, (W - i) * (H/ 2));
		 s3 = (W - i) * H - s2;
 
		minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3}));
	}
 
  cout<<minn<<endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:37: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   19 |                 minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3}));
      |                                  ~~~^~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
a.cc:19:57: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   19 |                 minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3}));
      |                                                      ~~~^~~~~~~~~~~~~~
/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:30:37: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   30 |                 minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3}));
      |                                  ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
a.cc:30:57: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   30 |                 minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3}));
      |                                                      ~~~^~~~~~~~~~~~~~
/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