Language: C

template< typename node_t, typename ret_t >
struct SplayTree {
  using F = function< ret_t(ret_t, ret_t) >;
  using G = function< ret_t(ret_t, node_t) >;

  struct Node {
    Node *l, *r, *p;
    int idx;
    node_t key;
    ret_t ret;
    int sz;

    bool is_root() {
      return !p;
    }

    Node(int idx, const node_t &key, const ret_t &ret) :
        idx(idx), key(key), ret(ret), sz(1),
        l(nullptr), r(nullptr), p(nullptr) {}
  };

  const ret_t OM0;
  const F f;
  const G g;

  SplayTree(const F &f, const G &g, const ret_t &OM0) :
      f(f), g(g), OM0(OM0) {}


  void update(Node *t) {
    t->sz = 1;
    t->ret = OM0;
    if(t->l) t->sz += t->l->sz, t->ret = f(t->ret, g(t->l->ret, t->l->key));
    if(t->r) t->sz += t->r->sz, t->ret = f(t->ret, g(t->r->ret, t->r->key));
  }

  void rotr(Node *t) {
    auto *x = t->p, *y = x->p;
    if((x->l = t->r)) t->r->p = x;
    t->r = x, x->p = t;
    update(x), update(t);
    if((t->p = y)) {
      if(y->l == x) y->l = t;
      if(y->r == x) y->r = t;
      update(y);
    }
  }

  void rotl(Node *t) {
    auto *x = t->p, *y = x->p;
    if((x->r = t->l)) t->l->p = x;
    t->l = x, x->p = t;
    update(x), update(t);
    if((t->p = y)) {
      if(y->l == x) y->l = t;
      if(y->r == x) y->r = t;
      update(y);
    }
  }

  void splay(Node *t) {
    while(!t->is_root()) {
      auto *q = t->p;
      if(q->is_root()) {
        if(q->l == t) rotr(t);
        else rotl(t);
      } else {
        auto *r = q->p;
        if(r->l == q) {
          if(q->l == t) rotr(q), rotr(t);
          else rotl(t), rotr(t);
        } else {
          if(q->r == t) rotl(q), rotl(t);
          else rotr(t), rotl(t);
        }
      }
    }
  }

};

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename node_t, typename ret_t >
struct EulerTourTree : SplayTree< node_t, ret_t > {
  using ST = SplayTree< node_t, ret_t >;
  using Node = typename ST::Node;
  using Vertex = pair< Node *, Node * >;

  EulerTourTree(const typename ST::F &f, const typename ST::G &g, const ret_t &OM0) :
      ST(f, g, OM0) {}

  Node *splay_root(Node *t) {
    this->splay(t);
    while(t->l) t = t->l;
    this->splay(t);
    return t;
  }

  void cut(Vertex t) {
    this->splay(t.first);
    auto L = t.first->l;
    t.first->l = nullptr;
    this->update(t.first);
    if(L) {
      L->p = nullptr;
      while(L->r) L = L->r;
      this->splay(L);
    }
    this->splay(t.second);
    auto R = t.second->r;
    t.second->r = nullptr;
    this->update(t.second);
    if(R) {
      R->p = nullptr;
      while(R->l) R = R->l;
      this->splay(R);
    }
    if(L && R) {
      L->r = R;
      R->p = L;
      this->update(L);
    }
  }

  void link(Vertex child, Vertex parent) {
    this->splay(parent.second);
    this->splay(child.first);

    auto L = parent.second->l;
    L->p = nullptr;
    parent.second->l = nullptr;
    this->update(parent.second);
    assert(L);
    while(L->r) L = L->r;
    this->splay(L);
    L->r = child.first;
    child.first->p = L;
    this->update(L);
    this->splay(child.second);
    child.second->r = parent.second;
    parent.second->p = child.second;
    this->update(child.second);
  }


  Vertex make_node(int idx, const node_t &in_data, const node_t &out_data) {
    auto L = new Node(idx, in_data, this->OM0);
    auto R = new Node(idx, out_data, this->OM0);
    R->p = L;
    L->r = R;
    this->update(L);
    return {L, R};
  }
};

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | template< typename node_t, typename ret_t >
      |         ^
main.c:82:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   82 | template< typename T >
      |         ^
main.c:99:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   99 | template< typename T >
      |         ^
main.c:101:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
  101 | template< typename T >
      |         ^
main.c:103:1: error: unknown type name 'using'
  103 | using UnWeightedGraph = vector< vector< int > >;
      | ^~~~~
main.c:103:25: error: 'vector' undeclared here (not in a function)
  103 | using UnWeightedGraph = vector< vector< int > >;
      |                         ^~~~~~
main.c:103:41: error: expected expression before 'int'
  103 | using UnWeightedGraph = vector< vector< int > >;
      |                                         ^~~
main.c:104:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
  104 | template< typename T >
      |         ^
main.c:107:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
  107 | template< typename node_t, typename ret_t >
      |         ^