Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a,b,c,d;
  cin>>a>>b;
  if(a*b%3==0)
    cout<<0<<endl;
  else{
    int a1,b1,c1,a2,b2,c2;
    a1=a/2*(b*2/3);
    b1=a*(b*2/3)-a1;
    c1=a*b-a1-b1;
    a2=a/2*(b*2/3+1);
    b2=a*(b*2/3+1)-a1;
    c2=a*b-a1-b1;
    c=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1));
    c=min<int>(min<int>(c,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2)));
    swap(a,b);
    a1=a/2*(b*2/3);
    b1=a*(b*2/3)-a1;
    c1=a*b-a1-b1;
    a2=a/2*(b*2/3+1);
    b2=a*(b*2/3+1)-a1;
    c2=a*b-a1-b1;
    d=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1));
    d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2)));
    cout<<min<int>(c,d)<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:87:52: error: no matching function for call to 'min<long long int>(long long int)'
   87 |     c=min<int>(min<int>(c,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2)));
      |                                            ~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:31: note:   no known conversion for argument 1 from 'long long int' to 'std::initializer_list<long long int>'
 5686 |     min(initializer_list<_Tp> __l)
      |         ~~~~~~~~~~~~~~~~~~~~~~^~~
/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:   candidate expects 2 arguments, 1 provided
a.cc:96:52: error: no matching function for call to 'min<long long int>(long long int)'
   96 |     d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2)));
      |                                            ~~~~~~~~^~~~~~~~~~~~~~~~~
/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
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:31: note:   no known conversion for argument 1 from 'long long int' to 'std::initializer_list<long long int>'
 5686 |     min(initializer_list<_Tp> __l)
      |         ~~~~~~~~~~~~~~~~~~~~~~^~~
/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:   candidate expects 2 arguments, 1 provided