Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>

using namespace std;


int main(){

  long long ans = 999999999999999;
  for(int i = 1; i < n; i++){
    a = i * m;
    b = m/2;
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }
  
  for(int i = 1; i < n; i++){
    a = i * m;
    b = m/2 * (n-i);
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }

  swap(n,m);
  for(int i = 1; i < n; i++){
    a = i * m;
    b = m/2;
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }
  
  for(int i = 1; i < n; i++){
    a = i * m;
    b = m/2 * (n-i);
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }
  cout << ans << endl;
  return 0;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: 'n' was not declared in this scope
   15 |   for(int i = 1; i < n; i++){
      |                      ^
a.cc:16:5: error: 'a' was not declared in this scope
   16 |     a = i * m;
      |     ^
a.cc:16:13: error: 'm' was not declared in this scope
   16 |     a = i * m;
      |             ^
a.cc:17:5: error: 'b' was not declared in this scope
   17 |     b = m/2;
      |     ^
a.cc:18:5: error: 'c' was not declared in this scope
   18 |     c = t - a - b;
      |     ^
a.cc:18:9: error: 't' was not declared in this scope
   18 |     c = t - a - b;
      |         ^
a.cc:25:22: error: 'n' was not declared in this scope
   25 |   for(int i = 1; i < n; i++){
      |                      ^
a.cc:26:5: error: 'a' was not declared in this scope
   26 |     a = i * m;
      |     ^
a.cc:26:13: error: 'm' was not declared in this scope
   26 |     a = i * m;
      |             ^
a.cc:27:5: error: 'b' was not declared in this scope
   27 |     b = m/2 * (n-i);
      |     ^
a.cc:28:5: error: 'c' was not declared in this scope
   28 |     c = t - a - b;
      |     ^
a.cc:28:9: error: 't' was not declared in this scope
   28 |     c = t - a - b;
      |         ^
a.cc:35:8: error: 'n' was not declared in this scope; did you mean 'yn'?
   35 |   swap(n,m);
      |        ^
      |        yn
a.cc:35:10: error: 'm' was not declared in this scope; did you mean 'tm'?
   35 |   swap(n,m);
      |          ^
      |          tm
a.cc:37:5: error: 'a' was not declared in this scope
   37 |     a = i * m;
      |     ^
a.cc:38:5: error: 'b' was not declared in this scope
   38 |     b = m/2;
      |     ^
a.cc:39:5: error: 'c' was not declared in this scope
   39 |     c = t - a - b;
      |     ^
a.cc:39:9: error: 't' was not declared in this scope
   39 |     c = t - a - b;
      |         ^
a.cc:47:5: error: 'a' was not declared in this scope
   47 |     a = i * m;
      |     ^
a.cc:48:5: error: 'b' was not declared in this scope
   48 |     b = m/2 * (n-i);
      |     ^
a.cc:49:5: error: 'c' was not declared in this scope
   49 |     c = t - a - b;
      |     ^
a.cc:49:9: error: 't' was not declared in this scope
   49 |     c = t - a - b;
      |         ^