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.
Problems
The exit from the summer cottage is fenced with a fence consisting of (n) boards, each (1) meter wide. To the left and right of the exit are the fences of other plots. Some of the boards of the fence want to be removed for the construction of a bathhouse (possibly all or none), while there is an automatic lawn mower on the plot that is (w) meters wide and must not leave the plot through a hole in the fence. The lawn mower will be able to exit the plot if there are at least (w) consecutive removed boards among the numbers of the removed boards. Determine the maximum number of boards that can be removed from the fence. 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 only line of each test case contains two integers (n) and (w) ((1 \leq n \leq 10^{9}), (1 \leq w \leq 10^{9})) — the number of boards in the fence and the width of the lawnmower in meters, respectively. For each test case, output a single number — the maximum number of boards that can be removed from the fence. In the first test case, the fence consists of (9) boards. You can remove (6) boards and leave only the boards numbered (2), (5), and (8). Then the lawn mower will not be able to leave the boundaries of the territory. In the second test case, you can remove (10) boards, a possible arrangement is shown below. |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
362024415 |
Desh2 |
A |
Feb. 8, 2026, 3:26 p.m. |
OK |
C# 10 |
TESTS |
4 |
62 |
3072000 |
|
|
|
362053645 |
papa_joo |
A |
Feb. 8, 2026, 8:03 p.m. |
OK |
C# 13 |
TESTS |
4 |
62 |
921600 |
|
|
|
362079425 |
Mamun064 |
A |
Feb. 9, 2026, 5:32 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362076584 |
adarshhssingh |
A |
Feb. 9, 2026, 4:54 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362075290 |
bo0yeong |
A |
Feb. 9, 2026, 4:34 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362073189 |
MelodicOctopus |
A |
Feb. 9, 2026, 4 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362050503 |
disha21 |
A |
Feb. 8, 2026, 7:20 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362048993 |
Juhair_Manar |
A |
Feb. 8, 2026, 7:02 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362047075 |
aayush_505 |
A |
Feb. 8, 2026, 6:39 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362045618 |
aninditamukherjee129 |
A |
Feb. 8, 2026, 6:24 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362041889 |
Teigu |
A |
Feb. 8, 2026, 5:49 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362040740 |
boyko120 |
A |
Feb. 8, 2026, 5:38 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
4 |
15 |
0 |
|
|
|
362080823 |
k4rich |
A |
Feb. 9, 2026, 5:48 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362075283 |
stvy2346 |
A |
Feb. 9, 2026, 4:34 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362070624 |
not_famous |
A |
Feb. 9, 2026, 3:13 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362069445 |
winniedapooh |
A |
Feb. 9, 2026, 2:51 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362058013 |
ALHAWASH |
A |
Feb. 8, 2026, 9:21 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362057723 |
Ulvi |
A |
Feb. 8, 2026, 9:15 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362047639 |
Cy-nape |
A |
Feb. 8, 2026, 6:46 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362043343 |
arshjeet |
A |
Feb. 8, 2026, 6:03 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362031907 |
charanreddy_23 |
A |
Feb. 8, 2026, 4:30 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362028487 |
Sameed-Rais |
A |
Feb. 8, 2026, 3:59 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
4 |
15 |
0 |
|
|
|
362080632 |
sarathchandrakvl07 |
A |
Feb. 9, 2026, 5:46 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362079634 |
toha._.10 |
A |
Feb. 9, 2026, 5:35 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362068316 |
ekamkataria34 |
A |
Feb. 9, 2026, 2:27 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362059264 |
Eduardmm |
A |
Feb. 8, 2026, 9:48 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362053973 |
tourist_riu |
A |
Feb. 8, 2026, 8:07 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362044034 |
divyansh1_1 |
A |
Feb. 8, 2026, 6:09 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362040828 |
mohhit10 |
A |
Feb. 8, 2026, 5:39 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362036370 |
ItzVarshith |
A |
Feb. 8, 2026, 5:07 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362034394 |
Intisar_Fuad |
A |
Feb. 8, 2026, 4:53 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362034317 |
blankKyo |
A |
Feb. 8, 2026, 4:52 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
4 |
15 |
0 |
|
|
|
362024857 |
Manas0878787878 |
A |
Feb. 8, 2026, 3:29 p.m. |
OK |
GNU C11 |
TESTS |
4 |
31 |
0 |
|
|
|
362022641 |
2510876139 |
A |
Feb. 8, 2026, 3:13 p.m. |
OK |
GNU C11 |
TESTS |
4 |
31 |
0 |
|
|
|
362075178 |
TommyTeo14 |
A |
Feb. 9, 2026, 4:32 a.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
|
362026369 |
rahatrisha6 |
A |
Feb. 8, 2026, 3:41 p.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
|
362024733 |
RIGZ |
A |
Feb. 8, 2026, 3:28 p.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
|
362022537 |
ajgar_badmash7 |
A |
Feb. 8, 2026, 3:12 p.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
|
361998805 |
jawaharsenthilvel2007 |
A |
Feb. 8, 2026, 11:02 a.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
|
361997895 |
2510876139 |
A |
Feb. 8, 2026, 11 a.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
|
362079001 |
Rockstar_123 |
A |
Feb. 9, 2026, 5:27 a.m. |
OK |
GNU C11 |
TESTS |
4 |
62 |
0 |
|
|
|
362069830 |
M-Ridea |
A |
Feb. 9, 2026, 2:58 a.m. |
OK |
GNU C11 |
TESTS |
4 |
62 |
0 |
|
|
|
362018270 |
LittleGopher |
A |
Feb. 8, 2026, 2:42 p.m. |
OK |
Go |
TESTS |
4 |
31 |
409600 |
|
|
|
362034506 |
upland.gravity |
A |
Feb. 8, 2026, 4:54 p.m. |
OK |
Java 21 |
TESTS |
4 |
140 |
102400 |
|
|
|
362061727 |
Ningzhuo |
A |
Feb. 8, 2026, 11:01 p.m. |
OK |
Java 21 |
TESTS |
4 |
140 |
204800 |
|
|
|
362021764 |
d_harshitha02 |
A |
Feb. 8, 2026, 3:06 p.m. |
OK |
Java 21 |
TESTS |
4 |
156 |
0 |
|
|
|
362052378 |
Ujjal_roy |
A |
Feb. 8, 2026, 7:45 p.m. |
OK |
Java 21 |
TESTS |
4 |
156 |
307200 |
|
|
|
362072606 |
Pratham_Tiwari |
A |
Feb. 9, 2026, 3:50 a.m. |
OK |
Java 21 |
TESTS |
4 |
156 |
614400 |
|
|
|
361995429 |
dkumarmishra402 |
A |
Feb. 8, 2026, 10:54 a.m. |
OK |
Java 21 |
TESTS |
4 |
156 |
921600 |
|
|
|
362026285 |
punitpunde |
A |
Feb. 8, 2026, 3:41 p.m. |
OK |
Java 21 |
TESTS |
4 |
171 |
0 |
|
|
|
362025037 |
VenkateshSubbiah |
A |
Feb. 8, 2026, 3:31 p.m. |
OK |
Java 21 |
TESTS |
4 |
171 |
0 |
|
|
|
362028175 |
JC_codescf |
A |
Feb. 8, 2026, 3:56 p.m. |
OK |
Java 21 |
TESTS |
4 |
171 |
204800 |
|
|
|
362049730 |
Ishan.Boral.1810 |
A |
Feb. 8, 2026, 7:10 p.m. |
OK |
Java 21 |
TESTS |
4 |
171 |
307200 |
|
|
|
362023077 |
jhemanth |
A |
Feb. 8, 2026, 3:16 p.m. |
OK |
Java 8 |
TESTS |
4 |
78 |
0 |
|
|
|
362076030 |
AchalVishnoi |
A |
Feb. 9, 2026, 4:46 a.m. |
OK |
Java 8 |
TESTS |
4 |
109 |
0 |
|
|
|
362067997 |
yrflxian |
A |
Feb. 9, 2026, 2:20 a.m. |
OK |
Java 8 |
TESTS |
4 |
109 |
0 |
|
|
|
361997297 |
rajsaumya |
A |
Feb. 8, 2026, 10:59 a.m. |
OK |
Java 8 |
TESTS |
4 |
109 |
0 |
|
|
|
361995145 |
kit27.bme03 |
A |
Feb. 8, 2026, 10:54 a.m. |
OK |
Java 8 |
TESTS |
4 |
109 |
0 |
|
|
|
362071247 |
Trinay |
A |
Feb. 9, 2026, 3:25 a.m. |
OK |
Java 8 |
TESTS |
4 |
125 |
0 |
|
|
|
362030741 |
MovingBit |
A |
Feb. 8, 2026, 4:19 p.m. |
OK |
Java 8 |
TESTS |
4 |
125 |
0 |
|
|
|
362017929 |
JONNADA_PAVAN |
A |
Feb. 8, 2026, 2:39 p.m. |
OK |
Java 8 |
TESTS |
4 |
125 |
0 |
|
|
|
361993921 |
SRIKAR5139 |
A |
Feb. 8, 2026, 10:51 a.m. |
OK |
Java 8 |
TESTS |
4 |
125 |
0 |
|
|
|
362081490 |
humblehabit |
A |
Feb. 9, 2026, 5:56 a.m. |
OK |
Java 8 |
TESTS |
4 |
156 |
0 |
|
|
|
362027446 |
gerogeVT |
A |
Feb. 8, 2026, 3:50 p.m. |
OK |
Kotlin 2.2 |
TESTS |
4 |
140 |
25190400 |
|
|
|
362054981 |
mnkp |
A |
Feb. 8, 2026, 8:23 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
171 |
5427200 |
|
|
|
362081728 |
abhay015 |
A |
Feb. 9, 2026, 5:58 a.m. |
OK |
PyPy 3 |
TESTS |
4 |
171 |
5529600 |
|
|
|
362023375 |
Lakshay_Arya |
A |
Feb. 8, 2026, 3:18 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
171 |
5529600 |
|
|
|
362016957 |
Rohidul |
A |
Feb. 8, 2026, 2:33 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
187 |
5529600 |
|
|
|
362024845 |
ravi_krst |
A |
Feb. 8, 2026, 3:29 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
203 |
5529600 |
|
|
|
362062265 |
Ne_xt_ |
A |
Feb. 8, 2026, 11:21 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
234 |
5427200 |
|
|
|
362062081 |
weii2000 |
A |
Feb. 8, 2026, 11:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
46 |
2969600 |
|
|
|
362055324 |
MOHAMEDHOSSAM34 |
A |
Feb. 8, 2026, 8:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
46 |
3788800 |
|
|
|
362046311 |
PANDEYdod |
A |
Feb. 8, 2026, 6:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
46 |
3788800 |
|
|
|
362076502 |
bhargav_kikani |
A |
Feb. 9, 2026, 4:53 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
62 |
2969600 |
|
|
|
362044997 |
willweste |
A |
Feb. 8, 2026, 6:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
62 |
2969600 |
|
|
|
362035830 |
Sheikah |
A |
Feb. 8, 2026, 5:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
62 |
2969600 |
|
|
|
362035489 |
jord_ussop |
A |
Feb. 8, 2026, 5:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
62 |
2969600 |
|
|
|
362042136 |
tusharmyself06 |
A |
Feb. 8, 2026, 5:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
62 |
3276800 |
|
|
|
361993760 |
asrithzz |
A |
Feb. 8, 2026, 10:50 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
62 |
3891200 |
|
|
|
362033329 |
AKIDNAR |
A |
Feb. 8, 2026, 4:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
78 |
2969600 |
|
|
|
362075408 |
nuhanintekhab |
A |
Feb. 9, 2026, 4:36 a.m. |
OK |
Python 3 |
TESTS |
4 |
46 |
204800 |
|
|
|
362075815 |
shyamvinay |
A |
Feb. 9, 2026, 4:42 a.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
0 |
|
|
|
362055725 |
sakshamkachhawaha |
A |
Feb. 8, 2026, 8:35 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
0 |
|
|
|
362030664 |
Riya_Pancholi |
A |
Feb. 8, 2026, 4:19 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
0 |
|
|
|
362027120 |
Nafosat_1306 |
A |
Feb. 8, 2026, 3:48 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
0 |
|
|
|
362026831 |
heeky |
A |
Feb. 8, 2026, 3:45 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
0 |
|
|
|
361994468 |
bhargav_6681 |
A |
Feb. 8, 2026, 10:52 a.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
0 |
|
|
|
362041644 |
dhriti.g |
A |
Feb. 8, 2026, 5:47 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
204800 |
|
|
|
362021738 |
radhika02 |
A |
Feb. 8, 2026, 3:06 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
204800 |
|
|
|
362021443 |
kit27.am62 |
A |
Feb. 8, 2026, 3:04 p.m. |
OK |
Python 3 |
TESTS |
4 |
62 |
204800 |
|
|
|
362026416 |
Ne0B1ade |
A |
Feb. 8, 2026, 3:42 p.m. |
OK |
Rust 2021 |
TESTS |
4 |
15 |
0 |
|
|
|
362031209 |
Spheniscine |
A |
Feb. 8, 2026, 4:24 p.m. |
OK |
Rust 2021 |
TESTS |
4 |
31 |
0 |
|
|
|
362027084 |
cinkozzz |
A |
Feb. 8, 2026, 3:47 p.m. |
OK |
Rust 2024 |
TESTS |
4 |
15 |
0 |
|
|
|
362024261 |
Mon_ster |
A |
Feb. 8, 2026, 3:25 p.m. |
OK |
Rust 2024 |
TESTS |
4 |
31 |
0 |
|
|
remove filters
Back to search problems