I just returned from another camp, the longest ever. I've been in Saudi Arabia 🇸🇦 for 12 days, teaching around 20 students. The goal of the camp was to prepare students to shape their team for IOI.
After teaching in camps in Syria, Uzbekistan, Azerbaijan, Croatia, and India, this was yet another incredible experience of helping students push closer to their competitive programming goals.
I really enjoyed working with students, as usual; or maybe even more. There were three levels of students, and working with each of them was interesting. Again, I learned new things by teaching them to students, as usual.
The camp was hosted by KAUST, which is a very beautiful place.
I covered the following topics in our classes: Sack, DP, Games, Trie, Segment Tree, Arpa's trick, NSJ, and Backtrack. None of them were taught by me; they discovered it themselves, because my style of teaching is to never teach, but let students teach themselves.
I would like to thank the organizers for the invitation and the students for making it such a joyful experience.
We are conducting a comparative study on the structure, governance, and impact of student Olympiad systems in various countries.
Our aim is to gather open and comparable information about participation rules, student age and grade levels, selection processes, and the privileges granted to Olympiad medalists.
Please provide answers for your country based on your knowledge — even partial information is valuable and appreciated.
Watch the video describing solutions: Video Link
Watch the video of live participation: Video Link
| Problem | Name | Submission |
|---|---|---|
| A | DBMB and the Array | 359896698 |
| B | Reverse a Permutation | 359896674 |
| C | Replace and Sum | 359896662 |
| D | Monster Game | 359896642 |
| E | Product Queries | 359896546 |
| F | Pizza Delivery | 359896454 |
| G | Paths in a Tree | 359896762 |
| H | Remove the Grail Tree | 359896790 |
Watch the video describing solutions: Video Link
Watch the video of live participation: Video Link
Check out my submissions:
| Problem | Name | Submission |
|---|---|---|
| A | Perfect Root | 358641451 |
| B | Prefix Max | 358641429 |
| C | Shifted MEX | 358641415 |
| D | OutOfMemoryError | 358641372 |
| E | The Robotic Rush | 358641342 |
| F | BattleCows | 358641328 |
| G | Mixing MEXes | 358641306 |
| H | BattleCows 2 | 359040200 |
Watch the full video: Video Link
Check out my submission: A (354851291), B (354851311), C (354851326), D (354851404), E (354851429), F (354852547), G (354851486), H (354851523).
Please let me know which style of problem-solving video you prefer.
Full virtual contest experience: Record everything from the start — reading the problem, thinking aloud, solving, and coding (example).
→ Gives the complete journey of solving a problem, but tends to be quite long.
Live reasoning after solving on paper: Record the thinking and coding after having a rough solution idea (example).
→ Might include some mistakes or wrong attempts before getting AC.
Post-solve explanation: First solve and get AC, then record a short and clear video explaining the solution idea and implementation (like in this video).
→ Concise and focused on insights.
Competitive programmers, get ready! The Go for Gold Long Challenge is back, bringing another thrilling opportunity to test your problem-solving skills and climb the leaderboard on Codeforces!
We are excited to present yet another round of engaging and challenging problems for the community. Whether you're a seasoned competitor or just starting out, this contest is designed to offer a balanced mix of difficulty levels to help everyone push their limits.
The format of the Long Challenge is IOI-style, which includes subtasks in problems, so that everyone can try all of them.
Please join the codeforces group and register for the contest.
All problems are prepared and tested by DeadlyCritic, ili, amiraskarieh2003, Hooded_Hood, MTSS.
You can join our Discord server for any questions.
We invite you to propose problem ideas for the next rounds. Give back to the community.
The countdown has begun! Mark your calendars and prepare to GoForGold once again. We can’t wait to see your amazing submissions.
Stay tuned for more updates and happy coding!
Watch the full video: Video Link
Check out my submission: A (352117104), B (352117084), C (352117125), D (352117146), E (352117168), F (352117257).
Please let me know which style of problem-solving video you prefer.
Full virtual contest experience: Record everything from the start — reading the problem, thinking aloud, solving, and coding (example).
→ Gives the complete journey of solving a problem, but tends to be quite long.
Live reasoning after solving on paper: Record the thinking and coding after having a rough solution idea (example).
→ Might include some mistakes or wrong attempts before getting AC.
Post-solve explanation: First solve and get AC, then record a short and clear video explaining the solution idea and implementation (like in this video).
→ Concise and focused on insights.
Hello Codeforces!
I’m going to introduce you to a C++ struct that helps you easily forget MOD, instead of always being nervous about it.
Using this struct, you can easily add, subtract, multiply, divide, and raise to a power without thinking about overflow or missing MOD. Everything is considered in it. This is very easy to use; copy, paste, and use. Let’s see a few examples.
| Operation | Before | After |
|---|---|---|
| Addition | | |
| Subtraction | | |
| Multiplication | | |
| Division | Maybe a * raising b to power MOD — 2? | |
| Power | Implementing the binary pow function | |
Let's look at a real problem, 296B - Ярослав и две строки. The following is the old solution (20869331) without using Mint:
int sbet = 1, pbet = 1, mos = 1; for(int i = 0; i < n; i++) sbet = (ll) sbet * bet(s[i], p[i]) % mod, pbet = (ll) pbet * bet(p[i], s[i]) % mod, mos = (ll) mos * eq(p[i], s[i]) % mod; int ans = 1; int b = count(s.begin(), s.end(), '?') + count(p.begin(), p.end(), '?'); for(int a = 10; b; b >>= 1, a = (ll) a * a % mod) if(b & 1) ans = (ll) ans * a % mod; (ans += mos) %= mod; (ans -= sbet — mod) %= mod; (ans -= pbet — mod) %= mod; cout << ans << '\n';
But now, see how clean the new version (351365035) is:
Mint sbet = 1, pbet = 1, mos = 1; for (int i = 0; i < n; i++) { sbet *= bet(s[i], p[i]); pbet *= bet(p[i], s[i]); mos *= eq(p[i], s[i]); } Mint ans = Mint(10).pow(count(s.begin(), s.end(), '?') + count(p.begin(), p.end(), '?')); cout << ans + mos - sbet - pbet << '\n';
More examples:
Benefits of the Mint struct:
2 + x, x + 2, x / 2, all of them work.Also, there is an appendix to the Mint struct which makes the factorials and comb function, which are useful in a lot of cases.
I've been using this for several years, and you can be sure it works fine.
If you want to copy/paste, use this.
Competitive programmers, get ready! The Go for Gold Long Challenge is back, bringing another thrilling opportunity to test your problem-solving skills and climb the leaderboard on Codeforces!
We are excited to present yet another round of engaging and challenging problems for the community. Whether you're a seasoned competitor or just starting out, this contest is designed to offer a balanced mix of difficulty levels to help everyone push their limits.
The format of the Long Challenge is IOI-style, which includes subtasks in problems, so that everyone can try all of them.
Please join the codeforces group and register for the contest.
All problems are prepared and tested by DeadlyCritic, ili, amiraskarieh2003, Hooded_Hood, MTSS.
You can join our Discord server for any questions.
We invite you to propose problem ideas for the next rounds. Give back to the community.
The countdown has begun! Mark your calendars and prepare to GoForGold once again. We can’t wait to see your amazing submissions.
Stay tuned for more updates and happy coding!
Watch the full video: Video Link
Check out my submission: A (349982917), B (349982921), C1 (349982923), C2 (349982926), D (349982929), E (349982933), F (349982935), G (349982912).
Please let me know which style of problem-solving video you prefer.
Full virtual contest experience: Record everything from the start — reading the problem, thinking aloud, solving, and coding (example).
→ Gives the complete journey of solving a problem, but tends to be quite long.
Live reasoning after solving on paper: Record the thinking and coding after having a rough solution idea (example).
→ Might include some mistakes or wrong attempts before getting AC.
Post-solve explanation: First solve and get AC, then record a short and clear video explaining the solution idea and implementation (like in this video).
→ Concise and focused on insights.
Note 1: This is not the official editorial. I prepared these solutions while testing the problems as a tester before the contest.
Note 2: The video tutorial is for those who prefer learning from videos and want to see implementation tips alongside the problem explanations.
Watch the full video: Video Link
Check out my submission: A (346358188), B (346358219), C (346358246), D (346358285), E (346358316), F (346358353), G (346358382).
Based on your feedback, I changed the video type from premiere to regular.
Please let me know how you prefer this kind of problem-solving video.
Please let me know which style of problem-solving video you prefer.
Full virtual contest experience: Record everything from the start — reading the problem, thinking aloud, solving, and coding (example).
→ Gives the complete journey of solving a problem, but tends to be quite long.
Live reasoning after solving on paper: Record the thinking and coding after having a rough solution idea.
→ Might include some mistakes or wrong attempts before getting AC.
Post-solve explanation: First solve and get AC, then record a short and clear video explaining the solution idea and implementation (like in this video).
→ Concise and focused on insights.

Hello Codeforces!
We're excited to announce GTOI: Graph Theory for Olympiad in Informatics, a free, community-driven book designed specifically for competitive programming.
Why it's important and different:
Completely Free & Open Source: High-quality knowledge, accessible to everyone.
Massive Coverage: It covers from the fundamentals like DFS, BFS to advanced topics like Heavy-Light Decomposition and Min-Cost Max-Flow.
Contest-Ready Code: Short, fast C++ snippets ready for you to use in a contest.
This is a community project, and we need your help!
The book is on GitHub, and we invite you to help us make it better. You can:
Contribute: Fix issues, add new topics, add images, or provide alternative code implementations.
Translate: Help us bring GTOI to your native language.
Let's work together to build the ultimate graph theory resource for competitive programmers.
Project Creator and Coordinator dorostmishe
Authors dorostmishe, Shayan.P, Matin.Asp, AliTavassoly, Amoo_Safar, _MGH_, ArshiaDadras, AliShahali1382, Kalam, KMAASZRAA, _Seyed37_
English Translators dorostmishe, AliTavassoly, Arpa
Note 1: This is not the official editorial. I prepared these solutions while testing the problems as a tester before the contest.
Note 2: The video tutorial is for those who prefer learning from videos and want to see implementation tips alongside the problem explanations.
Watch the full video: Video Link
Check out my submission: A (344369578), B (344369585), C (344369588), D (344369598), E (344369602), F (344369606), G (344369610), H (344369616).
Based on your feedback, I changed the video type from premiere to regular.
Please let me know how you prefer this kind of problem-solving video.
Please let me know which style of problem-solving video you prefer.
Full virtual contest experience: Record everything from the start — reading the problem, thinking aloud, solving, and coding (example).
→ Gives the complete journey of solving a problem, but tends to be quite long.
Live reasoning after solving on paper: Record the thinking and coding after having a rough solution idea (like in this video).
→ Might include some mistakes or wrong attempts before getting AC.
Post-solve explanation: First solve and get AC, then record a short and clear video explaining the solution idea and implementation.
→ Concise and focused on insights.
Competitive programmers, get ready! The Go for Gold Long Challenge is back, bringing another thrilling opportunity to test your problem-solving skills and climb the leaderboard on Codeforces!
We are excited to present yet another round of engaging and challenging problems for the community. Whether you're a seasoned competitor or just starting out, this contest is designed to offer a balanced mix of difficulty levels to help everyone push their limits.
The format of the Long Challenge is IOI-style, which includes subtasks in problems, so that everyone can try all of them.
Please join the codeforces group and register for the contest.
All problems are prepared and tested by DeadlyCritic, ili, amiraskarieh2003, Hooded_Hood, MTSS.
You can join our Discord server for any questions.
We invite you to propose problem ideas for the next rounds. Give back to the community.
The countdown has begun! Mark your calendars and prepare to GoForGold once again. We can’t wait to see your amazing submissions.
Stay tuned for more updates and happy coding!
Hey, Codeforces!
I’m AmirReza PourAkhavan, the former Codeforces Contest Coordinator. I let the story become complete, and I’m sharing it now.
The story is about a 16-year-old competitive programmer who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals twice.
Read the previous parts: 1, 2, 3, 4.
Read the Persian version here.
This part covers from December 2016 to November 2017.
Our contest was held on Codeforces, and it broke several records.
Famous people like Errichto even called its editorial the best they had ever read.
You might wonder: what kind of popular or controversial topic gets 175 comments?
The answer:
You are right! Codeforces edu section — Community Course! Most of the comments are "Still empty" :) But the good news is, this is not the case anymore!
I've just added the first set of tutorials on the RMQ Problem, which covers these three topics:
It's just a starting point, but hopefully, it will encourage others to contribute. Let's work together to build a high-quality collection of competitive programming materials! Check out a related comment below.
Let me know if you have any comments on the tutorials, which will help future writers as well.
Note 1: This is not the official editorial. I prepared these solutions while testing the problems as a tester before the contest.
Note 2: The video tutorial is for those who prefer learning from videos and want to see implementation tips alongside the problem explanations.
Watch the full video: Video Link
Check out my submission: A (340623573), B (340623949), C (340624017), D (340623462), E (340623412), F (340623387), G (340754616).
Please let me know how you prefer this kind of problem-solving video.
Competitive programmers, get ready! The Go for Gold Long Challenge is back, bringing another thrilling opportunity to test your problem-solving skills and climb the leaderboard on Codeforces!
We are excited to present yet another round of engaging and challenging problems for the community. Whether you're a seasoned competitor or just starting out, this contest is designed to offer a balanced mix of difficulty levels to help everyone push their limits.
The format of the Long Challenge is IOI-style, which includes subtasks in problems, so that everyone can try all of them.
Please join the codeforces group and register for the contest.
All problems are prepared and tested by DeadlyCritic, ili, amiraskarieh2003, Hooded_Hood.
You can join our Discord server for any questions.
We invite you to propose problem ideas for the next rounds. Give back to the community.
The countdown has begun! Mark your calendars and prepare to GoForGold once again. We can’t wait to see your amazing submissions.
Stay tuned for more updates and happy coding!
Some small countries do very well at the IOI — is that luck, culture, money, or a training system?
Or maybe because some developed countries don't care about IOI at all, so there is no investment in it? If that's the case in your country, please leave a comment. By the way, why do you think that is?
See the first 20 countries at the IOI website (the full list is here):
Also, this is the diagram showing the relation between a country’s IOI rank and its GDP per capita. A higher GDP per capita usually means the country is more developed and people have a good standard of living, so they can invest in areas that are not essential for survival. As you can see, there is no meaningful correlation between these two parameters!
Knowing the experience of other countries and the reasons behind their good results would help the community benefit from others’ experiences and grow CP in all countries.
Please share with us why your country is great or not great at IOI.
Let me start by telling you the story behind our success in Olympiads, including IOI. Iran is very good at Olympiads, as you may know. We took third place in five main important international Olympiads, considering overall performance. To find the root cause, we should go back in time. Iran participated in the IMO for the first time in 1985. The President at the time was a supporter of Olympiads and elites. The result was great. Shortly, a few laws were passed in favor of Olympiads:
Giving such big advantages to people who try for Olympiads made big communities participate in Olympiads. For example, around one hundred thousand Iranian students participated in Olympiads last year. Seven thousand of them participated in the Informatics Olympiad.
I made a YouTube Short describing the politics of our high schools regarding the IOI.
Join the codeforces group and checkout the contest.
Here, you can see the PDF version of the editorial.
Note 1: This is not the official editorial. I prepared these solutions while testing the problems as a tester before the contest.
Note 2: The video tutorial is for those who prefer learning from videos and want to see implementation tips alongside the problem explanations.
Watch the full video: Video Link
Check out my submissions: A, B, C, D, E, F, G.
Please let me know how you prefer this kind of problem-solving video.
We are excited to announce that the final round of the Rayan Programming Contest will be held onsite in Tehran, from November 25–29, 2025!
All participants ranked 1-1000 in the Rayan Selection Round are invited to complete the registration form by August 25, 2025 August 27, 2025. The final list of invited participants—selected based on rank and geographical diversity—will be announced shortly thereafter.
Beyond the chance to win top-tier prizes worth $40,000 USD, finalists will enjoy a unique opportunity to experience the timeless beauty and rich heritage of ancient Persia, with special highlights from the vibrant city of Tehran.

Hotel accommodation, local transportation, and meals are provided to all finalists. Moreover, a partial travel fund of 200 USD will be provided to all foreign participants (except prize winners).
Furthermore, T-shirts for the top 50 participants of selection round as well as 50 more for randomly chosen participants ranked 51-1000 will be sent to those who complete the registration form. 👕
We look forward to seeing you on-site! 🎉
UPDATE (August 23): The registration summary so far is available here. The final selection process is described in this post.
UPDATE (August 26): Because of codeforces unavailability last night, the registration deadline has been extended to August 27.
UPDATE (August 29): The list of finalists for the Rayan 2025 World Finals has been announced.