<commit_before>/* Baseado na implementacao do Sleator */
class Node {
public:
    int id;
    bool rev;
    Node *l, *r, *p;
    Node(){
      l = r = p = NULL;
      rev = false;
    }
    Node (int i) {
      id = i;
      l = r = p = NULL;
      rev = false;
    }

    // se eh raiz de splay tree
    bool isroot() {
      return p==NULL || (p->l != this && p->r != this);
    }
    
    /* If this node is flipped, we unflip it, and push the change
       down the tree, so that it represents the same thing. */
    void normalize() {
      if (rev) {
          rev = false;
          swap(l,r);
          
          if (l != NULL) l->rev ^= 1;
          if (r != NULL) r->rev ^= 1;
      }
    }

    /* The tree structure has changed in the vicinity of this node
       (for example, if this node is linked to a different left
       child in a rotation).  This function fixes up the data fields
       in the node to maintain invariants. */
    void update() {
      
    }
};

namespace LinkCut{
  inline void connect(Node *ch, Node *p){
    if (ch != NULL)
      ch->p = p;
  }
  inline void connect(Node *ch, Node *p, bool isLeftChild) {
    connect(ch,p);
    if (isLeftChild)
      p->l = ch;
    else
      p->r = ch;
  }

  inline void rotate(Node * x) {
    Node *p = x->p;
    Node *g = p->p;
    bool isRootP = p->isroot();
    bool leftChildX = (x == p->l);

    // create 3 edges: (x.r(l),p), (p,x), (x,g)
    connect(leftChildX ? x->r : x->l, p, leftChildX);
    connect(p, x, !leftChildX);<commit_msg>colocando placeholders pra os aggregate<commit_after>/* Baseado na implementacao do Sleator */
class Node {
public:
    int id;
    bool rev;
    Node *l, *r, *p;
    Node(){
      l = r = p = NULL;
      rev = false;
    }
    Node (int i) {
      id = i;
      l = r = p = NULL;
      rev = false;
    }

    // se eh raiz de splay tree
    bool isroot() {
      return p==NULL || (p->l != this && p->r != this);
    }
    
    /* If this node is flipped, we unflip it, and push the change
       down the tree, so that it represents the same thing. */
    void normalize() {
      if (rev) {
          rev = false;
          swap(l,r);
          
          if (l != NULL) l->rev ^= 1;
          if (r != NULL) r->rev ^= 1;
      }
      // Lazy propagation aqui
    }

    /* The tree structure has changed in the vicinity of this node
       (for example, if this node is linked to a different left
       child in a rotation).  This function fixes up the data fields
       in the node to maintain invariants. */
    void update() {
      // Node update aqui
      // Considerar vizinhos com o valor calculado
    }
};

namespace LinkCut{
  inline void connect(Node *ch, Node *p){
    if (ch != NULL)
      ch->p = p;
  }
  inline void connect(Node *ch, Node *p, bool isLeftChild) {
    connect(ch,p);
    if (isLeftChild)
      p->l = ch;
    else
      p->r = ch;
  }

  inline void rotate(Node * x) {
    Node *p = x->p;
    Node *g = p->p;
    bool isRootP = p->isroot();
    bool leftChildX = (x == p->l);

    // create 3 edges: (x.r(l),p), (p,x), (x,g)
    connect(leftChildX ? x->r : x->l, p, leftChildX);
    connect(p, x, !leftChildX);
{'fraction_non_alphanumeric': 0.138670028364324, 'fraction_numerical': 0.0018909549322407816, 'mean_word_length': 1.79155672823219, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7027420', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1089, 'n_words': 393}