ac-library-rb 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/unittest.yml +16 -0
  3. data/.gitignore +11 -0
  4. data/.rubocop.yml +198 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +116 -0
  7. data/README.ja.md +56 -0
  8. data/README.md +41 -0
  9. data/Rakefile +11 -0
  10. data/ac-library-rb.gemspec +32 -0
  11. data/bin/console +8 -0
  12. data/bin/lock_lib.rb +27 -0
  13. data/bin/setup +8 -0
  14. data/document_en/binary_index_tree.md +3 -0
  15. data/document_en/convolution.md +67 -0
  16. data/document_en/dsu.md +132 -0
  17. data/document_en/fenwick_tree.md +99 -0
  18. data/document_en/index.md +79 -0
  19. data/document_en/lazy_segtree.md +141 -0
  20. data/document_en/math.md +104 -0
  21. data/document_en/max_flow.md +165 -0
  22. data/document_en/min_cost_flow.md +132 -0
  23. data/document_en/modint.md +263 -0
  24. data/document_en/priority_queue.md +119 -0
  25. data/document_en/segtree.md +134 -0
  26. data/document_en/string.md +106 -0
  27. data/document_en/two_sat.md +91 -0
  28. data/document_en/union_find.md +3 -0
  29. data/document_ja/convolution.md +64 -0
  30. data/document_ja/dsu.md +183 -0
  31. data/document_ja/fenwick_tree.md +83 -0
  32. data/document_ja/index.md +89 -0
  33. data/document_ja/lazy_segtree.md +135 -0
  34. data/document_ja/math.md +116 -0
  35. data/document_ja/max_flow.md +129 -0
  36. data/document_ja/min_cost_flow.md +105 -0
  37. data/document_ja/modint.md +349 -0
  38. data/document_ja/priority_queue.md +103 -0
  39. data/document_ja/scc.md +65 -0
  40. data/document_ja/segtree.md +145 -0
  41. data/document_ja/string.md +105 -0
  42. data/document_ja/two_sat.md +87 -0
  43. data/lib/ac-library-rb/version.rb +3 -0
  44. data/lib/convolution.rb +124 -0
  45. data/lib/core_ext/modint.rb +19 -0
  46. data/lib/crt.rb +52 -0
  47. data/lib/dsu.rb +44 -0
  48. data/lib/fenwick_tree.rb +48 -0
  49. data/lib/floor_sum.rb +21 -0
  50. data/lib/inv_mod.rb +26 -0
  51. data/lib/lazy_segtree.rb +149 -0
  52. data/lib/lcp_array.rb +23 -0
  53. data/lib/max_flow.rb +137 -0
  54. data/lib/min_cost_flow.rb +143 -0
  55. data/lib/modint.rb +170 -0
  56. data/lib/pow_mod.rb +13 -0
  57. data/lib/priority_queue.rb +89 -0
  58. data/lib/scc.rb +77 -0
  59. data/lib/segtree.rb +140 -0
  60. data/lib/suffix_array.rb +128 -0
  61. data/lib/two_sat.rb +34 -0
  62. data/lib/z_algorithm.rb +32 -0
  63. data/lib_helpers/ac-library-rb/all.rb +22 -0
  64. data/lib_lock/ac-library-rb.rb +22 -0
  65. data/lib_lock/ac-library-rb/convolution.rb +126 -0
  66. data/lib_lock/ac-library-rb/core_ext/modint.rb +19 -0
  67. data/lib_lock/ac-library-rb/crt.rb +54 -0
  68. data/lib_lock/ac-library-rb/dsu.rb +46 -0
  69. data/lib_lock/ac-library-rb/fenwick_tree.rb +50 -0
  70. data/lib_lock/ac-library-rb/floor_sum.rb +23 -0
  71. data/lib_lock/ac-library-rb/inv_mod.rb +28 -0
  72. data/lib_lock/ac-library-rb/lazy_segtree.rb +151 -0
  73. data/lib_lock/ac-library-rb/lcp_array.rb +25 -0
  74. data/lib_lock/ac-library-rb/max_flow.rb +139 -0
  75. data/lib_lock/ac-library-rb/min_cost_flow.rb +145 -0
  76. data/lib_lock/ac-library-rb/modint.rb +172 -0
  77. data/lib_lock/ac-library-rb/pow_mod.rb +15 -0
  78. data/lib_lock/ac-library-rb/priority_queue.rb +91 -0
  79. data/lib_lock/ac-library-rb/scc.rb +79 -0
  80. data/lib_lock/ac-library-rb/segtree.rb +142 -0
  81. data/lib_lock/ac-library-rb/suffix_array.rb +130 -0
  82. data/lib_lock/ac-library-rb/two_sat.rb +36 -0
  83. data/lib_lock/ac-library-rb/z_algorithm.rb +34 -0
  84. metadata +158 -0
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ require_relative "./bin/lock_lib.rb"
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["test/**/*_test.rb"]
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/ac-library-rb/version'
2
+
3
+ gem_description = "ac-library-rb is a ruby port of AtCoder Library (ACL).
4
+ DSU(UnionFind), FenwickTree, PriorityQueue, Segtree, SCC, 2-SAT, suffix_array, lcp_array, z_algorithm, crt, inv_mod, floor_sum, max_flow, min_cost_flow......"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ac-library-rb"
8
+ spec.version = AcLibraryRb::VERSION
9
+ spec.authors = ["universato"]
10
+ spec.email = ["universato@gmail.com"]
11
+
12
+ spec.summary = "ac-library-rb is a ruby port of AtCoder Library (ACL)."
13
+ spec.description = gem_description
14
+ spec.homepage = "https://github.com/universato/ac-library-rb"
15
+ spec.license = "CC0"
16
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/universato/ac-library-rb"
20
+
21
+ spec.add_development_dependency "minitest"
22
+ spec.add_development_dependency "rake"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib_lock", "lib_helpers"]
32
+ end
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+
5
+ require "ac-library-rb"
6
+
7
+ require "irb"
8
+ IRB.start(__FILE__)
data/bin/lock_lib.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'pathname'
2
+
3
+ # copy libraries from `lib` to `lib_lock/ac-library` and add `module AcLibraryRb`
4
+ lib_path = File.expand_path('../../lib/**', __FILE__)
5
+ lock_dir = File.expand_path('../../lib_lock/ac-library-rb', __FILE__)
6
+ Dir.glob(lib_path) do |file|
7
+ next unless FileTest.file?(file)
8
+
9
+ path = Pathname.new(lock_dir) + Pathname.new(file).basename
10
+ File.open(path, "w") do |f|
11
+ f.puts "module AcLibraryRb"
12
+ f.puts File.readlines(file).map{ |line| line == "\n" ? "\n" : ' ' + line }
13
+ f.puts "end"
14
+ end
15
+ end
16
+
17
+ # cope library from `lib/core_ext` to `lib_lock/ac-library-rb/core_ext`
18
+ lib_path = File.expand_path('../../lib/core_ext/**', __FILE__)
19
+ lock_dir = File.expand_path('../../lib_lock/ac-library-rb/core_ext', __FILE__)
20
+ Dir.glob(lib_path) do |file|
21
+ next unless FileTest.file?(file)
22
+
23
+ path = Pathname.new(lock_dir) + Pathname.new(file).basename
24
+ File.open(path, "w") do |f|
25
+ f.puts File.readlines(file)
26
+ end
27
+ end
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ See [FenwickTree document (fenwick_tree.md)](https://github.com/universato/ac-library-rb/blob/main/document_en/fenwick_tree.md).
2
+
3
+ Fenwick Tree is an alias of BIT(Binary Index Tree).
@@ -0,0 +1,67 @@
1
+ # Convolution
2
+
3
+ Performs convolution. An array of `Integer` of length `N`, `a[0],a[1],... ,a[N - 1]` and an array of `Integer` of length `M`, `b[0],b[1],... ,b[M - 1]`, and returns it as `c`, an array of `Integer` of length `N + M - 1`.
4
+
5
+ ## convolution
6
+
7
+ ``ruby
8
+ (1) conv = Convolution.new(m = 998244353)
9
+ (2) conv = Convolution.new(m, primitive_root)
10
+ ``
11
+
12
+ It creates an object to compute the convolution with `mod m`.
13
+
14
+ The `primitive_root` must be a primitive root for the method `m`. If it is not given, the minimal primitive root is computed internally.
15
+
16
+ **constraints**.
17
+
18
+ - `2 ≤ m`.
19
+
20
+ - `m` is a prime number
21
+
22
+ - ((2) only) `primitive_root` is the primitive root for law `m`.
23
+
24
+ **computational complexity** 1.
25
+
26
+ 1.`O(sqrt m)` 2.
27
+
28
+ 2.`O(log m)`.
29
+
30
+ ### Usage
31
+
32
+ The actual computation is done as follows, using the object `conv` created above.
33
+
34
+ ```ruby
35
+ c = conv.convolution(a, b)
36
+ ```
37
+
38
+ If at least one of `a` and `b` is an empty array, it returns an empty array.
39
+
40
+ **constraints**.
41
+
42
+ - There exists a `c` such that `2^c|(m-1)` and `|a|+|b|-1<=2^c`.
43
+
44
+ **computational complexity**.
45
+
46
+ - `O((|a|+|b|) log (|a|+|b|))`
47
+
48
+ ## convolution_ll
49
+
50
+ This can be handled by using a sufficiently large prime number as `m` in `convolution`.
51
+
52
+ An example of an `NTT-Friendly` prime over `1e15` is `1125900443713537 = 2^29×2097153+1`.
53
+
54
+ # Verified
55
+
56
+ - [C - Fast Fourier Transform](https://atcoder.jp/contests/atc001/tasks/fft_c)
57
+ - `m = 1012924417`
58
+ [1272ms](https://atcoder.jp/contests/atc001/submissions/17193829)
59
+ - `m = 1125900443713537`
60
+ [2448 ms](https://atcoder.jp/contests/atc001/submissions/17193739)
61
+
62
+ # Reference.
63
+
64
+ - [Main ACL documentation Convolution](https://atcoder.github.io/ac-library/master/document_ja/convolution.html)
65
+
66
+
67
+ Translated with www.DeepL.com/Translator (free version)
@@ -0,0 +1,132 @@
1
+ # DSU - Disjoint Set Union
2
+
3
+ **alias: Union Find**
4
+
5
+ Given an undirected graph, it processes the following queries in `O(α(n))` time (amortized).
6
+
7
+ - Edge addition
8
+ - Deciding whether given two vertices are in the same connected component
9
+
10
+ Each connected component internally has a representative vertex.
11
+
12
+ When two connected components are merged by edge addition, one of the two representatives of these connected components becomes the representative of the new connected component.
13
+
14
+ ## Usage
15
+
16
+ ```rb
17
+ d = DSU.new(5)
18
+ p d.groups # => [[0], [1], [2], [3], [4]]
19
+ p d.same?(2, 3) # => false
20
+ p d.size(2) # => 1
21
+
22
+ d.merge(2, 3)
23
+ p d.groups # => [[0], [1], [2, 3], [4]]
24
+ p d.same?(2, 3) # => true
25
+ p d.size(2) # => 2
26
+ ```
27
+
28
+ ## Class Method
29
+
30
+ ### new(n = 0) -> DSU
31
+
32
+ ```rb
33
+ d = DSU.new(n)
34
+ ```
35
+
36
+ It creates an undirected graph with `n` vertices and `0` edges.
37
+
38
+ **complexity**
39
+
40
+ - `O(n)`
41
+
42
+ **alias**
43
+
44
+ - `DSU`, `DisjointSetUnion`, `UnionFind`, `UnionFindTree`
45
+
46
+ ## Instance Methods
47
+
48
+ ### merge(a, b) -> Integer
49
+
50
+ ```rb
51
+ d.merge(a, b)
52
+ ```
53
+
54
+ It adds an edge $(a, b)$.
55
+
56
+ If the vertices $a$ and $b$ were in the same connected component, it returns the representative of this connected component. Otherwise, it returns the representative of the new connected component.
57
+
58
+ **complexity**
59
+
60
+ - `O(α(n))` amortized
61
+
62
+ **alias**
63
+
64
+ - `merge`, `unite`
65
+
66
+ ### same?(a, b) -> bool
67
+
68
+ ```rb
69
+ d.same?(a, b)
70
+ ```
71
+
72
+ It returns whether the vertices `a` and `b` are in the same connected component.
73
+
74
+ **complexity**
75
+
76
+ - `O(α(n))` amortized
77
+
78
+ **alias**
79
+
80
+ - `same?`, `same`
81
+
82
+ ### leader(a) -> Integer
83
+
84
+ ```rb
85
+ d.leader(a)
86
+ ```
87
+
88
+ It returns the representative of the connected component that contains the vertex `a`.
89
+
90
+ **complexity**
91
+
92
+ - `O(α(n))` amortized
93
+
94
+ **alias**
95
+
96
+ - `leader`, `root`, `find`
97
+
98
+ ### size(a) -> Integer
99
+
100
+ It returns the size of the connected component that contains the vertex `a`.
101
+
102
+ **complexity**
103
+
104
+ - `O(α(n))` amortized
105
+
106
+ ### groups -> Array(Array(Integer))
107
+
108
+ ```rb
109
+ d.groups
110
+ ```
111
+
112
+ It divides the graph into connected components and returns the list of them.
113
+
114
+ More precisely, it returns the list of the "list of the vertices in a connected component". Both of the orders of the connected components and the vertices are undefined.
115
+
116
+
117
+ **complexity**
118
+
119
+ - `O(α(n))` amortized
120
+
121
+ ## Verified
122
+
123
+ [A \- Disjoint Set Union](https://atcoder.jp/contests/practice2/tasks/practice2_a)
124
+
125
+ ## Links & Reference
126
+
127
+ - ac-library-rb
128
+ - [Code dsu.rb](https://github.com/universato/ac-library-rb/blob/master/lib/dsu.rb)
129
+ - [Test dsu_test.rb](https://github.com/universato/ac-library-rb/blob/master/test/dsu_test.rb)
130
+ - AtCoder Library
131
+ - [Document](https://github.com/atcoder/ac-library/blob/master/document_en/dsu.md)
132
+ - [Code dsu.hpp](https://github.com/atcoder/ac-library/blob/master/atcoder/dsu.hpp)
@@ -0,0 +1,99 @@
1
+ # Fenwick Tree
2
+
3
+ **alias: BIT (Binary Indexed Tree)**
4
+
5
+ Given an array of length `N`, it processes the following queries in `O(log N)` time.
6
+
7
+ - Updating an element
8
+ - Calculating the sum of the elements of an interval
9
+
10
+ ## Class Method
11
+
12
+ ### new(n) -> FenwickTree
13
+
14
+ ```rb
15
+ fw = FenwickTree.new(5)
16
+ ```
17
+
18
+ It creates an array `a_0, a_1, ...... a_{n-1}` of length `n`. All the elements are initialized to `0`.
19
+
20
+ **complexity**
21
+
22
+ - `O(n)`
23
+
24
+ ### new(ary) -> FenwickTree
25
+
26
+ ```rb
27
+ fw = FenwickTree.new([1, 3, 2])
28
+ ```
29
+
30
+ It creates an array `ary`.
31
+
32
+ **complexity**
33
+
34
+ - `O(n)`
35
+
36
+ ## add(pos, x)
37
+
38
+ ```rb
39
+ fw.add(pos, x)
40
+ ```
41
+
42
+ It processes `a[p] += x`.
43
+
44
+ `pos` is zero-based index.
45
+
46
+ **constraints**
47
+
48
+ - `0 ≦ pos < n`
49
+
50
+ **complexity**
51
+
52
+ - `O(log n)`
53
+
54
+ ## sum(l, r) ->Integer
55
+
56
+ ```rb
57
+ fw.sum(l, r)
58
+ ```
59
+
60
+ It returns `a[l] + a[l + 1] + ... + a[r - 1]`.
61
+
62
+ It equals `fw._sum(r) - fw._sum(l)`
63
+
64
+ **constraints**
65
+
66
+ - `0 ≦ l ≦ r ≦ n`
67
+
68
+ **complexity**
69
+
70
+ - `O(log n)`
71
+
72
+ ## _sum(pos) -> Integer
73
+
74
+ ```rb
75
+ fw._sum(pos)
76
+ ```
77
+
78
+ It returns `a[0] + a[1] + ... + a[pos - 1]`.
79
+
80
+ **complexity**
81
+
82
+ - `O(logn)`
83
+
84
+ ## Verified
85
+
86
+ - [AtCoder ALPC B \- Fenwick Tree](https://atcoder.jp/contests/practice2/tasks/practice2_b)
87
+ - [AC Code(1272ms)](https://atcoder.jp/contests/practice2/submissions/17074108)
88
+ - [F \- Range Xor Query](https://atcoder.jp/contests/abc185/tasks/abc185_f)
89
+ - [AC Code(821ms)](https://atcoder.jp/contests/abc185/submissions/18769200)
90
+
91
+
92
+ ## Link
93
+
94
+ - ac-library-rb
95
+ - [Code dsu.rb](https://github.com/universato/ac-library-rb/blob/master/lib/dsu.rb)
96
+ - [Test dsu_test.rb](https://github.com/universato/ac-library-rb/blob/master/test/dsu_test.rb)
97
+ - AtCoder
98
+ - [fenwicktree.html](https://atcoder.github.io/ac-library/document_en/fenwicktree.html)
99
+ - [Code fenwick.hpp](https://github.com/atcoder/ac-library/blob/master/atcoder/fenwick.hpp)
@@ -0,0 +1,79 @@
1
+ # index
2
+
3
+ | C | D | |
4
+ | :--- | :--- | --- |
5
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/fenwick_tree.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/fenwick_tree.md) |FenwickTree(BIT)|
6
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/segtree.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/segtree.md) |Segtree|
7
+ | [○](https://github.com/universato/ac-library-rb/blob/master/lib/lazy_segtree.rb) | [○G](https://github.com/universato/ac-library-rb/blob/master/document_ja/lazy_segtree.md) |LazySegtree|
8
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/priority_queue.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/priority_queue.md) |PriorityQueue|
9
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/suffix_array.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/string.md) |suffix_array|
10
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/lcp_array.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/string.md) |lcp_array|
11
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/z_algorithm.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/string.md) |z_algorithm|
12
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/pow_mod.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/math.md) |pow_mod|
13
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/inv_mod.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/math.md) |inv_mod|
14
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/crt.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/math.md) |crt(Chinese remainder theorem)|
15
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/floor_sum.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/math.md) |floor_sum|
16
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/convolution.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/convolution.md) |convolution|
17
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/modint.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/modint.md) |ModInt|
18
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/dsu.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/dsu.md) |DSU(UnionFind)|
19
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/max_flow.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/max_flow.md) |MaxFlow|
20
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/min_cost_flow.rb) |[◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/min_cost_flow.md) |MinCostFlow|
21
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/scc.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/scc.md) |SCC (Strongly Connected Component)|
22
+ | [◎](https://github.com/universato/ac-library-rb/blob/master/lib/two_sat.rb) | [◎G](https://github.com/universato/ac-library-rb/blob/master/document_ja/two_sat.md) |TwoSat|
23
+
24
+ ## Link to Code on GitHub
25
+
26
+ ### Data structure
27
+
28
+ - [fenwick_tree.rb](https://github.com/universato/ac-library-rb/blob/master/lib/fenwick_tree.rb)
29
+ - [segtree.rb](https://github.com/universato/ac-library-rb/blob/master/lib/segtree.rb)
30
+ - [lazy_segtree.rb](https://github.com/universato/ac-library-rb/blob/master/lib/lazy_segtree.rb)
31
+ - [priority_queue.rb](https://github.com/universato/ac-library-rb/blob/master/lib/priority_queue.rb)
32
+ - String
33
+ - [suffix_array.rb](https://github.com/universato/ac-library-rb/blob/master/lib/suffix_array.rb)
34
+ - [lcp_array.rb](https://github.com/universato/ac-library-rb/blob/master/lib/lcp_array.rb)
35
+ - [z_algorithm.rb](https://github.com/universato/ac-library-rb/blob/master/lib/z_algorithm.rb)
36
+
37
+ ### Math
38
+
39
+ - math
40
+ - [pow_mod.rb](https://github.com/universato/ac-library-rb/blob/master/lib/pow_mod.rb)
41
+ - [inv_mod.rb](https://github.com/universato/ac-library-rb/blob/master/lib/inv_mod.rb)
42
+ - [crt.rb](https://github.com/universato/ac-library-rb/blob/master/lib/crt.rb)
43
+ - [floor_sum.rb](https://github.com/universato/ac-library-rb/blob/master/lib/floor_sum.rb)
44
+ - [convolution.rb](https://github.com/universato/ac-library-rb/blob/master/lib/convolution.rb)
45
+ - [modint.rb](https://github.com/universato/ac-library-rb/blob/master/lib/modint.rb)
46
+
47
+ ### Graph
48
+
49
+ - [dsu.rb](https://github.com/universato/ac-library-rb/blob/master/lib/dsu.rb)
50
+ - [max_flow.rb](https://github.com/universato/ac-library-rb/blob/master/lib/max_flow.rb)
51
+ - [min_cost_flow.rb](https://github.com/universato/ac-library-rb/blob/master/lib/min_cost_flow.rb)
52
+ - [scc.rb](https://github.com/universato/ac-library-rb/blob/master/lib/scc.rb)
53
+ - [two_sat.rb](https://github.com/universato/ac-library-rb/blob/master/lib/two_sat.rb)
54
+
55
+ ## Alphabet Order Index
56
+
57
+ <details>
58
+ <summary>Alphabet Order Index</summary>
59
+
60
+ [convolution.rb](https://github.com/universato/ac-library-rb/blob/master/lib/convolution.rb)
61
+ [crt.rb](https://github.com/universato/ac-library-rb/blob/master/lib/crt.rb)
62
+ [dsu.rb](https://github.com/universato/ac-library-rb/blob/master/lib/dsu.rb)
63
+ [fenwick_tree.rb](https://github.com/universato/ac-library-rb/blob/master/lib/fenwick_tree.rb)
64
+ [floor_sum.rb](https://github.com/universato/ac-library-rb/blob/master/lib/floor_sum..rb)
65
+ [inv_mod.rb](https://github.com/universato/ac-library-rb/blob/master/lib/inv_mod.rb)
66
+ [lazy_segtree.rb](https://github.com/universato/ac-library-rb/blob/master/lib/lazy_segtree.rb)
67
+ [lcp_array.rb](https://github.com/universato/ac-library-rb/blob/master/lib/lcp_array.rb)
68
+ [max_flow.rb](https://github.com/universato/ac-library-rb/blob/master/lib/max_flow.rb)
69
+ [min_cost_flow.rb](https://github.com/universato/ac-library-rb/blob/master/lib/min_cost_flow.rb)
70
+ [modint.rb](https://github.com/universato/ac-library-rb/blob/master/lib/modint.rb)
71
+ [pow_mod.rb](https://github.com/universato/ac-library-rb/blob/master/lib/pow_mod.rb)
72
+ [priority_queue.rb](https://github.com/universato/ac-library-rb/blob/master/lib/priority_queue.rb)
73
+ [scc.rb](https://github.com/universato/ac-library-rb/blob/master/lib/scc.rb)
74
+ [segtree.rb](https://github.com/universato/ac-library-rb/blob/master/lib/segtree.rb)
75
+ [suffix_array.rb](https://github.com/universato/ac-library-rb/blob/master/lib/suffix_array.rb)
76
+ [two_sat.rb](https://github.com/universato/ac-library-rb/blob/master/lib/two_sat.rb)
77
+ [z_algorithm.rb](https://github.com/universato/ac-library-rb/blob/master/lib/z_algorithm.rb)
78
+
79
+ </details>