Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define V vector<int>
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int N, x[100010], y[100010], d[100010];
int xmin[4], ymin[4], xmax[4], ymax[4];
int xminc, xmaxc, yminc, ymaxc;
V time;
int calc(int t)
{
    int XMAX = max(xmaxc, max(xmax[1] + t, xmax[3] - t));
    int XMIN = min(xminc, min(xmin[1] - t, xmin[3] + t));
    int YMAX = max(ymaxc, max(ymax[0] + t, ymax[2] - t));
    int YMIN = min(yminc, min(ymin[0] - t, ymin[2] + t));
    return (XMAX - XMIN) * (YMAX - YMIN);
}
void solve()
{
    FOR(i, 0, 4)
    {
        xmin[i] = INF;
        xmax[i] = -INF;
        ymin[i] = INF;
        ymax[i] = -INF;
    }
    FOR(i, 0, N)
    {
        int t = d[i];
        if (x[i] < xmin[t])
            xmin[t] = x[i];
        if (x[i] > xmax[t])
            xmax[t] = x[i];
        if (y[i] < ymin[t])
            ymin[t] = y[i];
        if (y[i] > ymax[t])
            ymax[t] = y[i];
    }
    xminc = min(xmin[0], xmin[2]);
    xmaxc = max(xmax[0], xmax[2]);
    yminc = min(ymin[1], ymin[3]);
    ymaxc = max(ymax[1], ymax[3]);
    if (xmax[2] >= xmaxc)
        time.push_back(xmax[2] - xmaxc);
    if (xmax[0] <= xmaxc)
        time.push_back(xmaxc - xmax[0]);
    if (xmin[2] >= xminc)
        time.push_back(xmin[2] - xminc);
    if (xmin[0] <= xminc)
        time.push_back(xminc - xmin[0]);
    if (ymax[3] >= ymaxc)
        time.push_back(ymax[3] - ymaxc);
    if (ymax[1] <= ymaxc)
        time.push_back(ymaxc - ymax[1]);
    if (ymin[3] >= yminc)
        time.push_back(ymin[3] - yminc);
    if (ymin[1] <= yminc)
        time.push_back(yminc - ymin[1]);

    ans = INF * INF;
    FOR(int i = 0; i < (int)time.size(), i++)
    {
        ans = min(calc(time[i]), ans);
    }
    cout << ans << endl;
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N)
    {
        cin >> x[i] >> y[i];
        char c;
        cin >> c;
        if (c == 'U')
            d[i] = 0;
        if (c == 'R')
            d[i] = 1;
        if (c == 'D')
            d[i] = 2;
        if (c == 'L')
            d[i] = 3;
    }
    solve();
    return 0;
}


Compiler output:
a.cc:67:45: error: macro "FOR" requires 3 arguments, but only 2 given
   67 |     FOR(int i = 0; i < (int)time.size(), i++)
      |                                             ^
a.cc:7:9: note: macro "FOR" defined here
    7 | #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
      |         ^~~
a.cc:15:3: error: 'std::vector<long long int> time' redeclared as different kind of entity
   15 | V time;
      |   ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void solve()':
a.cc:50:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   50 |         time.push_back(xmax[2] - xmaxc);
      |              ^~~~~~~~~
a.cc:52:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   52 |         time.push_back(xmaxc - xmax[0]);
      |              ^~~~~~~~~
a.cc:54:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   54 |         time.push_back(xmin[2] - xminc);
      |              ^~~~~~~~~
a.cc:56:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   56 |         time.push_back(xminc - xmin[0]);
      |              ^~~~~~~~~
a.cc:58:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   58 |         time.push_back(ymax[3] - ymaxc);
      |              ^~~~~~~~~
a.cc:60:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   60 |         time.push_back(ymaxc - ymax[1]);
      |              ^~~~~~~~~
a.cc:62:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   62 |         time.push_back(ymin[3] - yminc);
      |              ^~~~~~~~~
a.cc:64:14: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   64 |         time.push_back(yminc - ymin[1]);
      |              ^~~~~~~~~
a.cc:66:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   66 |     ans = INF * INF;
      |     ^~~
      |     abs
a.cc:66:15: warning: integer overflow in expression of type 'long long int' results in '7766279631452241920' [-Woverflow]
   66 |     ans = INF * INF;
      |           ~~~~^~~~~
a.cc:67:5: error: 'FOR' was not declared in this scope
   67 |     FOR(int i = 0; i < (int)time.size(), i++)
      |     ^~~