func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 3010;   int n, x[M];   char d[M][6];   int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, -1, 1};   vector<long long> X, Y;   int g[M][M], fw1, fw2;   queue<pair<int, int> > Q;   const long long INF = 20000000005LL, MINF = -INF;   struct point {     long long lasx, lasy, nowx, nowy;     point() {}     point(int _lasx, int _lasy, int _nowx, int _nowy)         : lasx(_lasx), lasy(_lasy), nowx(_nowx), nowy(_nowy) {}   } ways[M];   inline int renumber(int x, vector<long long> _find) {     return find(_find.begin(), _find.end(), x) - _find.begin();   }   inline void BFS() {     while (!Q.empty()) Q.pop();     Q.push(make_pair(0, 0));     g[0][0] = 2;     fw1 = X.size(), fw2 = Y.size();     while (!Q.empty()) {       pair<int, int> top = Q.front();       Q.pop();       for (int i = 0; i < 4; ++i) {         pair<int, int> x;         x.first = top.first + dx[i], x.second = top.second + dy[i];         if (x.first >= 0 && x.first < fw1 && x.second >= 0 && x.second < fw2 &&             g[x.first][x.second] == 0) {           g[x.first][x.second] = 2;           Q.push(x);         }       }     }   }   int main() {     scanf( %d , &n);     long long nowx, nowy;     nowx = nowy = 0;     X.push_back(MINF);     X.push_back(INF);     Y.push_back(MINF);     Y.push_back(INF);     for (int i = 1; i <= n; ++i) {       int face;       long long tx, ty;       scanf( %s%d , d[i], &x[i]);       if (d[i][0] ==  R ) face = 0;       if (d[i][0] ==  L ) face = 1;       if (d[i][0] ==  D ) face = 2;       if (d[i][0] ==  U ) face = 3;       tx = nowx + dx[face] * x[i];       ty = nowy + dy[face] * x[i];       int Xmin = min(nowx, tx), Xmax = max(nowx, tx) + 1;       int Ymin = min(nowy, ty), Ymax = max(nowy, ty) + 1;       X.push_back(Xmin);       X.push_back(Xmax);       Y.push_back(Ymin);       Y.push_back(Ymax);       ways[i] = point(Xmin, Ymin, Xmax, Ymax);       nowx = tx, nowy = ty;     }     sort(X.begin(), X.end());     sort(Y.begin(), Y.end());     X.resize(unique(X.begin(), X.end()) - X.begin());     Y.resize(unique(Y.begin(), Y.end()) - Y.begin());     for (int i = 1; i <= n; ++i) {       int tx1 = renumber(ways[i].lasx, X), tx2 = renumber(ways[i].nowx, X),           ty1 = renumber(ways[i].lasy, Y), ty2 = renumber(ways[i].nowy, Y);       for (int j = tx1; j < tx2; ++j)         for (int k = ty1; k < ty2; ++k) g[j][k] = 1;     }     BFS();     long long ans = 0;     for (int i = 0; i <= fw1 - 2; ++i)       for (int j = 0; j <= fw2 - 2; ++j)         if (g[i][j] != 2)           ans = ans + (long long)(X[i + 1] - X[i]) * (Y[j + 1] - Y[j]);     cout << ans << endl;     return 0;   }   