Skip to content

Commit

Permalink
Chore: build snippet, index, site
Browse files Browse the repository at this point in the history
  • Loading branch information
theSoberSobber committed Apr 10, 2024
1 parent b9a20f3 commit b8baec5
Show file tree
Hide file tree
Showing 70 changed files with 236 additions and 126 deletions.
127 changes: 64 additions & 63 deletions README.md

Large diffs are not rendered by default.

Binary file modified book/codebook-dark.pdf
Binary file not shown.
Binary file modified book/codebook-light.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/Lazy Segtree.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/Lazy Segtree
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L437)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L488)

```cpp

Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ curl -L "https://raw.githubusercontent.com/theSoberSobber/CP-Snippets/main/snipp
- **[General-Hash](https://thesobersobber.github.io/CP-Snippets/General-Hash)** : General Hash functions that returns two hashes, takes in 0 indexed arr or string, allows hash query on range, beware that this uses the decreasing power convention
- **[Segtree-General](https://thesobersobber.github.io/CP-Snippets/Segtree-General)** : General segree, needs node struct (with members def and epsilon(default) for all of them) and operation lambda (merge)
- **[Simpler-Segtree](https://thesobersobber.github.io/CP-Snippets/Simpler-Segtree)** : Init with an array simply using the build fn, customize operation and epslion in the struct itself, supports point updates and range queries
- **[Sparse-General](https://thesobersobber.github.io/CP-Snippets/Sparse-General)** : General Implementation of Sparse table with the template<class T> structure
- **[Weird_Lazy_Segtree](https://thesobersobber.github.io/CP-Snippets/Lazy Segtree)** : A lazy segtree taken from a abc340 E mridulahi submission, it's supposed to be able to do range updates and point queries
- **[arr-inp](https://thesobersobber.github.io/CP-Snippets/arr-inp)** : arr-inp
- **[arr-pref](https://thesobersobber.github.io/CP-Snippets/arr-pref)** : arr-pref
Expand Down
56 changes: 56 additions & 0 deletions docs/Sparse-General.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

## Sparse-General

- General Implementation of Sparse table with the template<class T> structure
- ```
https://thesobersobber.github.io/CP-Snippets/Sparse-General
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L437)

```cpp
template<class T>
class sparseTable
{
public:
int n,k;
vector<vector<T>> table;
vector<T> logs;
function<T(T,T)> operation;
void init(int x,function<T(T,T)> _operation)
{
operation=_operation;
n=x;
logs.resize(n+1);
logs[1]=0;
for(int i=2;i<=n;i++)
logs[i]=logs[i/2]+1;
k=*max_element(logs.begin(),logs.end());
table.resize(k+1,vector<T>(n));
}

void build(vector<T> &arr)
{
for(int i=0;i<n;i++)
table[0][i]=arr[i];

for(int j=1;j<=k;j++)
{
for(int i=0;i+(1<<j)<=n;i++)
table[j][i]=operation(table[j-1][i],table[j-1][i+(1<<(j-1))]);
}
}
// 1 based indexing
T query(int l , int r)
{
assert(l<=r);
assert(l>=0 && r<n);
int j = logs[r - l + 1];
T answer = operation(table[j][l], table[j][r-(1<<j)+1]);
return answer;
}
};


// does not have a constructor, make an instance and then use the init method to use this

```
2 changes: 1 addition & 1 deletion docs/arr-inp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/arr-inp
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L586)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L637)

```cpp
vector<int> a(n, 0);
Expand Down
2 changes: 1 addition & 1 deletion docs/arr-pref.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/arr-pref
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L594)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L645)

```cpp
vector<int> pre(n, 0);
Expand Down
2 changes: 1 addition & 1 deletion docs/bfs-dist.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/bfs-dist
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L602)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L653)

```cpp
queue<int> q;
Expand Down
2 changes: 1 addition & 1 deletion docs/binpow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/binpow
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L621)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L672)

```cpp
ll binpow(ll x, ll y){
Expand Down
2 changes: 1 addition & 1 deletion docs/binsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/binsearch
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L636)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L687)

```cpp
int lo = 0, hi = n-1;
Expand Down
2 changes: 1 addition & 1 deletion docs/bp-small.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/bp-small
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L657)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L708)

```cpp
#include <bits/stdc++.h>
Expand Down
2 changes: 1 addition & 1 deletion docs/bp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/bp
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L702)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L753)

```cpp
#include <bits/stdc++.h>
Expand Down
2 changes: 1 addition & 1 deletion docs/clock_for_TL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/clock_for_TL
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L780)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L831)

```cpp
auto start = chrono::high_resolution_clock::now();
Expand Down
2 changes: 1 addition & 1 deletion docs/combi-mint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/combi-mint
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L792)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L843)

```cpp
const int mod=1e9+7;
Expand Down
2 changes: 1 addition & 1 deletion docs/combi-struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/combi-struct
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L868)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L919)

```cpp
struct Comb {
Expand Down
2 changes: 1 addition & 1 deletion docs/combination-non-mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/combination-non-mod
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L919)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L970)

```cpp
vector<vector<int>> dp(n+1, vector<int> (k+1));
Expand Down
2 changes: 1 addition & 1 deletion docs/combination-small.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/combination-small
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L936)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L987)

```cpp
int C(int n,int r){
Expand Down
2 changes: 1 addition & 1 deletion docs/combination.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/combination
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L952)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1003)

```cpp
int C(int n, int r){
Expand Down
2 changes: 1 addition & 1 deletion docs/crt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/crt
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L965)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1016)

```cpp
/**
Expand Down
2 changes: 1 addition & 1 deletion docs/cute-lcm.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/cute-lcm
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L989)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1040)

```cpp
"https://math.stackexchange.com/questions/1579/n-ary-version-of-gcda-b-space-lcma-b-ab"
Expand Down
2 changes: 1 addition & 1 deletion docs/derangments.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/derangments
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L999)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1050)

```cpp
int countDerangements(int n){
Expand Down
2 changes: 1 addition & 1 deletion docs/dfs-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/dfs-full
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1012)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1063)

```cpp
auto dfs = [&](auto &&dfs, int curr, int parent, vector<int> &visG, vector<int> &visPath ,vector<int> &comp, bool &cycle_directed, stack<int> topo, vector<int> &adj) -> void {
Expand Down
2 changes: 1 addition & 1 deletion docs/dfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/dfs
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1042)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1093)

```cpp
map<int,int> dfs(int cur,int par,vi&a){
Expand Down
2 changes: 1 addition & 1 deletion docs/diophantine.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/diophantine
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1062)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1113)

```cpp
long long gcd(long long a, long long b, long long &x, long long &y) {
Expand Down
2 changes: 1 addition & 1 deletion docs/dsu-rr.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/dsu-rr
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1138)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1189)

```cpp
class Solution {
Expand Down
2 changes: 1 addition & 1 deletion docs/easy_seive.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/easy_seive
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1177)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1228)

```cpp
void ez_seive(int n){
Expand Down
2 changes: 1 addition & 1 deletion docs/euclid.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/euclid
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1196)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1247)

```cpp
int euclid_gcd(int a, int b){
Expand Down
2 changes: 1 addition & 1 deletion docs/explanation_binsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/explanation_binsearch
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1221)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1272)

```cpp
int lo = 0, hi = n-1; // see constraints for lo and hi, nahi mil rahe toh just take 0 and 1e18
Expand Down
2 changes: 1 addition & 1 deletion docs/fac.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/fac
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1256)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1307)

```cpp
int fac[maxn];
Expand Down
2 changes: 1 addition & 1 deletion docs/factorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/factorization
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1270)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1321)

```cpp
void printFactors(int n) {
Expand Down
2 changes: 1 addition & 1 deletion docs/fenwick.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/fenwick
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1300)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1351)

```cpp
// 0-indexed BIT (binary indexed tree / Fenwick tree) (i : [0, len))
Expand Down
2 changes: 1 addition & 1 deletion docs/file_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/file_io
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1340)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1391)

```cpp
void file_i_o(){
Expand Down
2 changes: 1 addition & 1 deletion docs/freq-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/freq-map
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1350)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1401)

```cpp
map<int, int> m;
Expand Down
2 changes: 1 addition & 1 deletion docs/gr-inp-Fwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/gr-inp-Fwt
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1361)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1412)

```cpp
int e=f(n);
Expand Down
2 changes: 1 addition & 1 deletion docs/gr-inp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/gr-inp
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1374)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1425)

```cpp
int e=f(n);
Expand Down
2 changes: 1 addition & 1 deletion docs/highest_exponent.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/highest_exponent
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1387)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1438)

```cpp
int highest_exponent(int p, const int &n){
Expand Down
2 changes: 1 addition & 1 deletion docs/interactive.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/interactive
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1402)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1453)

```cpp
void solve(){
Expand Down
2 changes: 1 addition & 1 deletion docs/ip-overloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/ip-overloads
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1427)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1478)

```cpp
template<typename T1, typename T2> inline istream& operator >> (istream& in, pair<T1,T2>& a) { in>>a.first>>a.second; return in; }
Expand Down
2 changes: 1 addition & 1 deletion docs/kadane.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/kadane
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1444)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1495)

```cpp
int maxSubArraySum(vector<int> &v, int size){
Expand Down
2 changes: 1 addition & 1 deletion docs/kosaraju.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/kosaraju
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1482)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1533)

```cpp
class Graph {
Expand Down
2 changes: 1 addition & 1 deletion docs/kruskal.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- ```
https://thesobersobber.github.io/CP-Snippets/kruskal
```
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1562)
- [github-snip-file](https://github.com/theSoberSobber/CP-Snippets/blob/main/snippets.json#L1613)

```cpp
auto kruskalMST(vector<Edge> &edges, int V){
Expand Down
Loading

0 comments on commit b8baec5

Please sign in to comment.