Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define pb push_back
#define ll long long int
# define pll pair<ll,ll>
# define pii pair<int,int>
# define fio ios_base::sync_with_stdio(false); cin.tie(NULL)
vector<pii>adj1[200009],adj2[200009],adj3[400009],adj4[400009];
bool comppare(pii p1, pii p2)
{
    return p1.first<p2.first;
}
int main()
{   int n;
    
    cin>>n;
    char u;
    map<char,int>M;
    M['U']=1;
    M['D']=2;
    M['L']=3;
    M['R']=4;
    int x,y;
    for(int i=1;i<=n;i++)
    {
        cin>>x>>y>>u;
        adj1[x].pb({y,M[u]});
        adj2[y].pb({x,M[u]});
        adj3[x+y].pb({x,M[u]});
        adj4[x-y+200000].pb({x,M[u]});
        
    }
    ll ans=4e5+1;
    for(int i=1;1<=200000;i++)
    {
        if(adj1[i].size()>1)
        {
            sort(adj1[i].begin(),adj1[i].end(),compare);
            ll left=-1,right=-1;
            for(auto x : adj1[i])
            {
                if(x.second == 4) right=x.first;
                else if(right!=-1 and x.second==3) ans=min(ans,x.first-right);
            }
        }
        if(adj2[i].size()>1)
        {
            sort(adj2[i].begin(),adj2[i].end(),compare);
            ll up=-1,down=-1;
            for(auto x : adj2[i])
            {
                if(x.second == 1) up=x.first;
                else if(up!=-1 and x.second==2) ans=min(ans,x.first-up);
            }
        }
        
    }
    for(int i=1;i<=400000;i++)
    {
        if(adj3[i].size()>1)
        {
            ll left=-1,up=-1,right=-1,down=-1;
            sort(adj3[i].begin(),adj3[i].end(),compare);
            for(auto x : adj3[i])
            {
                if(x.second==4) right=x.first;
                else if(x.second==2) down=x.first;
                else if(x.second==1 and right!=-1) ans=min(ans,x.second-right);
                else if(x.second==3 and down!=-1) ans=min(ans,x.second-right);
                
            }
        }
    }
    for(int i=1;i<=400000;i++)
    {
        if(adj4[i].size()>1)
        {
            ll left=-1,up=-1,right=-1,down=-1;
            sort(adj3[i].begin(),adj3[i].end(),compare);
            for(auto x : adj3[i])
            {
                if(x.second==4) right=x.first;
                else if(x.second==1) up=x.first;
                else if(x.second==2 and right!=-1) ans=min(ans,x.second-right);
                else if(x.second==3 and up!=-1) ans=min(ans,x.second-up);
                
            }
        }
    }
    cout<<ans*10;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:48: error: 'compare' was not declared in this scope; did you mean 'comppare'?
   42 |             sort(adj1[i].begin(),adj1[i].end(),compare);
      |                                                ^~~~~~~
      |                                                comppare
a.cc:52:48: error: 'compare' was not declared in this scope; did you mean 'comppare'?
   52 |             sort(adj2[i].begin(),adj2[i].end(),compare);
      |                                                ^~~~~~~
      |                                                comppare
a.cc:67:48: error: 'compare' was not declared in this scope; did you mean 'comppare'?
   67 |             sort(adj3[i].begin(),adj3[i].end(),compare);
      |                                                ^~~~~~~
      |                                                comppare
a.cc:83:48: error: 'compare' was not declared in this scope; did you mean 'comppare'?
   83 |             sort(adj3[i].begin(),adj3[i].end(),compare);
      |                                                ^~~~~~~
      |                                                comppare