Skip to content

Instantly share code, notes, and snippets.

struct WaveletTree{
int lo, hi;
WaveletTree *l, *r;
vector<int> b;
//from and to are array pointers
//Build Wavelet Tree on A[from...to];
//x <= A[j] <= y, for each from <= j <= to
//Warning : Changes the original array A
struct SegmentTree {
vector<ll> t;
int n;
inline ll ops(ll a, ll b) {return max(a,b);}
SegmentTree(vector<ll> &a) {
n = a.size();
t.resize(2*n);
for (int i = 0; i < n; i++)
#include <bits/stdc++.h>
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define debug(x) { cerr << #x << " = " << x << endl; }
#define IO { ios_base::sync_with_stdio(false); cin.tie(0); }
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
struct SuffixArray
{
vector<int> arr, lcp;
SuffixArray(string s) {
arr = suffix_array_construction(s);
s.pop_back();
lcp = lcp_construction(s, arr);
}
int size() {
#include <bits/stdc++.h>
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define debug(x) { cerr << #x << " = " << x << endl; }
#define IO { ios_base::sync_with_stdio(false); cin.tie(0); }
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
[
{
"keys": ["alt+`"], "command": "toggle_terminus_panel"
},
{
"keys": ["f6"], "command": "terminus_open", "args": {
"cmd": ["python", "$file"],
"cwd": "${file_path:${file}}",
"post_window_hooks": [
["carry_file_to_pane", {"direction": "right"}]
[
{
"keys": ["alt+`"], "command": "toggle_terminus_panel"
},
{
"keys": ["f6"], "command": "terminus_open", "args": {
"cmd": ["python3", "$file"],
"cwd": "${file_path:${file}}",
"post_window_hooks": [
["carry_file_to_pane", {"direction": "right"}]
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
template<typename T>
void debug(T args) {
import sys
import math
# Deliver more amadeusium to hq (left side of the map) than your opponent. Use radars to find amadeusium but beware of traps!
# height: size of the map
def debug(*args):
for i in args:
print(i, file = 'sys.stderr')