<commit_before>// Lowest Common Ancestor <O(nlogn), O(logn)>
int anc[25][N], h[N], rt;

// build (sancse table)
anc[0][rt] = rt; // set ancent of the root to itself
for (int i = 1; (1<<i) < n; ++i)
  for (int j = 1; j <= n; ++j)
    anc[i][j] = anc[i-1][anc[i-1][j]];

// query
int lca(int u, int v) {
  if (h[u] < h[v]) swap(u, v);
  for (int i = 20; i >= 0; --i) if (h[u]-(1<<i) <= h[v])
    u = anc[i][u];
  if (u == v) return u;
  for (int i = 20; i >= 0; --i) if (anc[i][u] != anc[i][v])
    u = anc[i][u], v = anc[i][v];
  return anc[0][u];
}<commit_msg>Fixed bug on LCA.<commit_after>// Lowest Common Ancestor <O(nlogn), O(logn)>
int anc[25][N], h[N], rt;

// build (sparse table)
anc[0][rt] = rt; // set parent of the root to itself
for (int i = 1; (1<<i) < n; ++i)
  for (int j = 1; j <= n; ++j)
    anc[i][j] = anc[i-1][anc[i-1][j]];

// query
int lca(int u, int v) {
  if (h[u] < h[v]) swap(u, v);
  for (int i = 20; i >= 0; --i) if (h[u]-(1<<i) >= h[v])
    u = anc[i][u];
  if (u == v) return u;
  for (int i = 20; i >= 0; --i) if (anc[i][u] != anc[i][v])
    u = anc[i][u], v = anc[i][v];
  return anc[0][u];
}
{'fraction_non_alphanumeric': 0.28380782918149466, 'fraction_numerical': 0.028469750889679714, 'mean_word_length': 2.839590443686007, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 10, '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': '176290', 'n_tokens_mistral': 575, 'n_tokens_neox': 551, 'n_words': 167}