Skip to content

Instantly share code, notes, and snippets.

View find_recurrence_relation.cpp
#include <cstdio>
#include <cassert>
#include <vector>
using namespace std;
using i64 = long long;
int mod_inv(int a, int mod) {
View count_lattice_points.cpp
#include <cstdio>
#include <cmath>
#include <utility>
#include <stack>
#include <functional>
using namespace std;
using i64 = int64_t;
View maximum_matching_sqrtn_m.cpp
#include <cstdio>
#include <cassert>
#include <vector>
using namespace std;
class MaximumMatching {
/*
Maximum Cardinality Matching in General Graphs.
View maximum_weighted_matching_nmlogn.cpp
#include <cstdio>
#include <cassert>
#include <vector>
#include <queue>
#include <random>
using namespace std;
View binomial_mod_pe_fast.py
def binomial_mod_pe_fast(n, m, p, e):
def mod_inv(a, p):
b = p
s, t = 1, 0
while b:
a, (q, b) = b, divmod(a, b)
s, t = t, s - t * q
if a != 1:
raise ValueError("gcd(a, mod) should be 1.")
return s if s >= 0 else s + p
View cost_scaling.cpp
#include <cstdio>
#include <cassert>
#include <vector>
#include <functional>
using namespace std;
template <
typename CapType, typename TotalCapType,
View maximum_flow_dinic_pr.cpp
#include <cstdio>
#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
View cost_scaling_lemon.cpp
#include <cstdio>
#include <iostream>
#include <lemon/dimacs.h>
#include <lemon/cost_scaling.h>
#include <lemon/smart_graph.h>
using i64 = long long;
using namespace std;
using namespace lemon;
View maximum_matching_gabow.cpp
#include <cstdio>
#include <vector>
#include <functional>
// main function
#include <iostream>
#include <set>
#include <random>
using namespace std;
You can’t perform that action at this time.