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)
Concept for arithmetic types including tools::int128_t and tools::uint128_t (tools/arithmetic.hpp)
Assertion macro (tools/assert_that.hpp)
Auxiliary tree (tools/auxiliary_tree.hpp)
Concept for a type that can be passed for range adaptors multi times (tools/available_for_multiple_range_adaptors.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)
$\prod_{i = 0}^{m - 1} (a_i + b_i x^{c_i})^{d_i}$ (tools/binomial_product.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)
Two-dimensional circumcircle (tools/circumcircle_2d.hpp)
std::cmp_equal extended for my library (tools/cmp_equal.hpp)
std::cmp_greater extended for my library (tools/cmp_greater.hpp)
std::cmp_greater_equal extended for my library (tools/cmp_greater_equal.hpp)
std::cmp_less extended for my library (tools/cmp_less.hpp)
std::cmp_less_equal extended for my library (tools/cmp_less_equal.hpp)
std::cmp_not_equal extended for my library (tools/cmp_not_equal.hpp)
Concept for commutative group (tools/commutative_group.hpp)
Concept for commutative monoid (tools/commutative_monoid.hpp)
Concept for commutative ring (tools/commutative_ring.hpp)
Concept for std::complex (tools/complex.hpp)
In-place coordinate compression (tools/compress.hpp)
Coordinate compression (tools/compressed.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)
In-place divisor Möbius transform (tools/divisor_moebius_inplace.hpp)
Divisor Zeta transform (tools/divisor_zeta.hpp)
In-place divisor Zeta transform (tools/divisor_zeta_inplace.hpp)
List all positive 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)
Formal Dirichlet series with prefix sums (tools/fds_with_prefix_sums.hpp)
Concept for field (tools/field.hpp)
Typical fields (tools/fields.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)
Return type of read-only getter (tools/getter_result.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)
Update $b$ to $a$ such that $b_i = \sum_{j = i}^{N - 1} a_j$ holds (tools/greater_equal_moebius_inplace.hpp)
Find $b$ from $a$ when $b_i = \sum_{j = i}^{N - 1} a_j$ holds (tools/greater_equal_zeta.hpp)
Update $a$ to $b$ such that $b_i = \sum_{j = i}^{N - 1} a_j$ holds (tools/greater_equal_zeta_inplace.hpp)
Concept for group (tools/group.hpp)
Typical groups (tools/groups.hpp)
Two-dimensional half line (tools/half_line_2d.hpp)
Check whether a given integer is $2^n$ (tools/has_single_bit.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)
Concept for integral types including tools::int128_t and tools::uint128_t (tools/integral.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 $(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 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)
Find the k-th largest integer using oracle (tools/kth_largest_by_oracle.hpp)
Find the k-th smallest integer using oracle (tools/kth_smallest_by_oracle.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)
Update $b$ to $a$ such that $b_i = \sum_{j = 0}^i a_j$ holds (tools/less_equal_moebius_inplace.hpp)
Find $b$ from $a$ when $b_i = \sum_{j = 0}^i a_j$ holds (tools/less_equal_zeta.hpp)
Update $a$ to $b$ such that $b_i = \sum_{j = 0}^i a_j$ holds (tools/less_equal_zeta_inplace.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::ranges::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)
Wider integral type (tools/make_wider.hpp)
Manacher (tools/manacher.hpp)
Matrix (tools/matrix.hpp)
tools/matrix_mod2.hpp
Maximum matching on general graph (tools/max_matching.hpp)
Solver of minimum-cost flow problem (tools/mcf_graph.hpp)
Heap managing median (tools/median_heap.hpp)
Minimum excluded value (tools/mex.hpp)
std::midpoint(a, b) extended for my library (tools/midpoint.hpp)
Minimum Steiner tree (tools/minimum_steiner_tree.hpp)
Mo's algorithm (tools/mo.hpp)
Minimum non-negative reminder (tools/mod.hpp)
Concept for atcoder::static_modint and atcoder::dynamic_modint (tools/modint.hpp)
Concept for a type compatible with atcoder::static_modint (tools/modint_compatible.hpp)
$\mathbb{Z} / (2^{61} - 1) \mathbb{Z}$ (tools/modint_for_rolling_hash.hpp)
Concept for monoid (tools/monoid.hpp)
Typical monoids (tools/monoids.hpp)
Multiple Möbius transform (tools/multiple_moebius.hpp)
In-place multiple Möbius transform (tools/multiple_moebius_inplace.hpp)
Multiple Zeta transform (tools/multiple_zeta.hpp)
In-place multiple Zeta transform (tools/multiple_zeta_inplace.hpp)
Automatically deduced multiplicative structure (tools/multiplicative_structure.hpp)
__gnu_pbds::tree, but it allows duplication (tools/multiset.hpp)
Sort multiple arrays at once (tools/multisort.hpp)
Multivariate convolution (tools/multivariate_convolution.hpp)
Concept for a mutable type (tools/mutable_type.hpp)
Dijkstra's algorithm for dense graph (tools/naive_dijkstra.hpp)
Next combination as n-choose-r (tools/next_combination.hpp)
Enumerate all integer partitions (tools/next_integer_partition.hpp)
Enumerate all matchings (tools/next_matching.hpp)
Next permutation as n-choose-r (tools/next_permutation.hpp)
tools::integral except for bool (tools/non_bool_integral.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 array (tools/persistent_array.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
Preset wavelet matrix (tools/preset_wavelet_matrix.hpp)
Prim's algorithm (tools/prim.hpp)
Pollard's rho algorithm (tools/prime_factorization.hpp)
Concept for atcoder::static_modint such that its modulo is a prime (tools/prime_static_modint.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)
Disjoint set union, but allows range parallel union (tools/range_parallel_dsu.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)
Concept for ring (tools/ring.hpp)
Typical rings (tools/rings.hpp)
Rolling hash (tools/rolling_hash.hpp)
Alias for __gnu_cxx::rope (tools/rope.hpp)
Circular shift to the left / Rotate a given matrix 90 degrees to the left (tools/rotl.hpp)
Circular shift to the right / Rotate a given matrix 90 degrees to the right (tools/rotr.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)
Second-order difference array (tools/second_order_imos.hpp)
Segmented sieve (tools/segmented_sieve.hpp)
tools/segtree_beats.hpp
Concept for semiring (tools/semiring.hpp)
Typical semirings (tools/semirings.hpp)
__gnu_pbds::tree, but more compatible with std::set (tools/set.hpp)
Shortest path tree (tools/shortest_path_tree.hpp)
Concept for signed integral types including tools::int128_t (tools/signed_integral.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)
Concept for the specialized type of U (tools/specialization_of.hpp)
$\sqrt{x} \pmod{P}$ (tools/sqrt_mod.hpp)
$x^2$ under a given monoid (tools/square.hpp)
Stern–Brocot tree (tools/stern_brocot_tree.hpp)
Signed Stirling numbers of the first kind (tools/stirling_1st.hpp)
Stirling numbers of the second kind (tools/stirling_2nd.hpp)
Subset convolution (tools/subset_convolution.hpp)
Subset Möbius transform (tools/subset_moebius.hpp)
In-place subset Möbius transform (tools/subset_moebius_inplace.hpp)
Subset sum (tools/subset_sum.hpp)
Subset Zeta transform (tools/subset_zeta.hpp)
In-place subset Zeta transform (tools/subset_zeta_inplace.hpp)
Wrapper of atcoder::suffix_array and atcoder::lcp_array (tools/suffix_array.hpp)
Superset Möbius transform (tools/superset_moebius.hpp)
In-place superset Möbius transform (tools/superset_moebius_inplace.hpp)
Superset Zeta transform (tools/superset_zeta.hpp)
In-place superset Zeta transform (tools/superset_zeta_inplace.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<Key, T, Hash> (tools/unordered_map.hpp)
Alias for __gnu_pbds::gp_hash_table<Key, __gnu_pbds::null_type, Hash> (tools/unordered_set.hpp)
Concept for unsigned integral types including tools::uint128_t (tools/unsigned_integral.hpp)
std::ranges::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)
Wavelet matrix (tools/wavelet_matrix.hpp)
Matching on weighted bipartite graph (tools/weighted_bipartite_matching.hpp)
Basis of xor (tools/xor_basis.hpp)
Bitwise XOR convolution (tools/xor_convolution.hpp)
01-BFS (tools/zero_one_bfs.hpp)
0-1 knapsack problem (tools/zero_one_knapsack.hpp)
tools/detail/
Verification Files
tests/
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/fds_with_prefix_sums/
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/ord_mod/
tests/partially_persistent_dsu/
tests/partition_function/
tests/persistent_lazy_segtree/
tests/polygon_2d/
tests/polynomial/
tests/preset_wavelet_matrix/
tests/prim/
tests/prime_factorization/
tests/quaternion/
tests/rational/
tests/scc_graph/
tests/segmented_sieve/
tests/sparse_fps_pow/
tests/stirling_1st/
tests/stirling_2nd/
tests/triangle_2d/
tests/triangle_2d/circumcircle/
tests/tsort/
tests/twelvefold_way/
tests/undoable_dsu/
tests/wavelet_matrix/
tests/weighted_bipartite_matching/
tests/zero_one_bfs/
tests/zero_one_knapsack/