diff --git a/algorithms/graph/travelling_salesman.cpp b/algorithms/graph/travelling_salesman.cpp
index f2cc22f93d7893afbbe24a669430c1c6547419a7..3aebcc10d488cb6e8a5f9364ee571d02c8c32a22 100644
--- a/algorithms/graph/travelling_salesman.cpp
+++ b/algorithms/graph/travelling_salesman.cpp
@@ -42,6 +42,6 @@ struct TSP {
   }
 
   int run(int start) {
-    return run(start, 1 << start);
+    return solve(start, 1 << start);
   }
 };
diff --git a/algorithms/structure/disjoint_set.cpp b/algorithms/structure/disjoint_set.cpp
index aaa382322a3cac2e2ba534c69ba7f554e8af30d9..7ce7b101bc0625a37ff0664099ad1cba1d1e7774 100644
--- a/algorithms/structure/disjoint_set.cpp
+++ b/algorithms/structure/disjoint_set.cpp
@@ -11,12 +11,13 @@ struct DisjointSet {
   vector<int> rnk, par;
 
   DisjointSet(int N) :
-    N(N), rnk(N), par(N)
+    N(N), rnk(N), par(N), siz(N)
   { init(); }
 
   void init() {
     iota(all(par), 0);
     fill(all(rnk), 0);
+    fill(all(siz), 1);
   }
 
   int find_set(int x) {
@@ -33,5 +34,6 @@ struct DisjointSet {
     if (rnk[x] < rnk[y]) swap(x, y);
     if (rnk[x] == rnk[y]) rnk[x]++;
     par[y] = x;
+    siz[x] += siz[y];
   }
 };
diff --git a/algorithms/structure/trie.cpp b/algorithms/structure/trie.cpp
index 6952a693689e9ccd5464615e19eab939e0f63da6..626a677f5fdfa7a434be03ed410a7aaa88e492aa 100644
--- a/algorithms/structure/trie.cpp
+++ b/algorithms/structure/trie.cpp
@@ -29,13 +29,13 @@ struct Trie {
   }
 
   int len(T x) {
-    if constexpr(is_same_v<T,int>) 
+    if (constexpr(is_same_v<T,int>)) 
       return 32;
     return x.size();
   }
 
   int idx(T x) {
-    if constexpr(is_same_v<T,int>) 
+    if (constexpr(is_same_v<T,int>))
       return !!(x & (1 << i));
     return x[i] - 'a';
   }
diff --git a/caderno.pdf b/caderno.pdf
index 9ff400bb0e5ec636c3703ff24aae3ac55aaf119c..9d215e2f2a2af3eaa1555fdd4d3ab4666fdcac70 100644
Binary files a/caderno.pdf and b/caderno.pdf differ
diff --git a/contests/Cadernaveis/BALE11.cpp b/contests/Cadernaveis/BALE11.cpp
index 4b0729f9276d94f6e9c6624f2b9c0c22c68bd6ef..2dbcd8a9aef47ce2e39261b3900c655b301fbb53 100644
--- a/contests/Cadernaveis/BALE11.cpp
+++ b/contests/Cadernaveis/BALE11.cpp
@@ -1,3 +1,5 @@
+/// Bale
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/Cadernaveis/CAVALOS.cpp b/contests/Cadernaveis/CAVALOS.cpp
index 839a029b07084b5f8f090cc1bf355d20c7576ac1..d3407170de1f7ece04ac3e33b2545f0db62c3a46 100644
--- a/contests/Cadernaveis/CAVALOS.cpp
+++ b/contests/Cadernaveis/CAVALOS.cpp
@@ -1,3 +1,5 @@
+/// A Lei vai a Cavalos
+
 #include <bits/stdc++.h>
 
 #define MAX 300
diff --git a/contests/Cadernaveis/CF342E.cpp b/contests/Cadernaveis/CF342E.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..746231ae1ab08722222e87ea80c3c099ac742a39
--- /dev/null
+++ b/contests/Cadernaveis/CF342E.cpp
@@ -0,0 +1,190 @@
+/// Xenia and Tree
+
+#include <bits/stdc++.h>
+ 
+#define MAX 101010
+#define EPS 1e-6
+#define MOD 1000000007
+#define inf 0x3f3f3f3f
+#define llinf 0x3f3f3f3f3f3f3f3f
+ 
+#define fi first
+#define se second
+#define pb push_back
+#define ende '\n'
+ 
+#define all(x) (x).begin(), (x).end()
+#define rall(x) (x).rbegin(), (x).rend()
+#define mset(x, y) memset(&x, (y), sizeof(x))
+ 
+using namespace std; 
+ 
+using ll = long long;
+using ii = pair<int,int>;
+ 
+#define MAXLOG 20
+ 
+vector<ii> graph[MAX];
+ 
+struct LCA {
+  vector<int> h;
+  vector<vector<int>> par, cost;
+ 
+  LCA(int N) :
+    h(N), 
+    par(N, vector<int>(MAXLOG)), 
+    cost(N, vector<int>(MAXLOG))
+  {
+    init();
+  }
+ 
+  void init() {
+    for (auto &i : par)
+      fill(all(i), -1);
+    for (auto &i : cost)
+      fill(all(i), 0);
+    dfs(0);
+  }
+ 
+  inline int op(int a, int b) {
+    return a + b;
+  }
+ 
+  void dfs(int v, int p = -1, int c = 0) {
+    par[v][0] = p;
+    cost[v][0] = c;
+ 
+    if (p != -1)
+      h[v] = h[p] + 1;
+ 
+    for (int i = 1; i < MAXLOG; ++i)
+      if (par[v][i - 1] != -1) {
+        par[v][i] = par[par[v][i - 1]][i - 1];
+        cost[v][i] = op(cost[v][i], op(cost[par[v][i-1]][i-1], cost[v][i-1]));
+      }
+ 
+    for (auto u : graph[v]) 
+      if (p != u.fi)
+        dfs(u.fi, v, u.se);
+  }
+ 
+  int query(int p, int q) {
+    int ans = 0; // *
+ 
+    if (h[p] < h[q])
+      swap(p, q);
+ 
+    for (int i = MAXLOG - 1; i >= 0; --i)
+      if (par[p][i] != -1 && h[par[p][i]] >= h[q]) {
+        ans = op(ans, cost[p][i]);
+        p = par[p][i];
+      }
+ 
+    if (p == q) {
+      return ans;
+    }
+ 
+    for (int i = MAXLOG - 1; i >= 0; --i)
+      if (par[p][i] != -1 && par[p][i] != par[q][i]) {
+        ans = op(ans, op(cost[p][i], cost[q][i]));
+        p = par[p][i];
+        q = par[q][i];
+      }
+ 
+    if (p == q) return ans;
+    else return op(ans, op(cost[p][0], cost[q][0]));
+  }
+};
+ 
+struct CentroidDecomposition {
+  vector<int> par, size, marked;
+ 
+  CentroidDecomposition(int N) :
+    par(N), size(N), marked(N)
+  {
+    init();
+  }
+ 
+  void init() {
+    fill(all(marked), 0);
+    build(0, -1);
+  }
+ 
+  void build(int x, int p) {
+    int n = dfs(x, -1);
+    int centroid = get_centroid(x, -1, n);
+    marked[centroid] = 1;
+ 
+    par[centroid] = p;
+ 
+    for (auto i : graph[centroid]) {
+      if (!marked[i.fi])
+        build(i.fi, centroid);
+    }
+  }
+ 
+  int dfs(int x, int p) {
+    size[x] = 1;
+    for (auto i : graph[x])
+      if (i.fi != p && !marked[i.fi])
+        size[x] += dfs(i.fi, x);
+ 
+    return size[x];
+  }
+ 
+  int get_centroid(int x, int p, int n) {
+    for (auto i : graph[x])
+      if (i.fi != p && size[i.fi] > n / 2 && !marked[i.fi])
+        return get_centroid(i.fi, x, n);
+    return x;
+  }
+ 
+  int operator[](int i) {
+    return par[i];
+  }
+};
+ 
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+ 
+  int n, m; cin >> n >> m;
+  vector<int> ans(n, inf);
+ 
+  for (int i = 0; i < n - 1; ++i) {
+    int a, b; cin >> a >> b;
+    a--, b--;
+    graph[a].pb(ii(b, 1));
+    graph[b].pb(ii(a, 1));
+  }
+ 
+  LCA lca(n);
+  CentroidDecomposition cd(n);
+ 
+  int p = 0;
+  while (p != -1) {
+    ans[p] = min(ans[p], lca.query(0, p));
+    p = cd[p];
+  }
+ 
+  for (int i = 0; i < m; ++i) {
+    int a, b; cin >> a >> b;
+    b--;
+    if (a == 1) {
+      int p = b;
+      while (p != -1) {
+        ans[p] = min(ans[p], lca.query(b, p));
+        p = cd[p];
+      }
+    } else {
+      int p = b, res = inf;
+      while (p != -1) {
+        res = min(res, lca.query(b, p) + ans[p]);
+        p = cd[p];
+      }
+      cout << res << ende;
+    }
+  }
+ 
+  return 0;
+}
diff --git a/contests/Cadernaveis/DESCULPA.cpp b/contests/Cadernaveis/DESCULPA.cpp
index b36b19292e14f65aa7b12ffbd0df856cdb4c480a..3996dc212873d786c91a878b00b93d0e6b98250f 100644
--- a/contests/Cadernaveis/DESCULPA.cpp
+++ b/contests/Cadernaveis/DESCULPA.cpp
@@ -1,3 +1,5 @@
+/// Pedido de Desculpas
+
 #include <bits/stdc++.h>
  
 #define MAX 1010
diff --git a/contests/Cadernaveis/EASUDOKU.cpp b/contests/Cadernaveis/EASUDOKU.cpp
index f6aa1709b05481cd3a85030b12760b472df55868..70af254db00c764610319abcf102730d5441d238 100644
--- a/contests/Cadernaveis/EASUDOKU.cpp
+++ b/contests/Cadernaveis/EASUDOKU.cpp
@@ -1,3 +1,5 @@
+/// Easy Sudoku
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/ENGARRAF.cpp b/contests/Cadernaveis/ENGARRAF.cpp
index 589978139de7ff4b1447d447dbca49af175a4852..ad23fe03749a52f7cad2fc6f49d31b3b6d289a6e 100644
--- a/contests/Cadernaveis/ENGARRAF.cpp
+++ b/contests/Cadernaveis/ENGARRAF.cpp
@@ -1,3 +1,5 @@
+/// Engarrafamento
+
 #include <bits/stdc++.h>
 
 #define MAX 200
diff --git a/contests/Cadernaveis/GINCAN11.cpp b/contests/Cadernaveis/GINCAN11.cpp
index 9b551c5c70fc8559f45850d950b6a94d2ec10115..9c0a271e0626ee4113b356e07da1fafbbd79ba27 100644
--- a/contests/Cadernaveis/GINCAN11.cpp
+++ b/contests/Cadernaveis/GINCAN11.cpp
@@ -1,3 +1,5 @@
+/// Gincana
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/JANELA13.cpp b/contests/Cadernaveis/JANELA13.cpp
index 766d7cd18bbe2ad3139b23e49905277ee4629971..509abfb0aae66369d22709a86e08f7bcb3285391 100644
--- a/contests/Cadernaveis/JANELA13.cpp
+++ b/contests/Cadernaveis/JANELA13.cpp
@@ -1,3 +1,5 @@
+/// Janela
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/KOCH.cpp b/contests/Cadernaveis/KOCH.cpp
index e5cf2391d2465eab4ddf78133824cacfe3abc380..91ff450f6a93d44855d78edf7c9131241223dfae 100644
--- a/contests/Cadernaveis/KOCH.cpp
+++ b/contests/Cadernaveis/KOCH.cpp
@@ -1,3 +1,5 @@
+/// Crescimento das Populacoes de bacilos
+
 #include <bits/stdc++.h>
  
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/KRAKOVIA.cpp b/contests/Cadernaveis/KRAKOVIA.cpp
index 847f1c22a349c1af77536609565db2172bc89aeb..fb390d9d53c4fa932dd07eb7f48b9e76b4b761f9 100644
--- a/contests/Cadernaveis/KRAKOVIA.cpp
+++ b/contests/Cadernaveis/KRAKOVIA.cpp
@@ -1,3 +1,5 @@
+/// Krakovia
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/LA3635.cpp b/contests/Cadernaveis/LA3635.cpp
index 20cb4e8c19d6e364537bb2ee18100d8fb4bd1d06..212d07ee96ce254503465f28bfeb4b08fbd41154 100644
--- a/contests/Cadernaveis/LA3635.cpp
+++ b/contests/Cadernaveis/LA3635.cpp
@@ -1,3 +1,5 @@
+/// Pie!
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/LA4509.cpp b/contests/Cadernaveis/LA4509.cpp
index 7ee3f60e913ca112030591f6caf46b92243af3d1..cd2de3fbe06e99afc617c392f82e4f04cc544adb 100644
--- a/contests/Cadernaveis/LA4509.cpp
+++ b/contests/Cadernaveis/LA4509.cpp
@@ -1,3 +1,5 @@
+/// Hauted Graveyard
+
 #include <bits/stdc++.h>
 
 #define MAX 40
diff --git a/contests/Cadernaveis/LA5138.cpp b/contests/Cadernaveis/LA5138.cpp
index fb0707b5b40cbbcff9fe4100323e18227d2dd991..349eab9a064dbe7058c3c760873fdb1d5ab70e0a 100644
--- a/contests/Cadernaveis/LA5138.cpp
+++ b/contests/Cadernaveis/LA5138.cpp
@@ -1,3 +1,5 @@
+/// Trash Removal
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/LA5220.cpp b/contests/Cadernaveis/LA5220.cpp
index efa746cbccf6f55e6999380449290c296aa09bf6..0a1d6a34067d1f24475c0577aa6dd81b5e164113 100644
--- a/contests/Cadernaveis/LA5220.cpp
+++ b/contests/Cadernaveis/LA5220.cpp
@@ -1,3 +1,5 @@
+/// Internet Bandwidth
+
 #include <bits/stdc++.h>
 
 #define MAX 1000
diff --git a/contests/Cadernaveis/MANUT.cpp b/contests/Cadernaveis/MANUT.cpp
index ceec4bf5e75383999a8c527b36e95876da2c1a85..a4e6b9e280a5a33884b455a7607de3efd410f20f 100644
--- a/contests/Cadernaveis/MANUT.cpp
+++ b/contests/Cadernaveis/MANUT.cpp
@@ -1,3 +1,5 @@
+/// Manutencao
+
 #include <bits/stdc++.h>
 
 #define MAX 500
diff --git a/contests/Cadernaveis/MCAIRO.cpp b/contests/Cadernaveis/MCAIRO.cpp
index 5915f7ba0a9fe7a5d88021aa5f3c73bff4cbe076..74c43a0cdbb2f5bf374077164c7fc9bc9cb4fc12 100644
--- a/contests/Cadernaveis/MCAIRO.cpp
+++ b/contests/Cadernaveis/MCAIRO.cpp
@@ -1,3 +1,5 @@
+/// Mercado do Cairo
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/NTICKETS.cpp b/contests/Cadernaveis/NTICKETS.cpp
index 668e021623247f0ecd200b6c671bbeb7850faed2..46ca3dd751d0dee0f4b5749900443a232bae19bd 100644
--- a/contests/Cadernaveis/NTICKETS.cpp
+++ b/contests/Cadernaveis/NTICKETS.cpp
@@ -1,3 +1,5 @@
+/// Nlogonian Tickets
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/Cadernaveis/ORKUT.cpp b/contests/Cadernaveis/ORKUT.cpp
index 7b594758f752ec16dbe8e7d28295145d08a9b5fa..52f79016fc6c1a174a0b8109e90fbbf7e2072cc3 100644
--- a/contests/Cadernaveis/ORKUT.cpp
+++ b/contests/Cadernaveis/ORKUT.cpp
@@ -1,3 +1,5 @@
+/// Orkut
+
 #include <bits/stdc++.h>
 
 #define MAX 1000
diff --git a/contests/Cadernaveis/TOPOLAND.cpp b/contests/Cadernaveis/TOPOLAND.cpp
index f533d48700ad11f29b7bbd4c721a4ed9a304c85d..8b8b1bf7387c676c8b836e108a45b2cafb9a1fb1 100644
--- a/contests/Cadernaveis/TOPOLAND.cpp
+++ b/contests/Cadernaveis/TOPOLAND.cpp
@@ -1,3 +1,5 @@
+/// To Poland
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/Cadernaveis/TUBOS.cpp b/contests/Cadernaveis/TUBOS.cpp
index 2a94641f08f541ca2fcae4161ceb5b0eeabd69dc..7a6307bb209ecb39679d4e556c7b361a4b54fb97 100644
--- a/contests/Cadernaveis/TUBOS.cpp
+++ b/contests/Cadernaveis/TUBOS.cpp
@@ -1,3 +1,5 @@
+/// Serie de Tubos
+
 #include <bits/stdc++.h>
 
 #define MAX 1010
diff --git a/contests/Cadernaveis/URI1033.cpp b/contests/Cadernaveis/URI1033.cpp
index f85f5ef31ad7d9bac84c95bdeb0d14548c4b211f..11d69a4b108650fe8f8ba94a8859899305c220d4 100644
--- a/contests/Cadernaveis/URI1033.cpp
+++ b/contests/Cadernaveis/URI1033.cpp
@@ -1,3 +1,5 @@
+/// Quantas Chamadas Recursivas
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/URI1128.cpp b/contests/Cadernaveis/URI1128.cpp
index 4e48af8c7546c0f9b2b57b8d9808769e26dcc843..4d8c55b48bd7e668614668255d53ad5d3f4845cd 100644
--- a/contests/Cadernaveis/URI1128.cpp
+++ b/contests/Cadernaveis/URI1128.cpp
@@ -1,3 +1,5 @@
+/// Ir e Vir
+
 #include <bits/stdc++.h>
 
 #define MAX 2010
diff --git a/contests/Cadernaveis/URI1130.cpp b/contests/Cadernaveis/URI1130.cpp
index 1d02342ecca8b13debb22aa02f106eccd7c1f586..012bed61b5dc04d6e6a1efc0f9c79de8852f8688 100644
--- a/contests/Cadernaveis/URI1130.cpp
+++ b/contests/Cadernaveis/URI1130.cpp
@@ -1,3 +1,5 @@
+/// Jogo da Velha
+
 #include <bits/stdc++.h>
 
 #define MAX 10101
diff --git a/contests/Cadernaveis/URI1135.cpp b/contests/Cadernaveis/URI1135.cpp
index 5f6d92216bab3a943fa74f3999c1ef04a4998348..a0395db5f37a3148cc63458ea8d2f98960be04df 100644
--- a/contests/Cadernaveis/URI1135.cpp
+++ b/contests/Cadernaveis/URI1135.cpp
@@ -1,3 +1,5 @@
+/// Ant's Colony
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/Cadernaveis/URI1356.cpp b/contests/Cadernaveis/URI1356.cpp
index 057ded7b6220572decb1f59d2532b076552c09de..a9936ab760ff724db1c6e67a1ac079cce4349c1c 100644
--- a/contests/Cadernaveis/URI1356.cpp
+++ b/contests/Cadernaveis/URI1356.cpp
@@ -1,3 +1,5 @@
+/// Jupter Ataca!
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/Cadernaveis/URI1364.cpp b/contests/Cadernaveis/URI1364.cpp
index 3cc36f91504c73186dda92c102bc7eb5263c95fd..f3385d540f9a2b7d478217f0cf7da0573581089c 100644
--- a/contests/Cadernaveis/URI1364.cpp
+++ b/contests/Cadernaveis/URI1364.cpp
@@ -1,3 +1,5 @@
+/// Emoticons
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/URI1464.cpp b/contests/Cadernaveis/URI1464.cpp
index c64d86420ab2182263f2e03a45a1ac4963c1d678..cdb85804b58fbd2ca6832fa2be8650a241d01116 100644
--- a/contests/Cadernaveis/URI1464.cpp
+++ b/contests/Cadernaveis/URI1464.cpp
@@ -1,3 +1,5 @@
+/// Camadas de Cebolas
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/URI1477.cpp b/contests/Cadernaveis/URI1477.cpp
index c8b0c0c37f86dd5e6f93740477bb2f2faa437edd..54df88c4241b4fa07fd76b3987218bcf39fbced6 100644
--- a/contests/Cadernaveis/URI1477.cpp
+++ b/contests/Cadernaveis/URI1477.cpp
@@ -1,3 +1,5 @@
+/// Homem-Elefante-Rato
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/Cadernaveis/URI1850.cpp b/contests/Cadernaveis/URI1850.cpp
index a75ef8658984bc52abdb8dfe64ea062ac0167e20..4bb2e7357d6ab93a60d70186a89cf37a63ece13d 100644
--- a/contests/Cadernaveis/URI1850.cpp
+++ b/contests/Cadernaveis/URI1850.cpp
@@ -1,3 +1,5 @@
+/// O Labirinto de Ninguem
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/URI1852.cpp b/contests/Cadernaveis/URI1852.cpp
index f33593107155cfa994cdfeb9b17ded41735ba72f..75c35d066c00e6b707b2b0b1af26b983d4a6d9c6 100644
--- a/contests/Cadernaveis/URI1852.cpp
+++ b/contests/Cadernaveis/URI1852.cpp
@@ -1,3 +1,5 @@
+/// Lobos Stark
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/URI1860.cpp b/contests/Cadernaveis/URI1860.cpp
index 75329ee0c266fc2f79a3ddd62dc2a68198f766b0..a2ce0546846d463fff40c80c5b3a44c2e328fd5b 100644
--- a/contests/Cadernaveis/URI1860.cpp
+++ b/contests/Cadernaveis/URI1860.cpp
@@ -1,3 +1,5 @@
+/// A Caminhada da Vergonha
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/URI1932_ite.cpp b/contests/Cadernaveis/URI1932_ite.cpp
index a5204f43a05d10bb9e2f96376f9332fa3426301e..4658e6e470b8d00a5e1fcfd2a46f8b101da67b37 100644
--- a/contests/Cadernaveis/URI1932_ite.cpp
+++ b/contests/Cadernaveis/URI1932_ite.cpp
@@ -1,3 +1,5 @@
+/// Bolsa de Valores (iterativo)
+
 #include <bits/stdc++.h>
 
 #define MAX 201010
diff --git a/contests/Cadernaveis/URI1932_rec.cpp b/contests/Cadernaveis/URI1932_rec.cpp
index 09953e6e5201aff7f19a5dfec372bed4f9a2532f..ab2e5b0ddf05ada9750b180ea349d828c1e3da1f 100644
--- a/contests/Cadernaveis/URI1932_rec.cpp
+++ b/contests/Cadernaveis/URI1932_rec.cpp
@@ -1,3 +1,5 @@
+/// Bolsa de Valores (recursivo)
+
 #include <bits/stdc++.h>
 
 #define MAX 201010
diff --git a/contests/Cadernaveis/URI2305.cpp b/contests/Cadernaveis/URI2305.cpp
index 488b197c5e8454c6342829e5f0d77eeb62791a41..b40735d9a76a6a681a7969648b41d718b590973f 100644
--- a/contests/Cadernaveis/URI2305.cpp
+++ b/contests/Cadernaveis/URI2305.cpp
@@ -1,3 +1,5 @@
+/// Colheita de Caju
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/UVA10594.cpp b/contests/Cadernaveis/UVA10594.cpp
index c0794ea984ade55b6a9fd3af58ad0232ada97027..265e484de58209edf88da1597b506eda5fe7155c 100644
--- a/contests/Cadernaveis/UVA10594.cpp
+++ b/contests/Cadernaveis/UVA10594.cpp
@@ -1,3 +1,5 @@
+/// Data Flow
+
 #include <bits/stdc++.h>
 
 #define MAXN 110
diff --git a/contests/Cadernaveis/UVA10679_kmp.cpp b/contests/Cadernaveis/UVA10679_kmp.cpp
index 380a1ac9d1efad1d652ca5e83c62847faf96c23a..5026bcc4c6e2f69c96a69ab856bb852b41bcfe1e 100644
--- a/contests/Cadernaveis/UVA10679_kmp.cpp
+++ b/contests/Cadernaveis/UVA10679_kmp.cpp
@@ -1,3 +1,5 @@
+/// I Love Strings! (kmp)
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/Cadernaveis/qTREE.cpp b/contests/Cadernaveis/qTREE.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9a42fd80c9d452cb88e0a7325ba55cac277f7fbe
--- /dev/null
+++ b/contests/Cadernaveis/qTREE.cpp
@@ -0,0 +1,203 @@
+/// Query on a tree
+
+#include <bits/stdc++.h>
+ 
+#define MAX 10101
+#define EPS 1e-6
+#define MOD 1000000007
+#define inf 0x3f3f3f3f
+#define llinf 0x3f3f3f3f3f3f3f3f
+ 
+#define fi first
+#define se second
+#define pb push_back
+#define ende '\n'
+ 
+#define all(x) (x).begin(), (x).end()
+#define rall(x) (x).rbegin(), (x).rend()
+#define mset(x, y) memset(&x, (y), sizeof(x))
+ 
+using namespace std; 
+ 
+using ll = long long;
+using ii = pair<int,int>;
+ 
+#define left(x) (x << 1)
+#define right(x) ((x << 1) + 1)
+ 
+int N;
+ 
+template <typename T>
+struct SegmentTree {
+  using func = function<T(T,T)>;
+ 
+  func op;
+  T ident = T();
+  vector<T> tree;
+ 
+  SegmentTree(func op) : 
+    op(op), tree(MAX*4) {}
+ 
+  void build(const vector<T> &v, 
+      int node = 1, int l = 0, int r = N - 1) 
+  {
+    if (l > r) 
+      return;
+ 
+    if (l == r)
+      tree[node] = v[l];
+    else {
+      int m = (l + r) / 2;
+      build(v, left(node), l, m);
+      build(v, right(node), m + 1, r);
+      tree[node] = op(tree[left(node)], tree[right(node)]);
+    }
+  }
+ 
+  void update(int i, T val, 
+      int node = 1, int l = 0, int r = N - 1) 
+  {
+    if (l > r || l > i || r < i) 
+      return;
+ 
+    if (l == r)
+      tree[node] = val;
+    else {
+      int m = (l + r) / 2;
+      update(i, val, left(node), l, m);
+      update(i, val, right(node), m + 1, r);
+      tree[node] = op(tree[left(node)], tree[right(node)]);
+    }
+  }
+ 
+  T query(int i, int j, 
+      int node = 1, int l = 0, int r = N - 1)
+  {
+    if (l > r || l > j || r < i) 
+      return ident;
+ 
+    if (l >= i && r <= j)
+      return tree[node];
+ 
+    int m = (l + r) / 2;
+    T q1 = query(i, j, left(node), l, m);
+    T q2 = query(i, j, right(node), m + 1, r);
+    return op(q1, q2);
+  }
+};
+ 
+ii edge[MAX];
+vector<ii> graph[MAX];
+ 
+template <typename ST>
+struct HLD {
+  ST &seg;
+  int cnum, ptr;
+  
+  vector<int> dep, par, val;
+  vector<int> head, heavy, pos, bot;
+ 
+  HLD(int n, ST &seg) :
+    seg(seg), 
+    dep(n, 0), par(n), val(n),
+    head(n), heavy(n, -1), pos(n), bot(n)
+  {
+    cnum = ptr = 0;
+ 
+    N = n;
+    dfs(0);
+    decompose(0);
+ 
+    for (int i = 0; i < n - 1; ++i)
+      if (dep[edge[i].fi] > dep[edge[i].se])
+        bot[i] = edge[i].fi;
+      else
+        bot[i] = edge[i].se;
+  }
+ 
+  int dfs(int x, int p = -1) {
+    int size = 1;
+    par[x] = p;
+ 
+    int max_size = 0;
+    for (auto i : graph[x])
+      if (i.fi != p) {
+        dep[i.fi] = dep[x] + 1;
+        val[i.fi] = i.se;
+        int isize = dfs(i.fi, x);
+ 
+        size += isize;
+        if (isize > max_size)
+          max_size = isize, heavy[x] = i.fi;
+      }
+ 
+    return size;
+  }
+ 
+  void decompose(int x, int h = 0) {
+    head[x] = h;
+    seg.update(ptr, val[x]);
+    pos[x] = ptr++;
+ 
+    if (heavy[x] != -1)
+      decompose(heavy[x], h);
+ 
+    for (auto i : graph[x])
+      if (i.fi != par[x] && i.fi != heavy[x])
+        decompose(i.fi, i.fi);
+  }
+ 
+  int query(int a, int b) {
+    int ans = seg.ident;
+    for (; head[a] != head[b]; b = par[head[b]]) {
+      if (dep[head[a]] > dep[head[b]])
+        swap(a, b);
+      ans = seg.op(ans, seg.query(pos[head[b]], pos[b]));
+    }
+ 
+    if (dep[a] > dep[b])
+      swap(a, b);
+ 
+    return seg.op(ans, seg.query(pos[a] + 1, pos[b]));
+  }
+ 
+  void update(int i, int val) {
+    seg.update(pos[bot[i]], val);
+  }
+};
+ 
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+ 
+  int t; cin >> t;
+  while (t--) {
+    int n; cin >> n;
+    for (int i = 0; i < n; ++i)
+      graph[i].clear();
+ 
+    for (int i = 0; i < n - 1; ++i) {
+      int a, b, c; cin >> a >> b >> c;
+      a--, b--;
+      graph[a].pb(ii(b, c));
+      graph[b].pb(ii(a, c));
+      edge[i] = ii(a, b);
+    }
+ 
+    SegmentTree<int> seg([](int a, int b) { return max(a, b); });
+    HLD<SegmentTree<int>> hld(n, seg);
+ 
+    string op;
+    while (cin >> op && op != "DONE") {
+      if (op == "QUERY") {
+        int a, b; cin >> a >> b; a--, b--;
+        cout << hld.query(a, b) << ende;
+      } else {
+        int idx, w; cin >> idx >> w; idx--;
+        hld.update(idx, w);
+      }
+    }
+  }
+ 
+  return 0;
+}
diff --git a/contests/CodeJam/2018/Qualification/A.cpp b/contests/CodeJam/2018/Qualification/A.cpp
deleted file mode 100644
index 0239075ee7e43f1f0dddc9660e1722e8b31cbe7a..0000000000000000000000000000000000000000
--- a/contests/CodeJam/2018/Qualification/A.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <bits/stdc++.h>
-
-#define EPS 1e-6
-#define MOD 1000000007
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int t; cin >> t;
-  for (int cas = 1; cas <= t; ++cas) {
-    int d; cin >> d;
-    string s; cin >> s;
-
-    int n = s.size();
-    vector<ll> v(n);
-
-    int nums = 0;
-    ll curr = 1, sum = 0;
-    for (int i = 0; i < n; ++i) {
-      if (s[i] == 'S') {
-        sum += curr;
-        nums++;
-      } else curr <<= 1;
-
-      v[i] = curr;
-    } 
-
-    cout << "Case #" << cas << ": ";
-    if (nums > d) {
-      cout << "IMPOSSIBLE" << ende;
-      continue;
-    }
-
-    int ans = 0;
-    int i = n - 2;
-    while (sum > d) {
-      if (i <= n - 2 && s[i] == 'C' && s[i+1] == 'S') {
-        sum -= v[i];
-        v[i] >>= 1;
-        sum += v[i];
-        swap(s[i], s[i+1]);
-        ans++;
-        i++;
-      } else
-        i--;
-    }
-
-    cout << ans << ende;
-  }
-
-  return 0;
-}
diff --git a/contests/CodeJam/2018/Qualification/B.cpp b/contests/CodeJam/2018/Qualification/B.cpp
deleted file mode 100644
index 933ccd199dbd1795d7c083983c0adc07dbb2d7e6..0000000000000000000000000000000000000000
--- a/contests/CodeJam/2018/Qualification/B.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <bits/stdc++.h>
-
-#define EPS 1e-6
-#define MOD 1000000007
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int t; cin >> t;
-  for (int cas = 1; cas <= t; ++cas) {
-    int n; cin >> n;
-    vector<int> v(n);
-    for (auto &i : v) cin >> i;
-
-    vector<int> v1, v2;
-    for (int i = 0; i < n; ++i)
-      if (i % 2) v2.pb(v[i]);
-      else v1.pb(v[i]);
-
-    sort(all(v1));
-    sort(all(v2));
-
-    int j = 0;
-    for (auto i : v1) {
-      v[j] = i;
-      j += 2;
-    }
-
-    j = 1;
-    for (auto i : v2) {
-      v[j] = i;
-      j += 2;
-    }
-
-    int ans = -1;
-    for (int i = 0; i < n - 1; ++i) {
-      if (v[i] > v[i+1]) {
-        ans = i;
-        break;
-      }
-    }
-    cout << "Case #" << cas << ": ";
-    if (ans == -1) cout << "OK" << ende;
-    else cout << ans << ende;
-  }
-
-  return 0;
-}
diff --git a/contests/CodeJam/2018/Qualification/C.cpp b/contests/CodeJam/2018/Qualification/C.cpp
deleted file mode 100644
index 9faa1d6ff5b347b2ba787a9a6280c79cadc5d63c..0000000000000000000000000000000000000000
--- a/contests/CodeJam/2018/Qualification/C.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <bits/stdc++.h>
-
-#define EPS 1e-6
-#define MOD 1000000007
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-int v[3][3];
-int m[1001][1001];
-
-bool check() {
-  return (v[0][0] && v[0][1] && v[0][2]);
-}
-
-int count() {
-  int num = 0;
-  for (int i = 0; i < 3; ++i)
-    for (int j = 0; j < 3; ++j)
-      num += !v[i][j];
-  return num;
-}
-
-void move(int &line) {
-  line++;
-
-  for (int i = 0; i < 3; ++i) v[0][i] = v[1][i];
-  for (int i = 0; i < 3; ++i) v[1][i] = v[2][i];
-  for (int i = 0; i < 3; ++i) v[2][i] = 0;
-}
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int t; cin >> t;
-
-  for (int cas = 1; cas <= t; ++cas) {
-    int a; cin >> a;
-    int line = 2;
-    int num = 0;
-    mset(v, 0);
-    mset(m, 0);
-
-    while (true) {
-      while (check() && line < 1000) {
-        if (count() + num >= a) break;
-        move(line);
-      }
-
-      cout << line << " " << 2 << ende;
-      cout << flush;
-      int x, y; cin >> x >> y;
-
-      if (x == 0 && y == 0) 
-        break;
-
-      if (!m[x][y]) num++;
-      m[x][y] = 1;
-
-      assert(x != -1 && y != -1);
-      v[x - line + 1][y - 1] = 1;
-    }
-  }
-
-  return 0;
-}
diff --git a/contests/CodeJam/2018/Round 1A/A.cpp b/contests/CodeJam/2018/Round 1A/A.cpp
deleted file mode 100644
index d3436ee1d699b474a173a1f1380f6e86a01be066..0000000000000000000000000000000000000000
--- a/contests/CodeJam/2018/Round 1A/A.cpp	
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <bits/stdc++.h>
-
-#define EPS 1e-6
-#define MOD 1000000007
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-int sum[101][101];
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int t; cin >> t;
-  for (int cas = 1; cas <= t; ++cas) {
-    int r, c, h, v; cin >> r >> c >> h >> v;
-
-    int choc = 0;
-    vector<string> waff(r);
-    for (auto &i : waff) {
-      cin >> i;
-      for (auto j : i) 
-        choc += (j == '@');
-    }
-
-    int per_r = choc / (h+1);
-    int per_c = choc / (v+1);
-
-    mset(sum, 0);
-    for (int i = 0; i < c; ++i)
-      sum[0][i] = (waff[0][i] == '@');
-    for (int i = 1; i < r; ++i)
-      for (int j = 0; j < c; ++j)
-        sum[i][j] = sum[i-1][j] + (waff[i][j] == '@');
-    for (int i = 0; i < r; ++i)
-      for (int j = 1; j < c; ++j)
-        sum[i][j] += sum[i][j-1];
-
-    vector<int> rcut;
-    for (int i = 0; i < r; ++i) {
-      int val = sum[i][c-1];
-      if (rcut.size() > 0)
-        val -= sum[rcut.back()][c-1];
-      if (val == per_r)
-        rcut.pb(i);
-    }
-
-    vector<int> ccut;
-    for (int i = 0; i < c; ++i) {
-      int val = sum[r-1][i];
-      if (ccut.size() > 0)
-        val -= sum[r-1][ccut.back()];
-      if (val == per_c)
-        ccut.pb(i);
-    }
-
-    bool poss = true;
-    if ((rcut.size() != (h+1) || ccut.size() != (v+1)) && choc != 0)
-      poss = false;
-
-    if (poss && choc != 0) {
-      for (int i = 0; i < h+1; ++i) {
-        for (int j = 0; j < v+1; ++j) {
-          int cnt = 0;
-          for (int ii = ((i==0) ? (0) : (rcut[i-1]+1)); ii <= rcut[i]; ++ii)
-            for (int jj = ((j==0) ? (0) : (ccut[j-1]+1)); jj <= ccut[j]; ++jj)
-              cnt += (waff[ii][jj] == '@');
-          if (cnt != (choc / ((h+1)*(v+1))))
-            poss = false;
-        }
-      }
-    }
-
-    cout << "Case #" << cas << ": ";
-    if (poss) cout << "POSSIBLE" << ende;
-    else cout << "IMPOSSIBLE" << ende;
-  }
-
-
-  return 0;
-}
diff --git a/contests/CodeJam/2018/Round 2/A.cpp b/contests/CodeJam/2018/Round 2/A.cpp
deleted file mode 100644
index 3c2e56cee8d4515324ce81509931fe07013cc1fb..0000000000000000000000000000000000000000
--- a/contests/CodeJam/2018/Round 2/A.cpp	
+++ /dev/null
@@ -1,86 +0,0 @@
-#include <bits/stdc++.h>
-
-#define EPS 1e-6
-#define MOD 1000000007
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-using ll = long long;
-using ii = pair<int,int>;
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int t; cin >> t;
-  for (int cas = 1; cas <= t; ++cas) {
-    int c; cin >> c;
-    vector<int> v(c + 1);
-    int sum = 0;
-    for (int i = 1; i <= c; ++i) {
-      cin >> v[i];
-      sum += v[i];
-    }
-
-    cout << "Case #" << cas << ": ";
-    if (v[1] == 0 || v[c] == 0 || sum != c) {
-      cout << "IMPOSSIBLE" << ende;
-      continue;
-    }
-
-    int k = 1;
-    vector<int> orig(c + 1);
-    for (int i = 1; i <= c; ++i)
-      for (int j = 0; j < v[i]; ++j)
-        orig[k++] = i;
-
-    int grt = 0;
-    for (int i = 1; i <= c; ++i)
-      grt = max(grt, abs(orig[i] - i) + 1);
-    
-    vector<string> ans(grt, string(c + 1, '.'));
-    vector<int> curr(c + 1);
-    iota(all(curr), 0);
-
-    for (int i = 0; i < grt; ++i) {
-      for (int j = 1; j <= c; ++j) {
-        if (curr[j] > orig[j]) {
-          ans[i][curr[j]] = '/';
-          curr[j]--;
-        } else if (curr[j] < orig[j]) {
-          ans[i][curr[j]] = '\\';
-          curr[j]++;
-        }
-      }
-    }
-
-    bool poss = true;
-    for (int i = 1; i <= c; ++i)
-      if (curr[i] != orig[i])
-        poss = false;
-
-    if (poss) {
-      cout << grt << ende;
-      for (int i = 0; i < grt; ++i) {
-        for (int j = 1; j <= c; ++j)
-          cout << ans[i][j];
-        cout << ende;
-      }
-    } else {
-      cout << "IMPOSSIBLE" << ende;
-    }
-  }
-
-  return 0;
-}
diff --git a/contests/CodeJam/2018/Round 2/C.cpp b/contests/CodeJam/2018/Round 2/C.cpp
deleted file mode 100644
index 708257044ed51a868869c11ed901c84a0d38bc90..0000000000000000000000000000000000000000
--- a/contests/CodeJam/2018/Round 2/C.cpp	
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <bits/stdc++.h>
-
-#define MAX 221
-#define EPS 1e-6
-#define MOD 1000000007
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-using ll = long long;
-using ii = pair<int,int>;
-
-vector<int> graph[MAX];
-
-struct HopcroftKarp {
-  int L, R;
-  vector<int> dist;
-  vector<int> matchL, matchR;
-
-  HopcroftKarp(int L, int R) :
-    L(L), R(R), dist(L),
-    matchL(L), matchR(R)
-  { init(); }
-
-  void init() {
-    fill(all(matchL), 0);
-    fill(all(matchR), 0);
-  }
-
-  bool bfs() {
-    queue<int> Q;
-
-    for (int l = 1; l <= L; ++l)
-      if (matchL[l] == 0) {
-        dist[l] = 0;
-        Q.push(l);
-      } else {
-        dist[l] = inf;
-      }
-
-    dist[0] = inf;
-    while (!Q.empty()) {
-      int l = Q.front(); Q.pop();
-
-      if (dist[l] < dist[0])
-        for (auto r : graph[l])
-          if (dist[matchR[r]] == inf) {
-            dist[matchR[r]] = dist[l] + 1;
-            Q.push(matchR[r]);
-          }
-    }
-
-    return (dist[0] != inf);
-  }
-
-  bool dfs(int l) {
-    if (l == 0)
-      return true;
-
-    for (auto r : graph[l])
-      if (dist[matchR[r]] == dist[l] + 1)
-        if (dfs(matchR[r])) {
-          matchR[r] = l;
-          matchL[l] = r;
-          return true;
-        }
-
-    dist[l] = inf;
-    return false;
-  }
-
-  int run() {
-    int ans = 0;
-
-    while (bfs())
-      for (int l = 1; l <= L; ++l)
-        if (matchL[l] == 0 && dfs(l))
-          ans++;
-
-    return ans;
-  }
-};
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int t; cin >> t;
-  for (int cas = 1; cas <= t; ++cas) {
-    int n; cin >> n;
-    vector<vector<int>> mat(n, vector<int>(n));
-    for (auto &i : mat)
-      for (auto &j : i) 
-        cin >> j;
-
-    cout << "Case #" << cas << ": ";
-    int ans = 0;
-    for (int i = -n; i <= n; ++i) {
-      for (int j = 0; j < MAX; ++j)
-        graph[j].clear();
-
-      int num = 0;
-      for (int j = 0; j < n; ++j)
-        for (int k = 0; k < n; ++k)
-          if (mat[j][k] == i) {
-            num++;
-            graph[j + 1].pb(n + k + 1);
-          }
-
-      HopcroftKarp hk(n+n+1, n+n+1);
-      ans += (num - hk.run());
-    }
-    cout << ans << ende;
-  }
-
-  return 0;
-}
diff --git a/contests/GYM_101492/B.cpp b/contests/GYM_101492/B.cpp
deleted file mode 100644
index 8bfa66716d4c573bff9a5424b55fd3d37bc3c76d..0000000000000000000000000000000000000000
--- a/contests/GYM_101492/B.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <bits/stdc++.h>
-
-#define MAX 0
-#define MOD 1000000007
-#define EPS 1e-6
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define sz size()
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-char ans[MAX];
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  ll n; cin >> n;
-  if (((n * (n + 1)) / 2) % 2)
-    return cout << -1 << ende, 0;
-
-  ll sum = 0, h = n * (n + 1) / 4;
-  for (int i = n; i >= 1; --i)
-    if (sum + i <= h) 
-      ans[i-1] = '+', sum += i;
-    else 
-      ans[i-1] = '-';
-
-  ans[n] = 0;
-  cout << ans << ende;
-  return 0;
-}
diff --git a/contests/GYM_101492/F.cpp b/contests/GYM_101492/F.cpp
deleted file mode 100644
index 94754f7f89682b5d25e028ddff132a936b5ca1d2..0000000000000000000000000000000000000000
--- a/contests/GYM_101492/F.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <bits/stdc++.h>
-
-#define MAX 0
-#define MOD 1000000007
-#define EPS 1e-6
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define sz size()
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  double r, dist;
-  cin >> r;
-  int sum = 0;
-
-  for (int i = 0; i < 3; ++i) {
-    double x, y;
-    cin >> x >> y;
-    dist = sqrt(x*x + y*y);
-
-    for (int j = 10; j > 0; --j)
-      if (dist <= (10 - j + 1)*r + 1e-6) {
-        sum += j;
-        break;
-      }
-  }
-
-  cout << sum << ende;
-  return 0;
-}
diff --git a/contests/GYM_101492/K.cpp b/contests/GYM_101492/K.cpp
deleted file mode 100644
index 1e058a25be9982aced7e09fdc4bda3e07fb7375b..0000000000000000000000000000000000000000
--- a/contests/GYM_101492/K.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <bits/stdc++.h>
-
-#define MAX 0
-#define MOD 1000000007
-#define EPS 1e-6
-#define inf 0x3f3f3f3f
-#define llinf 0x3f3f3f3f3f3f3f3f
-
-#define fi first
-#define se second
-#define sz size()
-#define pb push_back
-#define ende '\n'
-
-#define all(x) (x).begin(), (x).end()
-#define rall(x) (x).rbegin(), (x).rend()
-#define mset(x, y) memset(&x, (y), sizeof(x))
-
-using namespace std; 
-
-typedef long long ll;
-typedef pair<int,int> ii;
-
-int main() {
-  ios::sync_with_stdio(0);
-  cin.tie(0);
-
-  int n; cin >> n;
-  ll ans = 1;
-  for (int i = 0; i < n + 1; ++i)
-    ans *= 2;
-
-  cout << ans - 1 << ende;
-
-  return 0;
-}
diff --git a/contests/ICPC_LA16/A.cpp b/contests/ICPC_LA16/A.cpp
index eb471d2be6ff3758b15f4279b8dc8eefbf346e08..43060751f0d86bc96070babd86b45635f97cbf33 100644
--- a/contests/ICPC_LA16/A.cpp
+++ b/contests/ICPC_LA16/A.cpp
@@ -1,3 +1,5 @@
+/// A. Assigning Teams
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA16/B.cpp b/contests/ICPC_LA16/B.cpp
index e7d2f6bd6c8299a774490ab5af0f62c7b5e11f8c..d625d434f299c26c4daf29866dfad93e3d447e31 100644
--- a/contests/ICPC_LA16/B.cpp
+++ b/contests/ICPC_LA16/B.cpp
@@ -1,3 +1,5 @@
+/// B. Back to the Future
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/ICPC_LA16/D.cpp b/contests/ICPC_LA16/D.cpp
index 46f69ec9705ea5f0456454bcfcf7e64615a014b9..f9bf5df5a11e9f63403e3d121c89acdab7a5e2f8 100644
--- a/contests/ICPC_LA16/D.cpp
+++ b/contests/ICPC_LA16/D.cpp
@@ -1,3 +1,5 @@
+/// D. Dating On-Line
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA16/F.cpp b/contests/ICPC_LA16/F.cpp
index 8d1ea908689fd6b99a67e8e9dde8c10740629e4f..b1a5f4af2aa70f84796151d392c7fbb950d63287 100644
--- a/contests/ICPC_LA16/F.cpp
+++ b/contests/ICPC_LA16/F.cpp
@@ -1,3 +1,5 @@
+/// F. Farm robot
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA16/G.cpp b/contests/ICPC_LA16/G.cpp
index 67c7bb3e9efc863a10167b0e91f1e8387eded30e..3be349181f5ce1cbee35a70124850cdaaa8d0f03 100644
--- a/contests/ICPC_LA16/G.cpp
+++ b/contests/ICPC_LA16/G.cpp
@@ -1,3 +1,5 @@
+/// G. Game of Matchings
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA16/H.cpp b/contests/ICPC_LA16/H.cpp
index ddc137896e1a1cad01ed1cf43e2966f2bfe3aa89..e192a2f725e74370c5d69ce2ba393b1ed67e90e0 100644
--- a/contests/ICPC_LA16/H.cpp
+++ b/contests/ICPC_LA16/H.cpp
@@ -1,3 +1,5 @@
+/// H. Hotel Rewards
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA16/J.cpp b/contests/ICPC_LA16/J.cpp
index b6794af1284533afd1ec9e065942bae2cd28877e..60a757391b01a541c6f2ee56507578a04b349a49 100644
--- a/contests/ICPC_LA16/J.cpp
+++ b/contests/ICPC_LA16/J.cpp
@@ -1,3 +1,5 @@
+/// J. Just in Time
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA16/K.cpp b/contests/ICPC_LA16/K.cpp
index 96356ddf0604c5ed403b8f8da6e91315d26521f7..6e46d2344a3d411df4fef7317ef6a410844b0883 100644
--- a/contests/ICPC_LA16/K.cpp
+++ b/contests/ICPC_LA16/K.cpp
@@ -1,3 +1,5 @@
+/// K. Kill the Werewolf
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA17/B.cpp b/contests/ICPC_LA17/B.cpp
index 1c7531f56c5b275438590d314f6647fe541ab73c..b5a56d7070e794e4d3321276616e101fd3827d05 100644
--- a/contests/ICPC_LA17/B.cpp
+++ b/contests/ICPC_LA17/B.cpp
@@ -1,3 +1,5 @@
+/// B. Buggy ICPC
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA17/C.cpp b/contests/ICPC_LA17/C.cpp
index 2e49e7140491dcd570b655e78d77d2c5ef95c969..25d19868836fe8fecb6467f3f07c5472f9be06d9 100644
--- a/contests/ICPC_LA17/C.cpp
+++ b/contests/ICPC_LA17/C.cpp
@@ -1,3 +1,5 @@
+/// C. Complete Naebbirac's sequence
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA17/D.cpp b/contests/ICPC_LA17/D.cpp
index c267d5c7b0e3973a799d7c499cf180838958073c..dde13c8de2a959a35f06cdc1108f6c6245f59a50 100644
--- a/contests/ICPC_LA17/D.cpp
+++ b/contests/ICPC_LA17/D.cpp
@@ -1,3 +1,5 @@
+/// D. Dauting device
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA17/E.cpp b/contests/ICPC_LA17/E.cpp
index 8eaa2c7bf98bc582e7aad8085f4f700249dd2866..302e3bc37fa57bd71233ac08e41487dab9c188df 100644
--- a/contests/ICPC_LA17/E.cpp
+++ b/contests/ICPC_LA17/E.cpp
@@ -1,3 +1,5 @@
+/// E. Enigma
+
 #include <bits/stdc++.h>
 
 #define MAX 1010
diff --git a/contests/ICPC_LA17/F.cpp b/contests/ICPC_LA17/F.cpp
index f08ae7363250fd0e34f45890251c527f280857c7..5842ed3fe4d10fb318992965c3cd74c7c91d9fb2 100644
--- a/contests/ICPC_LA17/F.cpp
+++ b/contests/ICPC_LA17/F.cpp
@@ -1,3 +1,5 @@
+/// F. Fundraising
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/ICPC_LA17/G.cpp b/contests/ICPC_LA17/G.cpp
index 9ddc811335c5d4071a2c9b0282df994cf9116358..48857566eba35eaed611fa24b7ed459d24a2444f 100644
--- a/contests/ICPC_LA17/G.cpp
+++ b/contests/ICPC_LA17/G.cpp
@@ -1,3 +1,5 @@
+/// G. Gates of uncertainty
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/ICPC_LA17/H.cpp b/contests/ICPC_LA17/H.cpp
index 18994d25f4690b3f3369ee2f2514a6f90eb58957..0b1156ff53c3539f7ddb98ecd1277d97f790700c 100644
--- a/contests/ICPC_LA17/H.cpp
+++ b/contests/ICPC_LA17/H.cpp
@@ -1,3 +1,5 @@
+/// H. Hard choice
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA17/I.cpp b/contests/ICPC_LA17/I.cpp
index 2ccdb39856c8c5701de2cd853e8bc2eccc3a27c1..1056fd62d8bdce18fb0e535f6990ec428554d094 100644
--- a/contests/ICPC_LA17/I.cpp
+++ b/contests/ICPC_LA17/I.cpp
@@ -1,3 +1,5 @@
+/// I. Imperial roads
+
 #include <bits/stdc++.h>
 
 #define MAX 201010
diff --git a/contests/ICPC_LA17/J.cpp b/contests/ICPC_LA17/J.cpp
index d8ced42ce9e5e22e94738bd32e93540a200f7934..f7c4b7f7039593368ffd6284e1b030c310884dcd 100644
--- a/contests/ICPC_LA17/J.cpp
+++ b/contests/ICPC_LA17/J.cpp
@@ -1,3 +1,5 @@
+/// J. Jumping Frog
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA18/A.cpp b/contests/ICPC_LA18/A.cpp
index 7be4b8517fae73ef88bb5956299342f918aa1efb..d59077bd6c4e60e655ce1aa64bb7b76e7130308f 100644
--- a/contests/ICPC_LA18/A.cpp
+++ b/contests/ICPC_LA18/A.cpp
@@ -1,3 +1,5 @@
+/// A. A Symmmetrical Pizza
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA18/B.cpp b/contests/ICPC_LA18/B.cpp
index 86e86c27e9d1b9b967cc73c591ccfe1261a9c1e2..a4eb7ff9e2bf9c907f60cbd6f64982a4eeaa6c90 100644
--- a/contests/ICPC_LA18/B.cpp
+++ b/contests/ICPC_LA18/B.cpp
@@ -1,3 +1,5 @@
+/// B. Building a Field
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA18/C.cpp b/contests/ICPC_LA18/C.cpp
index 2394c73edc5898a9b7af88110415bffeadf20003..ad43314d8c9b4f006e7d9239f33112c72f13da62 100644
--- a/contests/ICPC_LA18/C.cpp
+++ b/contests/ICPC_LA18/C.cpp
@@ -1,3 +1,5 @@
+/// C. Cheap Trips
+
 #include <bits/stdc++.h>
 
 #define MAX 10101
diff --git a/contests/ICPC_LA18/D.py b/contests/ICPC_LA18/D.py
index 7032c5f8259fc1b3ec0a737640486ee23d0d413f..15555469cf9f27ee645374be049451170f49d527 100644
--- a/contests/ICPC_LA18/D.py
+++ b/contests/ICPC_LA18/D.py
@@ -1,3 +1,5 @@
+### D. Database of Clients
+
 n = int(input())
 every = []
 for i in range(n):
diff --git a/contests/ICPC_LA18/E.cpp b/contests/ICPC_LA18/E.cpp
index 83a7595d2eee6869bfd6a9972dd301b731af5918..556ea4c248a41f385fa32de23b7d9c89f753e829 100644
--- a/contests/ICPC_LA18/E.cpp
+++ b/contests/ICPC_LA18/E.cpp
@@ -1,3 +1,5 @@
+/// E. Escape, Polygon!
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA18/F.cpp b/contests/ICPC_LA18/F.cpp
index 712db75f6c92a968fa4cb14392dbc3e876affcf8..b21af32b31c520e6fd48e7e0664792c1c628f85c 100644
--- a/contests/ICPC_LA18/F.cpp
+++ b/contests/ICPC_LA18/F.cpp
@@ -1,3 +1,5 @@
+/// F. Fantastic Beasts
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA18/H.cpp b/contests/ICPC_LA18/H.cpp
index 3ffbae8d3b0d62ed82875c81e219dd91c5244470..80d33614102ae08059eb71f1bee312ebb0bbfd3f 100644
--- a/contests/ICPC_LA18/H.cpp
+++ b/contests/ICPC_LA18/H.cpp
@@ -1,3 +1,5 @@
+/// H. Highway Decommission
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/ICPC_LA18/I.cpp b/contests/ICPC_LA18/I.cpp
index 9724f19cebaee747c2f1f20f9ae78b81dde19c97..408da3c026e2498f23ae61a4e2e9f5b4035bdda8 100644
--- a/contests/ICPC_LA18/I.cpp
+++ b/contests/ICPC_LA18/I.cpp
@@ -1,3 +1,5 @@
+/// I. Ink Colors
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/ICPC_LA18/L.cpp b/contests/ICPC_LA18/L.cpp
index af7e048908cca1eca13de6a61c98a5925c14f0c9..8f2c5c1ffb9fed0249d532dfaa320a74a5cca2c4 100644
--- a/contests/ICPC_LA18/L.cpp
+++ b/contests/ICPC_LA18/L.cpp
@@ -1,3 +1,5 @@
+/// L. Looking for the Risk Factor
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/ICPC_LA18/M.cpp b/contests/ICPC_LA18/M.cpp
index b8db631e1dede361906fbf7588990832128fe489..cf7e018c2b2fde82a3ecceb62bac2db6f1fcc708 100644
--- a/contests/ICPC_LA18/M.cpp
+++ b/contests/ICPC_LA18/M.cpp
@@ -1,3 +1,5 @@
+/// M. Mount Marathon
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/A.cpp b/contests/SBC15/A.cpp
index e2a4903595b600f49e25f674ffe3c10439ad8323..0c1b5829f6cecaca138465662d72eab932a1329f 100644
--- a/contests/SBC15/A.cpp
+++ b/contests/SBC15/A.cpp
@@ -1,3 +1,5 @@
+/// A. Mania de Par
+
 #include <bits/stdc++.h>
 
 #define MAX 10101
diff --git a/contests/SBC15/B.cpp b/contests/SBC15/B.cpp
index b0f5abd0f47754e028678e715d118e3429300f28..417f7b039e06fd3d31fc82ebec443ba0b4a0d2cf 100644
--- a/contests/SBC15/B.cpp
+++ b/contests/SBC15/B.cpp
@@ -1,3 +1,5 @@
+/// B. Bolsa de Valores
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/C.cpp b/contests/SBC15/C.cpp
index ee90cb23f173a1187153acf3494b92f032e0296f..5edde77df31b2e90c095d299f07d6ec9568614f4 100644
--- a/contests/SBC15/C.cpp
+++ b/contests/SBC15/C.cpp
@@ -1,3 +1,5 @@
+/// C. Tri-du
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/D.cpp b/contests/SBC15/D.cpp
index 13a3552f594362f7414368b64732e152de32c187..b17fea0ee3fac144c3367182a11c9fba66381c43 100644
--- a/contests/SBC15/D.cpp
+++ b/contests/SBC15/D.cpp
@@ -1,3 +1,5 @@
+/// D. Quebra-cabeca
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/E.cpp b/contests/SBC15/E.cpp
index ffb26800f97f43178d5e086358f8d1555c14c3a8..6a3d117702ae386693a5eb275dad601415adde22 100644
--- a/contests/SBC15/E.cpp
+++ b/contests/SBC15/E.cpp
@@ -1,3 +1,5 @@
+/// E. Espiral
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/F.cpp b/contests/SBC15/F.cpp
index 3f7986e536a7cd99d746a88db766ab00bbbb2597..e920a79a8bc8d8ce1e90a0b0c9fd4a584458f430 100644
--- a/contests/SBC15/F.cpp
+++ b/contests/SBC15/F.cpp
@@ -1,3 +1,5 @@
+/// F. Fatorial
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/J.cpp b/contests/SBC15/J.cpp
index f463b2f27858f0057a665e234f4a50fd3d812b0e..f109992dda14b8089a8afbd6ece92561e3b7f6c4 100644
--- a/contests/SBC15/J.cpp
+++ b/contests/SBC15/J.cpp
@@ -1,3 +1,5 @@
+/// J. Jogo da Estrategia
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC15/K.cpp b/contests/SBC15/K.cpp
index 0735dbf0aec72fedb9819a2d3387aefefb2e459b..7d255179eae15948bbc1efea5c399f01849dcb49 100644
--- a/contests/SBC15/K.cpp
+++ b/contests/SBC15/K.cpp
@@ -1,3 +1,5 @@
+/// K. Palindromo
+
 #include <bits/stdc++.h>
 
 #define MAX 2010
diff --git a/contests/SBC16/A.cpp b/contests/SBC16/A.cpp
index 459038702239650fab2ce663bd56d64de3da6c3e..ef761a5a1b58c06f9534eb6fbc20562c1544b385 100644
--- a/contests/SBC16/A.cpp
+++ b/contests/SBC16/A.cpp
@@ -1,3 +1,5 @@
+/// A. Andando no Tempo
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC16/H.cpp b/contests/SBC16/H.cpp
index b8f9651e7de3cbe7177821d5a624ba214f5532f2..9a514f49813ae3ecbc239f0702c64ebf85fc1f43 100644
--- a/contests/SBC16/H.cpp
+++ b/contests/SBC16/H.cpp
@@ -1,3 +1,5 @@
+/// H. huaauhahhuahau
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC17/A.cpp b/contests/SBC17/A.cpp
index e39e7b0a4803fe9976bae8f2b829f74d2f88d627..a4c783a82b69a9c11dea21b883635b7a327d42f3 100644
--- a/contests/SBC17/A.cpp
+++ b/contests/SBC17/A.cpp
@@ -1,3 +1,5 @@
+/// A. Acordes Intergalaticos
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/SBC17/B.cpp b/contests/SBC17/B.cpp
index 38a2619a0c1ade6573d1b374a17cb58687b111f4..23353828d830b36648dd7f2b778727e75161922c 100644
--- a/contests/SBC17/B.cpp
+++ b/contests/SBC17/B.cpp
@@ -1,3 +1,5 @@
+/// B. Brincadeira
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC17/C.cpp b/contests/SBC17/C.cpp
index 059e9d5edcb20a4466b4c4cce8f0db2b981cd408..ccd9f72a749d734e801a881cf6f94cc6d6b56571 100644
--- a/contests/SBC17/C.cpp
+++ b/contests/SBC17/C.cpp
@@ -1,3 +1,5 @@
+/// C. Cigarras Periodicas
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC17/D.cpp b/contests/SBC17/D.cpp
index d15c8680f17a07c29d45459b1b34b5fa9c81bbc2..a5645138916aaf03ebea613f810d92f787d69c27 100644
--- a/contests/SBC17/D.cpp
+++ b/contests/SBC17/D.cpp
@@ -1,3 +1,5 @@
+/// D. Despojados
+
 #include <bits/stdc++.h>
 
 #define MAX 0
diff --git a/contests/SBC17/E.cpp b/contests/SBC17/E.cpp
index e518b3f88db1641dd903fd25058fc1bfc050ee57..da220128bcd6484e1fae71c063dfea1de5c0cc37 100644
--- a/contests/SBC17/E.cpp
+++ b/contests/SBC17/E.cpp
@@ -1,3 +1,5 @@
+/// E. Escala Musical
+
 #include <bits/stdc++.h>
 
 #define MAX 0
diff --git a/contests/SBC17/F.cpp b/contests/SBC17/F.cpp
index a417b84f5ca4e3b7111f23497ee23e21aeb265df..e52ecd1043eda718c187adcf932c85bd420d1e3d 100644
--- a/contests/SBC17/F.cpp
+++ b/contests/SBC17/F.cpp
@@ -1,3 +1,5 @@
+/// F. Fase
+
 #include <bits/stdc++.h>
 
 #define MAX 0
diff --git a/contests/SBC17/G.cpp b/contests/SBC17/G.cpp
index 648dd310d638a8ab9b5bf8dc588519e684429ef0..9282ec08c438dd1adb08aed051171b452648bec7 100644
--- a/contests/SBC17/G.cpp
+++ b/contests/SBC17/G.cpp
@@ -1,3 +1,5 @@
+/// G. Ginastica
+
 #include <bits/stdc++.h>
 
 #define MAX 100001
diff --git a/contests/SBC17/H.cpp b/contests/SBC17/H.cpp
index 9a9b2659ffc7beddb82b98784065a6f7e503ab29..654d0bf8008c0132332f187130c50d813e465c9f 100644
--- a/contests/SBC17/H.cpp
+++ b/contests/SBC17/H.cpp
@@ -1,3 +1,5 @@
+/// H. Hipercampo
+
 #include <bits/stdc++.h>
 
 #define MAX 200
diff --git a/contests/SBC17/I.cpp b/contests/SBC17/I.cpp
index a784084f627c677e0e36c7d30e5e8b4cc85001ea..0f7b97d237a864a248490e77328dc74b1e0d23f5 100644
--- a/contests/SBC17/I.cpp
+++ b/contests/SBC17/I.cpp
@@ -1,3 +1,5 @@
+/// I. Imposto Real
+
 #include <bits/stdc++.h>
 
 #define MAX 10101
diff --git a/contests/SBC17/J.cpp b/contests/SBC17/J.cpp
index e94c3019fc393d97e81d04670d9b6af10995183e..f9b9b64d277c18de88494f41701e1c9039c2f358 100644
--- a/contests/SBC17/J.cpp
+++ b/contests/SBC17/J.cpp
@@ -1,3 +1,5 @@
+/// J. Jogo de Boca
+
 #include <bits/stdc++.h>
 
 #define MAX 0
diff --git a/contests/SBC17/K.cpp b/contests/SBC17/K.cpp
index cbc6648324d7a02437c3d4502ddaa9df20b86bd2..1215b514afdaf04de396ea7273b0073b74dfea2e 100644
--- a/contests/SBC17/K.cpp
+++ b/contests/SBC17/K.cpp
@@ -1,3 +1,5 @@
+/// K. K-esimo
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
@@ -26,7 +28,6 @@ template <typename T>
 struct matrix {
   T m[K][K];
 
-  // Matrix multiplication - O(k^3)
   matrix operator*(matrix a) {
     matrix aux;
 
@@ -52,12 +53,9 @@ struct matrix {
   }
 };
 
-
-// Fast exponentiation (can be used with integers as well) - O(log n)
 matrix<ll> matrix_pow(matrix<ll> in, ll n) {
   matrix<ll> ans, b = in;
 
-  // Set ans as identity matrix
   ans.clear();
   for (int i = 0; i < K; ++i)
     ans[i][i] = 1;
@@ -73,8 +71,6 @@ matrix<ll> matrix_pow(matrix<ll> in, ll n) {
   return ans;
 }
 
-
-// Solves f(n) = x * f(n - 1) + y * f(n - 2)
 matrix<ll> solve(ll x, ll y, ll n) {
   matrix<ll> in;
 
@@ -86,7 +82,6 @@ matrix<ll> solve(ll x, ll y, ll n) {
   return matrix_pow(in, n);
 }
 
-
 int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
diff --git a/contests/SBC17/L.cpp b/contests/SBC17/L.cpp
index ae20c47bb98af5f98fc3cf539f668e4170661667..c2e782b3b353ec66845ffec69969f85661eabb6f 100644
--- a/contests/SBC17/L.cpp
+++ b/contests/SBC17/L.cpp
@@ -1,3 +1,5 @@
+/// L. Laboratorio de Biotecnologia
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
@@ -44,7 +46,6 @@ struct comp {
 };
 
 
-// Returns complex conjugate
 inline comp conj(comp a) {
   return comp(a.r, -a.i);
 }
@@ -52,17 +53,13 @@ inline comp conj(comp a) {
 vector<int> rev = {0, 1};
 vector<comp> roots = {{0, 0}, {1, 0}};
 
-
-// Initializes reversed-bit vector (rev) and roots of unity vector (roots)
 void init(int nbase) {
   rev.resize(1 << nbase);
   roots.resize(1 << nbase);
 
-  // Construct rev vector
   for (int i = 0; i < (1 << nbase); ++i)
     rev[i] = (rev[i >> 1] >> 1) + ((i & 1) << (nbase - 1));
 
-  // Construct roots vector
   for (int base = 1; base < nbase; ++base) {
     float angle = 2 * M_PI / (1 << (base + 1));
 
@@ -75,23 +72,15 @@ void init(int nbase) {
   }
 }
 
-
-// Applies FFT on vector a
 void fft(vector<comp> &a) {
   int n = a.size();
 
-  // Change order of elements to match the end of recursion
   for (int i = 0; i < n; ++i)
     if (i < rev[i])
       swap(a[i], a[rev[i]]);
 
-  // Iterate through "recursion tree"
   for (int s = 1; s < n; s <<= 1) {
-
-    // Iterate through all pairs of vectors (tree leaves)
     for (int k = 0; k < n; k += (s << 1)) {
-
-      // Execute "combine step"
       for (int j = 0; j < s; ++j) {
         comp z = a[k + j + s] * roots[j + s];
 
@@ -102,8 +91,6 @@ void fft(vector<comp> &a) {
   }
 }
 
-
-// Multiplies vectors a and b using FFT
 vector<int> multiply(vector<int> &a, vector<int> &b) {
   int nbase, need = a.size() + b.size() + 1;
 
@@ -113,7 +100,6 @@ vector<int> multiply(vector<int> &a, vector<int> &b) {
   int size = 1 << nbase;
   vector<comp> fa(size);
 
-  // Assemble vector fa from a and b
   for (int i = 0; i < size; ++i) {
     int x = (i < a.size() ? a[i] : 0);
     int y = (i < b.size() ? b[i] : 0);
@@ -122,7 +108,6 @@ vector<int> multiply(vector<int> &a, vector<int> &b) {
 
   fft(fa);
 
-  // Multiply vectors using magic
   comp r(0, -0.25 / size);
   for (int i = 0; i <= (size >> 1); ++i) {
     int j = (size - i) & (size - 1);
@@ -135,7 +120,6 @@ vector<int> multiply(vector<int> &a, vector<int> &b) {
 
   fft(fa);
 
-  // Obtain result vector
   vector<int> res(need);
   for (int i = 0; i < need; ++i)
     res[i] = fa[i].r + 0.5;
diff --git a/contests/SBC17/M.cpp b/contests/SBC17/M.cpp
index babdb6c0fbee232d0edf28253333af884f06cf12..3cc1ffd1c7ac1332312d2f30adee1acb7f4a53d7 100644
--- a/contests/SBC17/M.cpp
+++ b/contests/SBC17/M.cpp
@@ -1,3 +1,5 @@
+/// M. Maquina de Cafe
+
 #include <bits/stdc++.h>
 
 #define MAX 0
diff --git a/contests/SBC18/B.cpp b/contests/SBC18/B.cpp
index d08d5c40e291257b3fb3f9bcc30d4e5d8eeb1bae..75822afcb7db47bcd0f5f82555cd54b2d451003e 100644
--- a/contests/SBC18/B.cpp
+++ b/contests/SBC18/B.cpp
@@ -1,3 +1,5 @@
+/// B. Bolinhas de Gude
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC18/C.cpp b/contests/SBC18/C.cpp
index 818af61c570f56f401c12dd02b3342d695a75b5d..1199b955b2fa640bcc4e9cd40f79bbad18ac55c3 100644
--- a/contests/SBC18/C.cpp
+++ b/contests/SBC18/C.cpp
@@ -1,3 +1,5 @@
+/// C. Cortador de Pizza
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/contests/SBC18/D.cpp b/contests/SBC18/D.cpp
index ebfbb3e8b597d8d171e89ef14573fb85815c2fcf..7381f967d6234c5c0665bffa93525d5d4f8666fc 100644
--- a/contests/SBC18/D.cpp
+++ b/contests/SBC18/D.cpp
@@ -1,3 +1,5 @@
+/// D. Desvendando Monty Hall
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC18/E.cpp b/contests/SBC18/E.cpp
index 8e3600cca06ea3354f3c9df4e9e2f6d24a818dfe..c22dca27bc406157fa1597b42a4cf9646b0c3841 100644
--- a/contests/SBC18/E.cpp
+++ b/contests/SBC18/E.cpp
@@ -1,3 +1,5 @@
+/// E. Enigma
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC18/F.cpp b/contests/SBC18/F.cpp
index 294882d1e8bfb6ff89cb6e3713419a02095b942b..bdfeecebb0b4a33908b1d711c5799d6f8eae4485 100644
--- a/contests/SBC18/F.cpp
+++ b/contests/SBC18/F.cpp
@@ -1,3 +1,5 @@
+/// F. Festival
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC18/G.cpp b/contests/SBC18/G.cpp
index a96f5ceba6d8d1212d905c282cf2cc73bb7cdeba..6ff4450327af07a81e2e1974e2ab3acb947d628f 100644
--- a/contests/SBC18/G.cpp
+++ b/contests/SBC18/G.cpp
@@ -1,3 +1,5 @@
+/// G. Gasolina
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC18/I.cpp b/contests/SBC18/I.cpp
index 637a876b682e7871347b4afbaa95a6026ee85b23..aa2d90aa120e4c4f170d4294ed9cfa67cea7b8c2 100644
--- a/contests/SBC18/I.cpp
+++ b/contests/SBC18/I.cpp
@@ -1,3 +1,5 @@
+/// I. Interruptores 
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/contests/SBC18/J.cpp b/contests/SBC18/J.cpp
index 8aa4ea5415d63aa518f6b17e8cea70074a3cad5d..951df4e47bc686f90b9cb2837fa354d414e5d5ca 100644
--- a/contests/SBC18/J.cpp
+++ b/contests/SBC18/J.cpp
@@ -1,3 +1,5 @@
+/// J. Juntando Capitais
+
 #include <bits/stdc++.h>
 
 #define MAX 105
diff --git a/contests/SBC18/L.cpp b/contests/SBC18/L.cpp
index 49872438e144ee0f8a4736b387a3d12dfd2cd118..8444e6f36c00f029b13d2a2b1472c2b336d5a64b 100644
--- a/contests/SBC18/L.cpp
+++ b/contests/SBC18/L.cpp
@@ -1,3 +1,5 @@
+/// L. Linhas de Metro
+
 #include <bits/stdc++.h>
 
 #define MAX 101010
diff --git a/notebook/gen_latex.py b/notebook/gen_latex.py
index e42019db71aa5baa65d54784814bf370e45bae5a..3c57d3303a2ff7bf20e0ed905d5fcfbd6fe663d2 100644
--- a/notebook/gen_latex.py
+++ b/notebook/gen_latex.py
@@ -228,21 +228,30 @@ class LatexGenerator:
         source.output_code(self._write)
         self._write('\\hrule\n')
 
+    def _multicol(self, path):
+        path = path.split('/')[0]
+        num = {
+            'misc': 3,
+            'algorithms': 3,
+            'problems': 2,
+            'contests': 2
+        }
+        return str(num[path])
+
     # Generates LaTeX for entire tree recursively.
     def _gen_tree_latex(self, sub, path = '', depth = 0):
         if type(sub) == list:
+            self._write('\\begin{multicols}{' + self._multicol(path) + '}\n')
+            print(path)
             for i in sub:
                 source = self.SourceFile(path + i)
                 self._gen_title_latex(source.name, depth)
                 self._gen_code_latex(source)
+            self._write('\\end{multicols}\n')
         else:
-            if depth == 1:
-                self._write('\\begin{multicols}{3}\n')
             for i in sub:
                 self._gen_title_latex(self._parse_dir_name(i), depth)
                 self._gen_tree_latex(sub[i], path + i + '/', depth + 1)
-            if depth == 1:
-                self._write('\\end{multicols}\n')
 
         self._write('\n')
 
@@ -262,7 +271,7 @@ def get_args():
 
 def main():
     args = get_args()
-    tree = Tree(['algorithms', 'misc'])
+    tree = Tree(['algorithms', 'misc', 'problems', 'contests'])
     tex = LatexGenerator(tree, args.output, args.header)
 
 if __name__ == "__main__":
diff --git a/problems/a_simple_task.cpp b/problems/a_simple_task.cpp
index c3982502c7acc2841ca0cc2ffded5803d9736c5b..d1d2ce9f126e418d853a81c393d403fc0e93891f 100644
--- a/problems/a_simple_task.cpp
+++ b/problems/a_simple_task.cpp
@@ -1,3 +1,5 @@
+/// A Simple Task
+
 #include <bits/stdc++.h>
  
 #define MAX 100001
@@ -45,7 +47,6 @@ void build(int node = 1, int a = 0, int b = N-1) {
     tree[node][i] = tree[left(node)][i] + tree[right(node)][i];
 }
  
- 
 void push(int let, int node, int a, int b, int val) {
   tree[node][let] = (b - a + 1) * val;
  
@@ -57,7 +58,6 @@ void push(int let, int node, int a, int b, int val) {
   lazy[node][let] = -1;
 }
  
- 
 void update(int let, int i, int j, int val, int node = 1, int a = 0, int b = N-1) {
   if (lazy[node][let] != -1)
     push(let, node, a, b, lazy[node][let]);
@@ -75,7 +75,6 @@ void update(int let, int i, int j, int val, int node = 1, int a = 0, int b = N-1
   tree[node][let] = tree[left(node)][let] + tree[right(node)][let];
 }
  
- 
 int query(int let, int i, int j, int node = 1, int a = 0, int b = N-1) {
   if (a > b || a > j || b < i)
     return 0;
@@ -91,7 +90,6 @@ int query(int let, int i, int j, int node = 1, int a = 0, int b = N-1) {
   return q1 + q2;
 }
  
- 
 void get_ans(int let, string &ans, int node = 1, int l = 0, int r = N-1) {
   if (lazy[node][let] != -1)
     push(let, node, l, r, lazy[node][let]);
@@ -108,7 +106,6 @@ void get_ans(int let, string &ans, int node = 1, int l = 0, int r = N-1) {
   get_ans(let, ans, right(node), (l+r)/2 + 1, r);
 }
  
- 
 int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
diff --git a/problems/crise_hidrica.cpp b/problems/crise_hidrica.cpp
index 1d062589f6679998c9b9d1712d0f2069c813ebaf..308fc2f350a3bce00f954c5fc4150fb7ce54de1d 100644
--- a/problems/crise_hidrica.cpp
+++ b/problems/crise_hidrica.cpp
@@ -1,3 +1,5 @@
+/// Crise Hidrica
+
 #include <bits/stdc++.h>
 
 #define MAX 5010
@@ -46,13 +48,11 @@ void dfs(int va, int p = -1) {
       dfs(u, va);
 }
 
-
 void preprocess(int va) {
   memset(par, -1, sizeof par);
   dfs(va);
 }
 
-
 int query(int p, int q) {
   if (h[p] < h[q])
     swap(p, q);
@@ -74,7 +74,6 @@ int query(int p, int q) {
   return par[p][0];
 }
 
-
 ll fill(int x, int pare) {
   ll ans = 0;
 
@@ -85,7 +84,6 @@ ll fill(int x, int pare) {
   return v[x] = ans + upd[x];
 }
 
-
 int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
diff --git a/problems/escalacao.cpp b/problems/escalacao.cpp
index f046333d724ee3e494f34d6c3ae44d449f671375..67d71df38fc383a32059447701b31b481584e809 100644
--- a/problems/escalacao.cpp
+++ b/problems/escalacao.cpp
@@ -1,3 +1,5 @@
+/// Escalacao
+
 #include <bits/stdc++.h>
 
 #define MAX 1010101
@@ -44,7 +46,6 @@ void merge(vector<ll> a, vector<ll> b, vector<ll> &ans) {
   }
 }
 
-
 void build(int node = 1, int a = 0, int b = n - 1) {
   if (a > b)
     return;
@@ -58,7 +59,6 @@ void build(int node = 1, int a = 0, int b = n - 1) {
   merge(tree[node * 2], tree[node * 2 + 1], tree[node]);
 }
 
-
 void query(int i, int j, int node = 1, int a = 0, int b = n - 1) {
   if (a > b || a > j || b < i)
     return;
@@ -71,7 +71,6 @@ void query(int i, int j, int node = 1, int a = 0, int b = n - 1) {
   query(i, j, 1 + node * 2, 1 + (a + b) / 2, b);
 }
 
-
 int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
diff --git a/problems/exponial.cpp b/problems/exponial.cpp
index 1564e0fc538f86bf1260fca4963b6676fe1a271d..8eb98af9b7c806b4d114bf9d4ad63d03f8500441 100644
--- a/problems/exponial.cpp
+++ b/problems/exponial.cpp
@@ -1,3 +1,5 @@
+/// Exponial
+
 #include <bits/stdc++.h>
 
 #define EPS 1e-6
diff --git a/problems/trees_partition.cpp b/problems/trees_partition.cpp
index 513acce0481a5b6ca50046a3684edcc90ed6ac13..e7aaf7944c265c34ab647e7817cc133350977b2c 100644
--- a/problems/trees_partition.cpp
+++ b/problems/trees_partition.cpp
@@ -1,3 +1,5 @@
+/// Trees Partition
+
 #include <bits/stdc++.h>
 
 #define MAX 301010
@@ -17,7 +19,6 @@ using namespace std;
 typedef long long ll;
 typedef pair<int,int> ii;
 
-
 ll hsh[MAX];
 vector<int> t1[MAX], t2[MAX];
 
@@ -38,7 +39,6 @@ ll dfs(int x, int par) {
   return down;
 }
 
-
 ll solve(int x, int par) {
   ll down = hsh[x];
 
@@ -57,7 +57,6 @@ ll solve(int x, int par) {
   return down;
 }
 
-
 int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
diff --git a/problems/xor_submatrix.cpp b/problems/xor_submatrix.cpp
index cd1e175708b2c12d9f672fba9e03d60c4e55fa8d..70afff0d2780220c13372984f091302d7ac59ec6 100644
--- a/problems/xor_submatrix.cpp
+++ b/problems/xor_submatrix.cpp
@@ -1,3 +1,5 @@
+/// XOR submatrix
+
 #include <bits/stdc++.h>
 
 #define MAX 10101010
@@ -36,7 +38,6 @@ void insert(int x) {
   }
 }
 
-
 int search(int x) {
   int node = 0;
   int ans = 0;
@@ -54,7 +55,6 @@ int search(int x) {
   return ans;
 }
 
-
 int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);