Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long;
int f(int x, int y, int z) {
  return max({x,y,z})-min({x,y,z});
}
int gs(int x,int y){
  if(x*y%2==0)return x*y/2;
  if(x<y)swap(x,y);
  return x/2*y;
}
int gl(int x,int y){
  if(x*y%2==0)return x*y/2;
  if(x<y)swap(x,y);
  return (x/2+1)*y;
}
signed main(){
  int h, w;
  cin >> h >> w;
  int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w));
  res=min(res,f((h/3+1)*w,gs(h-h/3-1,w),gl(h-h/3-1,w)));
  swap(h,w);
  res=min(res,f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)));
  res=min(res,f((h/3+1)*w,gs(h-h/3-1,w),gl(h-h/3-1,w)));
  cout << res << endl;
  return 0;
}


Compiler output:
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:4:1: note: in expansion of macro 'int'
    4 | int f(int x, int y, int z) {
      | ^~~
a.cc:3:22: error: expected ')' before ';' token
    3 | #define int long long;
      |                      ^
a.cc:4:7: note: in expansion of macro 'int'
    4 | int f(int x, int y, int z) {
      |       ^~~
a.cc:4:6: note: to match this '('
    4 | int f(int x, int y, int z) {
      |      ^
a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token
    3 | #define int long long;
      |                      ^
a.cc:4:7: note: in expansion of macro 'int'
    4 | int f(int x, int y, int z) {
      |       ^~~
a.cc:4:11: error: 'x' does not name a type
    4 | int f(int x, int y, int z) {
      |           ^
a.cc:4:18: error: 'y' does not name a type
    4 | int f(int x, int y, int z) {
      |                  ^
a.cc:4:25: error: 'z' does not name a type
    4 | int f(int x, int y, int z) {
      |                         ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:7:1: note: in expansion of macro 'int'
    7 | int gs(int x,int y){
      | ^~~
a.cc:3:22: error: expected ')' before ';' token
    3 | #define int long long;
      |                      ^
a.cc:7:8: note: in expansion of macro 'int'
    7 | int gs(int x,int y){
      |        ^~~
a.cc:7:7: note: to match this '('
    7 | int gs(int x,int y){
      |       ^
a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token
    3 | #define int long long;
      |                      ^
a.cc:7:8: note: in expansion of macro 'int'
    7 | int gs(int x,int y){
      |        ^~~
a.cc:7:12: error: 'x' does not name a type
    7 | int gs(int x,int y){
      |            ^
a.cc:7:18: error: 'y' does not name a type
    7 | int gs(int x,int y){
      |                  ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:12:1: note: in expansion of macro 'int'
   12 | int gl(int x,int y){
      | ^~~
a.cc:3:22: error: expected ')' before ';' token
    3 | #define int long long;
      |                      ^
a.cc:12:8: note: in expansion of macro 'int'
   12 | int gl(int x,int y){
      |        ^~~
a.cc:12:7: note: to match this '('
   12 | int gl(int x,int y){
      |       ^
a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token
    3 | #define int long long;
      |                      ^
a.cc:12:8: note: in expansion of macro 'int'
   12 | int gl(int x,int y){
      |        ^~~
a.cc:12:12: error: 'x' does not name a type
   12 | int gl(int x,int y){
      |            ^
a.cc:12:18: error: 'y' does not name a type
   12 | int gl(int x,int y){
      |                  ^
a.cc: In function 'int main()':
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:18:3: note: in expansion of macro 'int'
   18 |   int h, w;
      |   ^~~
a.cc:18:7: error: 'h' was not declared in this scope
   18 |   int h, w;
      |       ^
a.cc:18:10: error: 'w' was not declared in this scope
   18 |   int h, w;
      |          ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:20:3: note: in expansion of macro 'int'
   20 |   int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w));
      |   ^~~
a.cc:20:7: error: 'res' was not declared in this scope
   20 |   int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w));
      |       ^~~
a.cc:20:19: error: 'gs' was not declared in this scope
   20 |   int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w));
      |                   ^~
a.cc:20:31: error: 'gl' was not declared in this scope
   20 |   int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w));
      |                               ^~
a.cc:20:11: error: 'f' was not declared in this scope
   20 |   int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w));
      |           ^