Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl
#define MAX 10000000000
#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;
long long a,b;
long long m;
long long del(long long x,long long y,long long z)
{
	long long M=max(x,max(y,z));
	long long m=min(x,min(y,z));
	return M-m;
}
int main()
{
	m=MAX;//
	cin>>a>>b;
	if(a%3==0)
	{
		m=min(m,0);
	}
	else m=min(m,b);
	//cout<<m<<endl;
	rep(i,a-1)
	{
		if(b%2==0)
		{
			m=min(m,abs((i+1)*b-(a-i-1)*b/2));
		}
		else m=min(m,del((i+1)*b,(a-i-1)*(b-1)/2,(a-i-1)*(b+1)/2));
	}
	long long c=a;
	a=b;
	b=c;
	if(a%3==0)
	{
		m=min(m,0);
	}
	else m=min(m,b);
	rep(i,a-1)
	{
		if(b%2==0)
		{
			m=min(m,abs((i+1)*b-(a-i-1)*b/2));
		}
		else m=min(m,del((i+1)*b,(a-i-1)*(b-1)/2,(a-i-1)*(b+1)/2));
	}
	cout<<m<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:22: error: no matching function for call to 'min(long long int&, int)'
   35 |                 m=min(m,0);
      |                   ~~~^~~~~
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:   template argument deduction/substitution failed:
a.cc:35:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |                 m=min(m,0);
      |                   ~~~^~~~~
/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,
                 from a.cc:7:
/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:35:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |                 m=min(m,0);
      |                   ~~~^~~~~
a.cc:52:22: error: no matching function for call to 'min(long long int&, int)'
   52 |                 m=min(m,0);
      |                   ~~~^~~~~
/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:52:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   52 |                 m=min(m,0);
      |                   ~~~^~~~~
/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:52:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   52 |                 m=min(m,0);
      |                   ~~~^~~~~