Codeforces Global Round 29 (Div. 1 + Div. 2)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2147 Codeforces Global Round 29 (Div. 1 + Div. 2) FINISHED False 10800 20359530 Sept. 20, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 375 ) G Modular Tetration PROGRAMMING combinatorics math number theory

For a positive integer (a), we define a recurrence (\{b_n\}_{n\geq 0}) as (b_n = a^{b_{n-1}}), with (b_0 = 1). We say that a positive integer (a) is (m)- tetrative if the sequence (b) stabilizes to (1) modulo (m), that is, there exists (N \ge 0) such that (b_n \equiv 1 \pmod m) for all (n \geq N). For a given (m), calculate the density of the (m)- tetrative integers. Here, the density of a set (S) is the limit ()\lim\limits_{n\rightarrow \infty}\frac{|S\cap 1,2,\ldots,n|}{n}.() Informally, it is the "proportion" of positive integers that are (m)- tetrative . It can be proven (under the constraints of this problem) that the density is well-defined and is always a rational number, whose denominator is not divisible by (998\,244\,353). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The number (m) will be given to you as a product of three integers (x), (y), and (z). The first and only line of each test case contains three integers (x), (y), (z) ((1\leq x,y,z \leq 10^6), (m = xyz \geq 2)). For each test case, print the density of (m)- tetrative integers ((a) such that its corresponding sequence (b_n) converges to (1) modulo (m)), modulo (998\,244\,353). Formally, let (M = 998\,244\,353). It can be shown that the exact answer can be expressed as an irreducible fraction (\frac{p}{q}), where (p) and (q) are integers and (q \not \equiv 0 \pmod{M}). Output the integer equal to (p \cdot q^{-1} \bmod M). In other words, output such an integer (x) that (0 \le x < M) and (x \cdot q \equiv p \pmod{M}). In the first test case, (m = 5). For example, (a=1) is (5)- tetrative since (b_n = 1) for all (n). For (a= 8), the sequence (b) is $$$[1, 8, 8^8, 8^{(8^8)}

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
339599379 max0000561 G Sept. 20, 2025, 5:21 p.m. OK C++17 (GCC 7-32) TESTS 42 140 102400
339646504 _VNND G Sept. 21, 2025, 3:59 a.m. OK C++17 (GCC 7-32) TESTS 42 140 7987200
339601652 Sudhss G Sept. 20, 2025, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 42 156 8089600
339616598 kavyansh_krishan G Sept. 20, 2025, 7:16 p.m. OK C++17 (GCC 7-32) TESTS 42 171 8089600
339591635 arnav1209 G Sept. 20, 2025, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 42 171 8089600
339596315 Flamire G Sept. 20, 2025, 5:12 p.m. OK C++17 (GCC 7-32) TESTS 42 171 9113600
339596511 scli_kws G Sept. 20, 2025, 5:12 p.m. OK C++17 (GCC 7-32) TESTS 42 186 13107200
339598938 quant77 G Sept. 20, 2025, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 42 187 204800
339614074 Biswadev G Sept. 20, 2025, 6:59 p.m. OK C++17 (GCC 7-32) TESTS 42 187 8089600
339600234 jayasri_dasari G Sept. 20, 2025, 5:23 p.m. OK C++17 (GCC 7-32) TESTS 42 187 8089600
339616557 KroosTheKeenGlint G Sept. 20, 2025, 7:16 p.m. OK C++20 (GCC 13-64) TESTS 42 124 8089600
339618857 maxplus G Sept. 20, 2025, 7:34 p.m. OK C++20 (GCC 13-64) TESTS 42 139 4096000
339639413 balakrishnan G Sept. 21, 2025, 1:33 a.m. OK C++20 (GCC 13-64) TESTS 42 140 4096000
339598029 kotatsugame G Sept. 20, 2025, 5:17 p.m. OK C++20 (GCC 13-64) TESTS 42 140 4198400
339593477 Yvens G Sept. 20, 2025, 5:03 p.m. OK C++20 (GCC 13-64) TESTS 42 156 8089600
339611265 BurnedChicken G Sept. 20, 2025, 6:43 p.m. OK C++20 (GCC 13-64) TESTS 42 171 8089600
339602783 conan45 G Sept. 20, 2025, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 42 186 8089600
339600810 kotori1 G Sept. 20, 2025, 5:25 p.m. OK C++20 (GCC 13-64) TESTS 42 186 8089600
339599124 siddh2913 G Sept. 20, 2025, 5:20 p.m. OK C++20 (GCC 13-64) TESTS 42 186 8089600
339594952 Salman_04 G Sept. 20, 2025, 5:08 p.m. OK C++20 (GCC 13-64) TESTS 42 186 8089600
339650433 seanlsy G Sept. 21, 2025, 5 a.m. OK C++23 (GCC 14-64, msys2) TESTS 42 93 8601600
339611431 A_G G Sept. 20, 2025, 6:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 108 12083200
339614798 aimoon G Sept. 20, 2025, 7:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 109 3993600
339640127 jackylova_fan_fan_fan G Sept. 21, 2025, 1:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 42 109 8089600
339611612 OIer_kzc G Sept. 20, 2025, 6:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 109 9011200
339645151 Huder_Zaluu G Sept. 21, 2025, 3:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 42 124 102400
339630491 ApurbaKumarShow G Sept. 20, 2025, 9:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 124 204800
339613217 IzhitskiyTimofey G Sept. 20, 2025, 6:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 139 204800
339632951 salatunia G Sept. 20, 2025, 10:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 139 3993600
339614689 a_b_68687 G Sept. 20, 2025, 7:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 42 140 204800
339601433 Cybuster G Sept. 20, 2025, 5:27 p.m. OK D TESTS 42 359 6860800
339596970 k.saijaswanth G Sept. 20, 2025, 5:14 p.m. OK Go TESTS 42 156 20992000
339590852 practiceDaily25 G Sept. 20, 2025, 4:56 p.m. OK Go TESTS 42 171 30208000
339600616 SanjeevKumarRay_4 G Sept. 20, 2025, 5:25 p.m. OK Java 21 TESTS 42 390 18636800
339593494 hs1663531 G Sept. 20, 2025, 5:03 p.m. OK Java 21 TESTS 42 436 6656000
339592537 2310030053 G Sept. 20, 2025, 5:01 p.m. OK Java 21 TESTS 42 453 6656000
339603021 panavagarwal G Sept. 20, 2025, 5:32 p.m. OK Java 21 TESTS 42 561 6758400
339604271 sajjadahmeddd G Sept. 20, 2025, 5:34 p.m. OK Java 21 TESTS 42 561 7680000
339591233 Pikaboo_2609 G Sept. 20, 2025, 4:57 p.m. OK Java 21 TESTS 42 624 1331200
339622271 akttripathi395 G Sept. 20, 2025, 8:03 p.m. OK Java 21 TESTS 42 624 7475200
339603347 amber_100 G Sept. 20, 2025, 5:33 p.m. OK Java 8 TESTS 42 296 2867200
339596360 jsomya2004 G Sept. 20, 2025, 5:12 p.m. OK Java 8 TESTS 42 312 8192000
339590905 Tlatoani G Sept. 20, 2025, 4:56 p.m. OK Kotlin 2.2 TESTS 42 546 204800
339640198 banibrata2007 G Sept. 21, 2025, 1:52 a.m. OK PyPy 3-64 TESTS 42 671 22425600
339594203 lagged G Sept. 20, 2025, 5:06 p.m. OK PyPy 3-64 TESTS 42 827 18022400
339599416 shivamsai006 G Sept. 20, 2025, 5:21 p.m. OK PyPy 3-64 TESTS 42 1093 9830400
339589947 ozensei G Sept. 20, 2025, 4:53 p.m. OK PyPy 3-64 TESTS 42 1296 31129600
339644717 __akash24_13 G Sept. 21, 2025, 3:25 a.m. OK Python 3 TESTS 42 1593 51097600
339599952 The_witcher09 G Sept. 20, 2025, 5:23 p.m. OK Python 3 TESTS 42 1655 55398400
339599434 Aroon.09 G Sept. 20, 2025, 5:21 p.m. OK Python 3 TESTS 42 1718 55398400
339592590 InO4 G Sept. 20, 2025, 5:01 p.m. OK Rust 2024 TESTS 42 109 0

remove filters

Back to search problems