Problem p03004 (C++)

Buggy submission (status: Time Limit Exceeded):
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);
#define LLINF ((long long)1e15) // 1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define db 0
#define EPS (1e-12) // 0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (100006)
#define ll long double
#define ld long double
mt19937
    rng(chrono::steady_clock::now()
            .time_since_epoch()
            .count()); // can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for (ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair<ll, ll> pi;
typedef pair<char, pi> spi;
typedef pair<pi, pi> dpi;
// inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; }
// //inclusivesss string to_string(char c) {string s(1,c);return s;}string
// to_string(bool b){return (b ? "true" : "false");}template <typename A,
// typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) +
// ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v)
// {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res
// += ", ";}first = false;res += to_string(x);}res += "}";return res;}void
// degug_out() { cerr << endl; }template <typename Head, typename... Tail>void
// degug_out(Head H, Tail... T) {cerr << " " <<
// to_string(H);degug_out(T...);}inline ll gcd(ll a,ll
// b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr                                                                   \
  if (0)                                                                       \
  cout
#endif
ll n;
spi A[MAXN];
ll tstar(ll x) {
  ll mxx = -LLINF, mix = LLINF, may = -LLINF, miy = LLINF;
  FOR(ii, 0, n) {
    int i = ii;
    ll movex = 0, movey = 0;
    if (A[i].f == 'L') {
      movex -= x;
    } else if (A[i].f == 'R') {
      movex += x;
    } else if (A[i].f == 'D') {
      movey -= x;
    } else if (A[i].f == 'U') {
      movey += x;
    } else
      assert(0);
    mxx = max(mxx, movex + A[i].s.f);
    mix = min(mix, movex + A[i].s.f);
    may = max(may, movey + A[i].s.s);
    miy = min(miy, movey + A[i].s.s);
  }
  return (mxx - mix) * (may - miy);
}
int main() {
  FAST cin >> n;
  FOR(i, 0, n) { cin >> A[(int)i].s.f >> A[(int)i].s.s >> A[(int)i].f; }
  ll st = 0, en = 2e8 + 100;
  while (1) {
    ll lmid = st + (en - st) / (ld)3;
    ll umid = en - (en - st) / (ld)3;
    if (st == lmid && en == umid)
      break;
    if (tstar(lmid) > tstar(umid))
      st = lmid;
    else
      en = umid;
  }
  cout << fixed << setprecision(15) << tstar((st + en) / (ld)2) << '\n';
}


Fixed submission:
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);
#define LLINF ((long long)1e15) // 1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define db 0
#define EPS (1e-12) // 0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (100006)
#define ll long double
#define ld long double
mt19937
    rng(chrono::steady_clock::now()
            .time_since_epoch()
            .count()); // can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for (ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair<ll, ll> pi;
typedef pair<char, pi> spi;
typedef pair<pi, pi> dpi;
// inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; }
// //inclusivesss string to_string(char c) {string s(1,c);return s;}string
// to_string(bool b){return (b ? "true" : "false");}template <typename A,
// typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) +
// ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v)
// {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res
// += ", ";}first = false;res += to_string(x);}res += "}";return res;}void
// degug_out() { cerr << endl; }template <typename Head, typename... Tail>void
// degug_out(Head H, Tail... T) {cerr << " " <<
// to_string(H);degug_out(T...);}inline ll gcd(ll a,ll
// b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr                                                                   \
  if (0)                                                                       \
  cout
#endif
ll n;
spi A[MAXN];
ll tstar(ll x) {
  ll mxx = -LLINF, mix = LLINF, may = -LLINF, miy = LLINF;
  FOR(ii, 0, n) {
    int i = ii;
    ll movex = 0, movey = 0;
    if (A[i].f == 'L') {
      movex -= x;
    } else if (A[i].f == 'R') {
      movex += x;
    } else if (A[i].f == 'D') {
      movey -= x;
    } else if (A[i].f == 'U') {
      movey += x;
    } else
      assert(0);
    mxx = max(mxx, movex + A[i].s.f);
    mix = min(mix, movex + A[i].s.f);
    may = max(may, movey + A[i].s.s);
    miy = min(miy, movey + A[i].s.s);
  }
  return (mxx - mix) * (may - miy);
}
int main() {
  FAST cin >> n;
  FOR(i, 0, n) { cin >> A[(int)i].s.f >> A[(int)i].s.s >> A[(int)i].f; }
  ll st = 0, en = 2e8 + 100;
  FOR(i, 0, 150) {
    ll lmid = st + (en - st) / (ld)3;
    ll umid = en - (en - st) / (ld)3;
    if (st == lmid && en == umid)
      break;
    if (tstar(lmid) > tstar(umid))
      st = lmid;
    else
      en = umid;
  }
  cout << fixed << setprecision(15) << tstar((st + en) / (ld)2) << '\n';
}