proconlib
Library Files
tools/
std::abs(x) extended for my library (tools/abs.hpp)
Alphabetical order of a given character (tools/alphabetical_order.hpp)
Bitwise AND convolution (tools/and_convolution.hpp)
Assertion macro (tools/assert_that.hpp)
Auxiliary tree (tools/auxiliary_tree.hpp)
Reversible self-balancing binary search tree based on AVL tree (tools/avl_tree.hpp)
Bell numbers (tools/bell.hpp)
Bellman-Ford algorithm (tools/bellman_ford.hpp)
Berlekamp-Massey algorithm (tools/berlekamp_massey.hpp)
Bernoulli numbers $B_k \pmod{P}$ for $0 \leq k \leq n$ (tools/bernoulli.hpp)
Bézout's identity (tools/bezout.hpp)
Arbitrary precision floating-point number (tools/bigdecimal.hpp)
Arbitrary precision integer (tools/bigint.hpp)
Binary heap (tools/binary_heap.hpp)
Matching on bipartite graph (tools/bipartite_matching.hpp)
$2^{\left\lceil \log_2(x) \right\rceil}$ (tools/bit_ceil.hpp)
$2^{\left\lfloor \log_2(x) \right\rfloor}$ (tools/bit_floor.hpp)
Bit vector (tools/bit_vector.hpp)
Bit width required to represent a given integer (tools/bit_width.hpp)
$\left\lceil \frac{x}{y} \right\rceil y$ (tools/block_ceil.hpp)
$\left\lfloor \frac{x}{y} \right\rfloor y$ (tools/block_floor.hpp)
Bostan-Mori algorithm (tools/bostan_mori.hpp)
Cartesian tree (tools/cartesian_tree.hpp)
Counter clockwise function (tools/ccw.hpp)
$\left\lceil \frac{x}{y} \right\rceil$ (tools/ceil.hpp)
$\left\lceil x^\frac{1}{k} \right\rceil$ (tools/ceil_kth_root.hpp)
$\left\lceil \log_b(x) \right\rceil$ (tools/ceil_log.hpp)
$\left\lceil \log_2(x) \right\rceil$ (tools/ceil_log2.hpp)
Enumerate the range of $\left\lceil \frac{A}{x} \right\rceil$ (tools/ceil_quotients.hpp)
$\left\lceil \sqrt{x} \right\rceil$ (tools/ceil_sqrt.hpp)
chmax function (tools/chmax.hpp)
chmin function (tools/chmin.hpp)
Chromatic number (tools/chromatic_number.hpp)
Fast input (tools/cin.hpp)
Two-dimensional circle (tools/circle_2d.hpp)
Compress values (tools/compress.hpp)
Compress values (for more complicated cases) (tools/compressor.hpp)
Convex hull (tools/convex_hull.hpp)
Convolution (tools/convolution.hpp)
Number of trailing zeros (tools/countr_zero.hpp)
Fast output (tools/cout.hpp)
2D cumulative sum (tools/cumsum2d.hpp)
Cycle detection on a graph (tools/cycle_detection.hpp)
Frequency table of digit products (tools/digit_product_frequency.hpp)
Sum of digits (tools/digit_sum.hpp)
Dijkstra's algorithm (tools/dijkstra.hpp)
Two-dimensional directed line segment (tools/directed_line_segment_2d.hpp)
Disjoint sparse table (tools/disjoint_sparse_table.hpp)
2D disjoint sparse table (tools/disjoint_sparse_table_2d.hpp)
Divisor Möbius transform (tools/divisor_moebius.hpp)
Divisor Zeta transform (tools/divisor_zeta.hpp)
List all divisors (tools/divisors.hpp)
List all divisors of a divisor of $n$ (tools/divisors_of_divisor.hpp)
Disjoint set union (tools/dsu.hpp)
Dual segment tree (tools/dual_segtree.hpp)
Dual sparse segment tree (tools/dual_sparse_segtree.hpp)
std::bitset with dynamic size (tools/dynamic_bitset.hpp)
Sieve of Eratosthenes (tools/eratosthenes_sieve.hpp)
std::exp(x) extended for my library (tools/exp.hpp)
Extend std::hash (tools/extend_hash.hpp)
Extend operator>> (tools/extend_input.hpp)
Extend operator<< (tools/extend_output.hpp)
Extended Garner's algorithm (tools/extended_garner.hpp)
Extended Lucas' theorem (tools/extended_lucas.hpp)
Extended Euclidean algorithm (tools/extgcd.hpp)
Cache for $n^{-1}, n!, n!^{-1} \pmod{P}$ (tools/fact_mod_cache.hpp)
Fill a multi-dimensional vector (tools/fill.hpp)
Floyd's cycle-finding algorithm (tools/find_cycle.hpp)
Fixed point combinator (tools/fix.hpp)
$\left\lfloor \frac{x}{y} \right\rfloor$ (tools/floor.hpp)
$\left\lfloor x^\frac{1}{k} \right\rfloor$ (tools/floor_kth_root.hpp)
$\left\lfloor \log_b(x) \right\rfloor$ (tools/floor_log.hpp)
$\left\lfloor \log_2(x) \right\rfloor$ (tools/floor_log2.hpp)
Enumerate the range of $\left\lfloor \frac{A}{x} \right\rfloor$ (tools/floor_quotients.hpp)
$\left\lfloor \sqrt{x} \right\rfloor$ (tools/floor_sqrt.hpp)
Formal power series (tools/fps.hpp)
Garner's algorithm (tools/garner.hpp)
Garner's algorithm for $\mathbb{Z} / M_1 \mathbb{Z}$ and $\mathbb{Z} / M_2 \mathbb{Z}$ (tools/garner2.hpp)
Garner's algorithm for $\mathbb{Z} / M_1 \mathbb{Z}$, $\mathbb{Z} / M_2 \mathbb{Z}$ and $\mathbb{Z} / M_3 \mathbb{Z}$ (tools/garner3.hpp)
std::gcd(m, n) extended for my library (tools/gcd.hpp)
GCD convolution (tools/gcd_convolution.hpp)
Golden section search (tools/golden_section_search.hpp)
std::greater by key (tools/greater_by.hpp)
std::greater by the argument (tools/greater_by_arg.hpp)
std::greater by the argument (total order) (tools/greater_by_arg_total.hpp)
std::greater by first (tools/greater_by_first.hpp)
std::greater by std::get (tools/greater_by_get.hpp)
std::greater by second (tools/greater_by_second.hpp)
Find $a$ from $b$ when $b_i = \sum_{j = i}^{N - 1} a_j$ holds (tools/greater_equal_moebius.hpp)
Find $b$ from $a$ when $b_i = \sum_{j = i}^{N - 1} a_j$ holds (tools/greater_equal_zeta.hpp)
Typical groups (tools/group.hpp)
Two-dimensional half line (tools/half_line_2d.hpp)
Check whether T has the member function mod() (tools/has_mod.hpp)
Combine hash values (tools/hash_combine.hpp)
Heavy-light decomposition (tools/hld.hpp)
128-bit signed integer (tools/int128_t.hpp)
Set of integers as closed integer intervals (tools/integer_interval_set.hpp)
$x^{-1} \pmod{M}$ (tools/inv_mod.hpp)
The number of inversions (tools/inversion_number.hpp)
Check whether a given graph is bipartite (tools/is_bipartite.hpp)
Check whether T is a group (tools/is_group.hpp)
Check whether $(r, c)$ is in a grid of height $h$ and width $w$ (tools/is_in_grid.hpp)
std::is_integral extended for tools::int128_t and tools::uint128_t (tools/is_integral.hpp)
Check whether T is a monoid (tools/is_monoid.hpp)
Check whether a given boolean function is partitioned (tools/is_partitioned.hpp)
Miller-Rabin primality test (tools/is_prime.hpp)
Check whether T is a range type (tools/is_range.hpp)
Check whether T is tools::rational (tools/is_rational.hpp)
std::is_signed extended for tools::int128_t and tools::uint128_t (tools/is_signed.hpp)
std::is_unsigned extended for tools::int128_t and tools::uint128_t (tools/is_unsigned.hpp)
Join elements with delimiter (tools/join.hpp)
Precompute $n! \pmod{P}$ for $0 \leq n < P \approx 10^9$ (tools/large_fact_mod_cache.hpp)
Largest rectangle in histogram (tools/largest_rectangle_in_histogram.hpp)
Lazy reversible self-balancing binary search tree based on AVL tree (tools/lazy_avl_tree.hpp)
Segment tree with lazy propagation (tools/lazy_segtree.hpp)
Sparse segment tree with lazy propagation (tools/lazy_sparse_segtree.hpp)
Lowest common ancestor (tools/lca.hpp)
LCM convolution (tools/lcm_convolution.hpp)
std::less by key (tools/less_by.hpp)
std::less by the argument (tools/less_by_arg.hpp)
std::less by the argument (total order) (tools/less_by_arg_total.hpp)
std::less by first (tools/less_by_first.hpp)
std::less by std::get (tools/less_by_get.hpp)
std::less by second (tools/less_by_second.hpp)
Find $a$ from $b$ when $b_i = \sum_{j = 0}^i a_j$ holds (tools/less_equal_moebius.hpp)
Find $b$ from $a$ when $b_i = \sum_{j = 0}^i a_j$ holds (tools/less_equal_zeta.hpp)
Li Chao segment tree (tools/li_chao_segtree.hpp)
Two-dimensional line (tools/line_2d.hpp)
Linear sieve (tools/linear_sieve.hpp)
Longest increasing subsequence (tools/lis.hpp)
std::log(x) extended for my library (tools/log.hpp)
$\log_x y \pmod{M}$ (tools/log_mod.hpp)
Multiset $S$ such that $\{\sum_{x \in S'} x | S' \subseteq S\} = \{0, 1, \ldots, N\}$ and $|S| = O(\log N)$ (tools/logn_integer_partition.hpp)
Longest common substring (tools/longest_common_substring.hpp)
std::lower_bound, but returns index (tools/lower_bound.hpp)
Lowlink (tools/lowlink.hpp)
std::make_signed extended for tools::int128_t and tools::uint128_t (tools/make_signed.hpp)
std::make_unsigned extended for tools::int128_t and tools::uint128_t (tools/make_unsigned.hpp)
Manacher (tools/manacher.hpp)
Matrix (tools/matrix.hpp)
tools/matrix_mod2.hpp
Solver of minimum-cost flow problem (tools/mcf_graph.hpp)
Heap managing median (tools/median_heap.hpp)
Minimum excluded value (tools/mex.hpp)
Minimum Steiner tree (tools/minimum_steiner_tree.hpp)
Mo's algorithm (tools/mo.hpp)
Minimum non-negative reminder (tools/mod.hpp)
$\mathbb{Z} / (2^{61} - 1) \mathbb{Z}$ (tools/modint_for_rolling_hash.hpp)
Typical monoids (tools/monoid.hpp)
Multiple Möbius transform (tools/multiple_moebius.hpp)
Multiple Zeta transform (tools/multiple_zeta.hpp)
__gnu_pbds::tree, but it allows duplication (tools/multiset.hpp)
Dijkstra's algorithm for dense graph (tools/naive_dijkstra.hpp)
Next combination as n-choose-r (tools/next_combination.hpp)
Enumerate all matchings (tools/next_matching.hpp)
Next permutation as n-choose-r (tools/next_permutation.hpp)
Dummy mapping (tools/nop_mapping.hpp)
Dummy monoid (tools/nop_monoid.hpp)
The number of nanoseconds that have elapsed since epoch (tools/now.hpp)
Online cumulative sum (tools/online_cumsum.hpp)
Online difference array (tools/online_imos.hpp)
Bitwise OR convolution (tools/or_convolution.hpp)
$\mathrm{ord}(x)$ for $x \in (\mathbb{Z}/p\mathbb{Z})^\times$ (tools/ord_mod.hpp)
Partially persistent disjoint set union (tools/partially_persistent_dsu.hpp)
Partition function (tools/partition_function.hpp)
Potentialized disjoint set union (tools/pdsu.hpp)
Permutation (tools/permutation.hpp)
Persistent dual segment tree (tools/persistent_dual_segtree.hpp)
Persistent segment tree with lazy propagation (tools/persistent_lazy_segtree.hpp)
Persistent queue (tools/persistent_queue.hpp)
Persistent segment tree (tools/persistent_segtree.hpp)
Persistent stack (tools/persistent_stack.hpp)
Two-dimensional polygon (tools/polygon_2d.hpp)
Polynomial (tools/polynomial.hpp)
Polynomial interpolation (tools/polynomial_interpolation.hpp)
Product of polynomials (tools/polynomial_product.hpp)
Popcount (tools/popcount.hpp)
$b^n$ under a given monoid, and std::pow(b, n) extended for my library (tools/pow.hpp)
$2^x$ (tools/pow2.hpp)
$x^y \pmod{M}$ (tools/pow_mod.hpp)
Cache for $b^n \pmod{M}$ (tools/pow_mod_cache.hpp)
tools/preset_segtree_beats.hpp
Prim's algorithm (tools/prim.hpp)
Pollard's rho algorithm (tools/prime_factorization.hpp)
Primitive root (tools/primitive_root.hpp)
$x \cdot y \pmod{M}$ (tools/prod_mod.hpp)
QCFium's method (tools/qcfium.hpp)
Quaternion (tools/quaternion.hpp)
Quotient as integer division (tools/quo.hpp)
Random tree generator (tools/random_tree.hpp)
Range count distinct (tools/range_count_distinct.hpp)
Rational number (tools/rational.hpp)
Rational binary search (tools/rational_binary_search.hpp)
Set of real numbers as closed integer intervals (tools/real_interval_set.hpp)
Area of union of rectangles (tools/rectangle_union_area.hpp)
Dynamic programming on a tree with rerooting technique (tools/rerooting_dp.hpp)
Resize a multi-dimensional vector (tools/resize.hpp)
Bit reverse (tools/reverse.hpp)
Rolling hash (tools/rolling_hash.hpp)
Circular shift to the left (tools/rotl.hpp)
Circular shift to the right (tools/rotr.hpp)
Apply banker's rounding to $\frac{x}{y}$ (tools/round.hpp)
Rounding mode (tools/rounding_mode.hpp)
Run-length encoding (tools/run_length.hpp)
$\mathbb{Z} \cup \{\infty, -\infty, \mathrm{NaN}\}$ and $\mathbb{Z}_{\geq 0} \cup \{\infty, \mathrm{NaN}\}$ (tools/safe_int.hpp)
Shift of sampling points of polynomial (tools/sample_point_shift.hpp)
Strongly connected component decomposition (tools/scc_graph.hpp)
Segmented sieve (tools/segmented_sieve.hpp)
tools/segtree_beats.hpp
__gnu_pbds::tree, but more compatible with std::set (tools/set.hpp)
Shortest path tree (tools/shortest_path_tree.hpp)
Sign function (tools/signum.hpp)
std::lower_bound in $\left\langle O(N + \max(A_i) - \min(A_i)), O(1) \right\rangle$ time (tools/small_range_lower_bound.hpp)
Power of a sparse FPS (tools/sparse_fps_pow.hpp)
Sparse segment tree (tools/sparse_segtree.hpp)
$\sqrt{x} \pmod{P}$ (tools/sqrt_mod.hpp)
$x^2$ under a given monoid (tools/square.hpp)
Signed Stirling numbers of the first kind (tools/stirling_1st.hpp)
Stirling numbers of the second kind (tools/stirling_2nd.hpp)
Subset Möbius transform (tools/subset_moebius.hpp)
Subset Zeta transform (tools/subset_zeta.hpp)
Wrapper of atcoder::suffix_array and atcoder::lcp_array (tools/suffix_array.hpp)
Superset Möbius transform (tools/superset_moebius.hpp)
Superset Zeta transform (tools/superset_zeta.hpp)
Sliding window aggregation (tools/swag.hpp)
$x \uparrow\uparrow y \pmod{M}$ (tools/tetration_mod.hpp)
Euler's totient function (tools/totient.hpp)
Transposition (tools/transposed.hpp)
Diameter of a tree (tools/tree_diameter.hpp)
Two-dimensional triangle (tools/triangle_2d.hpp)
Triangular array (tools/triangular_array.hpp)
One-to-one mapping from a triangular array to a one-dimensional array (tools/triangular_array_compressor.hpp)
Topological sorting (tools/tsort.hpp)
Traveling salesman problem (tools/tsp.hpp)
Hash of std::tuple (tools/tuple_hash.hpp)
Twelvefold way (tools/twelvefold_way.hpp)
128-bit unsigned integer (tools/uint128_t.hpp)
Undoable disjoint set union (tools/undoable_dsu.hpp)
Alias for __gnu_pbds::gp_hash_table&lt;Key, T, Hash&gt; (tools/unordered_map.hpp)
Alias for __gnu_pbds::gp_hash_table&lt;Key, __gnu_pbds::null_type, Hash&gt; (tools/unordered_set.hpp)
std::upper_bound, but returns index (tools/upper_bound.hpp)
Commonly used utilities for competitive programming (tools/util.hpp)
Vector (tools/vector.hpp)
Two dimensional vector (tools/vector2.hpp)
Three dimensional vector (tools/vector3.hpp)
Four dimensional vector (tools/vector4.hpp)
Lazy evaluation read-only std::vector (tools/virtual_vector.hpp)
Wavelet matrix (tools/wavelet_matrix.hpp)
Matching on weighted bipartite graph (tools/weighted_bipartite_matching.hpp)
Basis of xor (tools/xor_basis.hpp)
01-BFS (tools/zero_one_bfs.hpp)
0-1 knapsack problem (tools/zero_one_knapsack.hpp)
tools/detail/
Verification Files
tests/
tests/and_convolution/
tests/avl_tree/
tests/bell/
tests/bigdecimal/
tests/bigint/
tests/cartesian_tree/
tests/circle_2d/
tests/circle_2d/where/
tests/convolution/
tests/cycle_detection/
tests/dijkstra/
tests/directed_line_segment_2d/
tests/fastio/
tests/fps/
tests/gcd_convolution/
tests/hld/
tests/large_fact_mod_cache/
tests/lazy_segtree/
tests/lazy_segtree/lazy_segtree/
tests/lazy_sparse_segtree/
tests/lcm_convolution/
tests/li_chao_segtree/
tests/line_2d/
tests/lis/bisect/
tests/lis/segtree/
tests/lowlink/
tests/matrix/
tests/matrix_mod2/
tests/minimum_steiner_tree/
tests/or_convolution/
tests/ord_mod/
tests/partition_function/
tests/persistent_lazy_segtree/
tests/polygon_2d/
tests/polynomial/
tests/prim/
tests/quaternion/
tests/rational/
tests/scc_graph/
tests/sparse_fps_pow/
tests/stirling_1st/
tests/stirling_2nd/
tests/triangle_2d/
tests/tsort/
tests/twelvefold_way/
tests/undoable_dsu/
tests/wavelet_matrix/
tests/weighted_bipartite_matching/
tests/zero_one_bfs/
tests/zero_one_knapsack/