The video is already uploaded: https://youtu.be/ItdpgiFG-Bw

Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | tourist | 3880 |

2 | jiangly | 3669 |

3 | ecnerwala | 3654 |

4 | Benq | 3627 |

5 | orzdevinwang | 3612 |

6 | Geothermal | 3569 |

6 | cnnfls_csy | 3569 |

8 | jqdai0815 | 3532 |

9 | Radewoosh | 3522 |

10 | gyh20 | 3447 |

# | User | Contrib. |
---|---|---|

1 | awoo | 161 |

2 | maomao90 | 160 |

3 | adamant | 156 |

4 | maroonrk | 154 |

5 | -is-this-fft- | 148 |

5 | SecondThread | 148 |

7 | atcoder_official | 147 |

7 | Petr | 147 |

9 | TheScrasse | 145 |

10 | nor | 144 |

The video is already uploaded: https://youtu.be/ItdpgiFG-Bw

The video is already uploaded: https://www.youtube.com/watch?v=9MXalADEPZk

I solved A–F from Codeforces Global Round 26. Unfortunately, I had experienced issues with judgement system, so the participation was a bit spoiled for me, and it was made unrated. Nevertheless, the problems were quite fun, hope I'll become much faster one day!

Please watch! https://youtu.be/4B3g4NLdbuA

I've solved and explained all five problems of Codeforces Round 948 (Div. 2), the video will appear in about an hour.

UPD: the video is available.

I have recorded a screencast & editorial for Codeforces Round 947 (Div. 1 + Div. 2). It will upload on https://youtu.be/DrBmSO86xUQ in an hour or two.

UPD: the video is uploaded.

Tomorrow (in 12 hours) is the main day of my first ICPC WF! The preparation is over. We are not worried, but, unfortunately, after all the rounds of Ptz, UCup, previous years' ICPCps, it is clear to us that we will not win a medal without any luck. Please cheer for us and wish us luck! For two of our team, including me, this is our last attempt at the finals.

You should be able to find us tomorrow somewhere on https://www.youtube.com/@ICPCLive/, we will be 47^{th} WF St. Petersburg State University team.

Good evening everyone!

TL;DR: I am in Luxor preparing for ICPC WF and making some photos, and also I was offered to (and I will) give an interview to Shayan, please send your questions.

I really liked today's Codeforces Global Round 25! I got a pretty nice positive delta, although, unfortunately, I failed to settle down all the nasty conditional probabilistic formulae in 1951G - Clacking Balls and solved one problem less than I could have.

I uploaded my screencast and editorial on YouTube: https://www.youtube.com/watch?v=4-8kp8B2Dig. Surprisingly, the video is still processing, so it is still impossible to watch it. But it should become available in several minutes.

**UPD:** the video is available.

**UPDUPD:** the video is available in high resolution.

Today I participated in a pretty nice CodeTON Round 8 (Div. 1 + Div. 2, Rated, Prizes!) and recorded a pretty nice Screencast and Editorial of problems A–G. You are welcome to watch it!

**UPD:** now the video is in high quality.

In contests and in the custom invocation, after a pause, one can again find GNU G++20 64-bit. However, the slowdown issue because of which the language disappeared persists, there are still snippets of code that can slow down the execution on Codeforces servers by a factor of 100 or so.

So what is the official position of Codeforces headquarters and of our community on that?

Are there general methods of constructing testcases that can exploit this GCC/Windows bug and therefore slow down solutions (like there are anti-hash tests for solutions using

`unordered_set`

)? Are there methods that slow down both contest mode and custom invocation mode (since 249807302 is only slow in the contest mode whereas 253289473 is only slow in the custom invocation)?If so, should we expect such tests in future contests, will such methods be used during the test preparation in contests?

If this is deemed an unwanted bug, will participants be protected from unscrupulous hacks and tests? (For example, if the solution was hacked or FSTed because of a compiler bug rather than because of anything else, will the author be able to appeal against it and get their solution accepted?)

Is there no bug in 32-bit version? If it's 64-bit only, maybe CF team could add a C++20 32-bit compiler?

**UPD:**32-bit version can also be slowed down, see 253400416.Is there this bug in Microsoft Visual C++ compilers (32 or 64 bits)? If so, is it the reason why we cannot see it among the options?

Are there generic methods of protecting against the bug (except switching to 32 bits)? I read (and enjoyed) a blogpost by ToxicPie9 regarding this issue, he suggested to add several lines of code to the solution. However, it does not always help: 253290209 still gets TL (and the author said about that).

Has anyone a clue what is going on, why do the aforementioned programs run slowly? Is this bug reported to the GNU or Microsoft developers who are responsible for this strange behavior?

Why does behavior in custom invocation and in contest/gym mode differ?

Is this bug reproducible on other platforms? For instance, on godbolt there are some windows compilers. Is there a way to slow down this code: https://godbolt.org/z/5G73dfezK (by cleverly choosing the value of

`evil`

or anything else)?**UPD:**probably no way since Godbolt uses UCRT rather than MSVCRT.**UPDUPD:**this code is slow on Godbolt: https://godbolt.org/z/WE4Mxv9cK, so UCRT is also flawed.Is there surely no such bug on Linux? (Anyway, with regard to Codeforces it is probably a pointless question. I am quite certain that transition of all invokers to Linux is the last thing MikeMirzayanov would prefer to do since it is for sure really costly in time, effort, architecture changes, and/or money.)

Radewoosh inspired me by completing Project Euler, and I recently started, slow but steady, solving its problems. I don't mind anybody adding me as a friend on Project Euler, my friendship key is `2127163_HmDkRoxUDZa38znoBSPq2n4Prg996WEX`

, please enter it on this page if you're registered and you'd like to see me in your friend list. (Similarly, you'll appear in my friend list.)

I also record the process and upload on Youtube because, according to the rules, problems 1–100 are allowed for public analysis (although I'm afraid there won't be any serious or interesting problems in the first hundred). As for now, uploaded are:

These are screencasts, I would even call them editorials, but (at least in the earlier problems) there isn't exactly much to explain. Watch if you like!

Finally, I really encourage you to register and solve problems as well, if you haven't still!

**UPD.** Guys, I hate to say this, but Project Euler has an obscure limit of 64 friends max. That means that I cannot add all of you in my friends list.

Therefore, I kinda have to implement some sort of preference and remove people with the lowest one. Some preferences like time of appearance in my friend list sound like trash, so we won't be considering them. Instead I decided to remove people with the fewest problems solved. Currently, at least 11 solved problems are needed. Therefore, if you got deleted and for some reason you want back, just solve a couple of problems and try adding back again!

*It seems like I've created the most weird, not to say cringe, possible motivation for you to solve Project Euler, but whatever. If it works, it works.*

Here you can watch how I solved A–F from Hello 2024: https://youtu.be/3TV2VpVbUjM. Unfortunately, I only solved 1919E - Counting Prefixes after the contest has ended because my C++ template was too poor. This is an important lesson for me to collect all important algorithms and finally sit down and include them in the template.

**UPD:** the video is high resolution now.

Usually Euclid's algorithm, which computes $$$\gcd(a, b)$$$, is implemented as follows:

```
while b != 0:
a %= b
swap(a, b)
return a
```

Or, in recursive fashion,

```
if b == 0:
return a
else:
return gcd(b % a, b)
```

While it works in $$$\mathcal O(n)$$$ time (where $$$n$$$ is the maximum of binary lengths of $$$a$$$ and $$$b$$$ — that is, big-Theta of the length of the input), it uses quite an expensive operation of integer division. The fastest known procedure of integer division works in $$$\mathcal O(n \log n)$$$ time, so, if we take into account the time spent on arithmetic operations, the time complexity is $$$\mathcal O{\left(n^2 \log n\right)}$$$. But even if we don't, `int64`

division is still much slower than such operations as addition, subtraction and binary shifts.

If you didn't know there is an algorithm which doesn't need division at all!

```
def remove_trailing_zeros(a):
return a >> count_trailing_zeros(a)
def gcd_of_odd_numbers(a, b):
if a == b:
return a
if a < b:
swap(a, b)
return gcd_of_odd_numbers(b, remove_trailing_zeros(a - b))
def gcd(a, b)
if a == 0:
return b
if b == 0:
return a
return gcd_of_odd_numbers(remove_trailing_zeros(a), remove_trailing_zeros(b)) << min(count_trailing_zeros(a), count_trailing_zeros(b))
```

The function `count_trailing_zeros(a)`

finds the maximum $$$k$$$ such that $$$a$$$ is divisible by $$$2^k$$$. The function `remove_trailing_zeros(a)`

divides $$$a$$$ by the maximum power of two that divides $$$a$$$. Both these functions can be easily implemented in $$$\mathcal O(n)$$$ time, if we take into account the complexity of arithmetic operations. `gcd_of_odd_numbers(a, b)`

finds `gcd`

of the two numbers $$$a$$$ and $$$b$$$, given they are both odd. Everything except the recursive call works in $$$\mathcal O(n)$$$ time. Note that the sum of binary lengths of numbers is decremented by at least one from call to call, so there will be only $$$\mathcal O(n)$$$ recursive calls. Therefore, `gcd_of_odd_numbers(a, b)`

works in $$$\mathcal O{\left(n^2\right)}$$$ time. Finally, `gcd(a, b)`

is also obvious to take $$$\mathcal O{\left(n^2\right)}$$$ time.

My question is: why does everyone use the implementation with divisions? Are there some hidden advantages? I didn't compare how much these two take with fixed-length integer types and arbitrary-precision integer types in practice. Did someone in community investigated this question? Did you know about division-less gcd implementation at all? Please let me know in the comments.

Please watch: https://youtu.be/TutRcb1-K3s

**UPD:** the video is high resolution.

Today I participated in Pinely Round 3 (Div. 1 + Div. 2) and solved problems A–G. I recorded the participation here: https://www.youtube.com/watch?v=CZ6D-5bhgOQ. There is also an editorial of these problems, firstly in English, then in Russian. Follow the timecodes to find your problem of interest.

Finally, let me express my joy: I participated quite well, defeated tourist, Petr, Benq and Ormlis and returned my IGM title!

The ICPC Northern Eurasia Finals (a.k.a. Northern Eurasia Regional Contest) took place on 13 December 2023. The onsite participants competed on four venues: St. Petersburg, Russia; Novosibirsk, Russia; Astana, Kazakhstan; and Kutaisi, Georgia.

Congratulations to the medalists of the contest:

Rank | Team | = | Time |

🏆 1 | MIPT: Yolki-palki (Pechalka, Tikhon228, Kapt) | 12 | 1266 |

🥇 2 | HSE: Youthful Passion Fruit (alexxela12345, daubi, talant) | 10 | 982 |

🥇 3 | SPb ITMO: pengzoo (iakovlev.zakhar, golikovnik, DishonoredRighteous) | 9 | 713 |

🥇 4 | MIPT: Log-rank conjecture (sadovan, receed, Jatana) | 9 | 759 |

🥈 5 | SPb SU: block of cats (LeoPro, fastmath, turmax) | 9 | 843 |

🥈 6 | SPb SU: \_ -> chill (UnstoppableChillMachine, D.Pavlenko, Volkov_Ivan) | 9 | 904 |

🥈 7 | MIPT: In God We Trust (antonis.white, gop2024, PeregudovSergey) | 9 | 935 |

🥈 8 | MIPT: Shawarmasters (stepanov.aa, RP-1, PBBx0) | 9 | 1072 |

🥉 9 | HSE: Muffix Sassif (sevlll777, crazyilian, tem_shett) | 9 | 1076 |

🥉 10 | HSE: Drunk Driving in Moscow (Siberian, blyat, Nybik) | 9 | 1223 |

🥉 11 | HSE: am nyam) (vaaven, Ormlis, vsinitsynav) | 9 | 1368 |

🥉 12 | MIPT: Wake right (ZorikVar, ShadowLight, serg3000) | 8 | 905 |

As a result, several teams qualified for the ICPC Finals, which will be held in 2024 in Astana, Kazakhstan:

Rank | Team | = | Time |

🏆 1 | MIPT: Yolki-palki (Pechalka, Tikhon228, Kapt) | 12 | 1266 |

🥇 2 | HSE: Youthful Passion Fruit (alexxela12345, daubi, talant) | 10 | 982 |

🥇 3 | SPb ITMO: pengzoo (iakovlev.zakhar, golikovnik, DishonoredRighteous) | 9 | 713 |

🥈 5 | SPb SU: block of cats (LeoPro, fastmath, turmax) | 9 | 843 |

13 | Belarusian SU: 1: Last hope (MathBoy, ne4eHbKa, VEGAnn) | 8 | 944 |

14 | AITU: jaujurek 3 bala (dolbaeb, dimachine, nkamzabek) | 8 | 1089 |

15 | Yerevan SU: SD3 (mcdx9524, Andreasyan, erankyun) | 8 | 1446 |

16 | MAI: 1 (Inyutin, Belousov, Plyushkin) | 7 | 551 |

18 | Belarusian SUIR: 1: So Stuffy (kartel, p3rfect, romarkovets) | 7 | 673 |

19 | Novosibirsk SU: 1: Avdim last hope (amokrousov, Lylova, Timonnable) | 7 | 770 |

21 | Skoltech: Caravella (madn, kek1234, Goldman) | 7 | 819 |

22 | Tbilisi SU: Darwin Nunez (Macharashvili, Pipia, Khvedelidze) | 7 | 834 |

It is possible that the ICPC committee will increase the quota and allow more NERC teams to attend the Finals.

For the contestants who did not participate onsite, there was an online mirror on Codeforces: 2023-2024 ICPC, NERC, Northern Eurasia Onsite (Unrated, Online Mirror, ICPC Rules, Teams Preferred). I would like to especially highlight the teams who scored total during the contest:

Rank | Team | = | Time |

1 | xinyoudui: PubabaOnO, orzdevinwang, jqdai0815 | 12 | 842 |

2 | HoMaMaOvO: maroonrk, hos.lyric, maspy | 12 | 1266 |

3 | P+P+P: 244mhq, 353cerega, 998kover | 12 | 1339 |

The problemset was prepared by the jury headed by elizarov: cdkrot, VArtem, Aksenov239, goldvitaly, tourist, kgeorgiy, isaf27, izban, _LeMur_, orz, niyaznigmatul, PavelKunyavskiy, pashka and Elena Kryuchkova:

You can find the PDF statements here, and the tutorials here.

Finally, you are welcome to share your thoughts on the problemset in the comments. Also please tell me if there are mistakes in this post. Thanks to all of you who participated and attempted our problems!

I recorded my participation in CodeTON Round 7 (Div. 1 + Div. 2, Rated, Prizes!), after which I explained the solutions of problems 1896A - Jagged Swaps, 1896B - AB Flipping, 1896C - Matching Arrays, 1896D - Ones and Twos and 1896F - Bracket Xoring. The link to the video is https://youtu.be/xNYdRfbuBQ8, but the video is still processing and will be ready for watching in several minutes.

I guess some of you, who will watch this video, have solved problem C. Could you please share your observations which led to the solution? I believe that the fact presented in the editorial is really unobvious, although I didn't have the worst intuition possible in this problem's plot. Instead I came up with a solution which took a (code)ton of time and featured an intricate way of applying `std::set`

with `upper_bound`

and discrete continuity. Not bad for making the editorial educational, but really inappropriate for succeeding in the actual contest.

**UPD:** the video is uploaded, but is temporarily in low resolution.

**UPDUPD:** the video is now high quality.

The XXXI Saint-Petersburg High School Programming Contest took place on 4 November 2023 in ITMO University. It is a regional qualification for the XXIV Russia Open High School Programming Contest which will be held on 11–12 December 2023 in person. The problems were prepared by a committee headed by andrewzta: ba.tasya, Niko, Thinkbuge, Volkov_Ivan, golikovnik, orz, DishonoredRighteous, Volodya333, polipolinom, GShark, VArtem, peltorator, doreshnikov, Toy_mouse, step_by_step and fedor.tsarev.

There were several qualifications for XXIV Open VKOSHP based on this problemset. Below is the list of them with the links to their standings:

- Internet Selection
- Saint Petersburg
- Republic of Tatarstan
- Udmurt Republic
- Gomel Region
- Republic of Karelia
- Western Siberia

The contest has been added to the gym: The XXXI Saint-Petersburg High School Programming Contest (SpbKOSHP 2023) | Qualification for the XXIV Russia Open High School Programming Contest (VKOSHP 2023).

**UPD:** ghosts are added to the contest, so that during the virtual participation you could spectate in the Standings how the official participants did.

You can watch here how I participated in Qualification Round of Yandex Cup 2023 Algorithm.

I participated in Codeforces Round 898 (Div. 4) and, surprisingly, solved all problems.

You can watch the solutions (please, not during the contest!):

Today a horrible thing almost happened: I barely stayed an International Grandmaster on Codeforces after participation in CodeTON Round 6 (Div. 1 + Div. 2, Rated, Prizes!). I would't say I was exceptionally slow or that I solved problems too clumsily, but for some reason the majority of participants near my level were faster than me on these problems.

I recorded a five hour long video about my adventures. If you're interested in a particular problem, follow the timecodes:

Problem | Solving | Implementation | Editorial |
---|---|---|---|

1870A - MEXanized Array | 01:37 | 02:45 | 3:23:28 |

1870B - Friendly Arrays | 06:23 | 10:54 | 3:30:20 |

1870C - Colorful Table | 12:48 | 14:12 | 3:41:00 |

1870D - Prefix Purchase | 22:14 | 24:41 | 3:58:20 |

1870E - Another MEX Problem | 39:37 | 58:42 | 4:34:24 |

1870F - Lazy Numbers | 1:31:03 | 2:54:32 | 2:30:37 |

If you open a video and see it's low quality, you might want to wait several minutes until YouTube processes the higher resolutions.

**UPD.** This is high quality now. Please watch!

Dear friends,

Today I tried an experimental format: separate videos. So, today I participated in Codeforces Round 896 (Div. 1) and recorded a screencast, but, unlike the previous times, I did not immediately record the editorials. Instead several videos are dedicated to them. So here are the links:

- https://youtu.be/uuyVZcExbEI — screencast of Codeforces Round 896 (Div. 1);
- https://youtu.be/OFKF3oGhvmE — editorial (and upsolving!) of 1869A - Make It Zero;
- https://youtu.be/JoUOqDvKHuo — editorial (and upsolving!) of 1869B - 2D Traveling;
- https://youtu.be/iS3eusWsx3E — editorial of 1869C - Fill in the Matrix (if you're interested in the coding part, you can find it here: https://youtu.be/uuyVZcExbEI?t=938);
- https://youtu.be/1Vu2RSQg0D0 — editorial of 1869D1 - Candy Party (Easy Version) and 1869D2 - Candy Party (Hard Version) (if you're interested in the coding part, you can find it here: https://youtu.be/uuyVZcExbEI?t=2688);
- https://youtu.be/Zn2OkKlgaG0 — editorial of 1869E - Travel Plan (if you're interested in the coding part, you can find it here: https://youtu.be/uuyVZcExbEI?t=5204);
- https://youtu.be/i4RO3x1fmjA — editorial (and long, long upsolving!) of 1869F - Flower-like Pseudotree.

**UPD:** I recorded the upsolving of 1869F - Flower-like Pseudotree (see the link above). I guess my explanation was quite fine, but in one case I incorrectly calculated the preconditions, which resulted in WA (223630659) and, subsequently, a huge mess and pain. It is still quite educational stuff though: the first half of the video is just a normal editorial (but, alas, with a technical mistake which should't screw the flow of the problem though), and the second one can teach you how to seek for bugs in problems like this one (with a big number of cases).

Also keep noted that for now the video is low-resolution. It will fix itself in half an hour or so. **UPDUPD:** the high resolution version has been processed and is available on YouTube.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/20/2024 19:37:37 (k3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|