Codeforces Round 1072 (Div. 3)

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
2184 Codeforces Round 1072 (Div. 3) FINISHED False 8100 8177123 Jan. 12, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 23834 ) B Hourglass PROGRAMMING math

Vadim's hourglass measures (s) minutes. He flipped it over, and the time started. Every (k) minutes, Vadim will flip his hourglass again. He will do this even if the sand is still falling. Also, if the sand has already finished falling but there are still some minutes left, Vadim will wait for the required time and only then flip the hourglass. Each flip is done instantly. However, Vadim needs to leave for errands in (m) minutes, and he will stop flipping the hourglass (if Vadim needs to flip the hourglass in the last minute, he will do so). Determine how many minutes the sand will continue to fall after Vadim leaves. Each test consists of several test cases. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The following lines describe the test cases. In a single line of each test case, there are three integers (s), (k), and (m) — the number of minutes the hourglass measures, the number of minutes after which the hourglass flips, and the number of minutes after which Vadim will leave for errands ((1 \le s, k, m \le 10^9)). For each test case, output how many minutes the sand will continue to fall after Vadim leaves. In the first test case, Vadim will flip the hourglass just as the sand stops falling, then (4) minutes pass, Vadim leaves, and (4) minutes will remain. In the second test case, Vadim will flip the hourglass at the (10)-th minute, in the next (5) minutes the sand will completely finish falling, and in (2) minutes Vadim will leave, resulting in (0) minutes remaining. In the third test case, (2) minutes of sand have already fallen before the first flip, so after the flip, this sand will continue to fall. After (1) minute, (1) minute will remain. In the fourth test case, (7) minutes of sand have already fallen before the first flip, Vadim will perform it and immediately leave, so (7) minutes will remain.

Tutorials

Codeforces Round 1072 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
357784663 kushagra2245 B Jan. 14, 2026, 5:45 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357742940 Jerrasterix B Jan. 13, 2026, 5:47 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357739758 viivi B Jan. 13, 2026, 5:27 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357737282 Sasank123 B Jan. 13, 2026, 5:12 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357737004 sherrif_ahmed B Jan. 13, 2026, 5:10 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357717822 Ariad B Jan. 13, 2026, 2:53 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357716627 MelodicOctopus B Jan. 13, 2026, 2:43 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357706498 Jas19 B Jan. 13, 2026, 1:30 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357706030 sainiankit21981 B Jan. 13, 2026, 1:27 p.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357692797 Vansh_101 B Jan. 13, 2026, 11:41 a.m. OK C++17 (GCC 7-32) TESTS 3 15 0
357766161 AboSaleh B Jan. 13, 2026, 10:08 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357765374 ianding B Jan. 13, 2026, 9:45 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357763620 AbdelRahim_Osama B Jan. 13, 2026, 9:05 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357763565 AbdelRahim_Osama B Jan. 13, 2026, 9:04 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357759398 notnew B Jan. 13, 2026, 7:58 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357750260 Advay.05 B Jan. 13, 2026, 6:33 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357747242 avinashkumarmgr24 B Jan. 13, 2026, 6:13 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357725021 DivebombDijkstra B Jan. 13, 2026, 3:50 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357722852 tusharrx.ch B Jan. 13, 2026, 3:34 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357712848 Rohit_Chadda B Jan. 13, 2026, 2:14 p.m. OK C++20 (GCC 13-64) TESTS 3 15 0
357782822 girish_dhakar B Jan. 14, 2026, 5:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357782365 adityawcode B Jan. 14, 2026, 5:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357781891 avinash21 B Jan. 14, 2026, 5:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357780627 Cultmaster B Jan. 14, 2026, 4:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357772118 kkeansh B Jan. 14, 2026, 1:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357754811 Taslaq B Jan. 13, 2026, 7:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357747232 bala_siva B Jan. 13, 2026, 6:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357746815 arjund0702 B Jan. 13, 2026, 6:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357741154 1.b3 B Jan. 13, 2026, 5:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357740220 Kharshit801 B Jan. 13, 2026, 5:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 15 0
357746850 Piyush.1409 B Jan. 13, 2026, 6:10 p.m. OK GNU C11 TESTS 3 31 0
357740851 The_last123 B Jan. 13, 2026, 5:34 p.m. OK GNU C11 TESTS 3 31 0
357736703 Biswajeet-Omm B Jan. 13, 2026, 5:08 p.m. OK GNU C11 TESTS 3 31 0
357724411 pinkiphogat317 B Jan. 13, 2026, 3:45 p.m. OK GNU C11 TESTS 3 31 0
357710586 Zongb B Jan. 13, 2026, 1:58 p.m. OK GNU C11 TESTS 3 31 0
357710334 zerojanuary B Jan. 13, 2026, 1:56 p.m. OK GNU C11 TESTS 3 31 0
357773524 yvzuojianlianzi B Jan. 14, 2026, 2:28 a.m. OK GNU C11 TESTS 3 46 0
357771394 yvzuojianlianzi B Jan. 14, 2026, 1:24 a.m. OK GNU C11 TESTS 3 46 0
357732568 Ayush_Kumar_Sharma B Jan. 13, 2026, 4:42 p.m. OK GNU C11 TESTS 3 46 0
357714559 chemgod B Jan. 13, 2026, 2:26 p.m. OK GNU C11 TESTS 3 46 0
357778384 Leeeee B Jan. 14, 2026, 4:07 a.m. OK Go TESTS 3 31 614400
357653405 LittleGopher B Jan. 13, 2026, 4:51 a.m. OK Go TESTS 3 31 614400
357731620 VivirAstucia B Jan. 13, 2026, 4:36 p.m. OK Haskell TESTS 3 140 0
357673483 Dan1c B Jan. 13, 2026, 8:53 a.m. OK Java 21 TESTS 3 140 307200
357764168 satyam2611 B Jan. 13, 2026, 9:16 p.m. OK Java 21 TESTS 3 156 0
357766185 Jojomenace B Jan. 13, 2026, 10:09 p.m. OK Java 21 TESTS 3 156 409600
357759627 kishanbhadra B Jan. 13, 2026, 8:02 p.m. OK Java 21 TESTS 3 171 0
357709223 harshalwaghmare89 B Jan. 13, 2026, 1:49 p.m. OK Java 21 TESTS 3 171 102400
357683996 ailenibhargavreddy1 B Jan. 13, 2026, 10:25 a.m. OK Java 21 TESTS 3 171 409600
357712987 deepu4477 B Jan. 13, 2026, 2:15 p.m. OK Java 21 TESTS 3 187 0
357655262 rakshitsingh333 B Jan. 13, 2026, 5:17 a.m. OK Java 21 TESTS 3 187 204800
357739236 NpHardcore_05 B Jan. 13, 2026, 5:24 p.m. OK Java 21 TESTS 3 187 409600
357657719 rajumulik51 B Jan. 13, 2026, 5:48 a.m. OK Java 21 TESTS 3 187 409600
357653844 Picklzes B Jan. 13, 2026, 4:57 a.m. OK Java 8 TESTS 3 78 0
357742403 C47KIKI B Jan. 13, 2026, 5:44 p.m. OK Java 8 TESTS 3 109 0
357746950 jash.rashne B Jan. 13, 2026, 6:11 p.m. OK Java 8 TESTS 3 125 0
357705597 Piyushsinghal156 B Jan. 13, 2026, 1:24 p.m. OK Java 8 TESTS 3 125 0
357691326 Twinkal24 B Jan. 13, 2026, 11:29 a.m. OK Java 8 TESTS 3 156 0
357678276 jroy.karnati B Jan. 13, 2026, 9:35 a.m. OK Java 8 TESTS 3 156 0
357727867 javeed_123 B Jan. 13, 2026, 4:10 p.m. OK Java 8 TESTS 3 171 0
357739920 Vishalll_ B Jan. 13, 2026, 5:28 p.m. OK Java 8 TESTS 3 187 0
357679135 SaloniSinha B Jan. 13, 2026, 9:41 a.m. OK Java 8 TESTS 3 187 0
357775749 vamsidhar08 B Jan. 14, 2026, 3:18 a.m. OK Java 8 TESTS 3 203 0
357765112 arvindf232 B Jan. 13, 2026, 9:39 p.m. OK Kotlin 2.2 TESTS 3 140 0
357739633 tpsmacho B Jan. 13, 2026, 5:27 p.m. OK Node.js TESTS 3 187 11468800
357723934 Rudra_Dudhat B Jan. 13, 2026, 3:42 p.m. OK PyPy 3 TESTS 3 140 7065600
357781860 LaLiLuLaiLo B Jan. 14, 2026, 5:06 a.m. OK PyPy 3 TESTS 3 187 7372800
357655839 Nafosat_1306 B Jan. 13, 2026, 5:24 a.m. OK PyPy 3 TESTS 3 218 8396800
357734915 kaido_sama_ B Jan. 13, 2026, 4:57 p.m. OK PyPy 3 TESTS 3 234 6860800
357688378 itscris7777777 B Jan. 13, 2026, 11:04 a.m. OK PyPy 3 TESTS 3 234 8908800
357700787 Ayushman_123 B Jan. 13, 2026, 12:47 p.m. OK PyPy 3 TESTS 3 234 10342400
357733921 anishde85 B Jan. 13, 2026, 4:51 p.m. OK PyPy 3 TESTS 3 281 10547200
357737061 jinx_1407 B Jan. 13, 2026, 5:11 p.m. OK PyPy 3-64 TESTS 3 62 3174400
357678686 gardengnome B Jan. 13, 2026, 9:38 a.m. OK PyPy 3-64 TESTS 3 62 3584000
357657602 trexlore765 B Jan. 13, 2026, 5:46 a.m. OK PyPy 3-64 TESTS 3 62 4710400
357678991 hugoback01 B Jan. 13, 2026, 9:40 a.m. OK PyPy 3-64 TESTS 3 78 3686400
357772496 Sheikah B Jan. 14, 2026, 1:59 a.m. OK PyPy 3-64 TESTS 3 78 4812800
357706692 Vashya725 B Jan. 13, 2026, 1:31 p.m. OK PyPy 3-64 TESTS 3 78 4812800
357697106 Arihantt_ B Jan. 13, 2026, 12:18 p.m. OK PyPy 3-64 TESTS 3 78 5120000
357741655 titia B Jan. 13, 2026, 5:39 p.m. OK PyPy 3-64 TESTS 3 78 5734400
357721657 sanchit_kumar B Jan. 13, 2026, 3:23 p.m. OK PyPy 3-64 TESTS 3 78 6144000
357755860 Vikatoria B Jan. 13, 2026, 7:21 p.m. OK PyPy 3-64 TESTS 3 93 4710400
357779621 Ani_Shouko B Jan. 14, 2026, 4:30 a.m. OK Python 3 TESTS 3 46 102400
357779304 Ani_Shouko B Jan. 14, 2026, 4:24 a.m. OK Python 3 TESTS 3 46 102400
357747332 tailwind01 B Jan. 13, 2026, 6:14 p.m. OK Python 3 TESTS 3 46 2969600
357737238 jdxy201 B Jan. 13, 2026, 5:12 p.m. OK Python 3 TESTS 3 46 2969600
357720042 Gias_uddin_vuiya B Jan. 13, 2026, 3:10 p.m. OK Python 3 TESTS 3 46 2969600
357718300 Pranav1808 B Jan. 13, 2026, 2:56 p.m. OK Python 3 TESTS 3 46 2969600
357738964 co_ron B Jan. 13, 2026, 5:22 p.m. OK Python 3 TESTS 3 46 3072000
357754065 coder_gurl B Jan. 13, 2026, 7:04 p.m. OK Python 3 TESTS 3 62 0
357726123 matvei_akulov B Jan. 13, 2026, 3:58 p.m. OK Python 3 TESTS 3 62 0
357722263 ahsanul_farhan B Jan. 13, 2026, 3:29 p.m. OK Python 3 TESTS 3 62 0
357783926 Spheniscine B Jan. 14, 2026, 5:35 a.m. OK Rust 2021 TESTS 3 31 0
357716828 atofujiosukai B Jan. 13, 2026, 2:44 p.m. OK Rust 2021 TESTS 3 31 102400
357722627 cinkozzz B Jan. 13, 2026, 3:32 p.m. OK Rust 2024 TESTS 3 31 0
357690179 aeriesha B Jan. 13, 2026, 11:18 a.m. OK Rust 2024 TESTS 3 31 0
357726162 GUAIKATTO B Jan. 13, 2026, 3:58 p.m. OK Rust 2024 TESTS 3 46 13926400
357773653 hirose2020 B Jan. 14, 2026, 2:32 a.m. OK Rust 2024 TESTS 3 62 11776000

remove filters

Back to search problems