Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  int mm = 200000;
  cin >> N;
  vector<int> X(N),Y(N);
  vector<char> U(N);
  vector<vector<int>> xxl(mm+1,vector<int>()), xxr(mm+1,vector<int>()),
  						yyu(mm+1,vector<int>()),yyd(mm+1,vector<int>()),
  						zzl(2*mm+1,vector<int>()), zzr(2*mm+1,vector<int>()),
  						zzu(2*mm+1,vector<int>()), zzd(2*mm+1,vector<int>()),
  						zl(2*mm+1,vector<int>()), zr(2*mm+1,vector<int>()),
  						zu(2*mm+1,vector<int>()), zd(2*mm+1,vector<int>());
  for(int i=0; i<N; i++){
    cin >> X[i] >> Y[i] >> U[i];
    if(U[i] == 'L') xxl[X[i]].push_back(i);
    else if(U[i] == 'R') xxr[X[i]].push_back(i);
    else if(U[i] == 'U') yyu[Y[i]].push_back(i);
    else if(U[i] == 'D') yyd[Y[i]].push_back(i);
    if(U[i] == 'L') zzl[X[i]+Y[i]].push_back(i);
    else if(U[i] == 'R') zzr[X[i]+Y[i]].push_back(i);
    else if(U[i] == 'U') zzu[X[i]+Y[i]].push_back(i);
    else if(U[i] == 'D') zzd[X[i]+Y[i]].push_back(i);
    if(U[i] == 'L') zl[X[i]-Y[i]+mm].push_back(i);
    else if(U[i] == 'R') zr[X[i]-Y[i]+mm].push_back(i);
    else if(U[i] == 'U') zu[X[i]-Y[i]+mm].push_back(i);
    else if(U[i] == 'D') zd[X[i]-Y[i]+mm].push_back(i);
  }
  int flag = 0, time;
  for(int i=0; i<=mm; i++){
    vector<int> tml = xxl[i];
    vector<int> tmr = xxr[i];
    //sort(tml.begin(),tml.end());
    //reverse(tml.begin(),tml.end());
    //sort(tmr.begin(),tmr.end());
    for(int j=0; j<(int)tmr.size(); j++){
      for(int k=0; k<(int)tml.size(); k++){
        if(X[tmr[j]] < X[tml[k]]){ flag = 1; time = min(time, X[tml[k]] - X[tmr[j]]); }
      }
    }
  }
  for(int i=0; i<=mm; i++){
    vector<int> tml = yyd[i];
    vector<int> tmr = yyu[i];
    //sort(tml.begin(),tml.end());
    //reverse(tml.begin(),tml.end());
    //sort(tmr.begin(),tmr.end());
    for(int j=0; j<(int)tmr.size(); j++){
      for(int k=0; k<(int)tml.size(); k++){
        if(Y[tmr[j]] < Y[tml[k]]){ flag = 1; time = min(time, Y[tml[k]] - Y[tmr[j]]); }
      }
    }
  }
  for(int i=0; i<=2*mm; i++){
    vector<int> tml = zzl[i];
    vector<int> tmr = zzr[i];
    vector<int> tmu = zzu[i];
    vector<int> tmd = zzd[i];
    for(int j=0; j<tml.size(); j++){
      for(int k=0; k<tmd.size(); k++){
        if(X[tml[j]] > X[tmd[k]){ flag = 1; time = min(time, 2*(X[tml[k] - X[tmd[j]])); }
      }
    }
   for(int j=0; j<tmr.size(); j++){
      for(int k=0; k<tmu.size(); k++){
        if(X[tmr[j]] < X[tmu[k]){ flag = 1; time = min(time, 2*(X[tmu[k] - X[tmr[j]])); }
      }
    }
  }
  for(int i=0; i<=2*mm; i++){
    vector<int> tml = zl[i];
    vector<int> tmr = zr[i];
    vector<int> tmu = zu[i];
    vector<int> tmd = zd[i];
    for(int j=0; j<tml.size(); j++){
      for(int k=0; k<tmu.size(); k++){
        if(X[tml[j]] > X[tmu[k]){ flag = 1; time = min(time, 2*(X[tml[k] - X[tmu[j]])); }
      }
    }
   for(int j=0; j<tmr.size(); j++){
      for(int k=0; k<tmd.size(); k++){
        if(X[tmr[j]] < X[tmd[k]){ flag = 1; time = min(time, 2*(X[tmd[k] - X[tmr[j]])); }
      }
    }
  }
  
  cout << time*5;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:32: error: expected ']' before ')' token
   63 |         if(X[tml[j]] > X[tmd[k]){ flag = 1; time = min(time, 2*(X[tml[k] - X[tmd[j]])); }
      |                                ^
      |                                ]
a.cc:63:85: error: expected ']' before ')' token
   63 |         if(X[tml[j]] > X[tmd[k]){ flag = 1; time = min(time, 2*(X[tml[k] - X[tmd[j]])); }
      |                                                                                     ^
      |                                                                                     ]
a.cc:68:32: error: expected ']' before ')' token
   68 |         if(X[tmr[j]] < X[tmu[k]){ flag = 1; time = min(time, 2*(X[tmu[k] - X[tmr[j]])); }
      |                                ^
      |                                ]
a.cc:68:85: error: expected ']' before ')' token
   68 |         if(X[tmr[j]] < X[tmu[k]){ flag = 1; time = min(time, 2*(X[tmu[k] - X[tmr[j]])); }
      |                                                                                     ^
      |                                                                                     ]
a.cc:79:32: error: expected ']' before ')' token
   79 |         if(X[tml[j]] > X[tmu[k]){ flag = 1; time = min(time, 2*(X[tml[k] - X[tmu[j]])); }
      |                                ^
      |                                ]
a.cc:79:85: error: expected ']' before ')' token
   79 |         if(X[tml[j]] > X[tmu[k]){ flag = 1; time = min(time, 2*(X[tml[k] - X[tmu[j]])); }
      |                                                                                     ^
      |                                                                                     ]
a.cc:84:32: error: expected ']' before ')' token
   84 |         if(X[tmr[j]] < X[tmd[k]){ flag = 1; time = min(time, 2*(X[tmd[k] - X[tmr[j]])); }
      |                                ^
      |                                ]
a.cc:84:85: error: expected ']' before ')' token
   84 |         if(X[tmr[j]] < X[tmd[k]){ flag = 1; time = min(time, 2*(X[tmd[k] - X[tmr[j]])); }
      |                                                                                     ^
      |                                                                                     ]