This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
themes { | |
catppuccin-frappe { | |
fg 198 208 245 | |
bg 98 104 128 | |
black 41 44 60 | |
red 231 130 132 | |
green 166 209 137 | |
yellow 229 200 144 | |
blue 140 170 238 | |
magenta 244 184 228 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void calc(vector<int> &d1, vector<int> &d2, const string &s, int n) { | |
for (int i = 0, l = 0, r = -1; i < n; i++) { | |
int k = (i > r) ? 1 : min(d1[l + r - i], r - i + 1); | |
while (0 <= i - k && i + k < n && s[i - k] == s[i + k]) { | |
k++; | |
} | |
d1[i] = k--; | |
if (i + k > r) { | |
l = i - k; | |
r = i + k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
struct Node { | |
vector<int> endings; | |
unordered_map<char, Node*> followers; | |
}; | |
void insert_trie(Node *node, const string &word, int index) { | |
int ws = word.size(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Package manager settings | |
set -g @plugin 'tmux-plugins/tpm' | |
# Installs themes | |
set -g @plugin 'jimeh/tmux-themepack' | |
# Selects a theme | |
set -g @themepack 'powerline/block/cyan' | |
# Add resurrect and continuum to save tmux sessions automatically |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDsj3PW9mukC8pS0LyA8T3jbljvWqerPANMASkN8gwdtRy9+3v3QdvidlsxA1T4zkbktoYAMfbQzklidILDuSjYY4WyMos5hiGF4pJ3asZ55l/jL6cA1BBPU9edYdep30/A5qaxyjSVCEm6IIX5FBki9LkxrVtQ8f3yGWL5qkVQtylQgmZay4OLC2T5bJTLwjs8jcys6eEbbM2eA0R5omnJreUOpPxvOHHLO3U2Lq+Gdi2VhparuqISsKky47ggdMIwengPl2ScFZAN6i8qLvlzM7FFXWR8ODHGI33NKznk/y4APcRdjwZF2nfJanIaj2vNxd15S/KLFnPFqQT/zE1n65UAhJnnh+mU6MjXa7d/oNlqv450ui+SQ5HcEbe+6qdD6Rh+HqiYHpSohA4Gz+JLF+hJ/iuY0yoqETvoimKT2gYbX5k6Kxriyzl9MxLQM4Qo8Ygl2sYvIzxXKAGG9TAwgQdKUNP+tqGn1TMr4lntjN97FZTWelWVdawkHWbPmuE= dani@sigil-laptop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check(substr): | |
lower = [False for i in range(26)] | |
upper = [False for i in range(26)] | |
for c in substr: | |
o = ord(c) | |
if o > 90: | |
lower[o - 97] = True | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
template <typename T> | |
class my_shared_ptr { | |
T *data; | |
int *ref_count; | |
void _possibly_destroy() { | |
if (*ref_count == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
using ll = long long; | |
using ull = unsigned long long; | |
#define FOR(i, j, k, in) for (int i = j; i < k; i += in) | |
#define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in) | |
#define REP(i, j) FOR(i, 0, j, 1) | |
#define RREP(i, j) RFOR(i, j, 0, 1) | |
struct segment_tree { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
using ll = long long; | |
using ull = unsigned long long; | |
#define FOR(i, j, k, in) for (int i = j; i < k; i += in) | |
#define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in) | |
#define REP(i, j) FOR(i, 0, j, 1) | |
#define RREP(i, j) RFOR(i, j, 0, 1) | |
namespace prime { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
First I try to figure out what are the elements from 1 to 2 ** g - 1. In the end the value at node i(val[i]) is the following: | |
- If i > 2 ** g - 1 then 0 | |
- If it isn't than the minimal value from it's subtree such that it's bigger than max(val[2 * i], val[2 * i + 1]) that is the value of the roots of its subtrees since the heap property is preserved | |
during the operations. | |
Since we know which values should be in the heap in the end and since calling f on an index means removing the associated value we call f on the indices whose value we don't need(all values are different) back | |
to front. And that's it. | |
*/ |
NewerOlder