Language: C++

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

struct Node
{
    int l, r
    int val, mi;
    Node *lnode, *rnode;
    
    Node(int l, int r) : l(l), r(r), val(0), ma(-1)
    {
        if (r - l != 1)
        {
            lnode = new Node(l, l + r >> 1);
            rnode = new Node(l + r >> 1, r);
        }
    }
    
    void update(int idx, int delta)
    {
        if (r - l == 1)
        {
            val += delta;
            if (val)
                ma = l;
            else
                ma = -1
        }
        else
        {
            if (idx < lnode->r)
                lnode->update(idx, delta);
            else
                rnode->update(idx, delta);
            
            val = lnode->val + rnode->val;
            ma = max(lnode->ma, rnode->ma);
        }
    }
    
    int query(int L, int R)
    {
        if (R <= l || r <= L)
            return -1;
        else if (L <= l && r <= R)
            return ma;
        else
            return max(lnode->query(L, R), rnode->query(L, R));
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i != n; ++i)
        cin >> arr[i];
    sort(arr, arr + n);
    for (int i = 0; i != n; ++i)
    {
        int l = 0;
        int r = n;
        while (r - l != 1)
        {
            if (arr[l + r >> 1] > arr[i])
                r = l + r >> 1;
            else
                l = l + r >> 1;
        }
        
        arr[i] = l;
    }
    
    Node *st = new Node(0, n);
    for (int i = 0; i != n - 1; ++i)
        st->update(arr[i], 1);
    
    vector<int> slimes;
    slimes.push_back(arr[n - 1]);
    bool ok = 1;
    for (int i = 1; i != n; ++i)
    {
        for (int slime : slimes)
        {
            int qry = st->query(0, slimes[i]);
            if (qry == -1)
                ok = 0;
            else
            {
                st->update(qry, -1);
                slimes.push_back(qry);
            }
        }
    }
    
    if (ok)
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
    
    return 0;
}


Compiler output:
a.cc:6:12: error: expected ';' at end of member declaration
    6 |     int l, r
      |            ^
      |             ;
a.cc:50:2: error: expected ';' after struct definition
   50 | }
      |  ^
      |  ;
a.cc: In constructor 'Node::Node(int, int)':
a.cc:10:46: error: class 'Node' does not have any field named 'ma'
   10 |     Node(int l, int r) : l(l), r(r), val(0), ma(-1)
      |                                              ^~
a.cc: In member function 'void Node::update(int, int)':
a.cc:25:17: error: 'ma' was not declared in this scope; did you mean 'mi'?
   25 |                 ma = l;
      |                 ^~
      |                 mi
a.cc:27:17: error: 'ma' was not declared in this scope; did you mean 'mi'?
   27 |                 ma = -1
      |                 ^~
      |                 mi
a.cc:37:13: error: 'ma' was not declared in this scope; did you mean 'mi'?
   37 |             ma = max(lnode->ma, rnode->ma);
      |             ^~
      |             mi
a.cc:37:29: error: 'struct Node' has no member named 'ma'; did you mean 'mi'?
   37 |             ma = max(lnode->ma, rnode->ma);
      |                             ^~
      |                             mi
a.cc:37:40: error: 'struct Node' has no member named 'ma'; did you mean 'mi'?
   37 |             ma = max(lnode->ma, rnode->ma);
      |                                        ^~
      |                                        mi
a.cc: In member function 'int Node::query(int, int)':
a.cc:46:20: error: 'ma' was not declared in this scope; did you mean 'mi'?
   46 |             return ma;
      |                    ^~
      |                    mi