Language: C++

#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>

#define rep(i,n) for(int i=0; i<n;i++)
typedef long long ll;

using namespace std;

ll ans;
int n;
ll vmax= -1000000000;
ll vmin = 1000000000;
ll hmax= -1000000000;
ll hmin = 1000000000;
ll rmax= -1000000000;
ll rmin = 1000000000;
ll lmax= -1000000000;
ll lmin = 1000000000;
ll umax= -1000000000;
ll umin = 1000000000;
ll dmax= -1000000000;
ll dmin = 1000000000;
bool rf,lf,df,uf;
ll rrem;
ll lrem;
ll drem;
ll urem;
ll rmaxtmp= -1000000000;
ll rmintmp = 1000000000;
ll lmaxtmp= -1000000000;
ll lmintmp = 1000000000;
ll umaxtmp= -1000000000;
ll umintmp = 1000000000;
ll dmaxtmp= -1000000000;
ll dmintmp = 1000000000;





int main(){
  cin >> n;
  rep(i,n){
    ll x;
    ll y;
    char d;
    cin >> x >> y >> d;

    if (d == 'U') {umax = max(umax,y);
    umin = min(umin,y);
    }
    else if (d == 'D') {umax = max(dmax,y);
    umin = min(dmin,y);}
    else{    vmax = max(vmax, y);
        vmin = min(vmin, y);

}

    if (d == 'R') {rmax = max(rmax,x);
    rmin = min(rmin,x);}
    else if (d == 'L') {lmax = max(lmax,x);
    lmin = min(lmin,x);}
    else{    hmax = max(hmax, x);
    hmin = min(hmin, x);
}
  }



ans = (vmax-vmin)*(hmax-hmin);
ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));

if (hmax - rmax > 0){
  float time = hmax - rmax;
  rmaxtmp = rmax+time;
  lmaxtmp = lmax-time;
  rmintmp = rmin+time;
  lmintmp = lmin-time;
  umaxtmp = umax+time;
  dmaxtmp = dmax-time;
  umintmp = umin+time;
  dmintmp = dmin-time;
  ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
}
if(lmax - rmax > 0){
    float time = (lmax - rmax)/2;
  rmaxtmp = rmax+time;
  lmaxtmp = lmax-time;
  rmintmp = rmin+time;
  lmintmp = lmin-time;
  umaxtmp = umax+time;
  dmaxtmp = dmax-time;
  umintmp = umin+time;
  dmintmp = dmin-time;

  ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));

}
if(lmax - hmax > 0){
    float time = (lmax - hmax);
  rmaxtmp = rmax+time;
  lmaxtmp = lmax-time;
  rmintmp = rmin+time;
  lmintmp = lmin-time;
  umaxtmp = umax+time;
  dmaxtmp = dmax-time;
  umintmp = umin+time;
  dmintmp = dmin-time;

  ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));

}

if (vmax - umax > 0){
  float time = vmax - umax;
  rmaxtmp = rmax+time;
  lmaxtmp = lmax-time;
  rmintmp = rmin+time;
  lmintmp = lmin-time;
  umaxtmp = umax+time;
  dmaxtmp = dmax-time;
  umintmp = umin+time;
  dmintmp = dmin-time;
  ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
}
if(dmax - umax > 0){
    float time = (dmax - umax)/2;
  rmaxtmp = rmax+time;
  lmaxtmp = lmax-time;
  rmintmp = rmin+time;
  lmintmp = lmin-time;
  umaxtmp = umax+time;
  dmaxtmp = dmax-time;
  umintmp = umin+time;
  dmintmp = dmin-time;

  ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));

}
if(dmax - vmax > 0){
    float time = (dmax - vmax);
  rmaxtmp = rmax+time;
  lmaxtmp = lmax-time;
  rmintmp = rmin+time;
  lmintmp = lmin-time;
  umaxtmp = umax+time;
  dmaxtmp = dmax-time;
  umintmp = umin+time;
  dmintmp = dmin-time;

  ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));

}

cout << ans << endl;

  return 0;
}


Compiler output:
a.cc:31:4: error: 'll drem' redeclared as different kind of entity
   31 | ll drem;
      |    ^~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:28,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration 'double drem(double, double)'
  220 | __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:76:65: error: no matching function for call to 'max(ll)'
   76 | ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:76:65: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   76 | ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:76:115: error: expected ')' before ';' token
   76 | ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                             ~                                                     ^
      |                                                                                                                   )
a.cc:88:67: error: no matching function for call to 'max(ll)'
   88 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:88:67: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   88 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:88:117: error: expected ')' before ';' token
   88 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                               ~                                                     ^
      |                                                                                                                     )
a.cc:101:67: error: no matching function for call to 'max(ll)'
  101 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:101:67: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  101 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:101:117: error: expected ')' before ';' token
  101 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                               ~                                                     ^
      |                                                                                                                     )
a.cc:115:67: error: no matching function for call to 'max(ll)'
  115 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:115:67: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  115 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:115:117: error: expected ')' before ';' token
  115 |   ans = (max(hmax,rmaxtmp,lmaxtmp)-min(hmin,rmintmp,lmintmp))*(max((vmax,dmaxtmp,umaxtmp)-min(vmin,umintmp,dmintmp));
      |                                                               ~                                                     ^
      |                                                                                                                     )
a.cc:129:67: error: no matching function for call to 'max(ll)'
  129 |   ans = (max(hm