Skip to content

Commit c553e26

Browse files
use >> 1 for bit manipulation, / 2 for arithmetic halving (#240)
* data_structures: use >> 1 instead of / 2 for non-negative halving * [auto-verifier] verify commit 070a61a * library: use >> 1 instead of / 2 for non-negative halving repo-wide * [auto-verifier] verify commit 9f11767 * tests: use >> 1 instead of / 2 for non-negative halving * use / 2 for arithmetic halving, keep >> 1 for bit manipulation --------- Co-authored-by: GitHub <noreply@github.com>
1 parent 5feab23 commit c553e26

9 files changed

Lines changed: 56 additions & 56 deletions

File tree

.verify-helper/timestamps.remote.json

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"tests/library_checker_aizu_tests/convolution/gcd_convolution.test.cpp": "2026-07-07 12:06:00 -0700",
33
"tests/library_checker_aizu_tests/convolution/lcm_convolution.test.cpp": "2026-07-07 12:06:00 -0700",
4-
"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2026-07-08 09:28:48 -0700",
4+
"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2026-07-10 19:12:24 -0700",
55
"tests/library_checker_aizu_tests/convolution/xor_convolution.test.cpp": "2026-07-08 09:28:48 -0700",
66
"tests/library_checker_aizu_tests/data_structures/binary_search_example.test.cpp": "2026-07-06 13:10:16 -0700",
7-
"tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp": "2026-07-08 09:28:48 -0700",
8-
"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2026-07-09 22:46:18 -0600",
9-
"tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp": "2026-07-09 22:46:18 -0600",
10-
"tests/library_checker_aizu_tests/data_structures/bit_inc_walk.test.cpp": "2026-07-09 22:46:18 -0600",
11-
"tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp": "2026-07-09 22:46:18 -0600",
12-
"tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp": "2026-07-09 22:46:18 -0600",
13-
"tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp": "2026-07-09 22:46:18 -0600",
14-
"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2026-07-09 22:46:18 -0600",
15-
"tests/library_checker_aizu_tests/data_structures/deque.test.cpp": "2026-07-06 13:49:19 -0700",
16-
"tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp": "2026-07-06 13:49:19 -0700",
17-
"tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp": "2026-07-07 12:06:00 -0700",
18-
"tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp": "2026-07-06 13:49:19 -0700",
7+
"tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp": "2026-07-10 19:12:24 -0700",
8+
"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2026-07-10 16:56:24 -0700",
9+
"tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp": "2026-07-10 16:56:24 -0700",
10+
"tests/library_checker_aizu_tests/data_structures/bit_inc_walk.test.cpp": "2026-07-10 16:56:24 -0700",
11+
"tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp": "2026-07-10 16:56:24 -0700",
12+
"tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp": "2026-07-10 16:56:24 -0700",
13+
"tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp": "2026-07-10 16:56:24 -0700",
14+
"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2026-07-10 16:56:24 -0700",
15+
"tests/library_checker_aizu_tests/data_structures/deque.test.cpp": "2026-07-10 16:56:24 -0700",
16+
"tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp": "2026-07-10 16:56:24 -0700",
17+
"tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp": "2026-07-10 16:56:24 -0700",
18+
"tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp": "2026-07-10 16:56:24 -0700",
1919
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp": "2026-07-09 23:01:31 -0500",
2020
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp": "2026-07-09 23:01:31 -0500",
2121
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_sum.test.cpp": "2026-07-09 23:01:31 -0500",
@@ -24,11 +24,11 @@
2424
"tests/library_checker_aizu_tests/data_structures/kd_bit_1d.test.cpp": "2026-07-06 13:10:16 -0700",
2525
"tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp": "2026-07-07 10:02:09 -0700",
2626
"tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp": "2026-07-07 12:06:00 -0700",
27-
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2026-07-07 12:06:00 -0700",
28-
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2026-07-07 12:06:00 -0700",
29-
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp": "2026-07-06 13:10:16 -0700",
30-
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-06 13:10:16 -0700",
31-
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700",
27+
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2026-07-10 16:56:24 -0700",
28+
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2026-07-10 16:56:24 -0700",
29+
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp": "2026-07-10 16:56:24 -0700",
30+
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-10 16:56:24 -0700",
31+
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-10 16:56:24 -0700",
3232
"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-07-06 13:10:16 -0700",
3333
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-09 23:01:31 -0500",
3434
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-07-07 10:02:09 -0700",
@@ -37,14 +37,14 @@
3737
"tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp": "2026-07-06 13:10:16 -0700",
3838
"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-07-09 23:01:31 -0500",
3939
"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-07-09 23:01:31 -0500",
40-
"tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-07-09 23:01:31 -0500",
41-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-07-09 23:01:31 -0500",
42-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-07-09 23:01:31 -0500",
43-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_queue.test.cpp": "2026-07-09 23:01:31 -0500",
44-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-07-09 23:01:31 -0500",
45-
"tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-07-09 23:01:31 -0500",
46-
"tests/library_checker_aizu_tests/data_structures/simple_tree_queue.test.cpp": "2026-07-09 23:01:31 -0500",
47-
"tests/library_checker_aizu_tests/data_structures/simple_tree_walk.test.cpp": "2026-07-09 23:01:31 -0500",
40+
"tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-07-10 16:56:24 -0700",
41+
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-07-10 16:56:24 -0700",
42+
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-07-10 16:56:24 -0700",
43+
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_queue.test.cpp": "2026-07-10 16:56:24 -0700",
44+
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-07-10 16:56:24 -0700",
45+
"tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-07-10 16:56:24 -0700",
46+
"tests/library_checker_aizu_tests/data_structures/simple_tree_queue.test.cpp": "2026-07-10 16:56:24 -0700",
47+
"tests/library_checker_aizu_tests/data_structures/simple_tree_walk.test.cpp": "2026-07-10 16:56:24 -0700",
4848
"tests/library_checker_aizu_tests/dsu/dsu.test.cpp": "2026-02-27 15:26:53 -0700",
4949
"tests/library_checker_aizu_tests/dsu/dsu_bipartite.test.cpp": "2026-07-07 12:06:00 -0700",
5050
"tests/library_checker_aizu_tests/dsu/dsu_weighted_aizu.test.cpp": "2026-07-07 12:06:00 -0700",
@@ -79,27 +79,27 @@
7979
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-08 09:28:48 -0700",
8080
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-07-07 12:06:00 -0700",
8181
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-07 12:06:00 -0700",
82-
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-07 12:06:00 -0700",
82+
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-10 16:56:24 -0700",
8383
"tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-07-07 12:06:00 -0700",
84-
"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-09 23:01:31 -0500",
85-
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-07-09 23:01:31 -0500",
86-
"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-07-07 12:06:00 -0700",
84+
"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-10 19:12:24 -0700",
85+
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-07-10 19:12:24 -0700",
86+
"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-07-10 16:56:24 -0700",
8787
"tests/library_checker_aizu_tests/handmade_tests/mobius.test.cpp": "2026-07-06 13:10:16 -0700",
8888
"tests/library_checker_aizu_tests/handmade_tests/mod_division.test.cpp": "2026-07-08 09:28:48 -0700",
8989
"tests/library_checker_aizu_tests/handmade_tests/n_choose_k.test.cpp": "2026-07-07 12:06:00 -0700",
9090
"tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp": "2026-07-09 23:01:31 -0500",
9191
"tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp": "2026-07-09 23:01:31 -0500",
9292
"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-07-09 23:01:31 -0500",
93-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-09 22:46:18 -0600",
94-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-07 12:06:00 -0700",
95-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-07 09:17:02 -0700",
93+
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-10 16:56:24 -0700",
94+
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-10 16:56:24 -0700",
95+
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-10 16:56:24 -0700",
9696
"tests/library_checker_aizu_tests/handmade_tests/xor_basis_walk.test.cpp": "2026-07-07 12:06:00 -0700",
9797
"tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2026-07-06 13:10:16 -0700",
9898
"tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2026-07-06 13:10:16 -0700",
9999
"tests/library_checker_aizu_tests/loops/submasks.test.cpp": "2026-07-08 09:28:48 -0700",
100100
"tests/library_checker_aizu_tests/loops/supermasks.test.cpp": "2026-07-06 13:10:16 -0700",
101101
"tests/library_checker_aizu_tests/math/binary_matrix_mult.test.cpp": "2026-07-06 13:10:16 -0700",
102-
"tests/library_checker_aizu_tests/math/count_paths.test.cpp": "2026-07-07 21:14:10 -0700",
102+
"tests/library_checker_aizu_tests/math/count_paths.test.cpp": "2026-07-10 19:12:24 -0700",
103103
"tests/library_checker_aizu_tests/math/derangement.test.cpp": "2026-07-08 09:28:48 -0700",
104104
"tests/library_checker_aizu_tests/math/matrix_determinant.test.cpp": "2026-07-08 09:28:48 -0700",
105105
"tests/library_checker_aizu_tests/math/matrix_mult.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -108,7 +108,7 @@
108108
"tests/library_checker_aizu_tests/math/partitions.test.cpp": "2026-07-08 09:28:48 -0700",
109109
"tests/library_checker_aizu_tests/math/prime_sieve.test.cpp": "2026-07-06 13:10:16 -0700",
110110
"tests/library_checker_aizu_tests/math/solve_linear_mod.test.cpp": "2026-07-08 09:28:48 -0700",
111-
"tests/library_checker_aizu_tests/math/tetration.test.cpp": "2026-07-06 10:41:44 -0700",
111+
"tests/library_checker_aizu_tests/math/tetration.test.cpp": "2026-07-10 19:12:24 -0700",
112112
"tests/library_checker_aizu_tests/math/totient.test.cpp": "2024-11-17 14:04:03 -0600",
113113
"tests/library_checker_aizu_tests/math/xor_basis_intersection.test.cpp": "2026-07-07 12:06:00 -0700",
114114
"tests/library_checker_aizu_tests/monotonic_stack_related/cartesian_binary_tree.test.cpp": "2026-07-07 12:06:00 -0700",
@@ -120,9 +120,9 @@
120120
"tests/library_checker_aizu_tests/strings/lcp_query_palindrome.test.cpp": "2026-07-09 23:01:31 -0500",
121121
"tests/library_checker_aizu_tests/strings/lcp_query_zfunc.test.cpp": "2026-07-09 23:01:31 -0500",
122122
"tests/library_checker_aizu_tests/strings/lcs_dp.test.cpp": "2026-07-06 13:10:16 -0700",
123-
"tests/library_checker_aizu_tests/strings/lcs_queries.test.cpp": "2026-07-09 22:46:18 -0600",
124-
"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700",
125-
"tests/library_checker_aizu_tests/strings/manacher.test.cpp": "2026-07-07 12:06:00 -0700",
123+
"tests/library_checker_aizu_tests/strings/lcs_queries.test.cpp": "2026-07-10 16:56:24 -0700",
124+
"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2026-07-10 16:56:24 -0700",
125+
"tests/library_checker_aizu_tests/strings/manacher.test.cpp": "2026-07-10 19:12:24 -0700",
126126
"tests/library_checker_aizu_tests/strings/multi_matching_bs.test.cpp": "2026-07-09 23:01:31 -0500",
127127
"tests/library_checker_aizu_tests/strings/prefix_function.test.cpp": "2026-07-06 13:10:16 -0700",
128128
"tests/library_checker_aizu_tests/strings/sa_cmp.test.cpp": "2026-07-09 23:01:31 -0500",
@@ -133,18 +133,18 @@
133133
"tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-07-06 13:10:16 -0700",
134134
"tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2026-07-07 12:06:00 -0700",
135135
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-08 09:28:48 -0700",
136-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-09 22:46:18 -0600",
137-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-09 22:46:18 -0600",
136+
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-10 16:56:24 -0700",
137+
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-10 16:56:24 -0700",
138138
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-08 09:28:48 -0700",
139139
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-08 09:28:48 -0700",
140-
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-09 22:46:18 -0600",
141-
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-08 22:13:09 -0500",
142-
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-09 22:46:18 -0600",
143-
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-07-09 22:46:18 -0600",
144-
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-07-09 22:46:18 -0600",
140+
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-10 16:56:24 -0700",
141+
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-10 16:56:24 -0700",
142+
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-10 16:56:24 -0700",
143+
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-07-10 16:56:24 -0700",
144+
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-07-10 16:56:24 -0700",
145145
"tests/library_checker_aizu_tests/trees/kth_path_hagerup.test.cpp": "2026-07-09 23:01:31 -0500",
146146
"tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2026-07-09 23:01:31 -0500",
147-
"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-07-09 23:01:31 -0500",
147+
"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-07-10 19:12:24 -0700",
148148
"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-09 23:01:31 -0500",
149149
"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-09 23:01:31 -0500",
150150
"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-09 23:01:31 -0500",

library/data_structures_[l,r)/bit_uncommon/walk.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
int walk(ll sum) {
22
if (sum <= 0) return -1;
33
int r = 0;
4-
for (int i = bit_floor(size(s)); i; i /= 2)
4+
for (int i = bit_floor(size(s)); i; i >>= 1)
55
if (r + i <= sz(s) && s[r + i - 1] < sum)
66
sum -= s[(r += i) - 1];
77
return r;

library/data_structures_[l,r)/seg_tree.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ template<class T, class F> struct tree {
2727
tree(int n, T unit, F op):
2828
n(n), unit(unit), op(op), s(2 * n, unit) {}
2929
void update(int i, T val) {
30-
for (s[i += n] = val; i /= 2;)
30+
for (s[i += n] = val; i >>= 1;)
3131
s[i] = op(s[2 * i], s[2 * i + 1]);
3232
}
3333
T query(int l, int r) {
3434
T x = unit, y = unit;
35-
for (l += n, r += n; l < r; l /= 2, r /= 2) {
35+
for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
3636
if (l % 2) x = op(x, s[l++]);
3737
if (r % 2) y = op(s[--r], y);
3838
}

library/data_structures_[l,r)/uncommon/hilbert_mos.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
ll hilbert(int x, int y) {
1212
ll d = 0, mx = 1;
1313
while (mx <= max(x, y)) mx *= 4;
14-
for (int s = mx / 2; s; s /= 2) {
14+
for (int s = mx >> 1; s; s >>= 1) {
1515
bool rx = x & s, ry = y & s;
1616
d = d * 4 | (ry * 3 ^ rx);
1717
if (!rx) {

library/data_structures_[l,r]/seg_tree.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ template<class T, class F> struct tree {
3030
n(n), op(op), s(2 * n, unit) {}
3131
#include "seg_tree_uncommon/init.hpp"
3232
void update(int i, T val) {
33-
for (s[i += n] = val; i /= 2;)
33+
for (s[i += n] = val; i >>= 1;)
3434
s[i] = op(s[2 * i], s[2 * i + 1]);
3535
}
3636
T query(int l, int r) {

library/math/tetration_mod.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ll bin_exp(ll b, ll e, int mod) {
1414
ll res = 1;
1515
if ((b %= mod) < 0) b += mod;
16-
for (; e; b = b * b % mod, e /= 2)
16+
for (; e; b = b * b % mod, e >>= 1)
1717
if (e & 1) res = res * b % mod;
1818
return res;
1919
}

library/strings/binary_trie.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct binary_trie {
1818
binary_trie(): t(1) {}
1919
void update(ll num, int delta) {
2020
int v = 0;
21-
for (ll bit = mx_bit; bit; bit /= 2) {
21+
for (ll bit = mx_bit; bit; bit >>= 1) {
2222
bool b = num & bit;
2323
if (t[v].nxt[b] == -1) {
2424
t[v].nxt[b] = sz(t);
@@ -31,7 +31,7 @@ struct binary_trie {
3131
ll walk(ll num) {
3232
int v = 0;
3333
ll res = 0;
34-
for (ll bit = mx_bit; bit; bit /= 2) {
34+
for (ll bit = mx_bit; bit; bit >>= 1) {
3535
bool b = num & bit;
3636
int u = t[v].nxt[b];
3737
if (u != -1 && t[u].siz > 0) v = u, res |= num & bit;

library/trees/uncommon/linear_kth_par.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct linear_kth_par {
5050
assert(0 <= k && k <= d[u]);
5151
if (k == 0) return u;
5252
int anc_d = d[u] - k, bc = bit_ceil(k + 0u);
53-
int t = (tin[u] + bc / 2) & -bc;
53+
int t = (tin[u] + (bc >> 1)) & -bc;
5454
int i =
5555
idx[jmp[t].at(bit_width((d_tour[t] - anc_d) / 2u))];
5656
return lad[i + d[lad[i]] - anc_d];

tests/library_checker_aizu_tests/math/count_paths.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#undef modpow
1414
ll modpow(ll b, ll e) {
1515
ll res = 1;
16-
for (; e; b = b * b % 998'244'353, e /= 2)
16+
for (; e; b = b * b % 998'244'353, e >>= 1)
1717
if (e & 1) res = res * b % 998'244'353;
1818
return res;
1919
}

0 commit comments

Comments
 (0)