diff --git a/algorithms/structure/trie.cpp b/algorithms/structure/trie.cpp
index b1bd70ddbfab7e96ba4ea29542fef21c7e2c7ff4..948876a9aba2ffde2f850adec54bb495265d45b4 100644
--- a/algorithms/structure/trie.cpp
+++ b/algorithms/structure/trie.cpp
@@ -9,7 +9,7 @@
 
 // ========== Trie for String ==========
 int states = 0;
-int data[MAX][26];
+int trie[MAX][26]; // mset(-1)
 
 // ending[i] is true when the node i represents the last
 // character of a string contained in the Trie
@@ -22,9 +22,9 @@ void insert(string word) {
   for (int i = 0; i < word.size(); ++i) {
     int b = word[i] - 'a';
 
-    if (data[node][b] == -1)
-      data[node][b] = states++;
-    node = data[node][b];
+    if (trie[node][b] == -1)
+      trie[node][b] = ++states;
+    node = trie[node][b];
   }
 
   ending[node] = true;
@@ -35,7 +35,7 @@ bool search(string word) {
   int node = 0;
 
   for (int i = 0; i < word.size(); ++i) {
-    node = data[node][word[i] - 'a'];
+    node = trie[node][word[i] - 'a'];
     if (node == -1)
       return false;
   }
@@ -46,7 +46,7 @@ bool search(string word) {
 
 // ========== Trie for Integer ==========
 int states = 0;
-int data[MAX][2];
+int trie[MAX][2]; // mset(-1)
 
 // ending[i] is true when the node i represents the last
 // bit of an integer contained in the Trie
@@ -56,12 +56,12 @@ bool ending[MAX];
 void insert(int x) {
   int node = 0;
 
-  for (int i = 0; i < 32; ++i) {
-    int b = x >> (31 - i) & 1;
+  for (int i = 30; i >= 0; --i) {
+    int b = !!(x & (1 << i));
 
-    if (data[node][b] == -1)
-      data[node][b] = states++;
-    node = data[node][b];
+    if (trie[node][b] == -1)
+      trie[node][b] = ++states;
+    node = trie[node][b];
   }
 
   ending[node] = true;
@@ -71,9 +71,9 @@ void insert(int x) {
 bool search(int x) {
   int node = 0;
   
-  for (int i = 0; i < 32; ++i) {
-    int b = x >> (31 - i) & 1;
-    node = data[node][b];
+  for (int i = 30; i >= 0; --i) {
+    int b = !!(x & (1 << i));
+    node = trie[node][b];
     if (node == -1)
       return false;
   }
diff --git a/contests/Cadernaveis/BALE11.cpp b/contests/Cadernaveis/BALE11.cpp
index 16e26aaac348d50de8f24467b5ba5eb44c4c34c7..9aa2fb8a6ba41bf841b2d3c6984b4371a8d4980b 100644
--- a/contests/Cadernaveis/BALE11.cpp
+++ b/contests/Cadernaveis/BALE11.cpp
@@ -1,17 +1,22 @@
 #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 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;
+using namespace std; 
 
 typedef long long ll;
 typedef pair<int,int> ii;
diff --git a/contests/Cadernaveis/DESCULPA.cpp b/contests/Cadernaveis/DESCULPA.cpp
index 4b05311d520d3c904c7fa1f0b8c97290fd76d454..b36b19292e14f65aa7b12ffbd0df856cdb4c480a 100644
--- a/contests/Cadernaveis/DESCULPA.cpp
+++ b/contests/Cadernaveis/DESCULPA.cpp
@@ -1,19 +1,23 @@
 #include <bits/stdc++.h>
  
 #define MAX 1010
+#define EPS 1e-6
 #define MOD 1000000007
 #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;
- 
+#define mset(x, y) memset(&x, (y), sizeof(x))
+
+using namespace std; 
+
 typedef long long ll;
 typedef pair<int,int> ii;
  
diff --git a/contests/Cadernaveis/GINCAN11.cpp b/contests/Cadernaveis/GINCAN11.cpp
index accf32ec75457d025e131bc5ede6c76e23b457b9..9b551c5c70fc8559f45850d950b6a94d2ec10115 100644
--- a/contests/Cadernaveis/GINCAN11.cpp
+++ b/contests/Cadernaveis/GINCAN11.cpp
@@ -1,17 +1,21 @@
 #include <bits/stdc++.h>
 
-#define MAX 0
+#define EPS 1e-6
 #define MOD 1000000007
 #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;
+using namespace std; 
 
 typedef long long ll;
 typedef pair<int,int> ii;
diff --git a/contests/Cadernaveis/NTICKETS.cpp b/contests/Cadernaveis/NTICKETS.cpp
index c681d62fb68d4a9a3db63bbfa8a3307fb6fa0d4c..668e021623247f0ecd200b6c671bbeb7850faed2 100644
--- a/contests/Cadernaveis/NTICKETS.cpp
+++ b/contests/Cadernaveis/NTICKETS.cpp
@@ -1,18 +1,23 @@
 #include <bits/stdc++.h>
 
 #define MAX 101010
+#define MAXLOG 20
+#define EPS 1e-6
 #define MOD 1000000007
 #define inf 0x3f3f3f3f
-#define MAXLOG 20
+#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;
+using namespace std; 
 
 typedef long long ll;
 typedef pair<int,ll> ii;
@@ -106,4 +111,3 @@ int main() {
 
   return 0;
 }
-
diff --git a/contests/Cadernaveis/TOPOLAND.cpp b/contests/Cadernaveis/TOPOLAND.cpp
index 3db4470475f6fb31690d17305336dec59de260cd..f533d48700ad11f29b7bbd4c721a4ed9a304c85d 100644
--- a/contests/Cadernaveis/TOPOLAND.cpp
+++ b/contests/Cadernaveis/TOPOLAND.cpp
@@ -1,17 +1,22 @@
 #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 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;
+using namespace std; 
 
 typedef long long ll;
 typedef pair<int,int> ii;
diff --git a/contests/Cadernaveis/URI1135.cpp b/contests/Cadernaveis/URI1135.cpp
index 67499654d7276debb72949481a4d7c4fb2acf970..5f6d92216bab3a943fa74f3999c1ef04a4998348 100644
--- a/contests/Cadernaveis/URI1135.cpp
+++ b/contests/Cadernaveis/URI1135.cpp
@@ -1,18 +1,23 @@
 #include <bits/stdc++.h>
 
 #define MAX 101010
+#define MAXLOG 20
+#define EPS 1e-6
 #define MOD 1000000007
 #define inf 0x3f3f3f3f
-#define MAXLOG 20
+#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;
+using namespace std; 
 
 typedef long long ll;
 typedef pair<ll,ll> ii;
diff --git a/contests/Cadernaveis/URI1464.cpp b/contests/Cadernaveis/URI1464.cpp
index 0b6b120bccb403e595ed270ffaae4e5723c04369..c64d86420ab2182263f2e03a45a1ac4963c1d678 100644
--- a/contests/Cadernaveis/URI1464.cpp
+++ b/contests/Cadernaveis/URI1464.cpp
@@ -1,17 +1,21 @@
 #include <bits/stdc++.h>
 
-#define MAX 0
+#define EPS 1e-6
 #define MOD 1000000007
 #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;
+using namespace std; 
 
 typedef long long ll;
 typedef pair<int,int> ii;
diff --git a/contests/GYM_101492/K.cpp b/contests/GYM_101492/K.cpp
index 86fbaf578754089d83bd44408d38c1cc4f4cafb2..1e058a25be9982aced7e09fdc4bda3e07fb7375b 100644
--- a/contests/GYM_101492/K.cpp
+++ b/contests/GYM_101492/K.cpp
@@ -32,7 +32,5 @@ int main() {
 
   cout << ans - 1 << ende;
 
-
-
   return 0;
 }
diff --git a/contests/SBC17/D.cpp b/contests/SBC17/D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d15c8680f17a07c29d45459b1b34b5fa9c81bbc2
--- /dev/null
+++ b/contests/SBC17/D.cpp
@@ -0,0 +1,55 @@
+#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);
+
+  ll n; cin >> n;
+  vector<ll> f;
+  vector<ll> fat;
+
+  ll acc = 1;
+  fat.pb(1);
+  for (ll i = 1; i <= 40; ++i) {
+    acc *= i;
+    fat.pb(acc);
+  }
+
+  if (n % 2 == 0) f.pb(2);
+  while (n % 2 == 0) n /= 2;
+
+  for (ll i = 3; i*i <= n; i+=2) {
+    if (n % i == 0) f.pb(i);
+    while (n % i == 0) n /= i;
+  }
+
+  if (n > 2) f.pb(n);
+
+  ll ans = 0;
+  for (ll i = 2; i <= f.sz; ++i)
+    ans += fat[f.sz] / (fat[f.sz - i] * fat[i]);
+  cout << ans << ende;
+
+  return 0;
+}
diff --git a/contests/SBC17/E.cpp b/contests/SBC17/E.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e518b3f88db1641dd903fd25058fc1bfc050ee57
--- /dev/null
+++ b/contests/SBC17/E.cpp
@@ -0,0 +1,58 @@
+#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);
+
+  vector<string> notas = {"do", "do#", "re", "re#", "mi", "fa", "fa#", "sol", "sol#", "la", "la#", "si"};
+  vector<int> count(notas.sz);
+  vector<int> diff = {2, 2, 1, 2, 2, 2, 1};
+  vector<vector<int>> v(notas.sz, vector<int>(notas.sz, 0));
+
+  for (int i = 0; i < v.sz; ++i) {
+    int beg = i;
+    for (int j = 0; j < diff.sz; ++j) {
+      v[i][beg] = 1;
+      beg = (beg + diff[j]) % 12;
+    }
+  }
+
+  int n; cin >> n;
+  for (int i = 0; i < n; ++i) {
+    int x; cin >> x; x--;
+    count[x % 12]++;
+  }
+
+  for (int i = 0; i < 12; ++i) {
+    bool poss = true;
+    for (int j = 0; j < 12; ++j)
+      if (count[j] and !v[i][j])
+        poss = false;
+    if (poss)
+      return cout << notas[i] << ende, 0;
+  }
+  cout << "desafinado" << ende;
+
+  return 0;
+}
diff --git a/contests/SBC17/F.cpp b/contests/SBC17/F.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a417b84f5ca4e3b7111f23497ee23e21aeb265df
--- /dev/null
+++ b/contests/SBC17/F.cpp
@@ -0,0 +1,38 @@
+#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, k; cin >> n >> k;
+  vector<int> v(n);
+  for (auto &i : v) cin >> i;
+  sort(rall(v));
+
+  int ans = k;
+  while (v[ans] == v[ans-1] and ans < n) ans++;
+  cout << ans << ende;
+
+  return 0;
+}
diff --git a/contests/SBC17/G.cpp b/contests/SBC17/G.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..648dd310d638a8ab9b5bf8dc588519e684429ef0
--- /dev/null
+++ b/contests/SBC17/G.cpp
@@ -0,0 +1,47 @@
+#include <bits/stdc++.h>
+
+#define MAX 100001
+#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;
+
+ll dp[51][MAX];
+
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+
+  int t, m, n; cin >> t >> m >> n;
+
+  for (int i = m; i <= n; ++i)
+    dp[1][i] = 1;
+
+  for (int i = 2; i <= t; ++i)
+    for (int j = m; j <= n; ++j)
+      if (j == m) dp[i][j] = dp[i-1][j+1];
+      else if (j == n) dp[i][j] = dp[i-1][j-1];
+      else dp[i][j] = (dp[i-1][j-1] + dp[i-1][j+1]) % MOD;
+
+  ll ans = 0;
+  for (int i = m; i <= n; ++i)
+    ans = (ans + dp[t][i]) % MOD;
+
+  cout << ans << ende;
+  return 0;
+}
diff --git a/contests/SBC17/J.cpp b/contests/SBC17/J.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e94c3019fc393d97e81d04670d9b6af10995183e
--- /dev/null
+++ b/contests/SBC17/J.cpp
@@ -0,0 +1,34 @@
+#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);
+
+  ll num = 0;
+  string s; cin >> s;
+  for (auto i : s) num += i - '0';
+  cout << num % 3 << ende;
+
+  return 0;
+}
diff --git a/contests/SBC17/M.cpp b/contests/SBC17/M.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..babdb6c0fbee232d0edf28253333af884f06cf12
--- /dev/null
+++ b/contests/SBC17/M.cpp
@@ -0,0 +1,36 @@
+#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 a, b, c; cin >> a >> b >> c;
+
+  int x1 = a*0 + b*2 + c*4;
+  int x2 = a*2 + b*0 + c*2;
+  int x3 = a*4 + b*2 + c*0;
+  cout << min(x1, min(x2, x3)) << ende;
+
+  return 0;
+}
diff --git a/contests/SBC18/C.cpp b/contests/SBC18/C.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7b79559b04afff8d1d2b8300d905e6212d2946ac
--- /dev/null
+++ b/contests/SBC18/C.cpp
@@ -0,0 +1,93 @@
+#include <bits/stdc++.h>
+
+#define MAX 101010
+#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<ll,ll> ii;
+
+ll tree[MAX];
+
+ll query(int idx) {
+  ll sum = 0;
+  for (; idx > 0; idx -= (idx & -idx))
+    sum += tree[idx];
+
+  return sum;
+}
+
+
+void update(int idx, ll val) {
+  for (; idx <= MAX; idx += (idx & -idx))
+    tree[idx] += val;
+}
+
+
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+
+  ll x, y; cin >> x >> y;
+  ll h, v; cin >> h >> v;
+
+  ll a, b;
+  vector<ii> H, V;
+  vector<ll> h1, v1;
+  vector<ll> hh, vv;
+  map<ll,ll> Mh, Mv;
+
+  for (ll i = 0; i < h; ++i) {
+    cin >> a >> b;
+    H.pb(ii(b, a));
+    h1.pb(a);
+  }
+
+  for (ll i = 0; i < v; ++i) {
+    cin >> a >> b;
+    V.pb(ii(b, a));
+    v1.pb(a);
+  }
+
+  sort(all(H));
+  sort(all(V));
+  sort(all(v1));
+  sort(all(h1));
+
+  for (int i = 0; i < h; ++i) Mh[h1[i]] = i + 1;
+  for (int i = 0; i < v; ++i) Mv[v1[i]] = i + 1;
+
+  for (auto i : H) hh.pb(Mh[i.se]);
+  for (auto i : V) vv.pb(Mv[i.se]);
+
+  ll ans = (h + 1) * (v + 1);
+
+  mset(tree, 0);
+  for (int i = h - 1; i >= 0; --i) {
+    ans += query(hh[i]);
+    update(hh[i], 1);
+  }
+
+  mset(tree, 0);
+  for (int i = v - 1; i >= 0; --i) {
+    ans += query(vv[i]);
+    update(vv[i], 1);
+  }
+
+  cout << ans << ende;
+  return 0;
+}
diff --git a/contests/SBC18/D.cpp b/contests/SBC18/D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d3ec046fa9dc0209e1482b9a05e4c3a89d3d31bf
--- /dev/null
+++ b/contests/SBC18/D.cpp
@@ -0,0 +1,38 @@
+#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 ans = 0;
+  int n; cin >> n;
+  for (int i = 0; i < n; ++i) {
+    int x; cin >> x;
+    if (x != 1) ans++;
+  }
+
+  cout << ans << ende;
+
+  return 0;
+}
diff --git a/contests/SBC18/E.cpp b/contests/SBC18/E.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..caf757e9178d9d87c85ba2e9a2a1b9aba5a6c0ec
--- /dev/null
+++ b/contests/SBC18/E.cpp
@@ -0,0 +1,44 @@
+#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);
+
+  string a, b;
+  cin >> a >> b;
+
+  int na = a.sz, nb = b.sz;
+  int ans = na - nb + 1;
+  for (int i = 0; i <= na - nb; ++i) {
+    for (int j = 0; j < nb; ++j) {
+      if (b[j] == a[i+j]) {
+        ans--;
+        break;
+      }
+    }
+  }
+
+  cout << ans << ende;
+  return 0;
+}
diff --git a/contests/SBC18/F.cpp b/contests/SBC18/F.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d91a9daa896d432bf3ff3dc716515de731c06381
--- /dev/null
+++ b/contests/SBC18/F.cpp
@@ -0,0 +1,76 @@
+#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;
+
+typedef struct elem {
+  int i, f, o, p;
+  elem(int i, int f, int o, int p) : i(i), f(f), o(o), p(p) {}
+} elem;
+
+int n;
+vector<elem> v;
+int prox[1010];
+int dp[1010][1300];
+
+int solve(int i, int bit) {
+  if (i == -1 or i == v.sz) {
+    if (bit == (1 << n) - 1) return 0;
+    else return -inf;
+  }
+
+  if (dp[i][bit] != -1)
+    return dp[i][bit];
+
+  return dp[i][bit] = max(solve(prox[i], bit | (1 << v[i].p)) + v[i].o, solve(i + 1, bit));
+}
+
+
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+
+  mset(dp, -1);
+  mset(prox, -1);
+  cin >> n;
+  for (int i = 0; i < n; ++i) {
+    int m; cin >> m;
+    for (int j = 0; j < m; ++j) {
+      int a, b, c; cin >> a >> b >> c;
+      v.pb(elem(a, b, c, i));
+    }
+  }
+
+  sort(all(v), [](elem a, elem b) {
+    return a.i < b.i;    
+  });
+
+  for (int i = 0; i < v.sz; ++i)
+    for (int j = i + 1; j < v.sz; ++j)
+      if (v[j].i >= v[i].f) {
+        prox[i] = j;
+        break;
+      }
+
+  int ans = solve(0, 0);
+  cout << ((ans < 0) ? -1 : ans) << ende;
+  return 0;
+}
diff --git a/contests/SBC18/I.cpp b/contests/SBC18/I.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c44abef09c104a5fcb400c3569f0b589f559992a
--- /dev/null
+++ b/contests/SBC18/I.cpp
@@ -0,0 +1,65 @@
+#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;
+
+bool v[1010];
+vector<int> u[1010];
+
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+
+  int x, y;
+  int n, m; cin >> n >> m;
+  int l; cin >> l;
+  for (int i = 0; i < l; ++i) {
+    cin >> x;
+    v[x] = true;
+  }
+
+  for (int i = 0; i < n; ++i) {
+    cin >> x;
+    for (int j = 0; j < x; ++j) {
+      cin >> y;
+      u[i].pb(y);
+    }
+  }
+
+  int ans = 0;
+  for (int i = 0; i < 2; ++i) {
+    for (int j = 0; j < n; ++j) {
+      for (auto k : u[j])
+        v[k] = !v[k];
+
+      ans++;
+      bool done = true;
+      for (int k = 1; k <= m; ++k)
+        done &= !v[k];
+
+      if (done) 
+        return cout << ans << ende, 0;
+    }
+  }
+
+  cout << -1 << ende;
+  return 0;
+}
diff --git a/contests/SBC18/J.cpp b/contests/SBC18/J.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..51e09ec3b0b26cd28ba4d53794eaac9aabc35e8f
--- /dev/null
+++ b/contests/SBC18/J.cpp
@@ -0,0 +1,35 @@
+#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, k; cin >> n >> k;
+  for (int i = 0; i < n; ++i) {
+    double x, y;
+    cin >> x >> y;
+  }
+
+  return 0;
+}
diff --git a/contests/SBC18/L.cpp b/contests/SBC18/L.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e0452563d414cd91d0012b04674faaa5b18eb490
--- /dev/null
+++ b/contests/SBC18/L.cpp
@@ -0,0 +1,135 @@
+#include <bits/stdc++.h>
+
+#define MAX 101010
+#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 h[MAX];
+int par[MAX][20];
+vector<int> graph[MAX];
+
+
+void dfs(int v, int p = -1) {
+  par[v][0] = p;
+
+  if (p != -1)
+    h[v] = h[p] + 1;
+
+  for (int i = 1; i < 20; ++i)
+    if (par[v][i-1] != -1)
+      par[v][i] = par[par[v][i-1]][i-1];
+
+  for (auto u : graph[v])
+    if (p != u)
+      dfs(u, v);
+}
+
+
+int lca(int p, int q) {
+  if (h[p] < h[q])
+    swap(p, q);
+
+  for (int i = 19; i >= 0; --i)
+    if (par[p][i] != -1 and h[par[p][i]] >= h[q])
+      p = par[p][i];
+
+  if (p == q)
+    return p;
+
+  for (int i = 19; i >= 0; --i)
+    if (par[p][i] != -1 and par[p][i] != par[q][i]) {
+      p = par[p][i];
+      q = par[q][i];
+    }
+
+  return par[p][0];
+}
+
+
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+
+  int a, b, c, d;
+  int n, q; cin >> n >> q;
+  for (int i = 0; i < n - 1; ++i) {
+    cin >> a >> b;
+    graph[a].pb(b);
+    graph[b].pb(a);
+  }
+
+  mset(par, -1);
+  dfs(1);
+
+  for (int i = 0; i < q; ++i) {
+    cin >> a >> b >> c >> d;
+
+    int lab = lca(a, b);
+    int lac = lca(a, c);
+    int lad = lca(a, d);
+    int lbc = lca(b, c);
+    int lbd = lca(b, d);
+    int lcd = lca(c, d);
+
+    // If path C->D is above (or different subtree) than A->B and has no intersection
+    if (h[lca(c, lab)] < h[lab] and h[lca(d, lab)] < h[lab])
+      cout << 0 << ende;
+
+    // If path A->B is above (or different subtree) than C->D and has no intersection
+    else if (h[lca(a, lcd)] < h[lcd] and h[lca(b, lcd)] < h[lcd])
+      cout << 0 << ende;
+
+    // There is an intersection
+    else {
+
+      // If lca(A, B) belongs to the path C->D
+      if (h[lcd] < h[lab]) {
+        
+        // If intersection occurs between C->lca(C,D)
+        if (h[lac] > h[lcd] or h[lbc] > h[lcd]) cout << abs(h[lca(lac, c)] - h[lca(lbc, c)]) + 1 << ende; 
+
+        // If intersection occurs between D->lca(C,D)
+        else cout << abs(h[lca(lad, d)] - h[lca(lbd, d)]) + 1 << ende;
+
+
+      // If lca(C, D) belongs to the path A->B
+      } else if (h[lab] < h[lcd]) {
+
+       // If intersection occurs between A->lca(A,B)
+        if (h[lac] > h[lab] or h[lad] > h[lab]) cout << abs(h[lca(lac, a)] - h[lca(lad, a)]) + 1 << ende;
+
+        // If intersection occurs between B->lca(A,B)
+        else cout << abs(h[lca(lbc, b)] - h[lca(lbd, b)]) + 1 << ende;
+
+
+      // It means that lca(A, B) is the same node as lca(C, D)
+      } else {
+
+        // If A and C are on the same side -> B and D are on the same side
+        if (h[lac] > h[lcd] or h[lbd] > h[lcd]) cout << (h[lac] - h[lcd]) + (h[lbd] - h[lcd]) + 1 << ende; 
+
+        // If A and D are on the same side -> B and C are on the same side
+        else cout << (h[lad] - h[lcd]) + (h[lbc] - h[lcd]) + 1 << ende;
+      }
+    }
+  }
+
+  return 0;
+}
diff --git a/misc/template.cpp b/misc/template.cpp
index fce5f0bf34f62d12f5cfcce16ba1aad0844f995c..70e0abe1bbf8377d9d7602167a2de7f8eb9764a1 100644
--- a/misc/template.cpp
+++ b/misc/template.cpp
@@ -1,7 +1,7 @@
 #include <bits/stdc++.h>
 
-#define MOD 1000000007
 #define EPS 1e-6
+#define MOD 1000000007
 #define inf 0x3f3f3f3f
 #define llinf 0x3f3f3f3f3f3f3f3f
 
diff --git a/problems/xor_submatrix.cpp b/problems/xor_submatrix.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cd1e175708b2c12d9f672fba9e03d60c4e55fa8d
--- /dev/null
+++ b/problems/xor_submatrix.cpp
@@ -0,0 +1,95 @@
+#include <bits/stdc++.h>
+
+#define MAX 10101010
+#define EPS 1e-6
+#define MOD 1000000007
+#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 states = 0;
+int trie[MAX][2];
+
+void insert(int x) {
+  int node = 0;
+
+  for (int i = 30; i >= 0; --i) {
+    int b = !!(x & (1 << i));
+
+    if (trie[node][b] == -1)
+      trie[node][b] = ++states;
+    node = trie[node][b];
+  }
+}
+
+
+int search(int x) {
+  int node = 0;
+  int ans = 0;
+  
+  for (int i = 30; i >= 0; --i) {
+    int b = !(x & (1 << i));
+
+    if (trie[node][b] == -1)
+      b ^= 1;
+
+    node = trie[node][b];
+    ans |= (b << i);
+  }
+
+  return ans;
+}
+
+
+int main() {
+  ios::sync_with_stdio(0);
+  cin.tie(0);
+
+  mset(trie, -1);
+
+  int n, m; cin >> n >> m;
+  vector<int> v(n+1), u(m+1);
+
+  v[0] = u[0] = 0;
+  for (int i = 1; i <= n; ++i) {
+    int x; cin >> x;
+    v[i] = v[i-1] ^ x;
+  }
+
+  for (int i = 1; i <= m; ++i) {
+    int x; cin >> x;
+    u[i] = u[i-1] ^ x;
+  }
+
+  int ans = 0;
+  for (int i = 0; i <= n; ++i)
+    for (int j = i; j <= n; ++j)
+      if ((j - i) % 2) 
+        insert(v[i] ^ v[j]);
+      else 
+        ans = max(ans, v[i] ^ v[j]);
+
+  for (int i = 0; i <= m; ++i)
+    for (int j = i; j <= m; ++j)
+      if ((j - i) % 2) 
+        ans = max(ans, u[i] ^ u[j] ^ search(u[i] ^ u[j]));
+      else 
+        ans = max(ans, u[i] ^ u[j]);
+
+  cout << ans << ende;
+  return 0;
+}