You can use several words in query to find by all of them at the same time. In addition, if you are lucky search understands word forms and some synonyms. It supports search by title and author. Examples:

  • 305 — search for 305, most probably it will find blogs about the Round 305
  • andrew stankevich contests — search for words "andrew", "stankevich" and "contests" at the same time
  • user:mikemirzayanov title:testlib — search containing "testlib" in title by MikeMirzayanov
  • "vk cup" — use quotes to find phrase as is
  • title:educational — search in title

Results

1.

resolve

Last visit:  5 years ago
Registered:  5 years ago
2.
By MikeMirzayanov, history, 2 years ago, In English
Rule Restricting the Use of AI [revision 2024-09-14] It seems that neural networks are working technological wonders. Not long ago, they struggled with even the simplest tasks in our competitions, but now they are reaching new heights that cannot be overlooked. There is reason to believe that progress will continue, and we can expect further advancements in neural networks within the realm of programming competitions. For this reason, we are explicitly limiting the use of AI-based systems (such as various models like GPT, Gemini, Gemma, Llama, Claude, and others) for solving programming problems. However, we recognize that AI can be a valuable tool for learning and coding assistance, so we aim to establish clear boundaries for its use. **Application of this Rule:**<br/>This rule applies strictly to in-contest participation. This includes both registered contestants and out-of-competition participants in any rated Codeforces round. If a round is unrated and this is explicitly stated in the round announcement or rules, the rul...
language descriptions of the solution. * You are forbidden from using AI to diagnose orresolve, * You are forbidden from using AI to diagnose or resolve errors based on system feedback (e.g

Full text and comments »

  • Vote: I like it
  • +2558
  • Vote: I do not like it

3.
By MikeMirzayanov, 21 month(s) ago, In English
Codeforces celebrates its 15th anniversary! <img src="https://assets.codeforces.com/files/codeforces15.jpg" style="width:250px; float:right; margin: 0 1em 1em 1em;" /> Hi, Codeforces! Around this time, 15 years ago, I was deploying the first version of Codeforces on a server, registering my account, and writing the first post. 15 years have passed. Well, happy anniversary to us! For me, this is the most exciting adventure — full of ups and downs, hard work, and moments of joy. What's amazing is that it was never a lonely journey. I've always had caring and reliable friends by my side! That includes the Codeforces team, coordinators and problem writers, our partners in various events, all community members, and, of course, our sponsors — steadfast supporters and helpers. Look at what we've accomplished together! Here are some of the key metrics over the years. There seems to be plenty to celebrate! <center> <img src="https://assets.codeforces.com/files/15/01-submissions.png" class="resource" style="width:300px;"/>...

Full text and comments »

  • Vote: I like it
  • +2311
  • Vote: I do not like it

4.
By tourist, 2 years ago, translation, In English
Code Weekend #1 <div align="right" margin="20px"> <img align="right" src="/predownloaded/72/f1/72f1f31badb1452243838a0fc2553c04accff164.jpeg" alt="logo" width="300px" height="300px" margin="20px"/></div> Hello everyone! We, the [RGBTeam](https://clist.by/team/Romka,tourist,%E2%88%A83886090/) ([user:qwerty787788,2024-05-21], [user:Romka,2024-05-21] and [user:tourist,2024-05-21]), are huge fans of heuristic programming competitions and are quite saddened by the fact that they are becoming less and less frequent each year. One day, we decided to organize our own competition :) Despite the fact that such ideas often remain just ideas, this time we have a serious mindset, and now we want to invite you all to participate in the first — and hopefully not last — **[Code Weekend #1!](https://codeweekend.dev)** The competition will be held in a format quite similar to ICFPC/Google Hashcode — there will be one problem and several dozen tests for it. You will need to submit just an output according to t...

Full text and comments »

  • Vote: I like it
  • +1034
  • Vote: I do not like it

5.
By MikeMirzayanov, history, 19 months ago, In English
My Reply on "Mike, please stop ignoring your userbase" This is a response to [this post](https://codeforces.me/blog/entry/141442). Originally, I intended to leave it as a comment, but the text turned out to be quite long. So I decided to publish it as a separate post. Hi! Let me start with the main idea: I don't think I ignore too many issues (though I do ignore some). In most cases, I do work on them, but these days I just don't feel like writing about it. That kind of communication takes a lot of energy &mdash; which I currently don't have. Oh, it looks like you edited the beginning of the blog, and now it triggers less of an internal protest in me. Honestly, lately I've been in a difficult emotional state, and I just don't have the energy or desire to interact much. It's not just about Codeforces &mdash; it's generally harder for me to engage than it used to be. I won't go into details (health, relocation, family issues, changes in the nature of my work due to bots) &mdash; all of that affects my mental state and willingne...

Full text and comments »

  • Vote: I like it
  • +1425
  • Vote: I do not like it

6.
By MikeMirzayanov, history, 7 years ago, In English
About Division 4 Rounds Hello Codeforces! Initially, here was an announcement of the first round for the fourth division. But currently, in comments there is the huge discussion of division 4 rounds in general. Honestly, I read all (almost all) comments. I decided to replace the text of this post to match the comments better. Also, I'll write one more post separately to discuss problems. And this post will be about division 4 rounds in general. About Div4 rounds: * I'm not afraid of a queue or servers overload: it is technical challenges and my task is to resolve them. The previous biggest rounds were not overshadowed by technical problems and judging delays, they went well. I see no reasons why something should work much worse in the rounds for Div. 4 (and if it does, then this should be fixed). * I don't think that Div. 3 rounds are too dificult. Actually, they are quite good for beginners. They are noticeably easier than Div. 2. Almost every round trusted participants solve all problems, ma...
overload: it is technical challenges and my task is to resolve them. The previous biggest rounds were, resolve them. The previous biggest rounds were not overshadowed by technical problems and judging delays

Full text and comments »

  • Vote: I like it
  • +1391
  • Vote: I do not like it

7.
By unreal.eugene, 5 years ago, In English
Polygon Updates (June — August 2021) Hello, Codeforces. I and [user:DK318,2021-08-19] joined the Codeforces team in June. These three months we mainly dealt with the development of the Polygon platform. In this post, we would like to present to you a list of what we have done during this time. Most of the changes were made to attain easier problem creation. This list does not include minor bug fixes or any improvements that are invisible to users. #### Tables support when rendering statements in HTML Now it's possible to insert the most basic tables in your HTML statements. For example, you can show the scoring system of your problem or insert several images side by side. Only column text alignment and border specification are supported now. <img src="/predownloaded/4a/4a/4a4a6c726e96df40929803a1276a448947d6ebed.png" style="width: 800px; margin-left: auto; margin-right: auto; display: block"/> #### A brief manual for writing statements We bet a lot of users who wrote statements were confused by the fact ...
; display: block"/>[cut] #### Resolving conflicts When the conflict occurs, the link 'Resolve, When the conflict occurs, the link 'Resolve Conflicts' will appear on the sidebar accessing the

Full text and comments »

  • Vote: I like it
  • +1013
  • Vote: I do not like it

8.
By jiangly, 4 years ago, In English
1st Universal Cup Announcement Hello everyone, we are happy to announce that the 1st Universal Cup is started officially. Universal Cup is a non-profit organization dedicated to providing training for competitive programming teams. Our website is [https://ucup.ac/](https://ucup.ac/) (in English and Chinese). In recent years, Chinese problem-setter teams have created a great number of high-quality contests. We have reached an agreement with most of these setters, that they agree to provide contest materials to Universal Cup for hosting mirror contests before publishing the set in public. We believe that such an arrangement can provide good opportunities to teams who want to do better in the future competing. Every year, with the permission of the problem setter team and without involving copyright disputes, the Universal Cup will hold mirror contests for some undisclosed competition sets. It is expected to hold at least 10 contests a year. We will simulate the actual situation in the competition, using the ...
their sets. We expect to host the mirror contest on some Saturdays. To resolve the timezone issue, We expect to host the mirror contest on some Saturdays. To resolve the timezone issue, we plan on

Full text and comments »

  • Vote: I like it
  • +690
  • Vote: I do not like it

9.
By Qingyu, 16 months ago, In English
About the Universal Cup, the Semifinals, and myself... Hey'all! This gonna be a long post, so let me put an important TLDR here first: we are going to host **The 3rd Universal Cup Semifinals**, which will take place on August 24, 2025 **online**, at [11:00 (UTC)](https://www.timeanddate.com/worldclock/fixedtime.html?msg=The+3rd+Universal+Cup+Semifinals&iso=20250824T19&p1=33&ah=5). This contest will be a part of our Finals Team Selection, which the detailed rules and announcements will be published later next week. --- Now for some extra context, if you're interested. Last week, we hosted the [last online stage](https://codeforces.me/blog/entry/143954) of The 3rd Universal Cup. After that, I posted a [feedback form](https://docs.google.com/forms/d/1g5Txhiirh_lRsvGfkYWRozu0WDDGK31IAXjB7VgeVoM/edit) on our discord server. I received lots of thoughtful responses (P.S — it's still open, so feel free to fill it out if you haven't yet!). I've read through all the feedback, and I'd like to share a few thoughts. ### On the Number...
the past year trying to resolve it — fighting through layers of bureaucracy, filing appeals, trying to resolve it — fighting through layers of bureaucracy, filing appeals, seeking mediation

Full text and comments »

  • Vote: I like it
  • +814
  • Vote: I do not like it

10.
By -is-this-fft-, history, 6 years ago, In English
How to ask for help in PM There was a blog today with a similar title, and although it was (I think, not really sure as I didn't get a good look) some kind of satire/joke blog, I wanted to post some serious advice about things I (don't) like to see when people are PMing me. However I decided that this wouldn't be in the spirit of the blog and decided to make a separate blog. And now that blog is deleted anyway. While it's not a bad thing to write messages to more experienced users, most people who write me do things that make them very difficult to deal with. These are my opinions, but somewhy I feel that many reds will agree. Some things here feel silly to write because they are so obvious. But I'm only writing them because people regularly mess them up. [cut] $~$ ####Use punctuation and spelling. There are some [very simple rules](https://codeforces.me/blog/entry/82186#comment-689836) that make your messages infinitely more readable. I find it especially strange when many of these messagers call...

Full text and comments »

  • Vote: I like it
  • +746
  • Vote: I do not like it

11.
By unreal.eugene, 5 years ago, In English
Polygon's New Feature: Resolving Conflicts (finally!) Hello Codeforces! I and [user:DK318,2021-07-09], as students of ITMO University, joined the Codeforces team in June. Last month we mainly dealt with the development of the Polygon platform and were focused on one significant feature lots of people dreamed of. Have you ever made some changes to the problem, and at the same time another person changed the same file? I believe most of you did and disliked this situation. If you wanted to resolve the conflict, you needed to download an archive containing all your changes and repeat them all in the newest revision of the problem. This was very confusing and time-consuming, wasn't it? And now we present probably the most anticipated feature of Polygon since its creation: **a web interface for resolving conflicts**. [cut]<br> When the conflict occurs, the link 'Resolve Conflicts' will appear on the sidebar accessing the page, where you can merge different versions. If it is impossible to load into the problem, the same button will...
and disliked this situation. If you wanted to resolve the conflict, you needed to download an, same file? I believe most of you did and disliked this situation. If you wanted toresolve the conflict, When the conflict occurs, the link 'Resolve Conflicts' will appear on the sidebar accessing the, You can save a draft version using the button 'Save' (it won't resolve the file). When you are sure

Full text and comments »

  • Vote: I like it
  • +430
  • Vote: I do not like it

12.
By SecondThread, 2 years ago, In English
Meta Hacker Cup 2024 Schedule — Introducing the Meta Hacker Cup AI Track Meta Hacker Cup 2024 ================== Meta Hacker Cup is back! We’re excited to announce our schedule for our 2024 season, kicking off on September 20th! - Practice Round: [Fri. September 20th, 10am Pacific (72 hours)](https://www.timeanddate.com/worldclock/fixedtime.html?msg=Meta+Hacker+Cup+Practice+Round&iso=20240920T10&p1=234)* - Round 1: [Sat. October 5th, 10am Pacific](https://www.timeanddate.com/worldclock/fixedtime.html?msg=Meta+Hacker+Cup+Round+1&iso=20241005T10&p1=234&ah=3) (3 hours) - Round 2: [Sat. October 19th, 10am Pacific](https://www.timeanddate.com/worldclock/fixedtime.html?msg=Meta+Hacker+Cup+Round+2&iso=20241019T10&p1=234&ah=3) (3 hours) - Round 3: [Sat. November 2nd, 10am Pacific](https://www.timeanddate.com/worldclock/fixedtime.html?msg=Meta+Hacker+Cup+Round+3&iso=20241102T10&p1=234&ah=3) (3 hours) - Finals: [Sat. December 7th, 6am Pacific](https://www.timeanddate.com/worldclock/fixedtime.html?msg=Meta+Hacker+Cup+Finals&iso=20241207T10&p1=234&ah=4) (4 hou...

Full text and comments »

  • Vote: I like it
  • +528
  • Vote: I do not like it

13.
By E869120, 3 years ago, In English
Serious Altitude Issue in IOI 2025 Hello, CodeForces! Today, I would like to discuss about an issue of IOI 2025 venue. The venue of IOI 2025 is still not officially announced, but according to [the website](https://ioi2025.bo/), IOI 2025 will be held in La Paz, Bolivia. <img src="https://i.ibb.co/PFjkSF1/1.png" alt="1" border="0" width="40%"></img> As you know, La Paz is one of the highest cities in the world. For example, the center of La Paz is at 3600 meters above the sea level, and [El Alto International Airport](https://en.wikipedia.org/wiki/El_Alto_International_Airport), which is the nearest large airport from La Paz, is at 4100 meters above the sea level. Therefore, **altitude sickness can be a big concern.** I think that even the following things can happen: * 20% of the contestants collapsed at the airport, and they were even unable to reach hotels * 30% of the contestants collapsed during hotel stay, opening ceremony, practice sessions and excursions, and they were unable to participate in the c...

Full text and comments »

  • Vote: I like it
  • +436
  • Vote: I do not like it

14.
By adamant, 15 months ago, In English
GF: Competitive programming Discord server (Div. 1 only) Hi everyone! Every once in a while someone makes a competitive programming [Discord server](https://discord.com). Today, we're inviting you to join one of them &#128522; So, first things first, the big flashy link for those who want to cut to the chase: <br><br> <center> <span style="display:inline-block; border:2px solid #ccc; padding:10px; border-radius:8px; background:#f9f9f9;"> <a href="https://discord.gg/sTk4khgmSd" style="font-weight:bold; font-size:1.2em;">Join us!</a> </span> <div style="margin-top:5px; font-size:0.85em;"> <a href="https://discord.gg/bitset" style="color:#555;">discord.gg/bitset</a> </div> </center> **Name**: GF<br> **Members**: 1000+ (and growing!)<br> **Admins**: ~Halzion,2025-08-09 ~rewhile,2025-08-09 ~defnotmee,2025-08-09, ~adamant,2025-08-10<br> **Moderators:** <table style="border-collapse:collapse; border:none; margin-left:2em;"> <tr> <td style="border:none; padding:0 8px;">~jeroenodb,2025-08-09</...
create a hostile atmosphere than help resolve the issue. Please contact someone in the moderator, we'll do our best to resolve the issue.

Full text and comments »

  • Vote: I like it
  • +436
  • Vote: I do not like it

15.
By nifeshe, 10 months ago, In English
Codeforces Round 1073 (Div. 1, Div. 2) Hello Codeforces, After decades of hard work and several quality reviews from independent third parties, I'm delighted to invite you to participate in [contest:2190], and, if you really want to, [contest:2191], which will both held on [contest_time:2190]. In each division, you will be given $7$ problems and $3$ hours to solve them, one of which will be divided into subtasks. Problems were mainly authored by me, [user:nifeshe,2026-01-15], with help from [user:nika-skybytska,2026-01-15] and [user:satyam343,2026-01-15]. **Only $6$ or $7$ problems will not be interactive in each division**, so please make sure to read the [guide for interactive problems](https://codeforces.me/blog/entry/45307) before the contest. In related news, we’ve already been awarded the **Nobel Peace Prize** for this round, for achieving a level of problem quality so universally accepted that all global conflicts have been resolved. I would like to thank the following people for making the contest possi...

Full text and comments »

  • Vote: I like it
  • +456
  • Vote: I do not like it

16.
By cry, 3 years ago, In English
CodeTON Round 8 (Div. 1 + Div. 2, Rated, Prizes!) Hello Codeforcers! ================== We are pleased to invite you to participate in [contest:1942]. This round will start on [contest_time:1942] and will be **rated for all participants**. There will be $8$ problems to be solved in $3$ hours, with one divided into two subtasks. Similar to [USACO](https://usaco.org/), you will help Farmer John and his cows resolve a series of first world problems. Be there or be square. This round was cooked up by [user:smax,2024-03-10], [user:sum,2024-03-10], [user:oursaco,2024-03-10], [user:cry,2024-03-13], and [user:buffering,2024-03-10]. We would like to thank the following people for making the round possible: - Our favorite cherry [user:TheScrasse,2024-03-10] for the wonderful and speedy coordination. - Our MVP testers, [user:Benq,2024-03-10], [user:Geothermal,2024-03-26], and [user:rainboy,2024-03-26], for dedicating so much time to reviewing problems, providing essential feedback, and perfecting the problemset. - The rest of ...
Farmer John and his cows resolve a series of first world problems. Be there or be square., [USACO](https://usaco.org/), you will help Farmer John and his cows resolve a series of first world

Full text and comments »

  • Vote: I like it
  • +505
  • Vote: I do not like it

17.
By adamant, history, 4 years ago, In English
Osijek Competitive Programming Camp 2023 winter — wrap Hi everyone! <center><a href="https://ocpc.mathos.unios.hr"><img src="https://ocpc.mathos.unios.hr/images/ocpc.svg" height="100px"></a></center> <center> <b>Sponsored by</b><br> <a href="https://www.janestreet.com/join-jane-street/open-roles/?type=students-and-new-grads&location=london"> <img src="/predownloaded/ee/f2/eef26616a3661c658d1545f18ed21fabb14d5871.svg" height="50px" style="margin: 5px 5px 5px 5px;"> </a> <a href="https://www.think-cell.com/osijek2023"><img src="/predownloaded/97/88/97887beeb75a4601259414b36ecee0160c29d027.svg" height="40px" style="margin: 5px 5px 5px 5px;"></a> <a href="https://pinely.com/"> <img src="/predownloaded/0a/0f/0a0f3f67435d1f6e467bc7203d4a2090ba8f92cc.svg" height="50px" style="margin: 5px 5px 5px 5px;"> </a> </center> The [Osijek competitive programming camp](https://ocpc.mathos.unios.hr) (also see the [announcement](https://codeforces.me/blog/entry/110945) on Codeforces) just concluded last Sunday, on February 26, and I'd lik...

Full text and comments »

  • Vote: I like it
  • +328
  • Vote: I do not like it

18.
By errorgorn, 3 years ago, In English
Confession: I sent problem H to goodbye Going to be 100% honest here, I sent problem H to goodbye. I feel really bad to authors of Goodbye 2023 for ruining their round, it seems the round would have been better by just removing H. As much as the community is out here roasting [user:74TrAkToR,2023-12-31], I also had a part to play in this contest. I wish to be as transparent as I can here without saying any classified information (apologies to [user:KAN,2023-12-31] and [user:74TrAkToR,2023-12-31] if anything here shouldn't be disclosed). To give some context, here is what went down in goodbye round from my perspective: - 13 days before contest: KAN asks me if I can source a 1E for goodbye. I asked traktor to send me the testing gym so that I could gauge how hard the 1E should be. He told me he will send me after he translates the statements. (UPD: Note that the IMO 1986 problem was already removed before this stage which is why a new 1E was needed, I never saw this IMO problem) - 11 days before contest: traktor send it...

Full text and comments »

  • Vote: I like it
  • +815
  • Vote: I do not like it

19.
By MikeMirzayanov, 3 years ago, In English
Codeforces Round 875 is Rescheduled Hello, Codeforces! Unfortunately, today unexpectedly some errors occurred on the servers that we restarted before the round. We couldn't resolve them within 30 minutes. Half of the servers continue to work steadily. I don't want to risk hosting the round. A round preparation includes too much collaboration between the authors, coordinator, and testers. I have made the decision to postpone the round so that we can hold it in the future with confidence that everything will be fine. I apologize for the inconvenience. Today I will delve into what is happening and figure it out. There is no reason to think that something will not work for tomorrow's round. We will announce the new date for Round 875 later. Apologies again for the inconvenience, Mike **UPD: The round is rescheduled on [contest_time:1830].**
restarted before the round. We couldn't resolve them within 30 minutes. Half of the servers, round. We couldn't resolve them within 30 minutes. Half of the servers continue to work steadily.

Full text and comments »

  • Vote: I like it
  • +962
  • Vote: I do not like it

20.
By errorgorn, 19 months ago, In English
1/phi Halving in Interactive Tree Problems Thanks to [user:toxicpie9,2025-04-22] for proofreading and emotional support. Recently, I was thinking about JOISC 2025 Space Thief. And there is a part where you need to do divide and conquer on a tree, where you need to split the edges of the tree into two components where the edges are both connected. Basically, we consider an interactive problem on a tree where there is a hidden edge. We are allowed to ask queries of the form $(v,N_v)$ where $v$ is a vertex of the tree and $N_v$ is a set of neighbouring edges of $v$. Then the query returns to us whether the hidden edge is in the subtree of one of $N_v$ when we root the tree at $v$. We maintain a set of edges that the hidden edge can be in. In each query, we try to split the set of edges into two parts and ask a query to separate them. In the worst case, we replace the set of edges by the larger component. Let $R$ be the maximum ratio of the larger component. In [this blog](https://codeforces.me/blog/entry/120446)...

Full text and comments »

  • Vote: I like it
  • +208
  • Vote: I do not like it

21.
By Errichto, 6 years ago, In English
Community IOI Weekly Classes (on Codechef?) Let's discuss the idea of IOI preparation in form of weekly contests and classes. Many programming camps reuse problems from old national camps and contests. What about doing this on a bigger scale and conducting weekly mashup contests open for everybody for free? The problem analysis would be in English, in written or (live) video format, possibly combined with a lecture. Make a discord server for further discussion and questions, encourage students to upsolve, maintain yearly leaderboard and upsolving leaderboard. Once or twice a year, call it a 1-week online camp and organize these mashup contests daily. I can take part in this initiative but I want to be just one of many teachers. When it's my turn, I would pick some old interesting POI or ONTAK problems because I either know them or can look up the solution in Polish. If I do this once per 1-2 months, I won't run out of good problems anytime soon, and I have enough time to prepare analysis and lecture, and later spend severa...
often prefer to resolve small doubts with a teacher or assistant who speaks their native language. 3, troubles, but weaker ones often prefer to resolve small doubts with a teacher or assistant who speaks

Full text and comments »

Tags ioi
  • Vote: I like it
  • +466
  • Vote: I do not like it

22.
By Endagorion, 12 years ago, In English
Codeforces Round #300 Editorial (+challenges) As usual, a challenge comes with every problem. I tried not to repeat the mistakes of my previous editorials and made sure that all challenges have a solution =) (except for the _italics_ parts that are open questions, at least for me). Go ahead and discuss them in the comments! General questions about problems and clarification requests are welcomed too. **UPD**: I added codes of my solutions for all the problems. I didn't try to make them readable, but I believe most part of them should be clear. Feel free to ask questions. [problem:538A] Let me first clarify the statement (I really wish I didn't have to do that but it seems many participants had trouble with the correct understanding). You had to erase exactly one substring from the given string so that the rest part would form the word `CODEFORCES`. The (somewhat vague) wording `some substring` in the English translation may be the case many people thought that many substrings can be erased; still, it is beyond my understa...

Full text and comments »

Tutorial of Codeforces Round 300
  • Vote: I like it
  • +312
  • Vote: I do not like it

23.
By rot, 2 years ago, In English
I reached master (+ what practice strategies don't work) I've just hit my goal of reaching yellow on Codeforces. Thus, I'm celebrating by sharing with everyone what I've learned over the years while trying to improve. I've done _a lot_ of research on my own when I was at a lower rating, constantly googling and looking at blogs to try to come up with the "optimal practice strategy", and failed every time. So, I think my experience in failing is going to be very valuable to a lot of people reading this. Let's imagine a very simplified case of what happens when we're doing a problem. When solving a practice problem, these combinations of things can happen: 1. Solve? Yes/No 2. Tried a lot of ideas? Yes/No 3. Used the editorial? Yes/No Now, here are the simplified rules I follow to tell if I'm improving or not. - If you did not solve, did not try a lot of ideas, and did not use the editorial: you did not improve. - If you did not solve, did not try a lot of ideas, and did use the editorial: you did not improve. - If you did not...
? Because if you don't resolve why those ideas do/don't work, they were pointless. That's why reading, resolve why those ideas do/don't work, they were pointless. That's why reading the solution or

Full text and comments »

  • Vote: I like it
  • +422
  • Vote: I do not like it

24.
By awoo, history, 14 months ago, translation, In English
Educational Codeforces Round 182 Editorial [problem:2144A] Idea: [user:BledDest,2025-09-16] <spoiler summary="Tutorial"> [tutorial:2144A] </spoiler> <spoiler summary="Solution (BledDest)"> ~~~~~ t = int(input()) for i in range(t): n = int(input()) a = list(map(int, input().split())) if sum(a) % 3 == 0: print("1 2") else: print("0 0") ~~~~~ </spoiler> [problem:2144B] Idea: [user:BledDest,2025-09-16] <spoiler summary="Tutorial"> [tutorial:2144B] </spoiler> <spoiler summary="Solution (BledDest)"> ~~~~~ #include<bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> p(n); vector<int> pos0; vector<int> used(n); for(int i = 0; i < n; i++) { cin >> p[i]; --p[i]; if(p[i] == -1) pos0.push_back(i); else used[p[i]] = 1; } if(pos0.size() == 1) { int unused = 0; for(int i = 0; i < n; i++) if(used[i] == 0...
+ 2] += f[v]; f[v] = 0; } } void resolve(int v, int pos, ) { resolve(v, pos); t[pos] = add(t[pos], val); } else, ]; f[v] = 0; } } void resolve(int v, int pos) { if(f[v, void resolve(int v, int pos) { if(f[v] != 0) { t[pos] = mul(t

Full text and comments »

  • Vote: I like it
  • +50
  • Vote: I do not like it

25.
By peltorator, 6 months ago, In English
So Do You Really Understand Fast Matrix Multiplication? Most of you have probably heard of $\omega$, the matrix multiplication exponent. Are you sure you fully understand its definition, though? I thought so too, until I started asking myself some uncomfortable questions and realized that I had some subtle misconceptions. To answer these questions, I read a bunch of papers and book chapters, and now I have some peace of mind. Let me try to scare you a bit first and then hopefully rebuild your understanding of fast matrix multiplication. Let's start with four questions. Try to answer them before reading further. Q1: Does there exist an $O(n^{\omega})$-time matrix multiplication algorithm? Q2: Does there exist an $o(n^{\omega})$-time matrix multiplication algorithm? Q3: Does there exist an $O(n^{\omega + 0.1})$-time algorithm for integer matrix multiplication? Q4: Does there exist an $O(n^{\omega - 0.1})$-time algorithm for integer matrix multiplication? <spoiler summary="Answers"> A1: Maybe. We don't know. A2: ...
Let us now resolve these two issues. The first one is the easier one. Suppose we know how to

Full text and comments »

  • Vote: I like it
  • +379
  • Vote: I do not like it

26.
By cry, 2 years ago, In English
Codeforces Round 965 (Div. 2) Editorial #### [problem:1998A] Problem Credits: [user:sum,2024-07-03] <br> Analysis: [user:cry,2024-07-03] <spoiler summary="Solution "> We can construct a solution by fixing all $x_i$ as $x_c$ or all $y_i$ as $y_c$. For example, if we fix all $y_i$ as $y_c$, then we can output pairs $(x_c-1, y_c), (x_c+1, y_c), (x_c-2, y_c), (x_c+2, y_c), ... , (x_c- \lfloor \frac{k}{2} \rfloor, y_c), (x_c + \lfloor \frac{k}{2} \rfloor, y_c)$. If the $k$ is odd, we need one more pair, so just output $(x_c, y_c)$. </spoiler> <spoiler summary="Code (C++)"> ```cpp #include <iostream> using namespace std; int main() { int t; cin >> t; while(t--){ int x, y, k; cin >> x >> y >> k; for(int i = 0; i < k - k % 2; i++){ cout << x - (i & 1 ? 1 : -1) * (i / 2 + 1) << " " << y << "\n"; } if(k & 1){ cout << x << " " << y << "\n"; } } } ``` </spoiler> #### [problem:1998B] Problem Credits: [user:satyam343,2024-08-07] <br> Analysis: [user:cry,2024-07-03] <spoiler summ...

Full text and comments »

  • Vote: I like it
  • +159
  • Vote: I do not like it

27.
By Endagorion, 15 years ago, translation, In English
Codeforces Beta Round #99: editorial <h3>[[problem:139A]]</h3>If the total number of pages doesn't exceed the number of pages for Monday, the answer is Monday. Otherwise we can substract the Monday number from total and go on to Tuesday. If Tuesday isn't enough, we subtract and continue to Wednesday, and so on. We are sure that no more than N weeks will pass, as at least one page is read every week. Complexity - O(N).<br /><br /><h3>[[problem:139B]]</h3>Unluckily, the translated statement was <strike>quite tough</strike> even tougher to understand than the original statement.<br /><br />Say we fixed the roll type and the room. The only possible way to cut the roll is to cut it into vertical stripes with length equal to room's height (though it was said we can cut it any way we want, there were some conditions to fulfill, namely there could be no joints other than vertical). So we find the total width of stripes we can cut our roll into as the (length of the roll / height of the room) (rounded down) * (width of the roll). ...

Full text and comments »

  • Vote: I like it
  • +68
  • Vote: I do not like it

28.
By DNR, 4 months ago, In English
AI resolves yet another major conjecture in math Announcement on X: [link](https://x.com/__eknight__/status/2075643450196971805). (and if you wanna see some of the usual suspects on HN doing their best to cope, [here you go](https://news.ycombinator.com/item?id=48863490)) Summary: - The conjecture in question is the [cycle double cover conjecture](https://en.wikipedia.org/wiki/Cycle_double_cover), and resolving it has been a major open problem in graph theory for ~50 years. - The statement of the conjecture is actually pretty simple and immediately understandable to CPers: > For any bridge-less undirected graph $G(V, E)$, you can find a set of cycles $C$ such that each edge in $E$ is covered by exactly two cycles in $C$. - Shockingly, [the proof](https://cdn.openai.com/pdf/04d1d1e4-bc75-476a-97cf-49055cd98d31/cdc_proof.pdf) is also not that illegible for a mathematically illiterate person like me, and I was able to get a high-level understanding after talking to AI about it for an hour. - Unlike [previous instances](http...

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

29.
By s-sireneva, history, 2 years ago, In English
Bypassing Cloudflare's "bot fight mode", or how I wrote a working JS interpreter in a weekend... ...for fun and absolutely no profit. # Part 0. Introduction It so happened that I haven't written any Codeforces contest in a few months. When I was logging into my account to leave a comment under some post (I ended up not doing that), I noticed something weird:[cut]&#32; `Please wait. Your browser is being checked. It may take a few seconds...` After about half a second, this screen disappeared, and the normal login page showed up. But since I'm maintaining a CLI client for Codeforces, this immediately caught my attention with an intrusive question: did Mike break my client once again? After firing up a shell and trying to login, the answer was clear: yes, he did. # Part 1. "What the heck?" At the first glance, this screen looked suspiciously like the Cloudflare "Checking your browser" screen. This would have been a dead end, as even "professional" scrapers prefer using headless browsers and such instead of relying on "Cloudflare bypasses". The idea of the CLI tool ...
What can I do to resolve this?

Full text and comments »

  • Vote: I like it
  • +214
  • Vote: I do not like it

30.
By LorentzianExpanders, history, 22 months ago, In English
Convolution, In the Perspective of 3-Dimensional Tensors Hello everyone! Convolution is perhaps the first class of algorithms that one encounters in competitive programming requiring algebraic knowledge. There are many types of convolutions that we are interested in, including: - **Sequential convolution** (i.e., polynomial multiplication), - **XOR convolution**, - **AND/OR convolution**, - **GCD/LCM convolution**, - **Subset convolution**, and others. One of the most well-known ways to understand fast algorithms for these convolutions is through their associated algebraic structures. These algebraic structures can often be decomposed using the Chinese Remainder Theorem (CRT) into simpler components, i.e., direct products. For instance, in the case of XOR convolution, the algebraic structure arises from the computation rules of the group algebra: $$ R[\mathbb Z_2^n]\colon \left(\sum_{g\in \mathbb Z_2^n} a_g g\right) \left(\sum_{g\in \mathbb Z_2^n} b_g g\right) = \left(\sum_{g,h\in \mathbb Z_2^n} a_g b_h (g+h) \right), $$...

Full text and comments »

  • Vote: I like it
  • +238
  • Vote: I do not like it

31.
By adamant, history, 2 years ago, In English
OCPC 2024 Fall — wrap Hi everyone! <center><a href="https://ocpc.mathos.unios.hr"><img src="https://ocpc.mathos.unios.hr/images/ocpc.svg" height="100px"></a> <a href="https://icpc.foundation/"><img src="https://ocpc.mathos.unios.hr/images/ICPC.svg" height="100px"></a></center> <center> <b>Sponsored by</b><br> <a href="https://www.janestreet.com/join-jane-street/open-roles/?type=students-and-new-grads&location=london"> <img src="/predownloaded/ee/f2/eef26616a3661c658d1545f18ed21fabb14d5871.svg" height="50px" style="margin: 5px 5px 5px 5px;"> </a> <a href="https://pinely.com/"> <img src="/predownloaded/0a/0f/0a0f3f67435d1f6e467bc7203d4a2090ba8f92cc.svg" height="50px" style="margin: 5px 5px 5px 5px;"> </a> <a href="https://quantco.com/"> <img src="/predownloaded/5d/d5/5dd574cd921167d19fb0907b542835e09e6490f4.svg" height="50px" style="margin: 5px 5px 5px 5px;"> </a> </center> Last Sunday marked the conclusion of the fourth [Osijek Competitive Programming Camp](https://codeforces.me/blog/...
discuss the issue and try to improve in a way that will resolve your doubts. Other than that, reached out to me, so that we can discuss the issue and try to improve in a way that willresolve

Full text and comments »

  • Vote: I like it
  • +200
  • Vote: I do not like it

32.
By Balajiganapathi, history, 6 years ago, In English
Anouncement about Amritapuri ICPC and other Indian regionals Hi all, an important announcement about icpc (https://www.amrita.edu/icpc21) It has been decided to conduct the Asia Amritapuri ICPC Preliminary and Regional Round in the month of June and July respectively because of the current pandemic situation. Registration will end 10 days before the Preliminary Online Round. Teams can register at two sites as per the rules, if the contest is announced by other sites. Most probably Kanpur & Gwalior sites also will host the contest. ~In,2021-07-27 that case, there will be one single round of online contest. This will be announced soon~. Tentative date for the Preliminary Round Online contest: Last week of June 2021. Duration: 2.5 hours There is no registration fee to participate in the Preliminary Online Round. Regional Round: July second week. Duration: 5 hours Teams will be promoted after the Preliminary Online Round. Regional Round will be held online on [CODEDRILLS](https://codedrills.io/) platform. Amrita wil...
mock contest and ensuring that your login works. Make sure you resolve any issues faced well before the, sure you resolve any issues faced well before the main contest. We won't be able toresolve any

Full text and comments »

  • Vote: I like it
  • +224
  • Vote: I do not like it

33.
By wuhudsm, history, 15 months ago, In English
Codeforces Round 1040 (Div. 1, Div. 2) Editorial Thank you for participation and we hope you enjoy this round :) <spoiler summary="How did you find the contest?"> - Great: - Good: - Average: - Bad: - Trash: </spoiler> <spoiler summary="Which problem is your most favourite?"> - D2A: - D2B: - D1A: - D1B: - D1C1: - D1C2: - D1C3: - D1D: - D1E: - D1F1: - D1F2: </spoiler> <spoiler summary="Which problem you hate the most?"> - D2A: - D2B: - D1A: - D1B: - D1C1: - D1C2: - D1C3: [likes:favorite,2039E3_...
)$. This implies that a single application of operation $3$ suffices to resolve all such pairs.

Full text and comments »

  • Vote: I like it
  • +118
  • Vote: I do not like it

34.
By galen_colin, 6 years ago, In English
[Website] Contest Replay I've found that an interesting way to <s>waste</s> pass time is by watching the standings as rounds happen. As far as I know, there are mainly three ways to do this: - Watch a contest as it happens - Watch a contest as system tests run - Virtually participate, and watch standings that way Obviously, the first two are time-dependent and won't work for past contests. The third option is more viable, but it both introduces meaningless data into the CF system and also forces you to watch with ICPC rules, which is inaccurate and doesn't work for other scoring systems. There's also no way to rewind, you have to watch in real-time, etc. It should be easier than that. And now it is! I introduce you to [Contest Replay](https://contest-replay--colingalen.repl.co/) &mdash; a simple website that will let you "watch" a contest's standings at any point in time. You can also target a user and watch their ranking instead of the overall leaderboard, as well as customize a ton of things to yo...

Full text and comments »

  • Vote: I like it
  • +243
  • Vote: I do not like it

35.
By mcqueencin, history, 3 years ago, In English
Difficulties Faced in ICPC Colombia: Balancing National and International Competitions Hi Codeforces community! I am currently a member of a team that aspires to compete in the upcoming ICPC World Final 2024. As we gear up for this exciting journey, we encounter a significant hurdle that we'd like to share with you all. As part of the qualification process, we must first participate in the national marathon in Colombia, which is a crucial step towards earning a spot in the Latin American regional and, ultimately, the world finals. However, here's where the difficultie lies – the scheduled date for the national marathon (2nd September) coincides with the prestigious International Olympiad in Informatics (IOI), taking place from 28th August to 4th September. Several team members, including myself as a coach and one of my teammates as participant, have qualified to represent Colombia in Hungary at the IOI, making it seemingly impossible to be at both events simultaneously (as far as we know). Upon realizing this conflict, we immediately attempted to contact ICPC Co...
a situation similar to ours, and how did you resolve it? Do you have a feedback system or complaint, handled in your country? Have you encountered a situation similar to ours, and how did youresolve it

Full text and comments »

  • Vote: I like it
  • +213
  • Vote: I do not like it

36.
By adamant, history, 9 months ago, In English
OCPC 2026 Winter — wrap _If you are potentially interested in participating in OCPC **in person** in Summer/Autumn 2026, **please** fill **[this form](https://forms.gle/VdMRh6cAJRN4YvQN6)**!_ Hi everyone! <center><a href="https://ocpc.camp"><img src="https://ocpc.camp/images/ocpc_light.svg" height="80px"></a> <a href="https://icpc.foundation/"><img src="/predownloaded/43/08/43086529a28ccb5c9f2f2eec560ffa85e09c6881.svg" height="80px"></a></center> <center> <b>Supported by</b><br> <a href="https://www.janestreet.com/join-jane-street/open-roles/?type=students-and-new-grads&location=london"> <img src="/predownloaded/ee/f2/eef26616a3661c658d1545f18ed21fabb14d5871.svg" height="40px" style="margin: 10px 10px 10px 10px;"></a> <a href="https://www.hudsonrivertrading.com/"> <img src="https://ocpc.camp/images/HRT.svg" height="40px" style="margin: 10px 10px 10px 10px;"></a> <a href="https://www.silares.com/"> <img src="https://ocpc.camp/images/silares-red.svg" height="40px" style="margin: 10px 10px 10px ...

Full text and comments »

  • Vote: I like it
  • +157
  • Vote: I do not like it

37.
By plagues, 2 months ago, In English
The most outrageous cheating in the history of Huawei Challenge ![ ](/predownloaded/e4/f0/e4f0838fd7d6c43c6a92c2655748800519c78bd3.jpg) I am writing this because I believe that prohibited collaboration occurred during this Challenge and affected the prize positions. To state my personal conclusion plainly: I believe this is cheating, not merely a collection of innocent coincidences. The final positions relevant to the accounts discussed in this post were: | Rank | Handle | Final score | Result of my public-data review | |---:|---|---:|---| | 2 | [user:IceKylin,2026-08-28] | 16808.628 | Historical team with [user:candy0014,2026-08-28] named “IceKylin 0339 team”; all-time runtime/score leads with [user:candy0014,2026-08-28] and [user:Retired_Zhisheng,2026-08-28] | | 3 | [user:mahiro_zcy,2026-08-28] | 16757.390 | Repeated all-time runtime/score correlation with [user:mojo__hugo,2026-08-28]; repeated timing correlation with [user:Zinc-acetate,2026-08-28]; weak close event with [user:Mango2011,2026-08-28] | | 4 | [user:Zinc-acetate,2026-08-...
context. “The code is different” answers one narrow question. It does not resolve whether ideas, test, runtime/near-score correlation that the organizers can resolve by comparing sources. The public team and

Full text and comments »

  • Vote: I like it
  • +205
  • Vote: I do not like it

38.
By antontrygubO_o, 5 years ago, translation, In English
SnackDown 2021 Grand Finale, Parallel Contest & Closing Ceremony It’s finally time for one of the biggest events in the competitive programming world. The SnackDown ‘21 Grand Finale is here. The entire Grand Finale event is scheduled to be completed in two days &mdash; January 8 (Saturday), and January 9 (Sunday). ### For the Finalists All the information has been shared over email, but summarising &mdash; The Grand Finale will be spread over two days and will be a closed event accessible only to the finalists, and a few invited guests. The SnackDown 2021 Final contest will be held on Jan 9th between 6:30 &mdash; 10:30 PM (IST). For the last time for this SnackDown, meet the panelists! <ul> <li>Contest Admins: Anton [user:antontrygubO_o,2022-01-08] Trygub and Yahor [user:mhq,2022-01-08] Dubovik</li> <br> <li>Head Admin: Alex [user:Um_nik,2022-01-08] Danilyuk</li> <br> <li>Testers: Ashley [user:errorgorn,2022-01-08] Khoo and Andrew [user:ecnerwala,2022-01-08] He </li> <br> <li>Setters: Federico [user:dario299...

Full text and comments »

  • Vote: I like it
  • +203
  • Vote: I do not like it

39.
By Endagorion, history, 10 years ago, In English
Yandex.Algorithm 2016, third elimination round editorial I hope you've enjoyed the problems! Please ask your questions and report flaws in the comments. ### Problem A First insight is that two spells are always enough. Why? Let's freeze all leftbound penguins at point $10^{-9}$ and all rightbound penguins at point $10^9$. So the only problem is to determine when only one spell is enough. If that holds, there should exist a point which all penguins will cross at some moment. Let's put this point at $x_+$~--- rightmost point among penguins' coordinates which run to the right. Now all rightbound penguins will cross this point. If there is a leftbound penguin which doesn't cross $x_+$ then its coordinate $x_-$ must be less than $x_+$. But in this case there are two penguins running away from each other~--- clearly one spell will not suffice. So, the easiest and most effective solution is to find $x_+$~--- the location of rightmost rightbound penguin, and $x_-$~--- the location of leftmost leftbound penguin, and check if $x_- < x_+$. ...

Full text and comments »

  • Vote: I like it
  • +41
  • Vote: I do not like it

40.
By NetSpeed1, 23 months ago, In English
Codeforces Global Round 28 Editorial [problem:2048A] Author: [user:Little09,2024-12-19] <spoiler summary="Hint 1"> How much does the number decrease when we remove two consecutive $3$ s? </spoiler> <spoiler summary="Tutorial"> ### [problem:2048A] When we transform $\overline{x33y}$ into $\overline{xy}$ (where $x$ and $y$ are decimal numbers), the actual value changes from $10^{p+2} \cdot x + 33 \cdot 10^p + y$ to $10^p \cdot x + y$. The decrease is $99 \cdot 10^p \cdot x + 33 \cdot 10^p$. It is easy to see that $33 \mid (99 \cdot 10^p \cdot x + 33 \cdot 10^p)$. Therefore, we can replace the operation of removing two consecutive $3$ s with a series of $-33$ operations. Hence, we only need to determine whether $x$ can be reduced to $0$ using a series of $-33$ operations, which is equivalent to checking whether $x \bmod 33$ equals zero. </spoiler> [problem:2048B] Author: [user:wsyear,2024-12-19] <spoiler summary="Hint 1"> If the permutation is sufficiently long, what is the maximum number of leng...
The case where $x > y$ is easy to resolve. For the case where $x < y

Full text and comments »

  • Vote: I like it
  • +128
  • Vote: I do not like it

41.
By Ashishgup, 6 years ago, In English
Invitation to CodeChef January Cook-Off 2021 We invite you to participate in CodeChef’s [January Cook-Off](http://bit.ly/COOK126-Codeforces), this Sunday, 24th January, from [9:30 PM to 12:00 AM IST](https://www.timeanddate.com/worldclock/fixedtime.html?msg=January+Cook-Off&iso=20210124T2130&p1=44&ah=2&am=30). There will be **3 divisions**, each division containing **6 problems**! This CookOff, [ByteDance](https://en.wikipedia.org/wiki/ByteDance) is joining CodeChef as the official contest recruiter! The tech giants, who have their presence globally established through a range of content platforms, are looking to hire for multiple positions for their Singapore office, including &mdash; Algorithm Engineers, Backend Engineers, Data Engineers, Data Scientist, Machine Learning Engineers, Research Scientists, Frontend Engineers, Quality Assurance Engineer, Research Engineers, Software Engineer, and Site Reliability Engineers. Joining us on the problem setting panel are: - Setters: Ashish [user:Ashishgup,2021-01-22] Gupta, ...

Full text and comments »

  • Vote: I like it
  • +108
  • Vote: I do not like it

42.
By wangmarui, history, 10 months ago, In English
Hello 2026 Editorial We'd like to thank you all for participating in the contest, and hope you enjoyed it. Any feedback would be appreciated! <spoiler summary="Rate The Contest!"> - Great contest - Good contest - Average contest - Bad contest </spoiler> ## [2183A &mdash; Binary Array Game](https://codeforces.me/contest/2183/problem/A) Idea & Preparation: [user:wangmarui,2025-12-23] <spoiler summary="Rate The Problem!"> - Good Problem - Okay Problem - Bad Problem - Didn't Solve </spoiler> <spoiler summary="Hint 1"> If the sequence $a$ consists entirely of $1$ s, what will Alice do? </spoiler> <spoiler summary="Hint 2"> Consider discussing the values of $a_1$ and $a_n$. </spoiler> <spoiler summary="Solution"> First, if the entire sequence consists of $1$ s, Alice wins immediately by operating on the whole sequen...

Full text and comments »

Tutorial of Hello 2026
  • Vote: I like it
  • +146
  • Vote: I do not like it

43.
By EnDeRBeaT, 2 years ago, In English
Tutorial: Stealing the coolest debug feature from Rust # Introduction Rust is a quite popular programming language with a lot of different takes on how to write good code. Some people use it in competitive programming with varying success, but in general, C++ is the king. That doesn't mean that we can't take great ideas from this language, and one of Rust's shining jewels is it's macro system. Describing why it is better than "find and replace" thing we have in C++ is not the topic of this blog. We are here to steal from Rust, and today we will steal one of the coolest utilities for a competitive programmer: `dbg!` macro! # dbg! The `dbg!` macro in Rust has simple functionality: it evaluates the expression, prints it's to `stderr` and **returns it**. Last part is very, **very** useful, and you will see why. Example: ~~~~~ let a = 2; let b = dbg!(a * 2) + 1; // ^-- prints: [src/main.rs:2:9] a * 2 = 4 assert_eq!(b, 5); ~~~~~ Look, we evaluated `a * 2` mid expression and `b` still became `5`. Isn't that cool? ...
>(d)` can be interpreted as a template specialization or as 2 comparisons, which you can'tresolve

Full text and comments »

  • Vote: I like it
  • +184
  • Vote: I do not like it

44.
By dmkozyrev, history, 3 years ago, In English
[Tutorial] Quick start in solving problems on GPU + CPU Hello, codeforces! Do you have modern GPU and CPU and want to calculate something with them, but you don't know how to do it? Dont be upset, because you can read this blog and run your first GPU program on your AMD/Intel/NVIDIA GPU. I will describe an installation process and then we will dive into the C++ code. As an example, we will calculate a lot of mazes for [Bug Game](https://codeforces.me/blog/entry/115144) in parallel. For doing this in simple way, we will use library [Boost.Compute](https://www.boost.org/doc/libs/1_80_0/libs/compute/doc/html/index.html), which is a C++ STL-style wrapper over OpenCL library. [cut] ... Installation for MacOS (Apple M1 Pro) ================== As [user:Gosunov,2023-06-10] said, `OpenCL` and `g++` are pre-installed on `MacOS`. Everything that you have to do is install `Boost` with command `brew install boost`. After this you will be able to compile your program with command `g++ -std=c++17 -O3 -I/opt/homebrew/Cellar/boost/1.81.0_1/...
, something wrong with driver/setup, but I can't resolve it. `GPU ops` have to be `1.488.650.000`, but

Full text and comments »

  • Vote: I like it
  • +118
  • Vote: I do not like it

45.
By BledDest, 4 years ago, In English
Does Codeforces need a moderation system? In the recent months, the number of trash blogs on Codeforces has risen. Thankfully, they are mostly being ignored, and are very often recognizable by their title and/or author handle, but they still show up in the Recent Actions, making navigation through actually meaningful and good content like tutorials/contest invitations/etc harder. And very often, it's the same person posting one useless blog after another, not getting banned even after five or six instances. Personally, I am sick of those blogs, and I don't think I'm the only one. I understand why they don't get banned. Mike, Gera Nazarov and other people responsible for the platform are very busy maintaining the testing system, catching cheaters, improving Polygon and doing other work which lets Codeforces continue running and improving. They don't have time for digging through everything that gets posted, and that's perfectly understandable. So, I think we need some other people who can do this. Maybe a crew of some uni...
and people who post them? (If I were asked, I'd volunteer.) I don't think they'll be able toresolve, them? (If I were asked, I'd volunteer.) I don't think they'll be able to resolve the whole issue

Full text and comments »

  • Vote: I like it
  • +244
  • Vote: I do not like it

46.
By Vectors_Master, 20 months ago, In English
Codeforces Round 1007 (Div. 2) Editorial We hope you enjoyed the problems! Thank you for participating in the contest! We would love to hear your feedback in the comments. <br> <spoiler summary="How did you find the contest?"> - Great: - Good: - Average: - Bad: - Trash: </spoiler> <spoiler summary="Which problem was your favorite?"> - A: - B: - C: - D1: - D2: - E: - F: </spoiler> <spoiler summary="Which problem did you find the least enjoyable?"> - A: - B: - C: - D1: - D2: - E: - F: </spoiler> <br> [problem:2071A] <spoiler summary="Hints"> <spoiler summary="Hint 1"> When Fofo is the spectator of the first match, what is the earl...
condition that $1 + \ldots + i$ is a perfect square. What is the simplest and most efficient way toresolve, subsequence (like when the element with value $5$ becomes available from the example). Toresolve this we

Full text and comments »

  • Vote: I like it
  • +181
  • Vote: I do not like it

47.
By Proof_by_QED, 19 months ago, In English
Codeforces Round 1017 (Div. 4) Editorial <spoiler summary="Rating Predictions"> | Predictor | A | B | C | D | E | F | G | H | |----------------------------------|-----|-----|-----|------|------|------|------|------| | [user:Proof_By_QED,2025-04-12] | 800 | 800 | 800 | 1000 | 1200 | 1300 | 1600 | 1800 | | [user:Dominater069,2025-04-12] | 800 | 800 | 800 | 900 | 1200 | 1200 | 1600 | 1600 | | [user:reirugan,2025-04-12] | 800 | 800 | 800 | 900 | 1500 | 1500 | 1700 | 1700 | | [user:macaquedev,2025-04-12] | 800 | 800 | 800 | 900 | 1600 | 900 | 1800 | &mdash; | | [user:Filikec,2025-04-12] | 800 | 800 | 800 | 900 | 1300 | 1500 | 1700 | 1800 | | [user:edeeva,2025-04-12] | 800 | 800 | 800 | 1000 | 1300 | 1600 | 1700 | 1900 | | [user:yoru_sacri,2025-04-12] | 800 | 800 | 800 | 900 | 1400 | 1700 | 1900 | 1900 | | [user:kevlu8,2025-04-12] | 800 | 800 | 800 | 900 | 1600 | 1400 | 1700 | &mdash; | | [user:AG-88301,2025-04-12] ...
\pmod k$. Now try to resolve this case.

Full text and comments »

  • Vote: I like it
  • +90
  • Vote: I do not like it

48.
By mango_lassi, history, 7 years ago, In English
Problem H (Game on the Tree) from CCPC 2018 [This problem](https://codeforces.me/gym/102055/problem/H) I have a solution I think is correct but can't get it to pass, and apparently even my n^2 code (standard game theory iterating through all states solution) that should obviously work gets WA. They both give the same answers for random small inputs. I can't find editorials or test data for the contest, so seeing so many teams have +1 or more in this problem, is there some tricky corner case I might have missed? My code if it is of any interest: <spoiler summary="code"> ~~~~~ #include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; const int INF = (int)1e9 + 7; bool findCycle(int i, vector<int>& cycle, vector<int>& par, const vector<vector<int>>& conns) { for (auto t : conns[i]) { if (par[i] == t) continue; if (par[t] != -1) { if (par[t] == i) swap(t, i); while(i != t) { cycle.push_back(i); i = par[i]; } cycle.push_back(i); re...
][N]; vector>> que; void resolve(int s, int i, int j, int r) { if (rem, for (auto i : dest) { for (int j = 0; j < n; ++j) { resolve(0, i, j, 1); if (i != j, if (s == 0) { if (win[s][i][j] == r) { for (auto t : conns[j]) { resolve(s^1, i, t, void resolve(int s, int i, int j, int r) { if (rem[s][i][j] <= 0) return; win[s][i][j] = r

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

49.
By hehezhou, history, 4 years ago, In English
Invitation to 4th Turing Cup Hey everyone, Here's an invitation for all programming lovers to participate in the 4th Turing Cup competition! The Turing Cup is an invitational competition that is organized by one of the most successful informatics competition teams in China, the XinYouDui, and X-Camp. Several top students of XinYouDui: [Chao Li](https://stats.ioinformatics.org/people/2672) (IOI 2012 Gold Medalist);[Yinzhan Xu](http://stats.ioinformatics.org/people/5059) (IOI 2014 Individual 1st place winner);[Ce Jin](https://stats.ioinformatics.org/people/5872) (IOI 2016 Individual 1st place winner): Top contestants such as IOI Gold medalists, and other top CPers joined the past contest as well. The 4th Turing Fun cup is open for registration, come and code with us! [Registration link](https://contest.xinyoudui.com/22a) (No Registration Fee) Novice Group: We'd recommend programmers who have completed learning the language and basic algorithms and who are in USACO silver division, are eligible ...
The winners of the competition will be finalized in around 30 hours once we resolve all disputes

Full text and comments »

Announcement of The 4th Turing Cup
  • Vote: I like it
  • +129
  • Vote: I do not like it

50.
By Shayan, history, 3 years ago, In English
If I'm doing something wrong, I'm sorry I want to say that if I'm doing anything wrong, I'm sorry. I planned to do something big and make a big positive change, but I received hate in response. I don't think it was fair. But, maybe I was doing something wrong, and I'm sorry about it. You can read this blog to see what I'm talking about. https://codeforces.me/blog/entry/125745 I don't intend to defend myself. I just have one request. Help me figure out what I did I do wrong that I'm accused of being unethical here. Do you want to stop doing it? What should I do? I was thinking about many things that I might have done. **As [user:Kostka,2024-02-11] mentioned many times, duplicate accounts ([user:Shayan,2024-02-11] and [user:Algorithms_with_Shayan,2024-02-11]).** I'm sorry for it. As I mentioned once [user:Algorithms_with_Shayan,2024-02-11] is not my personal account and I think it is not against the policy. But from now on, I won't do anything in that account anymore. I will have this account. That account...
account can be banned. I'm sorry if I did anything against the policy. Does thatresolve it? **My, the policy. Does that resolve it?

Full text and comments »

  • Vote: I like it
  • +148
  • Vote: I do not like it

51.
By orz, history, 4 years ago, translation, In English
First Ever Users to Reach Some Rating Milestones Revised: ratings above 1500 and greatest falls Several days ago I published a [table](https://codeforces.me/blog/entry/104320) with first people to reach certain ratings. It was a bit raw because, firstly, it was based on top 20000 Codeforces users by rating, and, secondly, because it only gave information about ratings divisible by 50. Now I have prepared a table that is of more complex design, but both issues are resolved. Good luck understanding what is going on in it. [cut] For several reasons I firstly put another table. This is the table of greatest rating falls in the history of Codeforces. The reasons are: 1. I have collected so much data from Codeforces that it would be blasphemy not to use it in as many ways as possible. 2. These tables might intersect a lot: it's easier to get a terrific fall in ratings if you are high-rated. 3. Someone recently posted a table with greatest rating rises and falls. I wasn't able to find this table to check whether it was right, but if someone finds it, you're welcome to pu...

Full text and comments »

  • Vote: I like it
  • +170
  • Vote: I do not like it

52.
By qpwoeirut, 6 years ago, In English
A Few Questions About Posting Editorials Hello Codeforces! I was recently part of a team which wrote the first [Bay Area Programming Contest](https://codeforces.me/blog/entry/88990) and hosted it through a Codeforces gym. Now, I want to post the editorial for this gym, but I've run into some issues, which are bolded in the blog below. (We found out while hosting the contest that people tend to get angry if the important parts of some text aren't in bold.) ### Embedding a Tutorial into a Codeforces Blog When I went to go write the editorial blog, I realized that I didn't actually know how to embed tutorials into blogs, and no option to add a tutorial shows up in the editor. Fortunately, a bit of searching around led me to this [blog](https://codeforces.me/blog/entry/76100), which provides the syntax. However, that blog's purpose was definitely not to explain how to embed editorials. So, **is there some comprehensive list of all the features that CF blogs support?** I can't help but wonder if there are other things I d...
resolve these issues?

Full text and comments »

  • Vote: I like it
  • +81
  • Vote: I do not like it

53.
By Arpa, history, 4 years ago, In English
Ten years of competitive programming 2 Hey Codeforces! I’m AmirReza PourAkhavan, Codeforces Contest Coordinator. I let the story become complete and I’m sharing it now. The story is about a 16-year 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 post [here](https://codeforces.me/blog/entry/107465). 10th grade === Trying alone ------------------ In my tenth grade, the situation got worse. Before that, at least, I had some colleagues and at least a class per two weeks. But in the new grade, these brights disappeared too. Still, I was trying to do it alone. I remember when I learned the Dijkstra shortest-path algorithm and implemented it for the first time, how happy I was. Suddenly, my rating growth started. As you can see, my rating in Oct ‘14 was 1057 (minimum rating) and In Feb ‘15 I achieved 1761. Those years, >= ...

Full text and comments »

  • Vote: I like it
  • +167
  • Vote: I do not like it

54.
By Noam527, history, 4 years ago, In English
Attempting to Extend Segment Trees to Arbitrary Subsets Throughout the last several weeks I have tried to invent and solve, a generalization of segment trees (although now it doesn't fit to name it "segment trees"... see for yourself). The results are very few (and not good, if you ask me), but the problem was very appealing and fun to think about. The purpose of this blogpost is to share my experience with this problem, in order to provide curiousity to at least a few people, and also to let bright-minded users tackle this problem together, and hopefully achieve better results. Since I want to share my experience, I will also put some possibly challenging parts under spoilers, if you want to attempt it yourself. So, there is no tl;dr. Sorry :) The Motivation and The Problem ------------------------------ As the title suggests, the motivation was from inspection of segment trees. Define the following problem, which we will try to solve throughout this post: Given $n$ elements $a_0, \ldots, a_{n-1}$, initially $0$, and $m$ subs...
the lowerbound is $\frac{n}{d \log N}$, we also require $\log N$ work to resolve accesses to such

Full text and comments »

  • Vote: I like it
  • +200
  • Vote: I do not like it

55.
By adamant, history, 4 years ago, In English
Duality in linear programming. Part 2 — in competitive programming Hi everyone! Previously, I wrote a [general introduction](https://codeforces.me/blog/entry/105049) to linear programming duality. In this blog, I would like to write about several problems that could be solved with this technique. Familiarity with the first blog, or general knowledge of dual problems and how to construct them is generally expected to navigate in this one. Thanks to [user:brunovsky,2022-08-09] and [user:Golovanov399,2022-08-09] for problem suggestions! And particularly special thanks to [user:WeakestTopology,2022-08-09] for problem suggestions and all insightful discussions on the topic! [cut]<br> ### Dual construction mnemonics To simplify the construction of dual problems, let's recall the correspondence between constraints/variables in primal and dual problems. <spoiler summary="LP duality mnemonics"> Standard definition of LP dual problem looks like this: $$\begin{gather} \max\limits_x & c^\top x & \color{red}{\text{(maximization)}} & \ove...
versa. Besides that, it is also possible to resolve any cycle, as substituting variables along the

Full text and comments »

  • Vote: I like it
  • +169
  • Vote: I do not like it

56.
By wuhudsm, 3 years ago, In English
TheForces Round #19 (Briefest-Forces) Editorial [A](https://codeforces.me/gym/104455/problem/A) <spoiler summary="code"> ``` #include<bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast","inline","-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #define int long long const int MOD=998244353; void Delta() { int a,b,c,d; cin >> a >> b >> c >> d; cout << (a+b>c+d?"YES":"NO") << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int T;cin >> T; while(T--) Delta(); } ``` </spoiler> <spoiler summary="solution"> The probability of Alice's winning is strictly higher than Bob's iff $l_1+r_1>l_2+r_2$. <spoiler summary="Why?"> Lemma1:The distribution of scores for two dice rolls is symmetrical, with the axis of symmetry being $l+r$. For example,for $[2,4]$,the distribution of scores is $4,5,5,6,6,6,7,7,8$. Lemma2:For two intervals with the same axis of symmetry(i.e. $l1+r1=l2+r2$),Alice's probability of losing is always equal t...
$v$. Now if there is a cyce intersecting at some vertex $v'$ in the cycle, on reaching $v'$resolve, , resolve one of the cycles, then it reduces to the cases above. Totals to $n+2$ moves. For exactly, The graph is split into disjoint connected componnts. We can thus independently resolve each, To find the precise number of moves to resolve a component involving $s$ tokens, we need to create, resolve each component optimally for minimum number of moves. Next, we prove that a connected

Full text and comments »

  • Vote: I like it
  • +43
  • Vote: I do not like it

57.
By drastogi21, 7 years ago, In English
Perplexed — Codefest'19 Hi, Codeforces Community! [Codefest'19](http://codefest.tech/) — a diverse roster of high-quality programming competitions by Department of Computer Science and Engineering, IIT(BHU), Varanasi is excited to present **Perplexed — the constrained programming event**. Perplexed is one of the most innovative events of CodeFest, whose target is not only gauge a contestant's coding abilities but also how one tackles different situations and constraints. The problemset will include all mind-boggling coding problems, ranging from code obfuscation to language constraints, character limits etc The contest will take place at [HackerRank](https://www.hackerrank.com/perplexed-codefest19). This contest will be an individual event with a duration of 2 hours 30 minutes, from [Aug/23/2019 20:00 IST](https://www.timeanddate.com/worldclock/fixedtime.html?iso=20190823T20&p1=1045&ah=2). With the creativity that the problems will naturally encourage and **INR 50,000** at stake, there is absol...

Full text and comments »

  • Vote: I like it
  • +143
  • Vote: I do not like it

58.
By Codeforcer, history, 6 years ago, In English
Need Help in resolving TLE in DP with memo and iterative. Why do some solutions containing dp with memoization result in TLE but the same iterative version always passes? I have had this doubt for quite a while. For example this problem : https://codeforces.me/contest/628/problem/D <spoiler summary="DP+Memo->TLE"> ~~~~~ #include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define all(v) v.begin(),v.end() #define ff first #define ss second #define pb push_back #define mp make_pair #define pi pair<int,int> #define REP(i,n) for(int i=0;i<n;i++) const int N = 2e5+10; const ll mod = 1e9+7; int m,d; string a,b; int dp[2001][2][2001]; int solve(int pos,int f1,int rem,string x){ if(pos==(int)a.length()){ if((rem%m)==0) return 1; return 0; } if(dp[pos][f1][rem]!=-1) return dp[pos][f1][rem]; int ulmt; if(f1) ulmt=9; else ulmt=(x[pos]-'0'); int ans=0; for(int i=0;i<=ulmt;++i){ int nf1,nrem,nis; if(f1==...
->How to resolve such TLE's ?, resolve such TLE's ? Thanks!

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

59.
By ATSTNG, history, 2 years ago, In English
[Feature request] Past locations and organizations in user social settings Codeforces allows users to choose their locations and organizations in "Social" tab in profile settings. ![ ](/predownloaded/20/36/2036297fc136bd095cca5f6382171a8397cc091e.png) If configured, this information is shown in user profile to everyone and also includes user into filtered rating list of selected country, city and organization. This is a nice functionality, but I've always felt that this is incomplete. People tend to change locations and organizations over time, but currently there can be only one location and only one organizaton. But which one to choose? There are multiple options that seem reasonable - Your current location/organization - Location/organization/team where you had peak performance - Your alma mater - Your origin/place of birth From what I've seen different people resolve this ambiguity in different ways. This has it's impact on filtered rating lists. You will see a person in organization in these cases: - Active user who is currently in ...
seen different people resolve this ambiguity in different ways. This has it's impact on filtered, From what I've seen different people resolve this ambiguity in different ways. This has it's impact

Full text and comments »

  • Vote: I like it
  • +64
  • Vote: I do not like it

60.
By abdude824, 5 years ago, In English
Operating Systems Notes If you are struggling with the right track and a 10-min read for Operating systems from beginning to end, you're at the right place. Even I am not sure where to start, but we would figure it and if you are reading this, I have successfully completed these notes or at least am on right track. Let's start our struggle for OS: ### The Track I found many resources to learn, let's just list all: (Galvin Concise PPTs)[https://www.os-book.com/OS9/slide-dir/index.html]: These were great but I felt that these are a little bit too much, so here are the chapters we would do: 1. Processes 2. Threads 3. Process Synchronization 4. CPU Scheduling Algorithms 5. Deadlocks 6. Main memory 7. Virtual memory 8. Virtual Machines > I am skipping the introduction of OS for now as it was not that important, this is going to be a fast article that works like a last night dose. <spoiler summary="A simple introduction(May skip if you are already familiar)"> An Operating system is like a...

Full text and comments »

  • Vote: I like it
  • +160
  • Vote: I do not like it

61.
By MrLolthe1st, 23 months ago, translation, In English
Разбор Codeforces Round 990 (Div. 2 + Div. 1) ### Div2A Alyona is happy when there are no unfinished layers &mdash; that is, in front of her is a perfect square with odd side length. Since the order of pieces is fixed, it is enough to keep track of the total current size $s$ of the puzzle, and after each day check, if the $s$ is a perfect square of an odd number. The easiest way to do that is to create an additional array containing $1^2, 3^2, 5^3, ..., 99^2$, and check after each day, whether $s$ is in this array. <spoiler summary="Code"> ~~~~~ NT = int(input()) sqs = set() k = 1 while k * k <= 100 * 1000: sqs.add(k * k) k += 2 for T in range(NT): n = int(input()) a = list(map(int, input().split())) answer = 0 cursum = 0 for t in a: cursum += t if cursum in sqs: answer += 1 print(answer) ~~~~~ </spoiler> ### Div2B Find the character which appears the lowest number of times &mdash; if tied, take the earlier character in the alphabet. Find the character which appears the highe...
To resolve the problem from the first case, we will place barriers with 2 tasks of difficulty equal

Full text and comments »

  • Vote: I like it
  • +114
  • Vote: I do not like it

62.
By dendi239, history, 6 years ago, In English
Micro- and macro-management for your next cpp source: General tips'n'tricks Hello, Codeforces! In this series of articles, I would like to tell you about tips'n'tricks I use in C++ sources. Some of them require a strong C++ background, some not, but all of them are aimed to reduce the time you spend on basic things like reading input/debugging/etc, so it might be useful for your next template. This part is dedicated to some basic tips (and probably should've been the first part but it's not ¯\\_(ツ)_/¯). <spoiler summary="TL;DR"> Full code: ~~~~ #include <bits/stdc++.h> using namespace std; using i64 = int64_t; using f80 = long double; using Str = string; template <class T> using Vec = vector<T>; template <class K, class V> using UM = unordered_map<K, V>; template <class T> auto &operator>>(istream &is, vector<T> &xs) { for (auto &x : xs) is >> x; return is; } namespace io { template <class ...As> auto &read(As &...as) { return (cin >> ... >> as); } template <class ...As> auto &log(const As &...as) { return ((cerr << " " << as...
, sometimes you need to work with custom files. To resolve it, I can suggest using defines `INTERACTIVE, But, it might be a temporary object, that's kind of annoying. To resolve it, you could've used

Full text and comments »

  • Vote: I like it
  • +137
  • Vote: I do not like it

63.
By eidan, history, 8 years ago, In English
Unhackable List [Last round](https://codeforces.me/blog/entry/65033) involved a randomized solution for problem E, and some pretests were aimed against std's rand() function. This caused a big dispute among contestants. It was questioned whether doing this type of tests was fair or necessary, since passing them depended merely on specific language knowledge, not actual problem-solving skills. Contest coordinators counter-argued that participants would've gotten hacked if it hadn't been for these pretests. They also stated that it's one's responsibility to know their favorite language when using it on a round. The fact is, this controversy was really caused by a technical property within C++ (and codeforces, partly), which many people had no clue existed. This is just an example of the fact that languages and their functioning in CF will sometimes have non-intuitive and unexpected properties, which may screw our performance in a contest. In other words, we are constantly exposed to bumping into ano...
function, which makes your solution hackable. [How to resolve it](https://codeforces.me/blog/entry/62393

Full text and comments »

  • Vote: I like it
  • +123
  • Vote: I do not like it

64.
By dmkozyrev, history, 4 years ago, In English
Invitation to Bug Game [marathon problem, mirror of buglab.ru] Hello Codeforces! **UPD.** [user:I_love_natalia,2023-04-18] crashed the checker by his maze with $10^9$ moves. The problem is resolved now and all of the solutions rejudged. Scoring is changed. [More info](https://codeforces.me/blog/entry/115144?#comment-1023668) **UPD 2:** The official site [https://buglab.ru/](https://buglab.ru/) was updated. See [comment](https://codeforces.me/blog/entry/115144?#comment-1024061). **UPD 3:** The checker has been speeded-up by [user:mfv,2023-05-01] in $2.2$ times (in comparison with my checker. The new speed is equal to $4$ seconds for a $10^9$ moves in codeforces "Custom Invocation"). Current standings: 1. $17\cdot 10^9$ &mdash; [user:sas4eka,2023-05-01]; 2. $14\cdot 10^9$ &mdash; [user:I_love_natalia,2023-05-01]; 3. $6.8 \cdot 10^9$ &mdash; [user:maxplus,2023-05-01] (on the buglab: $11.3 \cdot 10^9$). **UPD 4:** I updated the checker: now mazes up to $42$ billions are supported before checker got TL. Time limit of checker on codef...

Full text and comments »

  • Vote: I like it
  • +76
  • Vote: I do not like it

65.
By prophet_, history, 6 years ago, In English
Critical Bug in Codeforces: Broken AES encryption results in 403 Forbidden Error. (Solution) After investigating an issue resulting in a 403 error when trying to access codeforces as described in this blog: https://codeforces.me/blog/entry/80065 I believe I have found the issue and the solution. Codeforces uses a "slow aes" decryption function to require users to perform a non-trivial amount of computational work before they can access the site, presumably to protect against malicious users spamming the server. A parameter is given based on the user's IP address and the user must decrypt using this to generate a RCPC token in order to access the site. Those experiencing the 403 error likely are victims of a bug that causes the last 2 characters (last byte in binary) to be deleted. You can confirm this by checking your RCPC token in your cookies. This token should be 32 characters, but is only 30 if you experience this bug. The aes javascript implementation is from here: https://codeforces.me/aes.min.js I believe the issue is with the function "unpadBytesOut"....

Full text and comments »

  • Vote: I like it
  • +232
  • Vote: I do not like it

66.
By notlikeduck, 4 years ago, In English
CerealCodes Summer 2022 Programming Contest ![ ](/predownloaded/92/0b/920b2ede164428adfec5b2ad2ca371ef1c5d5673.png) Hello Codeforces! CerealCodes is excited to announce our Summer 2022 Programming Contest! This contest will be held on [August 13-14th](https://www.timeanddate.com/worldclock/fixedtime.html?msg=CerealCodes+Summer+2022&iso=20220813T11&p1=263) on Codeforces (with 4 different start times). The competition has three divisions: Novice (USACO Bronze-Silver or Div 3), Intermediate (USACO Silver-Gold or Div 2), and Advanced (USACO Gold-Platinum or Div 1). You can form teams of up to 3 members, and compete to solve ~6 high quality (cereal themed!) problems within 3 hours. Over $500 in cash (possibly more) will be given out (in the form of Amazon gift cards), as well as other prizes like merchandise and raffle awards!!! Note: only pre-college teams are eligible for cash awards. Join our [Discord server](https://discord.gg/qve3dBA8Ek) for more info and access to faster communication about our competiti...

Full text and comments »

  • Vote: I like it
  • +122
  • Vote: I do not like it

67.
By 4aii_Blabn, 2 months ago, In English
[Tutorial] Online Dynamic Generalized Suffix Automaton (Trie SAM) via Link-Cut Tree Hello Codeforces! Building a Suffix Automaton (SAM) for a single string is a classic linear-time algorithm. Extending it to a set of strings (a Trie) is also common, known as a Generalized Suffix Automaton (GSAM). However, most standard implementations for GSAM are done **offline** (usually using BFS) to preserve the $O(N)$ time complexity. For a deep mathematical analysis of the standard offline construction and space bounds, you can refer to this paper: https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/35395.pdf But what if the problem forces us to build the SAM on a Trie **strictly online**? If we blindly apply the standard SAM construction online on a Trie, the amortized complexity analysis breaks. The cloned states and suffix link redirections can force us to traverse long paths repeatedly, blowing the complexity up to $O(N^2)$ in the worst case (imagine a star-shaped Trie or multiple branches sharing the same suffix paths). In this tut...
Link Tree, we can simply ask the LCT to resolve the stale transition: > *"Start at `q_base` and, ask the LCT to resolve the stale transition: > *"Start at `q_base` and walk towards the root. Find, // Resolve the TRUE state using LCT binary search instead of an explicit redirection loop, // Resolve the TRUE state using LCT binary search int q = lct.get_node(q_base, st[p, resolve any stale transition to its true cloned state on the fly.

Full text and comments »

  • Vote: I like it
  • +78
  • Vote: I do not like it

68.
By DBND, 6 weeks ago, In English
Beating Treaps & Splay with a Simple Idea: A Fast, Amortized Dynamic Segment Tree with Insertion ## The Origin & The Benchmarks: A Hardware-Aware Approach A few months ago, I independently conceptualized an idea for an amortized dynamic data structure. However, it wasn't until recently that I finally found the time to sit down and write a truly optimized, production-ready implementation for it. Curious to see if anyone else had thought of this, I dug deep into the Codeforces archives and stumbled upon a heavily forgotten [blog post from 12 years ago](http://codeforces.me/blog/entry/12285). The author successfully implemented the core base-logic: traversing down to a leaf and splitting it into two new children. **However, there was a major bottleneck in that ancient version:** It relied on **AVL Tree Rotations** (`left_rotate`, `right_rotate`) to keep the height balanced. In modern competitive programming, heavy pointer-chasing and branch-heavy rotation conditions destroy Cache Locality and inflate the constant factor massively. I realized that instead of doing local...
To resolve this, we can keep our insertion algorithm exactly as it is, but introduce **periodic

Full text and comments »

  • Vote: I like it
  • +74
  • Vote: I do not like it

69.
By r314, history, 13 months ago, In English
ICPC 2025-2026 season "covid rule" Hello everyone, we are facing a problem due to changes in the rules of participation in the ICPC qualification. And these changes seem unfair to us! We want to report this issue to the community and hear your opinion. Please give feedback if you have any thoughts on this. So, about the rules: In 2020 (covid year), the ICPC organizers introduced a rule according to which participation in the 20/21 online qualification will not be counted in the number of possible participation in the qualification: A student who has competed in qualifying regional contests during five different contest years is NOT eligible to compete. **Regional participation 2020/21 is not counted towards the max 5 regionals!** https://web.archive.org/web/20220324023911/https://icpc.global/regionals/rules In 2023, this rule was unexpectedly removed for the 2025-2026 season: 1. A student who has competed in qualifying regional contests during five different contest years is NOT eligible to compete wi...
leadership will listen to us and help resolve the issue.

Full text and comments »

  • Vote: I like it
  • +118
  • Vote: I do not like it

70.
By tridipta2806, history, 8 months ago, In English
Insomnia'26 Editorial ####[Problem A : Ancient Trees](https://codeforces.me/gym/680528/problem/A) Problem Idea: [user:shorya1835,2026-03-23], Problem Preparation: [user:aastik231205,2026-03-23] <spoiler summary="Hint 1"> You are allowed to use intermediate vertices in your sequence. Does it ever actually help? For any three vertices $a$, $b$, $c$, what is the relationship between $c(a,b) + c(b,c)$ and $c(a,c)$? Recall that for non-negative integers, $x + y \geq x \oplus y$. </spoiler> <spoiler summary="Answer for Hint 1"> Since, $c(a,b) + c(b,c) \geq c(a,b) \oplus c(b,c)$, Splitting the path doesn't minimize the distance at all. Hence $d(u,v) = c(u,v)$ always. </spoiler> <spoiler summary="Hint 2"> Since $d(u,v) = c(u,v)$ always, we can maintain a running mask $M$ (XOR of all Type 1 updates so far). A path with $\ell$ edges has its XOR-distance changed only if $\ell$ is odd, flipping their XOR-distance by $M$, depending only on the running XOR of Type 1 queries so far. Can you precomput...

Full text and comments »

Tutorial of Insomnia-26
  • Vote: I like it
  • +113
  • Vote: I do not like it

71.
By zxqfl, 11 years ago, In English
SRM 659 Editorial This was my first SRM, and I would like to thank [user:rng_58,2015-05-13] (algorithm coordinator + tester), KADR (tester), [user:misof,2015-05-13] (language reviewer) and [user:dreamoon,2015-05-13] (author of Div1 medium) for their invaluable help. I will try to keep this short, since the TC editorial writers are much better at writing explanations. ##Div2 Easy -- FilipTheFrog The simplest solution is to perform $N$ iterations. Each iteration, look for a pair $(i, j)$ such that island $i$ is reachable and $|positions[i]-positions[j]| \leq L$. Mark island $j$ as visited. The complexity is $O(N^3)$. It works because each iteration increases the answer by at least $1$ assuming it hasn't already been found, so after $N$ iterations your answer is guaranteed to be correct. ##Div2 Medium -- PublicTransit You can fix each possibility for the teleporter and then test every pair of cells to find the longest distance. You can calculate it as follows: if the teleporter cells are at ...
Here provides two method to resolve it by change dp status:, ]). Then, how can we resolve this situation?

Full text and comments »

  • Vote: I like it
  • +68
  • Vote: I do not like it

72.
By chenlinxuan0226, history, 10 months ago, In English
Formal Complaint Regarding the Suspension of a Newly Registered Contestant Dear Codeforces Administration Team, I am writing to formally request clarification and a review regarding the recent suspension of a newly registered contestant [user:tourits,2026-01-13]. The account in question does not belong to me, but to a close friend. What raises serious concern is that the suspension occurred immediately after his participation in a Codeforces contest, in which he achieved a notably strong result. From the information currently available to us, there is no indication of any rule violation; the only apparent factor appears to be his unexpectedly good performance. My friend has been studying algorithms and data structures in a systematic and long-term manner prior to registering on Codeforces. His contest performance was a natural reflection of this preparation and should not, in itself, be considered suspicious. If strong results by new users are treated as prima facie evidence of misconduct, this is a policy that merits careful reconsider...

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

73.
By kesh4281, history, 6 years ago, In English
Invitation to CodeNight 2021 Hello Codeforces! Hack36 2021 and Computer Club, MNNIT Allahabad, India are glad to invite you to the second edition of the programming competition of MNNIT Allahabad, CodeNight, which is an ACM-ICPC style team programming contest of 2 hours duration to be held on PrepBytes during its annual hackathon event [Hack36](http://www.hack36.com). A team can consist of up to 4 members. **Contest Details:** - Start Time: [Saturday, March 27, 2021, at 21:30 IST](https://www.timeanddate.com/worldclock/fixedtime.html?msg=CodeNight+by+Hack36+-+PrepBytes+Platform+&iso=20210327T2130&p1=176&ah=2) - Duration: 2 hours - Contest Link: https://mycode.prepbytes.com/contest/HACK36MNNIT2021 - The problemset consists of 8 problems. - Languages allowed: C, C++, Java and Python. - Each Team needs to register on [Hack36](http://www.hack36.com) and each member of the team should be registered on [PrepBytes](https://mycode.prepbytes.com/contest/HACK36MNNIT2021) to be eligible for prizes. Exact detail...

Full text and comments »

  • Vote: I like it
  • +27
  • Vote: I do not like it

74.
By Bahamin, history, 15 months ago, In English
Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) Editorial ### ✨ **Hope you enjoyed the problems!** ✨ <span style="font-size: 20px;">[problem:2127A]</span><br> **Idea:** [user:Bahamin,2025-08-04]<br> **Preparation:** [user:Hamed_Ghaffari,2025-08-04] <spoiler summary="Hints"> <spoiler summary="Hint 1"> What happens if $\operatorname{mex}([a_i, a_{i+1}, a_{i+2}]) = 0$? </spoiler> <spoiler summary="Hint 2"> Now what happens if $\operatorname{mex}([a_i, a_{i+1}, a_{i+2}]) \neq 0$? </spoiler> </spoiler> <spoiler summary="Solution"> Let's see when does $\operatorname{mex}([a_i, a_{i+1}, a_{i+2}])$ equal $\max([a_i, a_{i+1}, a_{i+2}]) - \min([a_i, a_{i+1}, a_{i+2}])$. **Case 1:** $\operatorname{mex}([a_i, a_{i+1}, a_{i+2}]) = 0$ This implies that all numbers are equal and non-zero, since otherwise $\min$ would be less than $\max$ and the difference wouldn't be $0$. **Case 2:** $\operatorname{mex}([a_i, a_{i+1}, a_{i+2}]) \neq 0$ In this case $\min([a_i, a_{i+1}, a_{i+2}])$ should be $0$ because $0$ is in the seque...
|$ and $|B|$ are around $\frac{n}{2}$. But this is not always true. Fortunately, we canresolve this

Full text and comments »

  • Vote: I like it
  • +243
  • Vote: I do not like it

75.
By BledDest, 6 years ago, In English
Kotlin Heroes 6 Announcement <img src="/predownloaded/6b/62/6b62332b37519ade4a4d42cb266937c422b64557.png" style="width:500px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the five Kotlin Heroes competitions which were held previously: [Episode 1](https://codeforces.me/contests/1170), [Episode 2](https://codeforces.me/contests/1211), [Episode 3](https://codeforces.me/contests/1297), [Episode 4](https://codeforces.me/contests/1346), and [Episode 5: ICPC Round](https://codeforces.me/contest/1431). Ready to challenge yourself to do better? The [contest:1488] competition will be hosted on the Codeforces platform on [contest_time:1488]. The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard ones, to make it interesting for seasoned competitive programmers. **Prizes:** **Top three winners will ge...

Full text and comments »

Announcement of Kotlin Heroes: Episode 6
Announcement of Kotlin Heroes: Practice 6
  • Vote: I like it
  • +168
  • Vote: I do not like it

76.
By Nickolas, 8 years ago, In English
Announcement: Microsoft Q# Coding Contest — Summer 2018 Microsoft's Quantum Team has good news for quantum enthusiasts and coders looking for new challenges. We are excited to announce Microsoft Q# Coding Contest &mdash; Summer 2018! By entering the contest, you can hone your quantum coding skills by tackling problems of varying difficulty and implementing solutions in the quantum programming language Q#. Winners will receive a Microsoft Quantum T-shirt! Quantum computing is a radically different computing paradigm compared to classical computing. Indeed, it is so different that some tasks that are believed to be classically intractable (such as factoring integers, computing discrete logarithms on elliptic curves, or simulating physical systems) can be performed efficiently on a quantum computer. Microsoft recently introduced the Quantum Development Kit which includes Q# &mdash; a new programming language to express quantum programs in a way that makes it easier for classical coders to enter the space. Q# integrates into [Visual Studi...

Full text and comments »

  • Vote: I like it
  • +413
  • Vote: I do not like it

77.
By Nickolas, 6 years ago, In English
Announcement: Microsoft Q# Coding Contest – Summer 2020 Microsoft's Quantum team is excited to announce the Q# Coding Contest – Summer 2020, the third in the series of Q# contests! In this contest you can put your quantum programming skills to the test, solving quantum computing tasks in Q#. The winners (as well as some lucky participants) will receive a Microsoft Quantum T-shirt! Quantum computing is a radically different computing paradigm compared to classical computing. Indeed, it is so different that some tasks that are believed to be classically intractable (such as factoring integers or simulating physical systems) can be performed efficiently on a quantum computer. In December 2017 Microsoft introduced the [Quantum Development Kit](https://docs.microsoft.com/quantum) which includes the Q# programming language. In summer of 2018 we hosted the [first quantum programming contest](https://codeforces.me/blog/entry/60209), which included problems on introductory topics in quantum computing: superposition, measurement, quantum oracl...

Full text and comments »

  • Vote: I like it
  • +512
  • Vote: I do not like it

78.
By Bazoka13, 2 years ago, In English
Codeforces Round #947 Editorial [problem:1975A] Idea: [user:Bazoka13,2024-05-25] Solution: [user:Bazoka13,2024-05-25] Prepared by: [user:Bazoka13,2024-05-25] <spoiler summary="Hint 1"> We can't do any insertions by the operation. </spoiler> <spoiler summary="Hint 2"> If the answer is yes, we can make $a$ become non-decreasing in no more than one operation. </spoiler> <spoiler summary="Solution"> Read the hints. If $a$ is non-decreasing initially, the answer is yes. If $a$ isn't non-decreasing initially, we can find the smallest $i$ such that $a_i> a_{i+1}$. Then we choose $x=[a_1,a_2,...,a_i]$ and $y=[a_{i+1},a_{i+2},...,a_n]$. If the array $y+x$ is non-decreasing, the answer is yes. Otherwise, the answer is no. </spoiler> <spoiler summary="Code"> ~~~~~ #include<bits/stdc++.h> using namespace std; const int N = 1e5+10; int a[N]; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } ...

Full text and comments »

  • Vote: I like it
  • +111
  • Vote: I do not like it

79.
By ExplodingKonjac, history, 6 months ago, In English
So I wrote a tool to save all people suffering from annoying template codes ## Foreword Almost every competitive programmer has his own template codes such as IO library or algorithms or data structures or debugging support or anything. Though templates are absolutely useful, but when we try to submit our code onto any Online Judge, the problem appears: We must paste all those extremely long templates into a single source file. It is unpleasant. Even if we are solving a 800-rated problem our source code would contain hundreds of lines just because that stupid template. Long codes distract our attention and make us unhappy. Ideally, we can use our templates by `#include` statements just like we use AC-Library in AtCoder. However, *most* online judges do not provide a library, and *all* online judges do not allow you to use your customized libraries. So I wrote a tool to solve this problem, in a compromise approch. ## Introduction <center> <img src="/predownloaded/06/e9/06e92e35f4e232d6b27644b96b9f45d2f7472ad5.png"> </center> **Template Expand**...
. It can automatically resolve dependencies and remove duplicated includes, and even has an optional, resolve dependencies and remove duplicated includes, and even has an optional code compression

Full text and comments »

  • Vote: I like it
  • +24
  • Vote: I do not like it

80.
By BledDest, 6 years ago, In English
Kotlin Heroes: Episode 4 <img src="/predownloaded/d3/f6/d3f67b5afe94939d82d9358aeb7a0edcf6a8d33f.png" style="width:300px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the first, second and third Kotlin Heroes competitions which were held previously. Congratulations to the top 3 winners: **Episode 1** 1. [user:Petr,2020-02-26] 1. [user:ecnerwala,2020-02-26] 1. [user:eatmore,2020-02-26] **Episode 2** 1. [user:tourist,2020-02-26] 1. [user:eatmore,2020-02-26] 1. [user:Benq,2020-02-26] **Episode 3** 1. [user:Egor,2020-05-23] 1. [user:tourist,2020-05-23] 1. [user:Benq,2020-05-23] Ready to challenge yourself to do better? The fourth "Kotlin Heroes" competition will be hosted on the Codeforces platform on [contest_time:1346]. The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard...

Full text and comments »

Announcement of Kotlin Heroes: Episode 4
Announcement of Kotlin Heroes: Practice 4
  • Vote: I like it
  • +202
  • Vote: I do not like it

81.
By potatoArmy, history, 6 months ago, In English
Cheaters in Round 1100 ### [user:thegscrypto.bot,2026-05-24] Evidence ------------------ 1. Lots of WA1/RE1/Compilation Error submissions 2. AI commented codes: [submission: 375834481] [submission: 375825486] [submission:375825486]. Mostly all of his submission are like this **Do you think its a cheater?** Yes! No, (comment why you think this) ### [user:Harshaii,2026-05-24] Evidence ------------------ AI commented codes: [submission: 375846083 ] [submission: 375846083] **Do you think its a cheater?** Yes! No, (comment why you think this) ### [user:gopal.thecoder,2026-05-24] Evidence ------------------ [submission:375836893]... bruh (if you can't view this submission, here's the code) <spoiler summary="Spoiler"> ~~~~~ I completely understand how frustrating that is! My previous fix strictly resolved the C# compilation error (the variable naming conflict) so your code could finall...

Full text and comments »

  • Vote: I like it
  • +83
  • Vote: I do not like it

82.
By Endagorion, 15 years ago, translation, In English
Codeforces Round #109: editorial [problem:155A] You should do what is written: go through the sequence and count the elements which are greater or less than all of its predecessors. We don't even have to store the whole sequence, just the current minimum and maximum. Complexity --- O(N), but squared still works fine. [problem:155B] Clearly, we can play the cards with $b_i$ > 0 first as each of them gives at least one extra move. After that, the number of extra moves left doesn't depend on the order of playing. The left cards all have $b_i$ = 0, so we play those of them which have larger $a_i$. Simpler version of this solution: sort all the cards by decrease of $b_i$, if equal --- by decrease of $a_i$, and then go through the sorted array from beginning to end, simulate the counter and sum up the points. Remember not to fall over the edge of array if the sum of $b_i$'s is larger than the number of cards. Complexity --- O(n log n) (or O(n^2), if using bubblesort, which is still accepted). [problem:155C] ...
solved independently. To resolve conflicts within a substring, one has to remove all letters of

Full text and comments »

  • Vote: I like it
  • +43
  • Vote: I do not like it

83.
By phpduke, history, 4 years ago, In English
Call for Contest Admin / Problemsetter! We are looking for **contest admins** and **problem setters** for a contest series we are starting at TheJobOverflow. We are experimenting with the format and variety of problems &mdash; the contests are primarily geared toward algorithms/ideas with a lesser component of peeling multilayer observations. TJO has 6,000 users and has evaluated 10,000 solution to programming tasks this week. What is TJO? TheJobOverflow is an **Open Community Platform** for interview preparation & CP. It's built and managed by alumni of IIIT Hyderabad, IIT Bombay, IIT BHU, and IIT Guwahati. Team has ICPC world finalists, IOI medalists, Math olympiad folks and also houses key people who authored math-contest [Gordian Knot](https://codeforces.me/blog/entry/57311) a few years ago ( : Our contest series is yet to be launched, meanwhile we have compiled & tested [**350 problem's Question Bank**](https://thejoboverflow.com/problems/) which includes **latest Coding Round & Interview** problems asked by **Go...

Full text and comments »

  • Vote: I like it
  • -13
  • Vote: I do not like it

84.
By smax, 3 years ago, In English
[Tutorial] Simulating Cost Flow You can also read this on my blog: https://mzhang2021.github.io/cp-blog/simulating-cost-flow/ Thanks to [user:gabrielwu,2023-07-19] for proofreading. --- This post assumes knowledge of [min/max cost flow](https://en.wikipedia.org/wiki/Minimum-cost_flow_problem) and a rough understanding of the high-level methods for solving (successive shortest path and cycle canceling). Knowledge of specific algorithms and implementation details are not expected. Also solutions to some problems will use [Aliens trick](https://web.archive.org/web/20210511092429/http://www.serbanology.com/). --- The cost flow problem is a well-known problem in literature that a whole slew of competitive programming problems can be formulated as. Unfortunately, competitive programming problems typically have constraints set too high for directly running even the most state of the art cost flow algorithm. However, in certain problems the flow network will have a very specific setup that allows us to figure ...

Full text and comments »

  • Vote: I like it
  • +293
  • Vote: I do not like it

85.
By BledDest, 5 years ago, In English
Kotlin Heroes 7 Announcement <img src="/predownloaded/6b/62/6b62332b37519ade4a4d42cb266937c422b64557.png" style="width:500px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the five Kotlin Heroes competitions which were held previously: [Episode 1](https://codeforces.me/contests/1170), [Episode 2](https://codeforces.me/contests/1211), [Episode 3](https://codeforces.me/contests/1297), [Episode 4](https://codeforces.me/contests/1346), [Episode 5: ICPC Round](https://codeforces.me/contest/1431), and [Episode 6](https://codeforces.me/contest/1488). Ready to challenge yourself to do better? The [contest:1533] competition will be hosted on the Codeforces platform on [contest_time:1533]. The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard ones, to make it interesting for seasoned competitive programme...

Full text and comments »

Announcement of Kotlin Heroes: Practice 7
Announcement of Kotlin Heroes: Episode 7
  • Vote: I like it
  • +163
  • Vote: I do not like it

86.
By BledDest, 5 years ago, In English
Kotlin Heroes 8 Announcement <img src="/predownloaded/dc/3d/dc3d601ff391e638c1f2b20ec167083978099bbe.png" style="width:500px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the seven Kotlin Heroes competitions which were held previously: [Episode 1](https://codeforces.me/contests/1170), [Episode 2](https://codeforces.me/contests/1211), [Episode 3](https://codeforces.me/contests/1297), [Episode 4](https://codeforces.me/contests/1346), [Episode 5: ICPC Round](https://codeforces.me/contest/1431), [Episode 6](https://codeforces.me/contest/1488), and [Episode 7](https://codeforces.me/contest/1533). Ready to challenge yourself to do better? The [contest:1571] competition will be hosted on the Codeforces platform on [contest_time:1571]. The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard ones, to mak...

Full text and comments »

Announcement of Kotlin Heroes: Practice 8
Announcement of Kotlin Heroes: Episode 8
  • Vote: I like it
  • +146
  • Vote: I do not like it

87.
By sushmit2022, history, 6 months ago, In English
Editorial - Insomnia 2026 [A. The Oracle's Curse](https://codeforces.me/gym/682678/problem/A) ================== Author: [user:aditya1977,2026-04-27] <spoiler summary="Explanation"> <h3>Observation</h3> An alarm rings when a stock with a low starting price passes a stock with a high starting price. Since all stocks go up by exactly $1$ every day, a lower stock can only pass a higher stock if the higher one hits its maximum limit and stops growing. Once it passes, it stays ahead forever. Because the total number of alarms only goes up over time (it never goes back down), we can easily use <b>Binary Search</b>. In coding terms, when a smaller starting value overtakes a larger one, we call this an <b>inversion</b>. <hr> <h3>Definition</h3> Let $N$ be the number of stocks and $g$ be the target alarms. First, we sort all stocks by their starting prices $s_i$. Each stock is stored as a pair: $$ E_i = (s_i, u_i) $$ For any guessed day $D$, the new projected price $P_i$ of the $i$-th stock...

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it

88.
By BledDest, history, 6 years ago, In English
Kotlin Heroes 5: ICPC Round Announcement <img src="/predownloaded/62/39/62391c8471a7dc4ca0b2f2da3e7903eefd1f3dc0.png" style="width:500px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the first, second, third, and fourth Kotlin Heroes competitions which were held previously: [Episode 1](https://codeforces.me/contests/1170), [Episode 2](https://codeforces.me/contests/1211), [Episode 3](https://codeforces.me/contests/1297) and [Episode 4](https://codeforces.me/contests/1346). Ready to challenge yourself to do better? The [contest:1431] competition will be hosted on the Codeforces platform on [contest_time:1431]. The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard ones, to make it interesting for seasoned competitive programmers. **Prizes:** **Top three winners will get prizes of $512, $256, and $128 re...

Full text and comments »

Announcement of Kotlin Heroes 5: ICPC Round
  • Vote: I like it
  • +165
  • Vote: I do not like it

89.
By chromate00, 13 months ago, In English
Codeforces Round 1058 Editorial Thanks for the participation! We hope you enjoyed the contest. <spoiler summary="Rate the contest!"> - Epic - Good - Moderate - Bad - Horrendous </spoiler> <strike>The solution codes will be added shortly after the system tests are finished.</strike> They have been added. [problem:2160A] Problem Credit: [user:Proof_by_QED,2025-10-12] <spoiler summary="Rate the problem!"> - Epic - Good - Moderate - Bad - Horrendous </spoiler> <spoiler summary="Solution"> First, let $m=\operatorname{mex}(A)$. We can ignore all elements that are greater than $m$. This is because since $m$ is the mex, $m$ does not appear in $A$, and consequently it also cannot appear in any of the partitions. Thus, which of the partitions each element goes to does not matter. Now, let's consider the n...

Full text and comments »

  • Vote: I like it
  • +68
  • Vote: I do not like it

90.
By vishwas_16.0, history, 3 months ago, In English
CC Wing Selection Contest 2026 Editorial CC Wing Selection Contest 2026 ================== [contest:709193] ------------------ </br> [Invitation Link](https://codeforces.me/contestInvitation/6272dbd500a98e5b9fb8fdc43969fd8573242e5a) </br> [Problem A : Terms and Conditions](https://codeforces.me/gym/709193/problem/A) <br> Author : [user:vishwas_16.0,2026-08-12] <spoiler summary="Hint 1"> The input is irrelevant. The required output is fixed and must be printed exactly as given.</spoiler> <spoiler summary="Solution"> This is a direct output problem. We are given a single string as input, but regardless of what the input contains, we must print the four Terms and Conditions exactly as specified in the statement. Since the required output is constant, there is no need to process the input. Just print: You confirm that you are a IIIT Allahabad Batch 2029 student. You understand that providing false information, copying code may result in removal from the wing. You accept that parties wil...
); // resolve(t); } return 0; } ~~~~~ , ); precalc(); int t = 1; cin >> t; while (t--) { resolve2(t); // resolve

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

91.
By mainyutin, history, 3 years ago, translation, In English
Codeforces Round 938 (Div. 3) Hello! [contest:1955] will start at [contest_time:1955]. You will be offered 6-8 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600 or higher, can register for the round unofficially. The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of **open hacks**. You will be given **6-8 problems** and **2 hours and 15 minutes** to solve them. Note that the **penalty** for the wrong submission in this round is **10 minutes**. [Remember](https://codeforces.me/blog/entry/59228) that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a _trusted participant of the thi...

Full text and comments »

  • Vote: I like it
  • +35
  • Vote: I do not like it

92.
By Um_nik, history, 5 years ago, In English
Q&A/AMA stream on Tuesday Hello Codeforces! I will hold a Q&A/AMA stream on [Twitch](https://www.twitch.tv/um_nik22) on [Tuesday, 21 MSK (UTC+3)](https://www.timeanddate.com/worldclock/fixedtime.html?msg=Um_nik+Q%26A%2FAMA+session&iso=20211012T21&p1=2008). You can write your questions in chat during the stream, or send them in this [form](https://forms.gle/UyfLdfcMHHHtu5rj6) beforehand (for example, if you can't attend the stream in person). Recording will be uploaded on [YouTube](https://www.youtube.com/channel/UC3-pkjZ8-D4aW8QfaExuMjw) afterwards. Questions written in Russian will be answered in Russian, questions written in English &mdash; in English, questions written in other languages won't be answered because I can't understand them. I won't answer a question if I don't want to. Hopefully, the multilingual nature of the stream will be resolved afterwards by interested people who will add subtitles. Questions can be about anything, but once again, I won't answer a question if I don't want to. ...

Full text and comments »

  • Vote: I like it
  • +273
  • Vote: I do not like it

93.
By BledDest, 5 years ago, In English
Kotlin Heroes 9 Announcement <img src="/predownloaded/dc/3d/dc3d601ff391e638c1f2b20ec167083978099bbe.png" style="width:500px;float:right;margin:0 1em 1em 1em;"/> **Given the current circumstances, we have decided to postpone Kotlin Heroes until further notice. Thank you for your understanding.** Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the eight Kotlin Heroes competitions which were held previously: [Episode 1](https://codeforces.me/contests/1170), [Episode 2](https://codeforces.me/contests/1211), [Episode 3](https://codeforces.me/contests/1297), [Episode 4](https://codeforces.me/contests/1346), [Episode 5: ICPC Round](https://codeforces.me/contest/1431), [Episode 6](https://codeforces.me/contest/1488), [Episode 7](https://codeforces.me/contest/1533), and [Episode 8](https://codeforces.me/contest/1571). Ready to challenge yourself to do better? The [contest:1643] competition will be hosted on the Codef...

Full text and comments »

  • Vote: I like it
  • +82
  • Vote: I do not like it

94.
By weedy, history, 14 months ago, In English
Issues with Building PDF Statements on Polygon [user:MikeMirzayanov,2025-09-17] Hello Mike, I am writing to bring to your attention a recent issue with the "Build PDF Statements" feature on Polygon. Over the past couple of days, several users (including myself) have encountered unexpected font-related issues that were not present before. Specifically, if we add certain `\usepackage` commands in the `statements.ftl` file, the rendered PDF exhibits abnormal font behavior. For example: - Adding `\usepackage[UTF8]{ctex}` or `\usepackage{CJK}` (which is necessary for Chinese content, and until a few days ago, this worked fine.) disrupts the rendering of `\textbf` text. In addition, other packages related to font specification will also cause abnormal font rendering. - Adding `\usepackage{lmodern}` causes irregularities in the appearance of `\texttt`, `\textbf`, and `\textsf` text. (And none of these text matches the looking of `Latin Modern`) - Adding `\usepackage{helvet}` affects the output of `\textsf` text. (And non...
compatibility with OpenType and TrueType fonts, which would resolve the current font issues and, improved compatibility with OpenType and TrueType fonts, which would resolve the current font issues and

Full text and comments »

  • Vote: I like it
  • +62
  • Vote: I do not like it

95.
By AdnanShamsi, history, 5 years ago, In English
Realtime Time Collaboration Website with Lockout Championship Me and [user:kickass,2021-06-26] have developed a website [https://code-n-collab.netlify.app/](https://code-n-collab.netlify.app/) . It is a Collaboration website for people just like you, who loves to code and collaborate with others or learn something new. It provides users to collaborate with their team, friends and also find people with similar interest. <a href="https://code-n-collab.netlify.app/" target="_blank" rel="noreferrer"> <table > <tr> <td> [![Home Page](/predownloaded/ba/c4/bac4ef076063bf81b5e99e27f46659d0ae14162d.png)](https://code-n-collab.netlify.app/) </td> <td > [![ Profile](/predownloaded/97/36/9736ea1eec6c5f262933fd5dddffce9bf3cfc15e.png)](https://code-n-collab.netlify.app/) </td> </tr> <tr> <td> [![ Lockout Contest ](/predownloaded/10/a1/10a1a3a0e95d492f062ce0b53f3119ace4c476ba.png)](https://code-n-collab.netlify.app/) </td> <td> [![ Blog Image ](/predownloaded/5b/3c/5b3caf...
- Write blogs/comment to share something, ask some doubts or resolve the doubts of other coders out, resolve the doubts of other coders out there. Website: [https://code-n-collab.netlify.app/](https

Full text and comments »

  • Vote: I like it
  • +86
  • Vote: I do not like it

96.
By huikang, history, 5 years ago, In English
Python too slow? Translate to C++ with OpenAI API I used OpenAI API to translate Python code written by [user:Kiri8128,2022-03-31] in the recent [combined division contest](https://codeforces.me/contest/1656/status?user=Kiri8128). These are the results. - Problem A: [Source](https://codeforces.me/contest/1656/submission/150725872), [AC](https://codeforces.me/contest/1656/submission/151465415) - Problem B: [Source](https://codeforces.me/contest/1656/submission/150731673), [CE](https://codeforces.me/contest/1656/submission/151467386) [AC](https://codeforces.me/contest/1656/submission/151467448) - Problem C: [Source](https://codeforces.me/contest/1656/submission/150739556), [WA](https://codeforces.me/contest/1656/submission/151467537) [WA](https://codeforces.me/contest/1656/submission/151467625) [WA](https://codeforces.me/contest/1656/submission/151467689) [RE](https://codeforces.me/contest/1656/submission/151467755) [CE](https://codeforces.me/contest/1656/submission/151467796) - Problem D: [Source](https://codeforces.c...

Full text and comments »

  • Vote: I like it
  • +45
  • Vote: I do not like it

97.
By ivanromanov, 14 years ago, In English
Bayan — live coverage Hi everybody, it's 11:10 local time at Tehran, I'll tell you how the Bayan Programming contest 2013 (1391) onsite Finals is progressing. ![ ](http://ivanromanov.ch/img/bayan/DSC04405.JPG) **22:17**. Peter50216, cerealguy and Egor are top-three! Congratulations! **22:05**. Closing ceremony. The rejudge took place for one problem. **18:30**. Not everything of Funkoders has been judged yet, so the results of this additional fun contest will come later. **18:29**. **It's over!** **18:27**. Announcement: two minutes to the end of the contest. It should have 5 though. **18:10**. It's a fun competition, so there are two guys entertaining competitors and spectators: ![ ](http://ivanromanov.ch/img/bayan/DSC04463.JPG) **18:04**. Every couple of minutes one of the baloons exploid, making a person next to it jumping up. **17:54**. Only the first submission will count. There are 15 problems. Competitors hope that the problems are not harder than in the main round. ...

Full text and comments »

  • Vote: I like it
  • +114
  • Vote: I do not like it

98.
By Nickolas, 8 years ago, In English
Introduction to Quantum Oracles *(text courtesy of my colleague Chris Granade)* A quantum oracle $O$ is a "black box" operation that is used as input to another algorithm. Often, such operations are defined using a classical function $f : \{0, 1\}^n \to \{0, 1\}^m$ which takes $n$-bit binary input and produces an $m$-bit binary output. To do so, consider a particular binary input $x = (x_{0}, x_{1}, \dots, x_{n-1})$. We can label qubit states as $|\vec{x} \rangle = |x_{0} \rangle \otimes |x_{1} \rangle \otimes \cdots \otimes |x_{n-1} \rangle$. We may first attempt to define $O$ so that $O |x \rangle = |f(x) \rangle$, but this has a couple problems. First, $f$ may have a different size of input and output ($n \ne m$), such that applying $O$ would change the number of qubits in the register. Second, even if $n = m$, the function may not be invertible: if $f(x) = f(y)$ for some $x \ne y$, then $O |x \rangle = O |y \rangle$ but $O^\dagger O|x \rangle \ne O^\dagger O|y \rangle$. This means we won't be able to...

Full text and comments »

  • Vote: I like it
  • +121
  • Vote: I do not like it

99.
By chokudai, 7 years ago, In English
AtCoder Beginner Contest 164 Announcement We will hold AtCoder Beginner Contest 164. - Contest URL: https://atcoder.jp/contests/abc164 - Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20200426T2100&p1=248 - Duration: TBD (around 2 hours) - Number of Tasks: 6 - Writer: kyopro_friends, [user:Kmcode,2020-04-25], [user:latte0119,2020-04-25], [user:smeke,2020-04-25], ynymxiaolongbao, wo01 - Rated range: ~ 1999 The point values will be 100-200-300-400-500-600. We are looking forward to your participation! Addition: About the Unrated ABC163 We are sorry for the inconvenience. The server down during the last contest was caused by a sudden access to the ALB, and we found that we could solve this problem by doing Pre-Warming. Also, the bug where the problem statement does not show up has been resolved by changing the caching algorithm. The problem with submissions showing up as IE (Internal Error) was due to the Judge server's scoring algorithm being different than in the past. This too h...

Full text and comments »

  • Vote: I like it
  • +100
  • Vote: I do not like it

100.
By CristianoPenaldo, history, 4 years ago, In English
My learning note on AGC061C based on Little09's (Simplified) Chinese Blog I admit that [AGC061C](https://atcoder.jp/contests/agc061/tasks/agc061_c) is too hard for me, and I don't even understand its [official editorial](https://atcoder.jp/contests/agc061/editorial/5695). Today I see a [Luogu blog](https://www.luogu.com.cn/blog/LJA001111/agc061c-first-come-first-serve) with a very genius and clear idea on this problem. I learned a lot from it, and I would like to share it to you now. The writer of this blog is possibly [user:little09,2023-02-15], but I am not quite sure. **Part1: Problem Statement and Constraints** There are $N$ customers named $1$, ..., $N$ visiting a shop. Customer $i$ arrives at time $A_i$ and leaves at time $B_i$ The queue order is first in first out, so $A_i$ and $B_i$ are both increasing. Additionally, all $A_i$ and $B_i$ are pairwise distinct. At the entrance, there's a list of visitors to put their names in. Each customer will write down their name next in the list exactly once, either when they arrive or when they leave. ...
you, I might resolve your confusion. For me, I can check whether I make a typo in the blog or not and

Full text and comments »

  • Vote: I like it
  • +58
  • Vote: I do not like it

101.
By c1729, history, 8 years ago, In English
Python Performance++ I've listed my findings on experimenting with Python below, I hope they are useful to someone else who uses Python too. **TL;DR:** Links for the [master template](https://github.com/cheran-senthil/PyRival/blob/master/template/template.py) and [algorithms](https://github.com/cheran-senthil/PyRival). #### __Python Version__ Based on [prior benchmarking](https://codeforces.me/blog/entry/21851) on Codeforces, it is quite conclusive that PyPy 2 is the fastest version of Python available on Codeforces. PyPy 2 also has features not present in PyPy 3 such as random, and numpypy. Moreover, in Python 2, bytes and strings are equivalent, this is not the case in Python 3 and results in significant input and output slowdowns unless you use Bytes in Python 3. #### __Input & Output__ Though there are faster ways to read input for specific types (integers and non-strings). The safest way to redefine input/print while maintaining the same functionality is to use the following code, ...
) give detail on how to resolve this issue. I've added some code below that should work for both

Full text and comments »

  • Vote: I like it
  • +46
  • Vote: I do not like it

102.
By JetBrains, history, 8 months ago, In English
Kotlin Heroes: Episode 14 Results Hello Codeforces! [contest:2199] has wrapped up, and what an exciting round it was! Thanks to everyone who joined the contest, solved problems, and made this round another great Kotlin Heroes event. We’ve already had many amazing rounds of the Kotlin Heroes series, and it’s incredible to see the community grow with each episode. Once again, we are proud to celebrate the true heroes of Kotlin who rose to the top and earned well-deserved prizes. Top 3 contestants are: 1. [user:Golovanov399,2026-03-08] 1. [user:BucketPotato,2026-03-08] 1. [user:literalchild,2026-03-08] Kotlin Heroes T-shirts will go to the top 50 contestants: <spoiler summary="list of the winners"> 1. [user:Golovanov399,2026-03-08] 1. [user:BucketPotato,2026-03-08] 1. [user:literalchild,2026-03-08] 1. [user:__baozii__,2026-03-08] 1. [user:Sugar_fan,2026-03-08] 1. [user:arvindf232,2026-03-08] 1. [user:potato167,2026-03-08] 1. [user:Fysty,2026-03-08] 1. [user:ttamx,2026-03-08] 1. [user:maom...
still waiting for their Kotlin Heroes T-shirts due to shipping delays. We are working toresolve

Full text and comments »

  • Vote: I like it
  • +113
  • Vote: I do not like it

103.
By banished_prince, history, 12 months ago, In English
One of the Optimal Construction for recent Problem E Hi guys! So, if you have given the recent contest, you may have encountered Problem E which is a construction problem, well let's try a little different version of it. _You are given a positive integer `n`. Find a permutation that does not contain any bad indices or say it doesn't exist._ Now, the intuition here is first start with a base solution and slowly make it better and see if it solves the problem. Here, the base solution is the one mentioned in the editorial. Let's see how it looks: ~~~~~ [_, 2, 2, _, 2, 2, _, 2, 2, _, 3, 3, _, 3, 3, _, 3, 3, 2, 3, _, _] ~~~~~ Here, `2` and `3` represents the spf value of numbers present at those indices. `_` represents remaining numbers. The above is just one representation that shows two issues with this construction. The first one is putting the remaining `2` at the end of the sequence which makes for one bad index in below example_1: ~~~~~ [1, 2, 4, 5, 6, 8, 7, 10, 12, 11, 14, 16, 13, 18, 20, 17, 3, 9, 19, 15, 21, `...
still not enough to solve the task above. The second issue is to resolve the remaining one bad, to resolve the remaining one bad index `[22, 17, 3]` which can be done by swapping the `22` with a

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

104.
By rama_pang, 4 years ago, In English
NUS CS3233 Final Team Contest 2023 Editorial The contest announcement and invitation link is [here](https://codeforces.me/blog/entry/114880). The contest link is [here](https://codeforces.me/gym/104296). ## [A. Artistic Masterpiece](https://codeforces.me/gym/104296/problem/A) <spoiler summary="Tutorial"> Since $(x,y)$ is covered by the brush iff $(x - x_c)^2 + (y - y_c)^4 \leq r$, that means we can decompose the area of the brush into $O(\sqrt[4]{r})$ independent 1-dimensional intervals (a contiguous block with the same $y$-coordinate). For each center $(x_c,y_c)$ traversed by the brush, add the 1-dimensional intervals for $y \in [y_c - \sqrt[4]{r}, y_c + \sqrt[4]{r}]$. After adding these intervals, the problem is now reduced to computing the area union of 1-dimensional intervals for each separate $y$-coordinate. </spoiler> ## [B. Broken Calculator](https://codeforces.me/gym/104296/problem/B) <spoiler summary="Tutorial"> First, we consider the minimum cost to get from an integer $X$ to another integer $Y$ us...
However, $k_L$ and $k_R$ may be large. There are numerous ways to resolve this. One of them is to

Full text and comments »

  • Vote: I like it
  • +45
  • Vote: I do not like it

105.
By shiny_shine, 2 years ago, In English
What I've learnt from Pinely Round 4 ## Abstract After I participated in Pinely Round 4 yesterday, my rating dropped down a lot. BUT, I learnt something useful. ## 1. Check your initialization &mdash; AND Reconstruction After I solved A in a minute and saw the statement of B, I quickly realized that there's an efficient construction which is simply set $a_i=b_i|b_{i-1}$. The code is below. <spoiler summary="code"> ```c++ #include <iostream> using namespace std; const int N = 1e5 + 10; int n, a[N], b[N]; void run() { scanf("%d", &n); for (int i = 1; i < n; i++) { scanf("%d", b + i); } for (int i = 1; i <= n; i++) { a[i] = (b[i] | b[i - 1]); } for (int i = 1; i < n; i++) { // printf("%d %d\n", (a[i] & a[i + 1]), b[i]); if ((a[i] & a[i + 1]) != b[i]) return puts("-1"), void(); } for (int i = 1; i <= n; i++) { printf("%d%c", a[i], " \n"[i == n]); } } int main() { int T = 1; ...
$, the $b_n$ won't be zero, and the program will output a wrong $a_n$. To resolve this, just set $b_n

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it

106.
By r3novatio, 5 years ago, In English
Solving 'Integers Have Friends' (Round #736) Without SparseTable/SegTrees? ##### Summary The blog is made to discuss these two things: 1. Other ways to solve the mentioned problem (without the need of knowing the data structures mentioned in the editorial)<br> 2. The issue of MLE and whether it depends on current memory used or the combined total. ##### Detail Problems with mandatory use of _Sparse Tables_ or _Segment Trees_ generally don't show up so early and even if they do, they have much less solves if they're purely based on the knowledge of Sparse Tables or Segment Trees. I wonder what ways could there be to solve [problem:1549D] without the pre-requisite knowledge of these advanced data structures. Can anyone propose other ways which they might have tried? One approach that I tried using _divide and conquer_ was as follows (it's to solve the `longest subarray with GCD > 1` problem, which is equivalent): <spoiler summary="My Approach"> **Algorithm:** For indices $L$ and $R$, do the following: - Recursively find the answer for ...

Full text and comments »

  • Vote: I like it
  • +19
  • Vote: I do not like it

107.
By zxqfl, history, 11 years ago, In English
SRM 663 Brief Editorial #### ABBADiv1 (d1 easy) The main idea here is that you should work backwards from the target string to the initial string. Almost any solution based on this idea can work. The simplest solution, conceptually, is to do a recursive backtracking search. It will run in polynomial time without any memoization at all. Why? If it runs in exponential time, we need a branch at each step (a choice of whether to try the last move as A or B). But suppose we had the option of picking A, and we picked B. Now we can never pick B again, since the first character in the string will always be A. So that branch will be resolved in polynomial time. The total complexity is something like $O(N^3)$. You can solve it in $O(N)$ with KMP and prefix sums. #### ChangingChange (d1 medium) In this solution we will assume $valueRemoved[i]=1$ for all $i$. Let's use generating functions. Suppose ways = ${1, 3, 6, 2}$. Then we will view it as the polynomial $1+3x+6x^2+2x^3$. You can show that adding a...

Full text and comments »

  • Vote: I like it
  • +109
  • Vote: I do not like it

108.
By liouzhou_101, history, 6 years ago, In English
Survive from Stack Overflow in Kotlin DFS is commonly used in those problems about trees and graphs. However, an unpopular guy &mdash; STACK OVERFLOW &mdash; often appears. The issue about the size of the stack is discussed [here](https://codeforces.me/blog/entry/79). However, only a few languages have been discussed there. For example, in CodeForces platform, the stack size of C/C++ is 256MB, while, that of JAVA is poorly 64MB. [user:MikeMirzayanov,2020-05-19] said he would change it but it seems he forgot it (or at least the stack overflow issue is not resolved for every language). Fortunately, at least there is a solution for [JAVA](https://codeforces.me/blog/entry/166) with threads. Why threads? It seems there is the only way to set stack size at the code (against compile) level in JAVA. Moreover, thanks to CodeForces that threads (in JAVA) have not been banned so far. The Kotlin Heroes Episode will be held in a few days. While I am using Kotlin, the STACK OVERFLOW issue comes out. It seems there is no blog tha...
have struggled for it for days and fortunately resolve it finally. I'd like to share the solution with, resolve it finally. I'd like to share the solution with you, and hope it will help for you. I

Full text and comments »

  • Vote: I like it
  • +32
  • Vote: I do not like it

109.
By kpw29, 5 years ago, In English
[ICPC blog series #0] My last ACM experience Disclaimer ================== This isn't really a first tutorial in the series. If you are interested in reading what participating in ICPC World Finals feels like, you can enjoy my <s>pathetic</s> behind-the-scenes story of the Cambridge silver-medal performance in WF2020. I tried to write a spoiler--free blog so that it contains minimum information about the problems. Motivation ================== In 2016 I have written a blogpost [My first ACM experience](https://codeforces.me/blog/entry/48082). It made sense to me to also close some chapter of the book by writing up about how my last serious contest went. I advise not to take the blog too seriously, it is just an honest stream of consciousness (some facts may not even be 100% accurate, though I will fix things people point me). Feel free to comment, praise, <s>or hate</s>. For a different perspective, check out [user:IBaloff,2021-10-07]'s [blog](https://codeforces.cc/blog/entry/95526). The hero and heroine of the story o...

Full text and comments »

  • Vote: I like it
  • +348
  • Vote: I do not like it

110.
By infinity, 10 years ago, In English
Fully Persistent Convex Hull Trick Hey guys, Convex hull optimization is a well known technique used for speeding up dynamic programming algorithms.A thorough explanation of the technique can be found in the end of the post at (1). You can also check the codeforces blog post about various dynamic programming optimizations at (2). I made this blog post to explain how to make convex hull optimization fully persistent. Even though the persistent version consists of a very natural extension of the original data structure I couldn't find anything with a quick search on google, therefore i decided to share it with the codeforces community. So here it goes. At first let me state the problem. We want to construct a DS which can support the following operations: - Insert a line in the DS, given by a pair (a,b) which represents the slope of the line and the vertical displacement. We demand that the line we are inserting has greater slope than any of the lines previously on the DS. - Given a vertical line $x = x_0$, find...
see how to resolve that shortly., By using jump pointers we can also resolve the problems we had updating the data structure. We will

Full text and comments »

  • Vote: I like it
  • +88
  • Vote: I do not like it

111.
By Nickolas, 8 years ago, In English
Announcement: Microsoft Q# Coding Contest – Winter 2019 Microsoft’s Quantum team is excited to announce the Q# Coding Contest – Winter 2019! In this contest you can put your quantum programming skills to the test, solving quantum computing tasks in Q#. Winners will receive a Microsoft Quantum T-shirt! Quantum computing is a radically different computing paradigm compared to classical computing. Indeed, it is so different that some tasks that are believed to be classically intractable (such as factoring integers or simulating physical systems) can be performed efficiently on a quantum computer. In 2017 Microsoft introduced the Quantum Development Kit which includes the Q# programming language. Q# can be used with Visual Studio, Visual Studio Code or the command line, on Windows, macOS, and Linux. In summer of 2018 we hosted the [first quantum programming contest](https://codeforces.me/blog/entry/60209), which included problems on introductory topics in quantum computing: superposition, measurement, quantum oracles and simple algorithm...

Full text and comments »

  • Vote: I like it
  • +220
  • Vote: I do not like it

112.
By k.shivaram252, history, 2 weeks ago, In English
An approach to 1129 D2 ### 1. Optimization of $f(n)$ Let the boundary sequence be defined as: $$f'(k) = \sum_{i=0}^k 2^i = 2^{k+1} - 1$$ For any given $n$, let $b$ be the maximum integer such that $l \le n \le r$, where $l = f'(b)$ and $r = f'(b+1)$. The state transition is given by: $$f(n) = \min(b + f(n - l + 1) + 1,\; b + 1 + r - n)$$ ### 2. Prefix Sums $f''(x, y)$ and Pivot $k'$ Define the prefix sum function: $$f''(x, y) = \sum_{i=x}^y f(i)$$ Let $S$ be the ordered set of boundary values such that $f(S_i) = i$: $$S = \{ 2^k - 1 \mid k \in \mathbb{Z}^+ \} = \{1, 3, 7, 15, 31, \dots\}$$ For an interval $(l, r)$ where $l = S_i$ and $r = S_{i+1}$, the size of the range is $l$. Within $(l, r)$, there exists a pivot $k'$ that splits the piecewise evaluation of $f(n)$: $$f(n) = \begin{cases} b + f(n - l + 1) + 1 & \text{if } n \le k' \\ b + 1 + r - n & \text{if } n > k' \end{cases}$$ ### 3. Block Sum Expansions Using $k'$, the sum over the open interval $(l, r)$...

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it

113.
By Cristofor, history, 3 years ago, In English
[Testing] Gray testing Hello, CodeForces! I am Cristofor Zaharescu. I am a teacher, in the Liceul Tehnologic Alunis. I was rather intrigued about the fact that not so many newbies get to examinate certain problems rounds, which in my eyes if quite a foolish thing for the future of the CodeForces community. I feel like normalizing Newbies test in rounds will succeed in the following things: - Boosting self confidence. Knowing you are important, and the fact that you can contribute in rounds, is something that can really upper your mettle in resolving wordproblems, making it easier to improve and having a higher chance to perform fairly well in future contests, as well as lowering the likelihood of giving up on programming competitively. - Experience. The fact that people get to test problems early on is quite meaningful, due to the fact that, when the Newbies will improve, go up a couple of colours, and need to test harder problems, the feedback they will give is going to be more appropriate, ...

Full text and comments »

  • Vote: I like it
  • +40
  • Vote: I do not like it

114.
By z4120, history, 7 years ago, In English
Main test for problem C2 is not strong enough (For codeforces global round 5.) There are some users who submit the same code for C1 and C2, but get main test failed for C1 and passed for C2. This JavaScript code shows that there are 12 users who passed C1 and failed C2: (run this in the developer console on a Codeforces page) <spoiler summary="Code"> ```js function sleep(ms){ return new Promise(function(resolve,reject){ setTimeout(resolve,ms) }) } async function custom_test(source,programTypeId,input){ // There's no official API // adapt from CF customtest js code const data=await $.post('/data/customtest',{ csrf_token: Codeforces.getCsrfToken(), source: source, sourceCode: source, tabSize: 4, programTypeId: programTypeId, input: input, output: '', // not _tta: 510, // ? communityCode: '', action: 'submitSourceCode', }) while(true){ sleep(2500) const response=await $.post("/data/customtest", { communityCode: "", action: "getVerdict", customTestSubmit...
```js function sleep(ms){ return new Promise(function(resolve,reject

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it

115.
By indjev99, history, 15 months ago, In English
A solution for IOI Day 2, Problem 2: Migrations with M <= 11 messages (and Z <= 4) EDIT: I have read the code for the author solution for $M \leq 8$ and it is mostly in this style and includes a chunking like here and a similar case breakdown at the final chunk of size $3$. I'd say all of the ideas here are a subset of the ideas in the full solution, though it also has one more clever element and a few more deails around it. I'll sum up the main clever part (as I understand it) at the end of the post. I came up with this solution with $M \leq 11$ to the problem and noticed the best solution at the competition was with $M \leq 12$, so I decided to post about it. This solution is quite complicated (I also have a simpler scheme with $12$), so it is understandable that no one had time for it (and I imagine $M \leq 8$ is even harder and/or cleverer). Here is a link to the problem: https://drive.google.com/file/d/1jMpszX2nPZ79jrK8yzDFIZXNb0CG_efi/view First notice that we can keep a state of which two nodes are opposite ends of some diameter. Then on a given node,...
. The key part is that the final 3 nodes can additionally resolve this ongoing ambiguity if they need

Full text and comments »

  • Vote: I like it
  • +102
  • Vote: I do not like it

116.
By prabhav_, 4 years ago, In English
An absolute shit-show contest! This is mainly a ranting blog for the ongoing Credit Suisse Global Coding Contest 4.0, which is an <b>absolute shit show</b> right now, feel free to skip it. <h1>Background: </h1> So if you don't know there was a contest organized by Credit Suisse on 6th October 2022. The contest's problem set consisted of 9 copied problems. Many people were able to solve all the problems so they arranged the leaderboard on the basis of the execution time taken by the code. The contest ended on 23rd October 2022 (or did it?) So here comes the twist. <h1>Shit show an exaggeration? </h1> <b> Issues </b> <li> In a contest where you need to just make your code the fastest, the version of the compiler can make a significant difference. Guess what? There are no details mentioned of the compiler being used for any language:) </li> <li> There were dumb issues like trailing and ending spaces that caused WA for various people <b>for days if you are lucky</b> </li> <li> You can't see the...
* Their query help center gave me an API Endpoint to resolve the issue of only being able to, help center gave me an API Endpoint to resolve the issue of only being able to see the last 10

Full text and comments »

  • Vote: I like it
  • +129
  • Vote: I do not like it

117.
By Prakul_Agrawal, 7 months ago, In English
Codeforces Round #1091 and CodeCraft '26 (Div. 2) Editorial [problem:2217A] =============== **Idea:** [user:shakr,2026-04-06] <br> **Problem Setting:** [user:AS23,2026-04-06], [user:shakr,2026-04-06] <spoiler summary="Hint 1"> What if Shaunak never uses the special move? </spoiler> <spoiler summary="Hint 2"> If Shaunak uses the special move, is using it on the first turn any different from using it later? </spoiler> <spoiler summary="Hint 3"> The above two cases are independent, and give you two conditions for Shaunak to win. What are they? </spoiler> <spoiler summary="Solution"> In a game without special moves, every turn reduces the total sum of the array, $\sum a_i$, by exactly $1$. Thus, the game lasts exactly $\sum a_i$ turns. The first player (Shaunak) wins if $\sum a_i$ is odd, and the second player (Yash) wins if $\sum a_i$ is even. <ul> <li><b>If $\sum a_i$ is odd:</b> Shaunak plays normally and wins. He doesn't need the special move.</li> <li><b>If $\sum a_i$ is even:</b> Shaunak is guaranteed to lose ...

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

118.
By Codeforcer, history, 6 years ago, In English
Getting TLE'd with O(nlogn) (2-sec) I cannot figure out why this code is getting TLE'd despite of everything being under order and constraint. I knew those mod operations were costly so I optimized them but still no luck. Problem : https://codeforces.me/contest/1466/problem/E <spoiler summary="Code"> ~~~~~ //Think simple yet elegant. #include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define all(v) v.begin(),v.end() #define F first #define S second #define pb push_back #define mp make_pair #define pi pair<int,int> #define REP(i,n) for(int i=0;i<n;i++) const int N = 3e4+10; const ll mod = 1e9+7; const int BLOCK_SIZE = 200; ll mul(ll a,ll b){ if(a>=mod) a%=mod; if(b>=mod) b%=mod; ll xt = a*b; if(xt>=mod) return (xt)%mod; return (xt); } ll add(ll a,ll b){ if((a+b)>=mod) return (a+b)%mod; return (a+b); } void run_case(){ ll n,i,j,k; //<i,j> -> {<j,1>+<j,2>+<j,3>,...............,...

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it

119.
By KickAss, history, 5 years ago, In English
[New Update]:CodeDrills on Code-N-Collab Me and [user:AdnanShamsi,2021-08-03] have developed a website [https://code-n-collab.netlify.app/](https://code-n-collab.netlify.app/) . It is a Collaboration website for people just like you, who loves to code and collaborate with others or learn something new. It provides users to collaborate with their team, friends and also find people with similar interest. As per your request... ------------------ 1. **We have added CodeDrills, now you can fetch problems from that website too and practice for ICPC** ✨ 2. **now you can directly upload and download your code in the code-editor** 3. **More anime characters added** (•_•) <a href="https://code-n-collab.netlify.app/" target="_blank" rel="noreferrer"> <table > <tr> <td> [![Home Page](/predownloaded/ba/c4/bac4ef076063bf81b5e99e27f46659d0ae14162d.png)](https://code-n-collab.netlify.app/) </td> <td > [![ Profile](/predownloaded/97/36/9736ea1eec6c5f262933fd5dddffce9bf3cfc15e.png)]...
- Write blogs/comment to share something, ask some doubts or resolve the doubts of other coders out

Full text and comments »

  • Vote: I like it
  • +39
  • Vote: I do not like it

120.
By yongwhan, 12 years ago, In English
2015 Facebook Hacker Cup Round 1 ## **General Comment** I did not spend too much time on thinking about the execution time since the 6-minute is usually much more than the required in the usual online contest (e.g., 2 seconds for CodeForces for instance). So, for each problem, I took whichever way leading me to code reliably. Also, for each problem, I did lots of stress testing since I screwed up few contests (e.g., the large input in the previous Google Code Jam) before by not fully testing my codes with respect to the full constraint given by the problem. For A and C, I generated the edge cases manually and compared the computed answers from the brute force approaches and made sure they match. For B and D, I generated the theoretical worst case to make sure they are handled properly using my codes. Thankfully, I hit few segmentation fault problems 4-5 hours into the contest, from which I tried few approaches to increase the stack size; manipulating the size limit in `#include<sys/resource.h>` did the trick ...

Full text and comments »

  • Vote: I like it
  • +47
  • Vote: I do not like it

121.
By bihariforces, history, 3 years ago, In English
An intuitive way to solve DQUERY If you have not seen already, [DQUERY](https://www.spoj.com/problems/DQUERY/) is a problem on SPOJ which asks us to query the number of distinct elements present in a range. There are ways to solve it online, which might also be possible with what I'll be discussing today, but for sake of explanation we'll solve it offline. Offline way to solve DQUERY involves use of Fenwick Trees, which is already a well-known technique but we'll try to formulate the solution ourselves in a much more intuitive way. Let us forget about queries, assume we've a hypothetical $N \times N$ grid $distinct$ where $distinct[i][j]$ is the number of distinct elements present in subarray $A[i,j]$. Now we'll use the technique of individual contribution, ie. rather than taking a range and counting distinct, we take an element and find all ranges where this element will contribute an answer to, In order to do that we need a way to resolve duplicates, ie. if there are duplicates only first occurrence shou...
, In order to do that we need a way to resolve duplicates, ie. if there are duplicates only first

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it

122.
By IlyaCk, 14 years ago, In Russian
Кажется, проблема в Полигоне Кажется, в данный момент имеет место проблема с Полигоном ( http://polygon.codeforces.com ). **UPD: Текущая** проблема &mdash; **в конце** текста Конкретно это проявляется в том, что одна и та же копия ejudge импортирует пакеты, созданные Полигоном ранее, но не импортирует созданные именно сейчас. Более того: по одной из задач (номер на Полигоне 5477) старый (8-й) пакет импортировался, а после абсолютно несущественных изменений (на уровне добавить пробелы в условие) и пересобирания пакета новый (9-й) пакет не импортируется. И заодно: было бы неплохо, если б [admin:MikeMirzayanov] (или кто-то другой из разработчиков) завёл централизованный блог, куда было бы официально положено писАть о всех подобных вещах. UPD: более конкретно, при попытке импорта архив выкачивается, а потом пишет, например, так: ~~~~~ zip_open_func: failed to open ZIP '/home/judges/000005/download/ck-2012-13-ii-d-15$linux.zip': Zip archive inconsistent Failed to open zip file '/home/judges/000005/do...
open problem <название-задачи>. It is possible that there conflicts found. Try "Resolve conflicts, possible that there conflicts found. Try "Resolve conflicts" option`. Попытка нажать `Resolve, >. It is possible that there conflicts found. Try "Resolve conflicts" option". Хотя я уверен, что как

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it

123.
By OmarAfterMidnight, history, 3 months ago, In English
VoidHub Update: 1v1 Duels, Solo Sprint, Originals, and CPC Problems Hi Codeforces! About seven weeks ago, [user:AdhamAfterMidnight,2026-08-19] and I shared [VoidHub](https://voidhub.co), a project we started while preparing for the ECPC. The main idea was simple: make regular practice feel less repetitive. Invite a friend, enter a live 1v1 room, solve under a timer, and let the original judge decide the result. Since that post, we kept building, testing, and fixing plenty of details. This is a small update about what has changed. [cut] ## VoidHub is still about 1v1 The core of VoidHub is still live 1v1 competitive programming. You can invite a friend, choose a mode, set a difficulty range and timer, then play in the same room using problems from: - Codeforces - HackerRank - Online Judge The available duel formats include BO3, BO5, Blitz, Pick & Play, and Quick Match links. ![VoidHub compete modes](/predownloaded/d1/fc/d1fcd4fd5f1a2a017a3e93648e93df92e470e605.png) For Codeforces rooms, submissions are sent through the ...

Full text and comments »

124.
By jigyasu_kalyan, 13 months ago, In English
Why Lazy Segment Tree needs a push() function? Hello Codeforces, We all learn `push()/push_down()` function when studying Lazy Segment Trees. It's the engine that propagates the changes stored on a node to its children. This ensures that before we recurse deeper, the children of the current node are updated with any pending changes, guaranteeing we always work with consistent data. I was just studying Lazy Segment Trees and a fundamental question came to my mind. Is it possible to continue in Lazy trees without this `push()` function? I tried some variations of problems where we use Lazy Propagation with push() function, and tried to solve and find approaches on paper pen and I was able to find way to solve problems without push() function. I discussed with my peers an faculty if they can prove me wrong in those solutions and can provide some variation where we strictly need push() function with lazy tree. I am listing some variations below and their standard approaches of lazy tree with push() function and my approach of lazy tre...

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

125.
By dyatkovskiy, history, 7 years ago, In English
Slow man's solutions. Independent sets calculations. **Disclaimer**: this is **not my** solution. Everything I could do is to chew it up to myself, and public here as well. Recently I was checking out solution for "[1221G &mdash; Graph And Numbers](https://codeforces.me/problemset/problem/1221/G)". The most intriguing thing was independent sets counting.[cut] Unfortunately I found existing explanation merely a hints of what actually is should be done in order to calculate that amount. But must say even those hints are good! Seriously! It gives you a motivation to work on details yourself. So thanks to [user:PikMike,2019-10-03] and [user:BledDest,2019-10-03] for that! This is much much better than nothing. And perhaps better then everything. So I recommend you guys to read first the [legacy tutorial](https://codeforces.me/blog/entry/69925?locale=en) and if you spent let say 24 hours with little progress, continue reading this super chewing post. Ah yeah, there is also C++ solution, but with no comments. Again. You may jus...
independ SS2, we just resolve |SS1SS2| and add to the final answer |SS1SS2|: Answer += |SS1SS2|.

Full text and comments »

  • Vote: I like it
  • +67
  • Vote: I do not like it

126.
By UzuHa_NaruSuke, history, 2 years ago, In English
Transforming a Hidden Passion: The Rise of Our College's CP Club A year ago, the Competitive Programming (CP) club at our college was a small, almost hidden community. At that time, only two of us actively participated in CP contests: I was a Pupil, and my friend was a Specialist. Fast forward to today, and our club has grown dramatically. We now proudly have five Experts among us, a testament to our collective effort and passion. How did we achieve this transformation? It wasn’t magic; it was a combination of strategic initiatives and a supportive environment. We organized engaging events like Code UnCode (You can search about it on LinkedIn), which not only challenged the students in the college but also sparked their interest and excitement. After every Codeforces (CF) and CodeChef (CC) round, we hold Post Contest Discussions. These sessions have become a cornerstone of our community, where members can share their strategies, learn from each other, and collectively improve their skills. But perhaps most importantly, we celebrated every achi...

Full text and comments »

  • Vote: I like it
  • +50
  • Vote: I do not like it

127.
By purplesyringa, history, 5 years ago, translation, In English
Let's face it, Polygon is horrible ![image](https://i.ibb.co/rs7PwmM/7Cu9Z.jpg) Polygon is not world's greatest evil. Polygon doesn't even have a particular defect that makes it horrible. You can't say what's exactly wrong with Polygon. Polygon seems to work, it seems like every feature is supported, but if you touch it here it will fall apart, and if you touch it there a problem (pun not intended) will appear. Or not, depending on your luck. Polygon is like PHP. For those who haven't read the famous rant, I'll cite it for you: > I can't even say what's wrong with PHP, because-- okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there. > > You pull out a screwdriver, and you see it's one of those weird tri-headed things. Okay, well, that's not very useful to you, but you guess it comes in handy sometimes. > > You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it...

Full text and comments »

  • Vote: I like it
  • +180
  • Vote: I do not like it

128.
By dendi239, history, 6 years ago, In English
Micro- and macro-management for your next cpp source: For Hello, codeforces! In this article, I would like to show you how to reduce time spent on working with `for` cycle. There're a few ways to do it, I'll show macro-based and expressible in pure c++. # Introduction I love `for` cycle. It looks quite simple: ~~~~ for (init statement; condition; increment) ~~~~ But you can adapt it to do many great things. To illustrate the power of `for`, let's look at the simple binary search problem: we have some values `l`, `r` and a predicate `p` which is true on segment `[l, x]` and false on `(x, r)`, and we are asked to find x. Using `for` we can implement the solution in basically just one line: ~~~~~ for (int m = (l + r) / 2; abs(r - l) > 1; (p(m) ? l : r) = m, m = (l + r) / 2); ~~~~~ Pretty neat, huh? After the cycle finishes, you'll get `l = x`. Another important note, the `(p(m) ? l : r) = m` part works because ternary operator returns reference type. It means that `(is_left ? left : right) = new_value;` assigns `ne...
you will get integer overflow for `i`. To resolve it, you could use `decltype` expression to get the

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

129.
By dalex, 12 years ago, translation, In English
EZ Collections, EZ Life (new Java library for contests) Hello guys, I'm going to tell you about one of the negative aspects of Java on programming contests (actually, not only on contests), or, more precisely, how I have tried to resolve it. As you may know, Java has the disadvantage related to its collections library: the constraints of this language make you use object types even when using primitive types should be enough. Compare `ArrayList<Integer>` and `vector<int>`: Java list stores objects of type Integer, which are created every time when you add an element into the list (it's called boxing / unboxing), whereas C++ vector just stores ints. This behaviour slows down Java programs, and many people don't like it. All this shit comes from the language design: you can't simply write a primitive type inside the angular brackets in Java. Some months ago I was thinking about this problem and came to the solution: why not just write my own collections library, with primitive types? Moreover, I haven't found any library with really all...
, not only on contests), or, more precisely, how I have tried to resolve it. As you may know, Java has

Full text and comments »

  • Vote: I like it
  • +77
  • Vote: I do not like it

130.
By eatmore, history, 9 years ago, In English
Let's promote Codeforces among Google Code Jam participants Hi all! Soon thousands of people will participate in Google Code Jam [qualification round](/blog/entry/58775). There is a problem though: Code Jam website doesn't offer a good place to discuss the problems afterwards. There is an [official Google group](https://groups.google.com/group/google-code/subscribe), but it is a poor place for discussion: not only is it premoderated, but they also reject/delete useful posts, like [this one](/blog/entry/54398). There is a solution: point people at Codeforces, the best place to discuss programming competitions! If we just start posting messages about Codeforces to the Google group, they will probably delete them. But there is something else that people (sometimes) read: your code. For many years, Code Jam allowed anyone to read any participant's code after the contest. While the current system doesn't support this yet, this is something that Code Jam team is willing to resolve. So, my idea is for as many people as possible to add a comment ...
Code Jam team is willing to resolve. So, my idea is for as many people as possible to add a comment, support this yet, this is something that Code Jam team is willing to resolve. So, my idea is for as

Full text and comments »

  • Vote: I like it
  • +248
  • Vote: I do not like it

131.
By sidat, 7 months ago, In English
International Coding League Round 1 Editorial ### [problem:681359A] **Problem Idea:** [user:kkapoor,2026-03-31] <spoiler summary="Solution"> We are given an array $a$ and need to find the maximum length subsequence $b$ such that for every adjacent pair: $$b_i \ \&\ b_{i+1} \ne 0$$ This means that every pair of consecutive elements in the subsequence must share at least one common set bit. #### Key Observation Two elements can be adjacent in the subsequence if and only if their bitwise AND is non-zero, i.e., they share at least one common bit. Instead of working with values directly, we can think in terms of bits (from $0$ to $32$). #### Approach Define a DP array: $$dp[b] = \text{maximum length of a valid subsequence ending with an element having bit } b$$ We process the array from left to right. For each element $a_i$: 1. Find all bits that are set in $a_i$ 2. Compute: $$best = 1 + \max(dp[b]) \quad \text{over all bits } b \text{ set in } a_i$$ If no such bit exists (i.e., all correspon...
Bits:** Since the maximum value is strictly less than $2^{54}$, we need to resolve exactly 54 bits. We, using bitsets, but this is also too slow. To resolve queries in $O(1)$, we use hashing.

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

132.
By JetBrains, 7 years ago, In English
Kotlin Heroes Announcement <img src="/predownloaded/d3/f6/d3f67b5afe94939d82d9358aeb7a0edcf6a8d33f.png" style="width:300px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! We are happy to announce that in partnership with Codeforces to promote [Kotlin programming language](https://kotlinlang.org/) we are launching a series of "Kotlin Heroes" programming contests. Kotlin programming language was introduced by JetBrains in 2011 and reached its first stable version 1.0 in 2016. The current language version is 1.3.31. The language is focused on solving the needs of application developers in various domains. Kotlin is a statically typed language that is designed for writing concise code, with less ceremony and more substance in it, and to scale from applications of just a few lines long to multi-million-lines projects. While not being specifically designed for competitive programming, it incidentally fits well in this domain, reducing the typical amount boilerplate that a programmer needs to write...

Full text and comments »

Announcement of Kotlin Heroes: Episode 1
  • Vote: I like it
  • +280
  • Vote: I do not like it

133.
By Nakagawa.Kanon, history, 4 months ago, In English
Me trying to study Atcoder World Tour Finals 2026 Algorithm : E — Even Rows ![ ](/predownloaded/77/c3/77c355894f49137e2eda44b44cc2e53a9fd7371e.png) It took days for me to just to barely understand the editorials and from my own opinion, it was so obscure and omitted lot of thing to barely make sense so I had an idea to share my own analysis here for everyone to discuss. Please note this is a wall of text since I want to elaborate on every ambiguous part of editorial and explain my flow of logic as much as possible and for anyone patient enough to read through the end, please share some advice and opinion to optimize and speed up my logic arguments, maybe fixing some typo or request some clarification of my explanation if possible. Thank you for reading. First about the problem statement, it can be divide into 3 parts : - Input : + A table with size $N\times M$ + Each cell is either empty or has a piece on it - Algorithm 1 : Take a table with pieces on it as input + Define the way to move a piece in the table + The ...

Full text and comments »

  • Vote: I like it
  • +165
  • Vote: I do not like it

134.
By kfqg, history, 6 years ago, In English
Quora Programming Challenge 2021 Quora Programming Challenge 2021 ================== Quora, an American tech-company, is hosting an algorithm contest with cash prizes on **February 6 and 7, 2021**. Some info copy-pasted from the contest [webpage](https://www.quora.com/careers/challenge) : About the Challenge ----------------------------------------------------------------------- At Quora, we work on difficult programming challenges on a daily basis. We wanted to share some of the interesting problems that we work on. Thus, we drew inspiration from real-world challenges in our product, systems, and machine learning applications to create an interesting set of algorithm problems that we hope you’ll enjoy. Divisions ------------------------------------------------------------------------------------------------- In order to accomodate a wide range of timezones, we will be holding the contest in two divisions. Each division will have its own unique set of problems and a separate set of winners and prizes....

Full text and comments »

  • Vote: I like it
  • +112
  • Vote: I do not like it

135.
By PavelKunyavskiy, 15 years ago, translation, In English
Codeforces Round #114 Hello! We are happy to invite you to participate in today's round. I hope everyone will find interesting problems for him. And most of the round participants will like it as well as the [previous one](http://codeforces.me/blog/entry/2115). Today's contest was prepared for you by SPb SU 4 team (~Alex-Gran,2012-03-27 (Alexandr Granovskiy), ~Dmitry_Egorov,2012-03-27 (Dmitry Egorov), ~kuniavski,2012-03-27 (Pavel Kunyavskiy)). After long thoughts you can notice that we present St.Petersburg State University. Thanks very much for help in the tasks preparation to Artem Rakhov(~RAD,2012-03-27), Gerald Agapov (~Gerald,2012-03-27) and Maria Belova (~Delinur,2012-03-27) for translation statements. Also thanks to Petr Kalinin (~KAP,2012-03-27) for statements proofreading. In today's contest there will be seven problems (5 in each division) about the country where wizards live, and this causes many interesting events. Today you have to take part in local meeting, understand ...
prizes, play in popular wizards game, help magic government in ruling the country andresolve, , play in popular wizards game, help magic government in ruling the country and resolve financial

Full text and comments »

  • Vote: I like it
  • +207
  • Vote: I do not like it

136.
By Endagorion, history, 10 years ago, In English
Grand Prix of Moscow Workshop (+ Editorial) Yesterday, on April 23 an Open Cup round &mdash; Grand Prix of Moscow Workshop was held. In fact, the same contest was held on April 17, the last day of [Moscow Pre-Finals ACM ICPC Workshop](https://it-edu.mipt.ru/ru/spring_training_2017). The problems were prepared by the workshop programming committee: Mikhail Tikhomirov ([user:Endagorion,2017-04-24]) and Gleb Evstropov ([user:GlebsHP,2017-04-24]), as well as members of MIPT teams Jinotega: Ivan Smirnov ([user:ifsmirnov,2017-04-24]), Artsem Zhuk ([user:Arterm,2017-04-24]), Konstantin Semenov ([user:zemen,2017-04-24]), and Cryptozoology: Alexander Ostanin ([user:Kostroma,2017-04-24]), Alexander Golovanov ([user:Golovanov399,2017-04-24]), Nikita Uvarov ([user:I_hate_ACM,2017-04-24]). We hope you enjoyed solving our contest! The results can be found on [the Open Cup page](http://opentrains.snarknews.info/~ejudge/res/res10377). Our congratulations to teams SPb ITMO University 1 (Belonogov, Zban, Smykalov) and the veteran team SPb H...

Full text and comments »

  • Vote: I like it
  • +96
  • Vote: I do not like it

137.
By dmkozyrev, history, 5 years ago, In English
Slowdown in twice with ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); in C++ Hello! I want to show you the real life example where using of next features: ``` ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ``` leads to slowdown of the program, written in C++, in two times. Example is quite simple &mdash; just print binary representation of all numbers in range $[0,10^7)$: ``` #include <bits/stdc++.h> using namespace std; int main() { //ios::sync_with_stdio(false); //cin.tie(0); cout.tie(0); char buf[33]={0}; buf[32] = '\n'; for (int i = 0; i < 10'000'000; i++) { for (int bit = 30; bit >= 0; bit--) { buf[30-bit] = ((i >> bit) & 1) ? '1' : '0'; } cout << buf; } } ``` **UPD**. When I replaced `buf[32] = '\n';` by `buf[31] = '\n';`, the situation wasn't changed. If we run this example in [codeforces custom invocation](https://codeforces.me/contest/1607/customtest), then we will see `Used: 1840 ms, 1184 KB`. When we will uncomment speedup of C++ input/output, the...

Full text and comments »

  • Vote: I like it
  • +41
  • Vote: I do not like it

138.
By rohantrix, history, 5 years ago, In English
CSES Labyrinth TLEs in Java and Python [SOLVED] Both the codes in Java and Python TLE on CSES for same test cases (7-10). Please help me resolve this issue. **Java: [WORKING NOW]** ```java static int endi, endj; static void solve() throws IOException{ StringTokenizer st; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out)); st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); char mat[][] = new char[n][m]; char dir[][] = new char[n][m]; fill2D(dir, '#'); int si = 0, sj = 0; for (int i = 0; i < n; i++) { st = new StringTokenizer(br.readLine()); mat[i] = st.nextToken().toCharArray(); for (int j = 0; j < m; j++) { if (mat[i][j] == 'A') { si = i; ...
resolve this issue.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

139.
By sigma__1, history, 7 months ago, In English
Editorial for CodeRed Prelims 2026 On behalf of the organizing team, we extend our deepest gratitude to everyone who participated in CodeRed Prelims 2026. Witnessing your dedication and fierce competitive spirit on the leaderboard validated the immense effort our team invested behind the scenes. Our problem-setters spent countless hours crafting and balancing these challenges. We sincerely hope the problemset provided a rewarding and engaging experience for the IIIT Allahabad community and our global participants. Below, you will find the official hints, detailed editorials, and author solutions. Happy upsolving! A: Ashutosh's Triad ---------------------- Author: [user:sigma__1,2026-04-16] <spoiler summary="Hint 1"> The phrase "minimize the maximum salary" is a classic indicator that we should use Binary Search on the answer. </spoiler> <spoiler summary="Hint 2"> Since $X$ is square-free, the maximum number of distinct prime factors $m$ is very small ($m \le 15$). Think about representing each wizard's ...
// Resolve the winner // Edge case: If both technically have a winning board at 'mid

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it

140.
By pritishn, 6 years ago, In English
Reporting Another loophole in InterviewBit platform contest. Reporting this issue here on Codeforces again because last time the issues were recognized and resolved effectively through [this blog.](https://codeforces.me/blog/entry/85987) Last Code-Drift contest (linklist+stack+queue) which was organized had two major issues. First is the hint system which when used will deduct some % from max achievable score for each problem. One can simply make an alt account and see the 1st hint. This could not be exploited that much because only 1 hint was available for participants who were active in the contest and it was very vague hint. **But the main issue was when I realized that everyone can actually see the setter solution for every problem by doing one trick.** <br> **After not being able to solve 3rd problem , I decided to press "End test" button out of frustration. Around 1 hour later I came back with some fresh ideas in mind and when I clicked the contest it opened in practice mode and there I was able to see complete solution before...

Full text and comments »

  • Vote: I like it
  • +43
  • Vote: I do not like it

141.
By AB22, 4 weeks ago, In English
Eitri: A Practical Competitive Programming Workflow ## The problem [Eitri](https://github.com/veryshyjelly/eitri) solves In competitive programming, the code you write while developing a solution often differs from the code you finally submit. During development, you benefit from a modular codebase: separate files for I/O utilities, graph algorithms, data structures, and other helpers make your work easier to read, test, and reuse. However, most online judges expect a single source file. Manually combining library files, resolving dependencies, maintaining the correct order, and stripping unused code is tedious and error‑prone—especially during a contest when minutes matter. Beyond library management, competitive programmers face other repetitive tasks: creating a new file for each problem, copying sample test cases whenever the solution changes, hunting through a file picker to open the right source, and repeatedly compiling and testing by hand. [Eitri](https://github.com/veryshyjelly/eitri) addresses these pain points by inte...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

142.
By karamkontar, 8 years ago, In English
ACPC Arab Collegiate Programming Contest 2018 Editorial Hello, Since the editorial posted for the ACPC 2018 is rather complicated (no offense), I decided to write my own tutorial with much simpler solutions. There are two problems missing, and, hopefully, they will be available soon. Hope you like it! [problem:101991A] <spoiler summary="Hint"> A tree has all its edges as bridges (initially $ \relax N-1 $ bridges). </spoiler> <spoiler summary="Hint"> Joining the end-points of a simple path with length $ \relax P $ edges, removes $ \relax P $ bridges from the tree (resulting in $ \relax N-1-P $ bridges). </spoiler> <spoiler summary="Tutorial"> Initially, all edges of the given tree are bridges since removing any of them disconnects the graph. So, we start with $ \relax N-1 $ bridges. Joining the end-points of a simple path with length $ \relax P $ edges, removes $ \relax P $ bridges from the tree (resulting in $ \relax N-1-P $ bridges). Since we want the resulting graph to have the number of bridges in $ \relax [L, R] $,...
substring $ \relax S_{2, 4} $, we get a value of $ \relax A_{4} = 3 $, which is better. How do weresolve

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

143.
By alphastigma, 3 years ago, In English
Setup coding environment for noobs **Note that the environment i am sharing is what I made from compiling a few sources here and there. I myself was facing some difficulty being a newbie in this as I usually used just Vim, so I figured adding it here would help some people save time and brain cells** <br> - **First**, I use _VSCode_ for coding in C++ language (You can also setup _NeoVim_ like _VSCode_ but there were so many good extensions available on _VSCode_ that i shifted to this one, also let's be honest: resolving dependencies in _Vim_ is mehh..). <br> - **Second**, you need to get a **template .cpp** file ready so that you don't have to waste time on it on every problem. I will not be giving that one here, as you should look at what template suits the best for you (Start looking in code submissions from higher rated coders here and see what all they use in their templates) (: I myself forgot from which sources I stole my template file ^__^ ) <br> - **Third**, and the main reason for writing this blog, g...

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it

144.
By nika-skybytska, 6 years ago, In English
AtCoder Regular Contest #111 Livesolve [A-D] CF seems to be the most reasonable place to post about AtCoder, as there are no blogs on AtCoder itself, so here we go. [Problems](https://atcoder.jp/contests/arc111), [my solutions](https://github.com/Sky-Nik/AtCoder/tree/main/arc111), [YT video](https://www.youtube.com/watch?v=ckAmjtXRpaA&feature=youtu.be&ab_channel=NikitaSkybytskyi). Short text editorial: A. If $10^N = A \cdot M^2 + B \cdot M + C$ then answer is $B$, and it remains to compute $10^N \pmod{M^2}$ with binary exponentiation. B. Cards form a graph. Connected components can be optimized independently. We can take all vertices from a component iff it is not the tree. Otherwise, we can take all vertices but one. C. Every permutation is a product of cycles. Process people in the increasing order of weight. Every cycle (and hence the entire permutation) will be resolved optimally unless you ran into smth that makes overall permutation impossible. D. If `c[u] > c[v]` then we must have `u -> v` as all vertices...

Full text and comments »

  • Vote: I like it
  • +43
  • Vote: I do not like it

145.
By codelegend, 5 years ago, In English
[query] Solving an interactive problem in Haskell I am attempting to solve [problem:1520F1] in Haskell. ```haskell import Control.Arrow ((>>>)) main = interact $ lines >>> (\(nt:ls) -> head (words nt) : ls) >>> map read >>> solve >>> map show >>> unlines data Query = Ask Int Int | Answer Int instance Show Query where show (Ask l r) = "? " ++ show l ++ " " ++ show r show (Answer x) = "! " ++ show x solve :: [Int] -> [Query] solve (n:k:rs) = go 1 n rs where go lo hi xs | lo == hi = [Answer lo] | otherwise = let mid = (lo + hi) `div` 2 in Ask 1 mid : (let (lo', hi') = (if head xs + k > mid then (mid + 1, hi) else (lo, mid)) in go lo' hi' (tail xs)) ``` I believe I have ensured maximum laziness while checking the query responses &mdash; I only force `xs` in the tail of the returned query list. The code runs fine locally. But I keep getting Idleness limit exceeded on the sample case: [submission:117826356] Am I missing some impo...

Full text and comments »

  • Vote: I like it
  • +46
  • Vote: I do not like it

146.
By OIer_kzc, history, 2 years ago, In English
Issues I encountered in this contest Usually, I use mirror sites m3.codeforces.com to play the contest, see problems and submit. But this it shows "The statement is not available" for unknown reason. ![ ](/predownloaded/1a/b0/1ab0bad314d3fb6a50e9f32bb46f6bd61672f5f4.png) I haven't been informed that, so I play the contest use the main sites codeforces.com. But it continually requires to verifying if I am human when I submitted a solution, and it's been a little long, 2 to 5 minutes every time. This causes me to submit my solution 2 to 5 minutes late in F and G, and more importantly, I couldn't submit E in the end of the contest. ![ ](/predownloaded/64/0c/640c6483fda3ab426c9cd83e28243948f398386d.png) I don't care about the result or the place, but it really made my experiences bad. I would very much like to know immediately if my solution of E is correct. I don't think anyone would want to face such an issue. I really hope this post can be seen and this issue can be resolved.

Full text and comments »

  • Vote: I like it
  • +213
  • Vote: I do not like it

147.
By bhatKa, history, 4 years ago, In English
Atcoder Library Lazy Segment Tree Implementation Bug (Probably) + Polynomial Queries CSES Bonus With **Atcoder API** of **Lazy Segment Tree,** [Lazy Seg Tree Template](https://github.com/atcoder/ac-library/blob/master/atcoder/lazysegtree.hpp) <br> I am trying the problem where we need to support query to increment a range with a given value. The Atcoder API implementation seems to fail here, where I have an array. <br> **[3, 2, 4, 5, 1, 1, 5, 3]** <br> and I want to do a range update over the range **[1,4] ( 0 based indexing)** and **add a value 1** to it. <br> The sum should ideally change to **16** after the update and the **array** should look like <br> **[3, 3, 5, 6, 2, 1, 5, 3]** <br> The query function , the **.prod()** function of Atcoder API seems to return result **15**,<br> You can try running this code for your reference to understand the ambiguity happening here. <spoiler summary="Code"> ~~~~~ #include<bits/stdc++.h> namespace internal { unsigned int bit_ceil(unsigned int n) { unsigned int x = 1; while (x < (unsigned...

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

148.
By sh19910711, 12 years ago, In English
Snippet Manager for Online Judges Greetings :-) ### tl;dr https://github.com/social-snippet/social-snippet ![Application Demo](http://social-snippet.github.io/img/ss-use.gif) ---- ### 0. Introduction to the Social Snippet I'm starting a new software project, "[The Social Snippet Project](https://social-snippet.github.io/)", to manage the snippet libraries for the online judges (e.g. [watashi's library](https://github.com/watashi/AlgoLib), [marioyc's library](https://github.com/marioyc/ACM-ICPC-Library) and etc...). As its name implies, it's made possible to share and retrieve your snippet libraries around the world through [GitHub](https://github.com) and other hosting services. The social snippet project provides several things: 1. Command-line interface to use and manage the snippet libraries and its dependencies 2. [Registry system](https://sspm.herokuapp.com) to find the snippet libraries 3. Editor plugins to use the snippets actually (e.g. [Vim](http://www.vim.org), [Emacs](http://...
One more thing, the social snippet can resolve the dependencies among the snippets. For example

Full text and comments »

  • Vote: I like it
  • +26
  • Vote: I do not like it

149.
By notsoawesome, history, 2 years ago, In English
A sample example for debugging code for newbs (like me) This is something which I was happy to achieve on my own for [problem:2004D]. I quickly achieved the greedy binary search, but I had few un-intended bugs (ideally would've saved time if I did a code review instead of debugging, but as a trade-off you do get a confidence that it will get resolved after debugging) **Here is the why this blog is for you:** - You are newb like me. - You get frustrated when your code randomly gets WA and you don't know what the edge case/bug is there in your code. **Here is probably why this blog is not for you:** - You are too good (please ignore, although, you can improvements are welcome!) - You probably know what to do, but just don't feel like debugging. (well, that's the only way I know which will work for sure for now) **Thing which helped the most:** [Debug template](https://codeforces.me/blog/entry/125435) &mdash; by [user:Anshul_Johri,2024-08-25] **TL;DR of the debugger** 1. Write the most correct version you can think o...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

150.
By Errichto, 8 years ago, In English
Is chemthan hacked? There was a blog that [user:chemthan,2019-03-20] got hacked, and indeed I got strange messages from his account, asking for help with problems from the next Google Kickstart. The blog is now deleted. It would be nice to hear from some friends of his whether everything is ok now. [user:chemthan1,2019-03-20] is allegedly his temporary alt account. Also, [user:ikatanic,2019-03-20] was mentioned. I can remove this blog a few days after everything is resolved, if [user:chemthan,2019-03-20] wishes so.

Full text and comments »

  • Vote: I like it
  • +76
  • Vote: I do not like it

151.
By CodingKnight, 4 years ago, In English
Compilation error in GNU++20 11.2.0 (64 bit, winlibs): Issue resolved Hello Codeforces, I got the following compilation error while using GNU++20 1l.2.0 (64 biy, winlibs) compiler to translate and run a C++ program that contains the following include statement. <spoiler summary="Include statement"> ~~~~~ #include <bits/stdc++.h> #include <bits/extc++.h> using namespace std; ~~~~~ </spoiler> <spoiler summary="Compilation Error"> Invocation failed [COMPILATION_ERROR] Can't compile file: In file included from c:\programs\gcc11-64-winlibs\include\c++\11.2.0\x86_64-w64-mingw32\bits\extc++.h:81, from program.cpp:2: c:\programs\gcc11-64-winlibs\include\c++\11.2.0\ext\codecvt_specializations.h:40:10: fatal error: iconv.h: No such file or directory 40 | #include <iconv.h> | ^ compilation terminated. ===== Used: 0 ms, 0 KB </spoiler> Has any member of the community encountered this compilation error before and knows how to resolve it? Thanks in advance for sharing any helpful in...
compilation error before and knows how to resolve it? Thanks in advance for sharing any helpful, Has any member of the community encountered this compilation error before and knows how toresolve

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

152.
By GreatShinobiOwl, history, 7 weeks ago, In English
Polyman v3: Let an AI Agent Build Your Problem (and Test It Before Polygon Sees It) About ten months ago, [Stop Fighting with Polygon — Create and Test Problems Locally] (https://codeforces.me/blog/entry/148803) was written. It introduced **Polyman**, a CLI for problem setters. You write the validator, generators, checker, and solutions on your own machine. One command, `polyman verify`, generates every test, validates it, and checks that every solution gets the verdict it should. Then `polyman remote push` sends the whole thing to Polygon. Thank you for the upvotes, the issues and the pull requests. A lot has changed since then, so here is what's new. **Upgrade:** ``` npm install -g polyman-cli@latest polyman --version # 3.0.0 ``` There is one breaking change in how generator scripts are written. See **Migrating from v2** at the end; it takes about two minutes. --- ## 1. Polyman is now built for AI agents This is the biggest change. More and more of us write code together with Claude Code, Codex, Cursor or Aider. A problem package is a good...

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

153.
By DukhiAatma420, history, 3 years ago, In English
Getting WA due to library data types behaving differently than expected Hi all, I would like to share something which happened with me in today's contest. I solved the following problem: [Strong Password](https://codeforces.me/contest/1845/problem/C). Here is my submission link: [Submission](https://codeforces.me/contest/1845/submission/211501589). I was not sure why it was giving runtime error, and after the contest, I tried submitting it in C++20. It passed without any problem! Here is the code snippet which was the reason of runtime error: ~~~~~ string s; cin >> s; ... vvll post(s.size(), vll(10, -1)); ... for (ll i = s.size() - 2; i >= 0; --i) { for (int j = 0; j < 10; ++j) post[i][j] = post[i + 1][j]; ... } ~~~~~ `vvll` is `vector<vector<long long>>`, `vll` is `vector<long long>` and `ll` is `long long`. Can you identify the source of runtime error here? **Hint**: what if input string is `"0"`? Most of us assume size_t to be unsigned long long (as most of us compile our code using 64bit compilers loca...
live and there was nothing I could do to resolve this issue. Every possible combination was working

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it

154.
By vishudon, history, 5 years ago, In English
Really need help in understanding why my approach is wrong. Please help. Hi there, I hope you all are doing very good. I'm trying to solve rated 1600 problems, and recently got this interactive problem: [Problem Link](https://codeforces.me/problemset/problem/1407/C) For solving this problem, I followed this below approach: **Step1:** I decided to ask these **(n-1)** queries: **? index n** (for all **index** in **[1, n-1]**). **Step2:** Then, I created an empty array **remArray** of size **n** for storing all the **(n-1)** remainder values provided by the judge of each query asked by the user. Obviously, judge will return values between **[0, p[n]-1]** in each query. **Step3:** Now, once I took all the **(n-1)** remainder values, I stopped asking for remainder values input. I started my implementation following the below procedure: a) Calculating maximum value in the remainder array so that I could identify which value needs to be present at **nth** index in the final result. I think that value must be p...

Full text and comments »

  • Vote: I like it
  • +14
  • Vote: I do not like it

155.
By maroonrk, history, 8 years ago, In English
Has anyone uploaded team notes for ICPC WF? **The problem is now resolved.** **See the comment on the top.** According to the instruction sent by the ICPC WF organizer, we should upload team reference document by 25th March. However, when I opened the WF team dashboard and clicked "Attachment", anything like uploading button didn't appear. My friend [user:joisino,2019-03-24] said he couldn't upload his document as well. Thus I think it's a problem with the webpage, but I'm not sure. Have you succeeded in submitting your document? Please let me know.

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

156.
By A2SV_Group7, history, 6 months ago, In English
A2SV G7 Contest Round #13 Editorial [Here](https://codeforces.me/contests/691516) is the contest link #### [A. PolandBall and Hypothesis](https://codeforces.me/gym/691516/problem/A) Idea and preparation: <spoiler summary="Hint"> Since $m$ only needs to be between $1$ and $1000$, can we just guess values for $m$ and check if $n \cdot m + 1$ is composite? Alternatively, is there an algebraic way to force the expression to become a perfect square? </spoiler> <spoiler summary="Solution"> There are two highly effective ways to solve this problem: **Approach 1: Brute Force** Since the constraints are extremely small ($n \le 1000$ and we only need $m \le 1000$), the maximum number we will ever check is $1000 \times 1000 + 1 \approx 10^6$. We can simply loop $m$ from 1 to 1000, calculate $val = n \cdot m + 1$, and check if $val$ is prime in $O(\sqrt{val})$ time. The first $m$ that yields a composite number is our answer. **Approach 2: $O(1)$ Math (Forcing a Square)** If we can make $n \cdot m + 1$ equal...
. * **Loops:** Already on the diagonal. Cost = 0 moves. * **Paths:** We can resolve them starting from

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

157.
By singhcoder694, history, 16 months ago, In English
Practice Like It's a Real Contest — CF Battleground (v1.1.0) is Live!!! ### Hey CF Community!! First of all, a big **THANK YOU** to everyone who used the platform, gave feedback, and helped it grow. The overwhelming response from the community inspired me to build a better, more **feature-rich experience**. After many trials, fixes, and feature requests — I’m excited to launch **v1.1.0** of the platform today! #### Improvements from the v1.0.0: - Score calculation issue resolved when creating a room — **no more inconsistencies!** (Credits: [user:thevyomanaut,2025-07-07]) - Dynamic questions every time a new contest is created — **no repeats!** (Credits: [user:uwu12,2025-07-07]) - Improved question selection logic — now fetched using problem names, which fixes the **Div1/Div2 mismatch** issue. (Credits: [user:Eyes_on_me,2025-07-07], [user:apollo07,2025-07-07]) #### What’s New in v1.1.0? - **Real-time Chat** added inside rooms to collaborate and discuss. (Credits: [user:1ota,2025-07-07]) - **Admin controls**: Room creator can now remove ...

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

158.
By MikeMirzayanov, history, 10 years ago, translation, In English
Surprise Language Round #8 The language of the round is **Kotlin**. Kotlin is a statically-typed programming language that runs on the Java Virtual Machine and also can be compiled to JavaScript source code. Its primary development is from a team of JetBrains programmers based in Saint Petersburg, Russia (the name comes from the Kotlin Island, near St. Petersburg). Here is an example of the simplest program on Kotlin to print sum of two numbers: ~~~~~ fun main(args: Array<String>) { val (x, y) = readLine()!!.split(' ').map(String::toInt) println(x + y) } ~~~~~ Here are some links to help you with Kotlin: * [https://en.wikipedia.org/wiki/Kotlin_(programming_language)](https://goo.gl/gYZ5xD) * https://kotlinlang.org/docs/reference/ * http://try.kotlinlang.org/ &mdash; be careful: reading from the console in the web-IDE is not allowed * and Google! You can download standalone compiler (version 1.0.1) by the link http://s.codeforces.com/files/kotlin-compiler-1.0.1.zip Also you need JR...

Full text and comments »

  • Vote: I like it
  • +82
  • Vote: I do not like it

159.
By vishudon, history, 5 years ago, In English
Really need help in understanding why my approach is wrong. Please help me. Hi there, I hope you all are doing very good. I'm trying to solve rated 1600 problems, and recently got this interactive problem: [Problem Link](https://codeforces.me/problemset/problem/1407/C) For solving this problem, I followed this below approach: **Step1:** I decided to ask these **(n-1)** queries: **? index n** (for all **index** in **[1, n-1]**). **Step2:** Then, I created an empty array **remArray** of size **n** for storing all the **(n-1)** remainder values provided by the judge of each query asked by the user. Obviously, judge will return values between **[0, p[n]-1]** in each query. **Step3:** Now, once I took all the **(n-1)** remainder values, I stopped asking for remainder values input. I started my implementation following the below procedure: a) Calculating maximum value in the remainder array so that I could identify which value needs to be present at **nth** index in the final result. I think that value must be p...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

160.
By linkyless, history, 2 years ago, In English
The Explanation Dilemma Hello Codeforces! Lately, I’ve become deeply immersed in the world of competitive programming. For me, at least, this has meant a commitment to studying every aspect of it in depth, with the goal of “learning it the right way.” Like many others, I began with the basics—identifying which problems to tackle, figuring out how to practice effectively, and learning how to keep my motivation up during the inevitable struggles. I grappled with questions like whether or not to read editorials. But as I delved deeper, I found myself contemplating broader questions: **How do we truly learn?** And perhaps more importantly, **how do we process and retain information** when we’re trying to master something as intricate as competitive programming? Like any curious person, I dove headfirst into this exploration, and I was surprised by the sheer volume of posts on this plataform that touch on this subject. There are masters who have ventured into the psychological depths, crafting entire article...
intuition, things like this happened. This only strengthened my resolve to explore these issues further.

Full text and comments »

  • Vote: I like it
  • +60
  • Vote: I do not like it

161.
By generic_placeholder_name, history, 8 years ago, In English
Compilation error on Codeforces while my PC compiles the code just fine I am trying to submit a code on Codeforces, but I always get compilation errors. My computer does just fine. Here is the code: ~~~~~ var s, tmp: ansistring; i, j, c: integer; function elim(var s: ansistring): ansistring; var i: integer; begin elim:=''; for i:=1 to length(s) do begin if s[i]='(' then elim:=elim+s[i] else if elim[length(elim)]='(' then delete(elim, length(elim), 1); end; end; begin readln(s); tmp:=elim(s); c:=0; if (tmp<>'((') and (tmp<>'))') then writeln(0) else if tmp='((' then begin i:=0; s:=s+'0'; while (s[i+1]='(') and (s[i+2]=')') do i:=i+2; for j:=i+2 to length(s) do if s[j]='(' then c:=c+1; writeln(c); end else begin i:=length(s)+1; s:='0'+s; while (s[i-2]='(') and (s[i-1]=')') do i:=i-2; for j:=i-2 downto 1 do if s[j]=')' then c:=c+1; writeln(c); end; end. ~~~~~ ...
It seems that Codeforces' FPC does not allow adding char and string. How do I resolve this?

Full text and comments »

162.
By dyukha, history, 3 years ago, In English
Issues with Polygon and Codeforces I'm using polygon to create problems for my private mash-up contest. Everything was fine yesterday. Today, I have the following problems: - In polygon, when trying to access the problem (Continue button), I'm getting message "Can't open problem [my problem]. It is possible that conflicts were found. Try "Resolve conflicts" option", and the "Resolve conflicts" button opens a blank screen. I'm using only one account for the problem, so there must be no conflicts. - In codeforces, I'm getting "Denial of judgement" verdict with message: "Can't compile file: Unable to find classes \\[my file].class", where [my file] corresponds to my main correct solution. The last change in polygon was 28 hours ago, and everything worked fine after that. Today, I wasn't able to open my problem in polygon. A few minutes ago, after I edited my mash up contest to set "Is practice allowed?" to "true", Denial of judgement started (I'm not sure the time is exactly the same, but I didn't do anything els...
found. Try "Resolve conflicts" option", and the "Resolve conflicts" button opens a blank screen. I'm, problem [my problem]. It is possible that conflicts were found. Try "Resolve conflicts" option", and

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

163.
By chokudai, history, 5 years ago, In English
Denso Create Programming Contest 2022(AtCoder Beginner Contest 239) Announcement We will hold Denso Create Programming Contest 2022(AtCoder Beginner Contest 239). - Contest URL: https://atcoder.jp/contests/abc239 - Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20220212T2100&p1=248 - Duration: 100 minutes - Number of Tasks: 8 - Writer:kyopro_friends,[user:Nyaan,2022-02-12] - Tester:[user:math957963,2022-02-12],[user:sugarrr,2022-02-12] - Rated range: ~ 1999 - The point values will be 100-200-300-400-500-500-600-600. We are looking forward to your participation! UPD: Due to the high volume of access to the server, we are currently unable to start the contest. We will postpone the contest start time to 22:00. Sorry for the inconvenience. UPD. This contest is now **Unrated** because we are unable to resolve the problem. We apologize for the inconvenience. UPD: This contest has been **cancelled.** We apologize for the inconvenience.
inconvenience. UPD. This contest is now **Unrated** because we are unable to resolve the problem, This contest is now **Unrated** because we are unable to resolve the problem. We apologize for the

Full text and comments »

  • Vote: I like it
  • +108
  • Vote: I do not like it

164.
By Nickolas, 13 years ago, translation, In English
Friday the 13th, Programmers' Day This time the language is **Ada**, chosen not for being particularly crazy (it's too Pascal-like to my taste) but for its name. Indeed, a language named for Ada Lovelace seems to be a perfect fit for programmers' professional holiday. I tried to balance the lack of language weirdness by problems somewhat less trivial than usual. Here is the traditional solution for "A+B" problem (integers A and B can be given in one line): ~~~ with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure AplusB is A, B: Integer; begin Get(Item => A); Get(Item => B); Put(Item => A + B, Width => 1); end AplusB; ~~~ The testing system uses gnat 4.7.2. To test your programs before submitting, you can: * use “Custom test” tab in the contest interface. * use ideone, language Ada (gnat-4.6). Remember that by default programs submitted by anonymous are shown in “recent codes”; to avoid this I recommend registering and using "private" privacy option or at least us...

Full text and comments »

  • Vote: I like it
  • +230
  • Vote: I do not like it

165.
By yevhenii_kanivets, history, 7 years ago, In English
Codeforces WatchR 1.4.7: Database migration + hotfix Last **2 weeks** we were busy migrating our database management from [Room](https://medium.com/r/?url=https%3A%2F%2Fdeveloper.android.com%2Ftraining%2Fdata-storage%2Froom) to [SQLDelight](https://github.com/cashapp/sqldelight). It's the first step of the migration to **Kotlin Multiplatform**, which will allow us to deliver more consistent features on iOS / Android and deliver them faster. ![ ](/predownloaded/d6/83/d68341b0ce35ff402a3e2624a3a8a25a16ba5296.png) Version `1.4.6` has been published today's morning, but it contained a **tricky bug** related to wrong column names. Unfortunately, **preliminary testing** didn't revealed it, so we've seen it only when started to see some new crashes coming into Firebase Crashlytics. Version `1.4.7` with a hotfix has been published just a few minutes ago. Everything should now **work smoothy** for all users who experienced crashes after updating to `1.4.6` and for all users who will update to `1.4.7` directly. In contrast, all first-...
As usually thanks [user:BOGDAN_,2020-03-17] for development efforts and helping to quicklyresolve

Full text and comments »

  • Vote: I like it
  • +14
  • Vote: I do not like it

166.
By RodionGork, 15 years ago, In Russian
Наше главное оружие <p><i>Пожилой чекист спрашивает молодого &quot;Знаешь, какое наше самое главное оружие, на букву Н&quot; - хм... Наган? нет... может, Наручники? тоже нет... а что же? - Балда ты, наше главное оружие есть Нтеллект!<br /><br /></i>Заранее извиняюсь - этот маленький пост о вещах (системах контроля версий и багтрекерах) которые для кого-то (достаточно многих, обычно, уже вступивших на поприще профессиональной деятельности) банальны. В этом случае лучше его не читать. Ну а если кто поймёт что для него это в диковинку - рекомендую не полениться и изучить вопрос подробнее. (Впрочем, если вы используете их на работе, а дома нет - то возможно надо задуматься, почему это так и правильно ли это?)<br /></p><p>Итак, здесь частенько всплывают вопросы типа &quot;<a href="http://codeforces.me/blog/entry/124">какую IDE вы рекомендуете/используете</a>&quot; и немного реже вопросы по поводу &quot;какую ОС&quot;. Однако компьютер, ОС и компилятор любимого языка это лишь необходимый минимум того, что нужно...
так, сохранил в репозитории в ревизии 237". После чего тикет "закрываю" ( resolve

Full text and comments »

  • Vote: I like it
  • +65
  • Vote: I do not like it

167.
By LieutenantLolicon, history, 7 years ago, In English
Pell's equation I first encountered Pell's equation when I was in 10th grade so I thought it was quite common. But alas, I cannot find a blog on Codeforces that talks about it, which makes me quite sad. So here, I will talk about it for a bit. First, let me introduce the equation, since it would be hard to talk about it otherwise. It is the diophantine equation $$x^2 - n y^2 = 1$$ where $n$ is a positive integer. Usually, we are given a positive integer $n$ and then we would be asked to find the smallest positive integer $x$ such that there exists a positive integer $y$ that satisfies the equation (or vice versa, but it doesn't matter). Usually, this minimal solution is called the fundamental solution. It is easy to see that no fundamental solution exists whenever $n$ is a perfect square. However, it is not as easy to see that there is always a solution whenever $n$ is not a perfect square. This is true, but I will omit the proof since I haven't bothered myself to learn it. After learning this...
Since you can't travel all the way to Erdos' grave just to spit on it, you insteadresolve to solve

Full text and comments »

  • Vote: I like it
  • +81
  • Vote: I do not like it

168.
By ssvb, 5 years ago, In English
Codeforces for partially colorblind people It's [been](https://codeforces.me/blog/entry/20669?#comment-253995) [known](https://codeforces.me/blog/entry/20638?#comment-253825) since a very long time ago that [partially colorblind](https://en.wikipedia.org/wiki/Color_blindness) people find it challenging to distinguish colors of <b><font color="#03a89e">cyan</font></b> and <b><font color="gray">gray</font></b> user handles on the Codeforces website. This shade of cyan just happens to look somewhat pale and very muddy, which makes it only slightly different from gray. Looking at these colors and trying to see the difference feels uncomfortable and exhausting (this kind of experience is similar to trying to read a blurry text). At least for me, cyan needs to be a lot more intensive in order to be reliably registered as cyan. As suggested in an [old comment](https://codeforces.me/blog/entry/20638?#comment-253836), a somewhat usable workaround is to add `.user-cyan { color:#08e8de!important; }` line to the <b>userContent.css</b...
workaround fully resolve the cyan/gray problem for everyone? Does anyone have any difficulties

Full text and comments »

  • Vote: I like it
  • +174
  • Vote: I do not like it

169.
By pi37, history, 11 years ago, In English
Codeforces Round #334 Editorial Problem 0: Richard has been infected with bovine spongiform encephalopathy. Help Kevin understand what he's saying! [Div 2 A](http://codeforces.me/contest/604/problem/A) ------------------------------------------------------ **Hint:** Just do it! But if you're having trouble, try doing your computations using only integers. This problem is straightforward implementation---just code what's described in the problem statement. However, floating point error is one place where you can trip up. Avoid it by rounding (adding $0.5$ before casting to int), or by doing all calculations with integers. The latter is possible since $250$ always divides the maximum point value of a problem. Thus when we rewrite our formula for score as $\max\left(3\cdot x/10, \left(250-m\right)\cdot x/250\right)$, it is easy to check that we only have integers as intermediate values. **Code:** http://codeforces.me/contest/604/submission/14608458 [Div 2 B](http://codeforces.me/contest/604/problem/B...

Full text and comments »

  • Vote: I like it
  • +89
  • Vote: I do not like it

170.
By yevhenii_kanivets, history, 6 years ago, In English
Codeforces Watcher 1.8.0 (Bradbury): Posts with latest comments Another milestone has been finished, and we are happy to share it with you \o/ Download updated apps from [Google Play](https://play.google.com/store/apps/details?id=com.bogdan.codeforceswatcher) and [App Store](https://apps.apple.com/us/app/codeforces-watchr-contests/id1495591299). ![ ](/predownloaded/d0/65/d065d10157e293694278fae77d97275669e23de3.png) Dedication ------------------ First of all, this milestone is dedicated to the great author Ray **B**radbury. Most of you read his book "Fahrenheit 451" in the school, but he has actually created much more [interesting stuff](https://en.wikipedia.org/wiki/Ray_Bradbury_bibliography). It's important to remember that technologies aren't the absolute good, and you need to educate yourself in many areas (read books, for example) to become a good person ;) The Feature ------------------ There is just one, but huge update in **Bradbury**. From now you will be able to see the posts with latest comments in News tab. Posts are us...

Full text and comments »

  • Vote: I like it
  • +50
  • Vote: I do not like it

171.
By JetBrains, 7 years ago, In English
Kotlin Heroes: Episode 3 <img src="/predownloaded/d3/f6/d3f67b5afe94939d82d9358aeb7a0edcf6a8d33f.png" style="width:300px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the first and second Kotlin Heroes competitions which was held previously. Congratulations to the top 3 winners: **Episode 1** 1. [user:Petr,2020-02-26] 1. [user:ecnerwala,2020-02-26] 1. [user:eatmore,2020-02-26] **Episode 2** 1. [user:tourist,2020-02-26] 1. [user:eatmore,2020-02-26] 1. [user:Benq,2020-02-26] Ready to challenge yourself to do better? The third "Kotlin Heroes" competition will be hosted on the Codeforces platform on [contest_time:1297]. The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard ones, to make it interesting for seasoned competitive programmers. **Top three winners will get prizes of $512...

Full text and comments »

Announcement of Kotlin Heroes: Episode 3
  • Vote: I like it
  • +181
  • Vote: I do not like it

172.
By Nickolas, 12 years ago, translation, In English
Surprise Language Round #7 The contest is over. 13 people solved all problems &mdash; you guys are amazing! The editorial will be available [here](/blog/entry/13777). ------------ Today's language is FALSE, stack-based esoteric programming language invented over 20 years ago. The traditional A+B problem (integers A and B are separated with a space) can be solved [like this](http://rosettacode.org/wiki/A%2BB#FALSE). To test your solutions, you can: * download source code in C of the original interpreter [here](http://assets.codeforces.com/rounds/470/false_int.c). Testing system uses this interpreter with -q option. * use ["Custom Invocation"](/contest/470/customtest). * use online interpreters (they differ from the reference interpreter a bit but make debugging much easier): [1](http://morphett.info/false/false.html), [2](http://www.quirkster.com/iano/js/false-js.html). Useful links: * [language description by its author Wouter van Oortmerssen](http://strlen.com/false/false.txt) * [Pro...

Full text and comments »

Announcement of Surprise Language Round 7
  • Vote: I like it
  • +153
  • Vote: I do not like it

173.
By porcif, history, 2 years ago, In English
000 — CSEC CPD KICKOFF Contest — (DIV 1) — Editorial [here](https://codeforces.me/contestInvitation/20d27b98a275636e2ceac807ccc79bfaefd490c2) is the contest link if u want to practice! ### [A. Garland](https://codeforces.me/gym/558367/problem/A) <spoiler summary = "Understand the Problem"> The problem asks us to turn on all four colored light bulbs in a garland, with the restriction that a bulb can only be switched if its color differs from the one switched previously. The goal is to find the minimum number of operations needed to turn all bulbs on, or determine if it’s impossible. </spoiler> <spoiler summary="Tutorial "> If u observe there are only Five possible configurations of the bulbs: 1. **AAAA**: All bulbs are of the same color. This makes it impossible to turn on all bulbs, as you cannot alternate between different colors. **Answer**: `-1`. 2. **AAAB**: Three bulbs are of the same color, and one bulb is different. In this case, it's impossible to turn all bulbs on in just 4 moves because at least on...
resolve all mysteries encountered so far. Each day, Ivan continues reading until he reaches this

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

174.
By pkhaustov, history, 2 years ago, In English
[Bug report] Can't submit solution On every submission I get `Ooops! Something has broken down in Codeforces` page. [Example problem](https://codeforces.me/contest/2000/problem/H) that I've tried. Even if I submit solutions to problems that I've already solved before. I've tried multiple browsers: Brave, Chromium, Firefox. At the same time I see some other people having their problems judged. cc: [user:MikeMirzayanov,2024-08-15] **P.S.** I couldn't find bug report option, so had to write a blog for that. **UPD:** The issue is resolved shortly after posting this blog.

Full text and comments »

  • Vote: I like it
  • -9
  • Vote: I do not like it

175.
By vamaddur, history, 9 years ago, In English
USACO 2012 Gold December Contest: "Running Away From the Barn" Solution Almost Identical to the Judge's Fails Problem: http://www.usaco.org/index.php?page=viewproblem2&cpid=213 My code below is my attempt to solve this problem, which keeps failing cases 7 through 9. I do not see a significant difference between my logic and the logic of the judge solution (the last one in the editorial here [Your text to link here...](http://www.usaco.org/current/data/sol_runaway.html)). Can someone explain why my solution keeps producing a WA? I even resorted to changing my code to 0 based indexing after 3 hours of trying to perfectly match the judge solution, with no change in output. I sincerely apologize for posting a wall of code, but I have not found another way to resolve the issue after privately asking other users to look over it for me. ~~~~~ #include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <vector> using namespace std; int id = 1; struct Node{ Node *parent; vector<Node*> children; long long depth; int last, label; N...
output. I sincerely apologize for posting a wall of code, but I have not found another way toresolve the

Full text and comments »

  • Vote: I like it
  • -20
  • Vote: I do not like it

176.
By shef_2318, history, 11 years ago, In English
Let's have some fun — November Easy'15 on HackerEarth Hello Codeforces! [November Easy](https://www.hackerearth.com/november-easy-15/) is taking place on November the 1-st at [19:00 MSK](http://www.timeanddate.com/worldclock/fixedtime.html?msg=November%20Easy%20%2715&iso=2015-11-01T10:00:00&p1=64). Contest duration is 3 hours. The contest will consist of 6 problems. Each problem is worth 100 points. Most of them have partial scoring. Ties are resolved by penalty time. I've decided to experiment a bit, so the format of the contest will slightly **differ** from the previous ones. There will be: - **4** usual algorithm problems of various difficulty. In my opinion they might be interesting for complete beginners as well as for enough experienced participants. - **2** problems that differ from usual ACM / IOI tasks. I'd like to thank all the guys who worked on it with me: admins [user:belowthebelt,2015-10-30], [user:chandan111,2015-10-30], tester [user:kmcode,2015-10-30] and editorialist [user:pkacprzak,2015-10-30]. Yo...

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

177.
By Nickolas, 15 years ago, translation, In English
VK Cup 2012 Wild-card Round 1 The contest is over. My sincere respect to the winner in overall run [user:nab,2012-03-18] who solved all 10 problems in 1h 25m, and congratulations to the winner in the official contest [user:winger,2012-03-18] who repeated this heroic deed in 1h 52m. [Here](http://codeforces.me/blog/entry/4139) is the editorial. ----- The language of this round is Factor --- a stack-based functional language with a sophisticated system of built-in libraries (dictionaries). [cut] Sample programs: #### A + B (A and B are given in different lines): ~~~~~ USING: io kernel math math.parser ; readln string>number readln string>number + number>string print ~~~~~ #### 42 (given the quantity of numbers, and then the numbers themselves, one per line, output YES if their sum equals 42, and NO otherwise): Version 1 ([user:Nickolas,2012-03-18]) ~~~~~ USING: io kernel math math.parser sequences ; readln string>number iota 0 [ drop readln string>number + ] r...

Full text and comments »

  • Vote: I like it
  • +78
  • Vote: I do not like it

178.
By blackc4, history, 4 years ago, In English
A variant of "Good Subarrays" from Round 825 EDIT: It's resolved; see comments. In hurry, I misread the "Good Subarrays" problems in [contest:1736] resulting in the following problems. The easy version is easier than the original easy, but I don't know if there is an $O(n)$ or $O(n\log n)$ algorithm for the corresponding hard version. I appreciate any hints towards $O(n)$ or $O(n\log n)$ algorithms. #### New good arrays (easy version) You are given an array $a = [a_1, \ldots, a_n]$. A position $i$ is good if $a_i \ge i$; a subarray $[a_{\ell},\ldots,a_r]$ is good if all the positions $\ell, \ell+1, \ldots, r$ are good. Find the number of good subarrays. <spoiler summary="Solution idea"> We can just compute the lengths of contiguous good blocks, say $\ell_1, \ldots, \ell_k$. Then the answer is $\sum_{i=1}^k \ell_i(\ell_i-1)/2$. </spoiler> #### New good arrays (harder version) Now you are, in addition, given $q$ updates to $a$, where $q \le n$. Unlike the original hard version, these updates are adaptive, i.e....

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

179.
By Endagorion, history, 9 years ago, translation, In English
Problem with moj plugin in Topcoder applet Hello! I've been trying to install moj plugin on a topcoder applet in a new environment. The problem is I'm getting `Exception in thread "AWT-EventQueue-2" java.lang.NoSuchMethodError: com.topcoder.client.contestApplet.common.LocalPreferences.removeProperty(Ljava/lang/String;)Ljava/lang/String;...` when trying to save preferences of CodeProcessor, at this point: ![ ](/predownloaded/c0/b1/c0b11f9449cd4d4d6adbd4880430c39d0eb8bd36.png) Pressing the save button doesn't do anything except for raising the exception in the console. Does someone have any information relevant to resolving this issue? Thanks!

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it

180.
By rumike, history, 2 years ago, In English
Predecessor of begin of set lead to accepted, why? I was resolving [problem:1922D], and I found that access to the prev of beginning of set doesn't through wrong answer and can't get why. First as you can see in that sumbmission that give wrong answer [submission:264232760], I put the defense of border element at N = 2e9 + 5, and their attacks at 0 so they can't die neither attack. I took that value because 2*1e9 < N. But in the editorial they took INT_MAX which is 2147483647 and it worked as you see here [submission:264232643]. I could not get why it's working, and after some times, I remark that if for the example the border 0 is in live set, it would be at the beginning of the set, and the code tried to access to predecessor of it, after and got the predecessor, it use that value as array index, which would normally leads to runtime error, but I get it gave a value which can be more than 1e9, it's for that reason N = 2e9 + 5 is not sufficient to prevent border to die. Can someone explain why predecessor of the beginning of...

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it

181.
By Sacchidananda, history, 4 years ago, In English
Understanding the reality of everything What we experience in our entire life is in reality Brahman and this is precisely your true self. Inquiry of your true self(Atma Vichara) = Inquiry of Brahman(Brahma Vichara)= Inquiry of everything in the universe(Sarva Vichara). Inquiry leads to knowledge. So knowledge of your true self = knowledge of Brahman = knowledge of the reality of everything in the universe. Everything in the universe, everything within time and everything which transcends time is indeed Brahman. This very self is Brahman and this self has 4 aspects. The 4 aspects of the self is explained stepwise as follows: Step 1: The existence of anything depends on its knowability. Unless a thing is knowable(at some time: past, present or future) in some way(see,hear,touch,smell or think/read/infer(books,thoughts,science,hypotheses,instruments,etc) about it &mdash; it must reveal itself to our senses in some way) by somebody somewhere, or atleast has a possibility to be known, it is meaningless/purposeless to talk...

Full text and comments »

  • Vote: I like it
  • -30
  • Vote: I do not like it

182.
By JetBrains, 7 years ago, In English
Kotlin Heroes: Episode 2 <img src="/predownloaded/d3/f6/d3f67b5afe94939d82d9358aeb7a0edcf6a8d33f.png" style="width:300px;float:right;margin:0 1em 1em 1em;"/> Hello, Codeforces! First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the first Kotlin Heroes competition which was held back in May. Congratulations to the top 3 winners [user:Petr,2019-08-28], [user:ecnerwala,2019-08-28], and [user:abacabadabacaba,2019-08-28] on their incredible achievement, especially considering they were up against 4,500 other registrants from over 63 countries. We’d also like to give a shout out to tourist for being the only other person, outside of the top 3, to manage to solve every problem set from this round. Well done all of you! Ready to challenge yourself to do better? The second "Kotlin Heroes" competition will be hosted on the Codeforces platform on <a href="https://www.timeanddate.com/worldclock/fixedtime.html?day=7&month=9&year=2019&hour=17&min=35&...

Full text and comments »

Announcement of Kotlin Heroes: Episode 2
  • Vote: I like it
  • +104
  • Vote: I do not like it

183.
By Nickolas, 12 years ago, translation, In English
VK Cup 2015 Wild Card Round 1 This round features Picat, a language somewhat similar to Prolog. We tried to make most of our problems convenient to solve using declarative approach. The traditional A+B program (A and B are space-separated) looks as follows: ~~~ main => A = read_int(), B = read_int(), C = A + B, println(C). ~~~ The main source of information about language is http://picat-lang.org/ The contest uses version 0.9. [cut] If the official site is not available, you can download archive with the compiler [here](http://assets.codeforces.com/files/eaa5e45a2309ed2b.7z), the password is b161bb757645d9f0. Several notes: * "compilation error" verdict means that syntax is not valid. In most cases (for example, if your program calls unknown function), the verdict will be "wrong answer" * variable names must start with an uppercase letter or with underscore * it is recommended to use %n instead of \n in printf * don't use mip module, it writes debug information to stdout --- ...

Full text and comments »

  • Vote: I like it
  • +140
  • Vote: I do not like it

184.
By ScorpioDagger, 3 years ago, In English
Aren't Hack tests added for last Div3 ? Why some hacked solutions on yesterday's div3 can still get the Accept now ? Shouldn't those hack test cases be added for all? Otherwise, it is unfair like why the one hacked only to suffer wrong ans or time limit verdict and his rank go down? Yesterday's D : Hacked [submission:208770029]. However, I resubmitted and got AC [submission:208875517] Yesterday's B : Hacked [submission:208823417] That was my 1st solution to the problem. It fails in case n = 1e9 and k = 30 because of taking MOD when doing the binary exponentiation (It was a typo taking the MOD just copying my template but it still wrong) Another Hacked B [submission:208731078] for K = 63 , it overflows 1LL << K as max for long long is 2^63-1 so adding 1 would overflow However, why they still pass ? And shouldn't those test cases be added for all contestants ? UPD : **Resolved**

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it

185.
By heisenberg_5, history, 3 years ago, In English
Getting Wrong Answer | Help needed I was doing ITMO pilot course segment tree problems. In the problem [LINK TO QUESTION](https://codeforces.me/edu/course/2/lesson/4/2/practice/contest/273278/problem/A), I am getting wrong answer on test number 72. Kindly help me out to resolve the issue. <spoiler summary="Code"> ``` #include <bits/stdc++.h> using namespace std; #define ll long long int class node { public: int maxi, sum, suff, pref; node(ll val) { sum = val; suff = pref = maxi = max(0LL, val); } }; class SEG { public: vector<node> seg; vector<ll> arr; ll n; SEG(ll n, vector<ll>& v) { this->n = n; seg.resize(4 * n + 1, node(0)); arr = v; build(0, 0, n - 1); } node merge(node l, node r) { node ans(0); ans.maxi = max({l.maxi, r.maxi, l.suff + r.pref}); ans.sum = l.sum + r.sum; ans.pref = max(l.pref, l.sum + r.pref); ans.suff = max(r.suff, l.suff + r.sum); return ans; } void build(ll idx, ll lo, ll hi) { if (lo == hi) { ...
test number 72. Kindly help me out to resolve the issue.

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

186.
By lkcbharath, history, 8 years ago, In English
Codeforces data bugged for my profile **Update:** Issue is resolved. Thank you [user:thedarkKnightrisesagain,2018-09-21] for your help. I'm probably not going to make a blog for a while thanks to the 'encouragement' below. ---------------------------------------------------------------------------------------------- I have two issues: <a href="https://ibb.co/fORn4z"><img src="https://preview.ibb.co/cZgbxK/Screenshot_from_2018_09_21_16_44_27.png" alt="Screenshot from 2018 09 21 16 44 27" border="0" /></a> <a href="https://imgbb.com/"><img src="https://image.ibb.co/c2wrge/Screenshot_from_2018_09_21_16_44_27.png" alt="Screenshot_from_2018_09_21_16_44_27" border="0"></a> ^ For those wondering where I got 2003 from... As you can see, my join date is 49 years ago (2003?) !!! That isn't right, because my join date is around 2 months ago, on the 28th of July, 2018. This issue appeared around the time of this post, right after my first contest: [contest:1051]. Is there a fix? Also, I don't appear in the ranking...

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it

187.
By Codeforcer, history, 5 years ago, In English
Need help in pbds (Find by order using pairs) When I try to use find by order using pairs in ordered_set of pbds it shows some error of no matching call as such. So how do I resolve it? ~~~~~ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define all(v) v.begin(),v.end() #define F first #define S second #define pb push_back #define mp make_pair #define pi pair<int,int> #define REP(i,n) for(int i=0;i<n;i++) const int N = 2e5+2; const ll mod = 1e9+7; using namespace __gnu_pbds; typedef tree<pi, null_type, less_equal<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; ordered_set ord_set; int main(){ int a; cin >> a; ord_set.insert({a,-1}); *ord_set.find_by_order(make_pair(a,-1)); //Why does this not work ? ord_set.order_of_...
matching call as such. So how do I resolve it?

Full text and comments »

  • Vote: I like it
  • -25
  • Vote: I do not like it

188.
By Bn00b, history, 5 years ago, In English
[FEATURE REQUEST : ATCODER] TOPICS TAGS AND SORTING BY SOLVE COUNT Hello all, recently I have been trying my hand at atcoder problems which I have heard has many good problems(even for beginners). But the thing is, it is not an ideal site for focused practice(imo, im n00b so..). I have been using kenkoooo for practice and for random solving it's good but if I want to focus on a topic more, I am having to google for the [topic_name]-atcoder it and often problems from latest(not even past 30 contests) are not present. Now you may say to me that you should solve(fft/umnik solve) all Ds and Es as a beginner, yes I agree,but then again that is not a very helpful short term goal to have. So if anyone thinks this request is legitimate please tag the atcoder admins below or upvote this blog, or if not please comment your reason below. If this issue has been brought up before and resolved, please link the blog below, I will delete this. Thanks n00b UPD : Since no one is tagging, I am tagging [user:chokudai,2022-01-08], as I only know of him ...

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

189.
By Nickolas, 14 years ago, translation, In English
Surprise Language Round #6 The contest is over; the editorial is [here](http://codeforces.me/blog/entry/4633). I've mis-estimated the complexity of the problems --- but how could I possibly guess who will arrive and finish everything in 40 minutes :-) Congratulations to the winners --- the slowest and the most relaxed of them took under an hour to solve all the problems. ----- Today's round features Roco --- a little-known esoteric language with a special approach to loops and subroutines. The programs written in it look a bit bulky, especially when compared to Befunge, but this is compensated by their relative simplicity and readability. Here is a program which calculates the sum of two given numbers: ~~~ iin [0] iin [1] add [2] [1] [0] iout [2] ac ~~~ There is little information about this language on the web --- the only two sources known to me are [the author's site](http://lodev.org/esolangs/roco/) and [Progopedia article](http://progopedia.com/language/roco/) with commented sampl...

Full text and comments »

Announcement of Surprise Language Round 6
  • Vote: I like it
  • +79
  • Vote: I do not like it

190.
By Ankitkumar_07, history, 2 months ago, In English
Request to Remove Contest Participation Due to Unauthorized Account Access Dear Codeforces Team, I am the owner of the Codeforces account Ankitkumar_07. I am writing regarding my participation in Codeforces Round 1119 (Div. 3), Contest 2259. proof:-/predownloaded/1f/0c/1f0c91885654b579a7f30b9a04d1d046693ee9ef.png During the contest, my account was accessed without my authorization, and several submissions were made from my account without my knowledge or intention. I noticed this afterward and I am concerned that these submissions may affect my contest rating and contest result. The submissions involved are: 389574368 389573821 389573517 389572574 389572337 389572146 I sincerely request you to please review this situation. If possible, I would be very grateful if my participation/submissions in this contest could be removed from the contest data and the contest could be excluded from my rating. I understand that this may require verification, and I am happy to provide any additional information necessary to confirm the situation. ...

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

191.
By onlyerror, 5 years ago, In English
A tool for saving your time #### Hello, Codeforces community, There are a lot of contests that happen across many websites and so you need to check it every time by opening multiple websites which cost you a lot of time. So I have created a **CLI** through which you can get the details of upcoming contests easily. For example, if you need to know about all the upcoming contests on **Codeforces** you can type `contests --codeforces` or `contests -cf` on your command line ![supporting image](https://i.ibb.co/LdB3VBM/codeforces.png) It is very easy to install and use. You just need the latest version of **Node** and **NPM**. All the commands and installation steps are documented in the `readme.md` file Any feedback regarding this is highly appreciated. Thanks for reading. So here is the [link](https://github.com/srijit2002/programming-contest-cli) ============================================================================ **UPD:** For those who are facing any problem, please...
error message on GitHub.I will try be best to resolve it.Thank you all for your support

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

192.
By RussianCodeCup, 10 years ago, translation, In English
Russian Code Cup 2017 Warmup — Problems (and testing queue length) analysis <p> Hello, everyone and thank you for participation! </p> <p> First of all we would like to say sorry for the length of the testing queue during the first hour. We have selected IOIP problems for the Warmup Round &mdash; there are many common problemsetters for IOIP and RCC &mdash; the round was prepared by Victoria Erokhina ([user:viktoria,2017-03-19]), Dmitry Filippov ([user:DimaPhil,2017-03-19]), Stanislav Naumov ([user:josdas,2017-03-19]), Mikhail Putilin ([user:SpyCheese,2017-03-19]), Grigory Shovkoplyas ([user:GShark,2017-03-19]), Andrew Stankevich ([user:andrewzta,2017-03-19]), Ilya Zban ([user:izban,2017-03-19]). We wanted to let everyone solve our interesting problems. </p> <p> But one small glitch lead to a big failure. You might have noticed that we usually make multiple tests in one input data for RCC. That is because the most expensive operation is to run user solution. But IOIP has fewer participants, so the easiest problem had 32 tests. It is not too many for a pr...
To resolve the situation when some pair of details have the same model number, calculate the

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

193.
By Xiaohuba, history, 2 years ago, In English
Have I come up with a compiler bug? **UPD**: It is a compiler bug, and is resolved since gcc 12.3. Further information is on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116459. [Apologize for my poor English.] The code at https://godbolt.org/z/PP1TTdhxf outputs 1. However, if you simulate the code, the answer is obviously 20. Further exploration showed that the compiler compiled function qpw, but did not call it. Uncomment line 22 solves the issue, surprisingly. Further more, the bug seems to only occur on gcc12.1 and gcc12.2, with -O2 enabled. I believe the code does not contain any undefined / unspecified behavior.

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

194.
By urnothing21, history, 7 years ago, In English
Google Kick Start Round A 2020 — Need Help Hi Guys, I was trying to solve the plates problem from the last kickstart round. I tried one approach which is not failing i dont know where the mistake is. Please help me resolving this. <h6>Approach : </h6><br> 1. Processing from the last stack of plates. <br> 2. In the last stack the max beauty i can get will be the K plates from that stack, so i'll copy it. At this point, if my P value is 1 to K, it is straightway the no of plates in the stack.<br> 3. Now i'll come to the N-1th stack, now i'll compare with previously processed one and i'll process the different combinations of plates. Ex : If i want one plate, i can either take it from the current stack(N-1) or check the prev calculated and update the current result. This process goes on.<br> 4. Step 3 will be going on till i'm on the 1st stack.<br> 5. When i'm in the first stack i'll have the best beauties of picking up the (N * K) plates.<br> This is the approach i tried and it is failing. Please help me to rectify ...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

195.
By silversapling, history, 5 years ago, In English
Codeforces False Plagiarism Matching for 1619A Hi all, I got a plagiarism match for my solution to problem [1619A](https://codeforces.me/problemset/problem/1619/A) (Round 762, Div.3). Here is my solution: [140025309](https://codeforces.me/contest/1619/submission/140025309) And here is the other guy ([Jaggar_2021](https://codeforces.me/profile/Jaggar_2021))'s code: [140079029](https://codeforces.me/contest/1619/submission/140079029) I don't know the other person and I have never seen his account before. This was our conversation after the false plagiarism detection: ![ ](/predownloaded/3e/c5/3ec56590c7f71ac3b4797cfe7fd098a48ea086e6.png) I agree that the code is somewhat similar, but the problem was very easy (Div.3 A) and my solution simply involved breaking the original string in half (if the length was a multiple of 2) and comparing the two halves. This was the approach that most people would have thought of. Also my code has slight differences, like I have used one more else block and I have used a typedef ...
Kindly resolve the issue.

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

196.
By Nickolas, 11 years ago, translation, In English
VK Cup 2016 Wild Card Round 1 The contest is over; the editorial is available [here](http://codeforces.me/blog/entry/44292). --- The language of this round is [J](http://jsoftware.com/). The traditional A+B program (A and B are written in one line and separated with space) looks as follows: ~~~ print =: 1!:2&2 read =: 1!:1[3 in =. (read-.LF)-.CR print +/ ". in exit '' ~~~ The main source of information about the language is http://code.jsoftware.com/wiki/Main_Page. Version used is J804. [cut] Several notes: * to test your solutions locally, use jsonsole solution.ijs < input.txt. It's also possible to use jsonsole solution.ijs, in this case after entering test press Ctrl+z+Enter. * you can run your code on Codeforces platform, using Custom Test tab. * the language is not compiled, if your code has syntax error, you'll get verdict "Wrong answer on test 1". * note that Codeforces uses Windows-style line endings, #13#10. You can download language from http://www.jsoftware.com/down...

Full text and comments »

  • Vote: I like it
  • +82
  • Vote: I do not like it

197.
By cqbzzjy, history, 2 years ago, In English
(Using Translation,may be inaccurate)On remote commits: cloudflare anti-crawler restrictions Remote commits on the Luogu (China) platform are not crawling due to Codeforces' use of Cloudflare's services, which makes it difficult to commit code and read the problem (language barrier). Why is it necessary to disable the crawler? Is it possible to release some of the Cloudflare restrictions to allow legitimate crawlers? Attachment: Luogu Announcement [Announcement] Codeforces RemoteJudge Service Disruption Announcement Recently, Codeforces has strengthened the Cloudflare defense service, which has prevented luogu crawlers from crawling the submission logs. Again, the stability of the RemoteJudge service is not guaranteed, it is just for the convenience of submitting foreign OJs more smoothly, but due to various reasons, we can't guarantee the stability of this service. For more details, please refer to: https://help.luogu.com.cn/manual/luogu/problem/remote-judge The submission process is now working, but the speed of submission is unsatisfactory and often t...

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

198.
By pathetique, history, 2 years ago, In English
COderfocers Codeforces | In English По-русски pathetique | Logout HOMETOPCATALOGCONTESTSGYMPROBLEMSETGROUPSRATINGEDUAPICALENDARHELP → Pay attention Before contest Codeforces Global Round 26 3 days Register now » *has extra registration → pathetique pathetique User''s contest rating in Codeforces communityRating: 1448 User''s contribution into Codeforces communityContribution: -77 Settings Blog Favourites Teams Submissions Problemsetting Groups Talks Contests → Top rated # User Rating 1 tourist 3757 2 jiangly 3647 3 Benq 3581 4 orzdevinwang 3570 5 Geothermal 3569 5 cnnfls_csy 3569 7 Radewoosh 3509 8 ecnerwala 3486 9 jqdai0815 3474 10 gyh20 3447 Countries | Cities | Organizations View all → → Top contributors # User Contrib. 1 maomao90 171 2 awoo 164 3 adamant 163 4 TheScrasse 159 5 maroonrk 155 6 nor 154 7 -is-this-fft- 152 8 Petr 147 9 orz 145 10 pajenegod 144 View all → → Favourite groups # Name 1 X-Camp 402H 2022 Fall View all → → Fi...

Full text and comments »

  • Vote: I like it
  • -36
  • Vote: I do not like it

199.
By Sumanto, 5 years ago, In English
Constraints Blocker Chrome Extension for Online Judges Hi Everyone, I built a chrome extension that will hide the constraints of the problem shown in coding platforms as constraints reveal major hints to solve the given problem. This helps to simulate real interview experience practice as in an interview you won't be revealed the constraints. The constraints give major hints of how to solve the problem. For example, if n<=20 then it's obvious the problem will be solved using some brute-force approach. I will later add more features like support for other online judges hide difficulty, test cases etc. Just let me know how is this extension working or are there any bugs. **Note:** As this is an open-source project, you can help add new features and resolve bugs. Link: https://chrome.google.com/webstore/detail/constraints-blocker/poadlijigkkehhbfnmdabgecngbmoaho Code: https://github.com/sumantopal07/Constraints-Blocker-Chrome-Extension Supported Platforms: - [Leetcode](https://www.leetcode.com) - [Binaryse...
open-source project, you can help add new features and resolve bugs.

Full text and comments »

  • Vote: I like it
  • +29
  • Vote: I do not like it

200.
By Noobish_Monk, history, 13 months ago, In English
[RESOLVED] with poorly written editorial for problem G of Global Round 29 Hi everyone! I need some help with the problem [problem:2147G]. In the editorial there is this identity $\sum_{x|\varphi(m), rad(x) | k} cnt(x) = \sum_{d_1| q_1^{\beta_1}, \ldots , d_t | q_t^{\beta_t}} \prod \varphi(d_i)$ Where $k$ is a square-free number with $gcd(k, m) = 1$ and $k | \varphi(m)$. $cnt(x)$ is the number of remainders $1 \le a < m$ for which $ord_m(a) = x$. $k = q_1 q_2 \ldots q_t$ and $\beta_i$ is the exponent of $q_i$ in $\varphi(m)$ It is some counting in 2 ways, as far as I understand. I tried to prove this for several days, now I am desperate to know the proof since the editorial mentions this as something obvious and the author of the problem doens't respond.

Full text and comments »

  • Vote: I like it
  • +42
  • Vote: I do not like it

201.
By vishudon, history, 5 years ago, In English
Map Solution is working fine, but unordered_map solution is giving wrong answer. Please help me. Hi there, I hope you all are doing well. I recently solved this problem: [Problem Link](https://codeforces.me/contest/1598/problem/C) But while solving this problem, I faced a weird issue. Although, I am able to solve this problem using Map STL in C++, but same solution with unordered_map is not getting accepted. Not understanding why is this happening. I thought to notice the time difference in execution after switching from map to unordered_map. But faced weird WA verdict. My unordered_map solution is giving WA verdict on test case 2 (on test input 3rd), But it is working fine on both my C++ editor and on online editors too on the same test case. **This is STRANGE for me**. Solution 1 (using map STL): https://codeforces.me/contest/1598/submission/155784539 (Accepted) Solution 2 (using unordered_map STL): https://codeforces.me/contest/1598/submission/155784670 (WA verdict) **Note: Solution2 is completely same as Solution1 except I changed map STL to unordered...

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

202.
By AARYABHATTA_THE_GREAT, history, 2 years ago, In English
Help with a 2-SAT problem please?(Resolved) Problem Link -> https://codeforces.me/contest/776/problem/D My submission -> https://codeforces.me/contest/776/submission/285238557 Its pretty obvious from my code what i am trying to do. My Question is that is the logic correct? Where am I going wrong? I just take cases of whether the door is locked or not and accordingly I build the adj list for the corresponding switch combinations. *Edit -> Resolved now.

Full text and comments »

203.
By gud_day, history, 7 years ago, In English
Iterative GCD function to find GCD coefficients Hi! I was hoping someone could help me understand how this bit of code works written by [saeed_odak](https://codeforces.me/profile/saeed_odak) in this submission to 1117E : [code](https://codeforces.me/contest/1117/submission/50126643): - `int mul_inv(int a, int b) { //Returns multiplicative inverse of a wrt b` - ` int b0 = b, t, q;` - ` int x0 = 0, x1 = 1;` - ` if (b == 1) return 1;` - ` while (a > 1) {` - ` q = a / b;` - ` t = b, b = a % b, a = t;` - ` t = x0, x0 = x1 - q * x0, x1 = t;` - ` }` - ` if (x1 < 0) x1 += b0;` - ` return x1;` - `}` `` - I think understanding how to write an iterative GCD function that develops GCD coeffecients would be helpful to understand this piece of code, but I can't seem to come up with a way to do so and online searches only provide code and not good explanations. Any help would be appreciated. Thank you! EDIT: Resolved. Looks like there were actually sources that explained that algorithm well that I missed. The wik...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

204.
By xiaowuc1, 8 years ago, In English
USACO 2018-2019 Third Contest Hi all, The [third contest](http://usaco.org/) of the 2018-2019 USACO season will be running from February 22nd through February 25th, and will be the final regular contest before the US Open. Good luck to everyone! Please wait until the contest is over for everyone before discussing problems here. Edit 1: The contest will open soon! If you see any issues with any of the problems, please follow the instructions [here](http://usaco.org/index.php?page=instructions) letting the contest director know what issues you have. Please do not complain about them on this blog post &mdash; that may spoil the problems for other contestants and it will not result in your issues being resolved. Good luck to all contestants! Edit 2: The contest will end in under 24 hours! As a reminder, since all contestants get a full four hour contest window irrespective of when they start, please hold off discussion of the contest until everyone has finished the contest (4 AM UTC-12).

Full text and comments »

  • Vote: I like it
  • +72
  • Vote: I do not like it

205.
By AARYABHATTA_THE_GREAT, history, 2 years ago, In English
2 similar approach getting different result? *Edit -> Resolved This is the question. https://codeforces.me/contest/1974/problem/E AC submission -> https://codeforces.me/contest/1974/submission/287177874 WA submission -> https://codeforces.me/contest/1974/submission/287176403 In both my submissions, i have the exact same approach, only diff being in 1 case i use the current dp state to update the next dp states(in the WA submission) and in the AC submission i use previous dp states to update current dp states. Where am i going wrong? *Edit -> Resolved

Full text and comments »

206.
By wrusb, 4 months ago, In English
Will I (wrusb) reach Expert on Codeforces before the start of August 1st 2026? [Link to Manifold Market 1](https://manifold.markets/LeNamPhong/will-i-wrusb-reach-expert-on-codefo) [Link to Manifold Market 2](https://manifold.markets/LeNamPhong/will-i-be-an-pupil-on-cf-before-aug). Will I finally reach Expert, or am I doomed to stay cyan forever? I made a prediction market about it. Feel free to check it out, and if you'd like, you can make a prediction with virtual mana (fake money). Sorry the previous one was resolved wrongly and I can't find the undo resolve button. Edit: The market has now been unresolved, so everyone can make predictions again! 2nd edit: I sincerely apologize for the inconvenience. I've been overwhelmed with work this month, and I'm afraid I won't be able to meet the current deadline. Would it be possible to extend the time limit to September 1, 2026? I completely understand if that's not possible, and I really appreciate your understanding.
money). Sorry the previous one was resolved wrongly and I can't find the undo resolve button.

Full text and comments »

  • Vote: I like it
  • -27
  • Vote: I do not like it

207.
By -Penguin, history, 20 months ago, In English
Codeforces Account Got Temporarily Blocked for No Reason Help! My Friend's Codeforces Account Got Temporarily Blocked for No Reason Hey everyone, He just ran into a frustrating issue, and I’m hoping someone here can help or provide insights. Today, when He tried to log into Codeforces and got the message: <img src="https://i.imgur.com/TNXin7M.png" width="150" style="vertical-align: middle; margin-left: 10px;"> The problem is, He has never broken any rules. He doesn’t participate in live contests, He doesn’t use AI tools, and He only uses Codeforces to solve problems and improve skills. He is a quiet and honest competitive programmer who respects the platform. This block has completely disrupted His training schedule, and if it isn’t resolved soon, He will lose His 75-day solving streak, which He has been working hard to maintain. Also, before anyone speculates about his handle ( [user:AbdelrahmanGPT,2025-03-22] )—it has nothing to do with AI-related cheating. It’s simply part of his personal branding and has never been...

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

208.
By ATSTNG, history, 3 years ago, In English
Polygon fails to commit any changes or build packages Polygon automaticly updates test meta files and produces strange difference, as JSON these files are the same but `inputSha1` is moved to suffix. ~~~~~ MODIFIED testsets/tests/1.meta MODIFIED testsets/tests/11.meta MODIFIED testsets/tests/2.meta MODIFIED testsets/tests/3.meta MODIFIED testsets/tests/5.meta MODIFIED testsets/tests/6.meta MODIFIED testsets/tests/7.meta MODIFIED testsets/tests/8.meta MODIFIED testsets/tests/9.meta ~~~~~ ![ ](/predownloaded/82/ca/82ca5151a6d1e871cff1066d88d1d09fc2e71ed1.png) This difference appears after any action and it prevents from commiting any changes and from building any packages. Building packages asks to commit uncommited changes before building. Commiting changes says `Your changes have not been committed. Try to find and resolve conflicts` Is there any workaround? [user:MikeMirzayanov,2024-02-16]
changes says `Your changes have not been committed. Try to find and resolve conflicts`

Full text and comments »

  • Vote: I like it
  • +20
  • Vote: I do not like it

209.
By DrunkMaster, history, 6 years ago, translation, In English
Resolve conflicts on polygon! Today I tried to create new task on polygon. When I wanted to create statements, I saw task failed. It offered to Resolve conflicts, which didn't help. In addition, my old tasks don't work( Help me please to fix it! UPD: Problem is solved! Thank you all for helping!)
Resolve conflicts on polygon!, Resolve conflicts на полигоне, прикол, когда пытаюсь создать условие: задача падает и предлагает Resolve conflicts, который, . It offered to Resolve conflicts, which didn't help. In addition, my old tasks don't work( Help me

Full text and comments »

  • Vote: I like it
  • +43
  • Vote: I do not like it

210.
By code_coffee, history, 22 months ago, In English
Regarding the accusation of plagiarism on my solution of the problem 2034C. Dear community, Recently, I received a message from Codeforces that my submission &mdash; [submission:298267063] to the problem [problem:2043C] in the contest [contest:2043] has significantly coincided with the submissions &mdash; [submission:298228434] by [user:lexapex5,2025-01-10] as well as [submission:298237538] by [user:aryak05,2025-01-10]. While I can see the similarities in the solution, I still came up with it on my own. The implementation of the solution is similar because I have used widely known and used methods, as have lexapex5 and aryak05. The similarities are purely coincidental. I have used the following techniques in my solution: 1. used linear search to find out the element not either 1 or -1 2. broke the problem down in two cases &mdash; one where the element other than 1 and -1 doesn't exist and solved it separately and then the case in which that element was present 3. used kadane's to find minimum and maximum sum of arrays containing only 1 and -1 4....
matter and resolve the problem.

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

211.
By SuperJ6, 4 years ago, In English
How to Effectively Practice CP + Problem Solving Guide This is a slight tweak of [a practice guide](https://www.reddit.com/r/usaco/comments/pk3tjp/the_ultimate_usaco_practice_method/) I wrote a while ago on USACO reddit since I thought it could be helpful to people here. Some USACO specific sections or extra clutter I left out here that aren't needed for a general audience. This should cover all general cp advice I have so I never have to retype. #Introduction This is a post on how I believe is the best method to practice modern day competitive programming based on my experiences. I assume you already have some knowledge and know simple things like binary search and dfs/bfs, but **read the footnote if you are complete beginner** (never code, solved <50 problems, div2 A/B too difficult, grey or stuck low pupil). First, a quick tl;dr of the practice strategy before a bunch of specifics and explanation: >**In short, mostly you only need to use codeforces (no matter what contest you're training for), find a rating range where you c...

Full text and comments »

  • Vote: I like it
  • +306
  • Vote: I do not like it

212.
By A_Bored_Dog, 2 years ago, In English
Python vs. C++: Runtime Errors in Tree and DFS Problems (solved) Hello Codeforces community, I've been focusing on solving problems related to trees and depth-first search (DFS) recently. However, I've encountered a recurring issue when submitting my solutions. Specifically, my Python solutions often result in runtime errors on certain test cases, while the equivalent C++ code works perfectly. For instance, consider the following submissions: Problem 1: [C++ code](https://codeforces.me/contest/1714/submission/265840995) [Python code](http://codeforces.me/contest/1714/submission/265840369) Problem 2: [C++ code](https://codeforces.me/contest/1592/submission/265748499) [Python code](https://codeforces.me/contest/1592/submission/265748056) In both cases, the Python code shows runtime errors on random test cases (such as 3 or 9), while the C++ code does not. Has anyone else experienced similar issues? If so, what strategies or modifications did you employ to resolve them? Any insights or suggestions would be greatly appreciated....
to resolve them? Any insights or suggestions would be greatly appreciated.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

213.
By SharvanCN1, history, 2 years ago, In English
False detection of Cheating.Codeforces Round 961 (Div. 2) I got this message from system:- Attention! Your solution 272114945 for the problem 1995B1 significantly coincides with solutions ayushi_agra12321/272095764, SharvanCN1/272114945. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.me/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked. I have generated the code using chatGPT, which I am sure is perfectly fine. Here is the link to my conversation with ChatGPT:- https://chatgpt.com/share/21a15704-0cda-45cb-a5ed-fbae157e94c0 All th...
How do I resolve this?

Full text and comments »

  • Vote: I like it
  • -36
  • Vote: I do not like it

214.
By Stigius, 14 years ago, translation, In English
acm.timus.ru and BigInteger.isProbablePrime As many of you know, call to BigInteger.isProbablePrime in java solutions at accm.timus.ru lead to "Restricted Function" verdict. Today I decided to resolve this problem. When I started reading BigInteger.java, I found that "isProbablePrime" method calls "primeToCertainty" method and passes null as "random" parameter. This null is passed to "passesMillerRabin", which has the following code: ~~~~~ if (rnd == null) { rnd = getSecureRandom(); } ~~~~~ Since "rnd" is actually null, getSecureRandom is called. It has following logic: ~~~~~ private static volatile Random staticRandom; private static Random getSecureRandom() { if (staticRandom == null) { staticRandom = new java.security.SecureRandom(); } return staticRandom; } ~~~~~ That is when called for the first time, it initializes staticRandom with java.security.SecureRandom, in all the following calls --- returns cached object. Call to java.security.SecureRandom is the source of all problems...
"Restricted Function" verdict. Today I decided to resolve this problem. When I started reading

Full text and comments »

  • Vote: I like it
  • +50
  • Vote: I do not like it

215.
By 3bdelbary, history, 11 days ago, In English
Our chapter built a training platform where Codeforces is the judge (open source) Every ICPC chapter has the same training infrastructure: a spreadsheet of problems, a group chat for announcements, an attendance list nobody can read a month later, and a coach who cannot tell you who actually finished sheet 4. That is where we started at the ICPC community of the Arab Academy for Science, Technology and Maritime Transport, Aswan branch (Egypt). We got tired of it, so we built a platform for the training side of a competitive-programming community &mdash; and just put it online under the MIT license. Live: [icpc-aast-aswan-community.vercel.app](https://icpc-aast-aswan-community.vercel.app) Source: [MO22BARY/ICPC-AAST-Aswan-community-platform](https://github.com/MO22BARY/ICPC-AAST-Aswan-community-platform) Registration is open: you sign up, link your Codeforces handle, and you are in. [cut] ![The community feed &mdash; pinned announcements, the daily puzzle and the XP rules](/predownloaded/d1/c6/d1c650a3e4480ee2daaf92ca886ce4a868746b1d.png) ## The ...

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

216.
By jossy_, history, 3 years ago, In English
A2SV Community Weekly Contest — Div 3 #2 Editorial [problem:263A] <spoiler summary="Tutorial"> <h4>[problem:263A]</h4> To find the minimum number of moves required to center a single "1" in a 5x5 matrix, we employ a distance-based approach. Imagine the center as a bullseye. First, locate the "1". Then, calculate the absolute vertical distance |2 &mdash; row number of "1"| by counting how many rows it needs to move up or down to reach row number 2 in 0-indexed format. Similarly, calculate the absolute horizontal distance |2-row number of "1"| by counting how many columns it needs to move left or right to reach column number 2 in 0-indexed format. Finally, add the vertical and horizontal distances to determine the minimum number of moves required. This method works because the "1" can only move up/down or left/right, mimicking independent horizontal and vertical movements needed to reach the center. <br/> <br/> </spoiler> <spoiler summary="Solution"> ```python for i in range(5): row = list(map(int, inpu...
arises when there's an unequal skill level between students in the same team. Toresolve this, some

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

217.
By Nishu_Coder, history, 3 years ago, In English
please resolve this admin? Attention! Your solution 206472221 for the problem 1833A significantly coincides with solutions shivam_satyam_/206464201, Nishu Coder/206472221. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.me/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked. The following complaint was sent to me just 3 hrs ago. Am I supposed to cheat for div3 problem A and that to for a contest that happened on may 19th,but still the system gave me notification after 12 days. even if I cheated then why my rat...
please resolve this admin?

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

218.
By -Pho3nix-, history, 6 weeks ago, In English
Codeforces, I Didn't Submit This UPD 1: The issue has been resolved. Thanks to the Codeforces team for looking into it. Hello Codeforces team, I noticed an unexpected submission in my account's submission history and wanted to report it in case there is an issue with the system. There is a submission for A &mdash; Monocarp's Contest dated September 22, 2026 at 15:27, which appears under my account. However, I did not submit this solution, and I did not make any submissions at all on September 22. Could you please check the logs for this submission and see how it ended up on my account? I wanted to report it as soon as I noticed it, in case this is affecting other users as well. Submission: [submission:391645045] <a href="https://ibb.co/LDtz9rPc"><img src="https://i.ibb.co/0pMjYKX6/2026-10-02-17-10.png" alt="2026-10-02-17-10" border="0" /></a> Thank you for looking into this. [user:MikeMirzayanov,2026-10-02], [user:KAN,2026-10-02]

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

219.
By pranet, 12 years ago, In English
Resolved: 191-C Fools and Roads : a strange runtime error [submission:8840553] Could anyone please point out my error in this one? I'm getting a runtime error whenever I call the following assertion in my lca() function ~~~~~ int x=firstOccurance[u]; int y=firstOccurance[v]; assert(x>=0 && x<m); assert(y>=0 && y<m); ~~~~~ which is weird since I specifically ensure that this is not possible by running the following in main() after generating firstOccurance[] ~~~~~ for(int i=1;i<=n;++i) { assert(firstOccurance[i]>=0); assert(firstOccurance[i]<m); } ~~~~~ and this part happens to pass the assertion tests. I have tried many random samples with n=100000 on my system, but could not replicate this error. Thanks Update: Corrected thanks to [user:catlak_profesor_mfb,2014-11-25] Since n was 100000,I had taken a size of 500000 for my segment tree which seemed to be sufficient. Unfortunately since the segment tree was on my order[] array, which has a size of 2*n-1, 500000 wasn't su...

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

220.
By maverick_xiii, 12 years ago, In English
Sublime Text 3 & C++ !!! Since the Sublime text 3 build 3083 update, short-cuts for building and running single file C++ programs have changed. If you loved the old shortcuts (cmd+b to compile and cmd+shift+b to run), you can restore them by adding these custom key bindings. ~~~~~ { "keys": ["super+b"], "command": "build", "context": [ { "key": "selector", "operator": "equal", "operand": "source.c++" } ], "args": { "build_system": "Packages/C++/C++.sublime-build", "variant": "Build" } }, { "keys": ["super+shift+b"], "command": "build", "context": [ { "key": "selector", "operator": "equal", "operand": "source.c++" } ], "args": { "build_system": "Packages/C++/C++.sublime-build", "variant": "Run" } }, { "keys": ["super+b"], "command": "build", "context": [ { "key": "selector", "operator": "equal", "operand": "source.java" } ], "args": { "build_system": "Packages/Java/Java.sublime-build", "variant": "Build...

Full text and comments »

  • Vote: I like it
  • +14
  • Vote: I do not like it

221.
By EtCetera, history, 8 years ago, In English
Proposal: 2FA Two-factor authentication, or 2FA, is an extra layer of security used when logging into websites or apps. With 2FA, you have to log in with your username and password and provide another form of authentication that only you know or have access to. It is already used on major websites (www.turnon2fa.com). The fact that a second factor of authentication is required significantly reduces the risk of compromise versus reliance upon a username and password alone. Password managers are great and they help guard against the risks that arise from people’s password habits. But they don’t protect against external threats to passwords. For instance, if cf database with passwords is hacked or if a personal computer is infected with malware that records keystrokes to steal account credentials, then the complexity and longevity of the password won’t help protecting your account. But 2FA will. Using 2FA would resolve recent security issues, and make cf users more secure about their account...
Using 2FA would resolve recent security issues, and make cf users more secure about their accounts

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

222.
By Raising_Heaven, history, 5 months ago, In English
Some problems cannot be reached Today, I was trying to solve some problems on Trie. I was following a list of problems on this topic. It has some problems from codeforces as well. Two of them were [problem:706D] and [problem:665E]. When I tried to access the first problem, an error message popped up like this: Oops! Probably Codeforces can't be reached right now or your Internet connection is broken. You can try: reload the page return to the main page visit official mirror website mirror.codeforces.com visit m1.codeforces.com, m2.codeforces.com or m3.codeforces.com (if you are taking part in the official round right now) I thought codeforces was down. But then when I clicked on the link to the second problem, it loaded normally. Then I go to the Problemset section of codeforces and try to view a random problem like [problem:501A]. The same error message popped up. Any idea why this is happening? I am kind of confused. Edit: The problem is resolved now.

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

223.
By N29, 3 years ago, In English
MacOs SIP slows down the compiler If you are experiencing slow compilation in macOS, it might be due to MacOS SIP(System Integrity Protection). <br> To resolve this, you can disable SIP. <br> To check the status of SIP on MacOS 11.0 or later: <br> ~~~~~ 1. Open terminal. 2. Write csrutil status 3. System Integrity Protection status: disabled/enabled. ~~~~~ This blog is concise but could be very helpful for you. <br>
Protection). To resolve this, you can disable SIP. To check the status of SIP on MacOS

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it

224.
By ScorpioDagger, 4 years ago, In English
What is wrong with codeforces these days? An unrated edu round, a +12 hour maintenance then some outages in recent hours and now many submissions are **in queue** Specifically, [a 5 page-inqueue](https://codeforces.me/problemset/status/page/5?order=BY_ARRIVED_DESC) UPD: It has been all resolved. Now, the queue runs fine and even bots aren't allowed to do submissions. And I guess the human verification imposed will lessen ChatGPT's crazy believers submissions spamming the queue as pointed in this [blog](https://codeforces.me/blog/entry/115022) It looks that DDOS attack which made the last edu unrated won't happen again (hopefully) by this series of strong enhancements. Thank you [user:mikemirzayanov,2023-04-13] and all the codeforces team. ![ ](https://i.imgur.com/J1gYbOm.png)

Full text and comments »

  • Vote: I like it
  • +115
  • Vote: I do not like it

225.
By _i.ayush_, 3 years ago, In English
What is exactly "VOID"? (In JAVA) **Void:** ========= Void is return type of the function main. Now what does this return type means? Before that we first need to understand returned value or return value. ### **Return Value:** Every function in any programing language returns some value. A value that it has computed, which function was meant for. Let's take an example to explain about value retuned and function computation. In the following code (see code below), we've a class sum that has a public method called sumof2() that computes the sum of two values of a variables 'a' and 'b' passed as an argument/parameters. So when we say return value we meant the line "return C". As you can notice from main function we've passed values 2 and 3 that were stored in 'a' and 'b' in sumof2 method. Sum of two method computed a+b and stored it in C and returned value 5. This 5 is k/a value returned. And all the lines before return line are k/a computation. ~~~~~ class sum{ public int sumof2(int a, int b...
talking about 5, 5.0 or Ascci value of 97. What value among these do you want. Toresolve this dilemma of

Full text and comments »

  • Vote: I like it
  • -23
  • Vote: I do not like it

226.
By Final_Track, history, 2 years ago, In English
A Question for Um_nik In a recent exchange, [user:kHarsh3715,2024-07-23] and I were discussing the potential topics in Number Theory to learn. [user:kHarsh3715,2024-07-23], with conviction, deemed **Mobius Inversion**, **Convolutions**, and **Diophantine Equations** as "very useful topics." He further went on to include **Generating Functions**, **Linear Recurrences**, and ventured into the arcane with the **Lucas Theorem**, **Pollard Rho**, and **Primality Testing**. Baffled by his bold assertions, I simply replied, _"Umnik would disagree"_ (Referring to this blog of course: [link](https://codeforces.me/blog/entry/92248)). This simple statement sparked a fierce debate, escalating to a wager that put our very financial futures at stake. Only the legendary [user:Um_nik,2024-07-23] himself could resolve this epic conflict and determine who would emerge victorious.
[user:Um_nik,2024-07-23] himself could resolve this epic conflict and determine who would emerge

Full text and comments »

  • Vote: I like it
  • +52
  • Vote: I do not like it

227.
By rumike, history, 2 years ago, In English
Heavy implementation Each time, I faced a heavy implementation problems, even If I had the idea of the solution earlier, I just lost myself in the process of resolving, and look at the editorial many times. Every time, I missed a detail, and that took me sometimes 30 minutes without even remark it. Suddenly when I look at the editorial again, I say oh what the hell? and repeat the same process, again and again. I am so slow on heavy implementation, and I know the common advice is to solve more implementation problems, but I am trying that and it's hard as described before. Did someone faced the same problem, and overcomed it? At least for implementation problems in range 1800 &mdash; 2000. If yes please give me advice, how should I trained this type of problems. Also any tips to become quicker on resolving problems in general is welcome.

Full text and comments »

  • Vote: I like it
  • +25
  • Vote: I do not like it

228.
By GooglerPraveen, history, 8 years ago, In English
Codeforces contest colliding with Codechef contest. On 23rd june codeforces round is colliding with a rated contest in codechef. On 30th june again another codeforces contest is colliding with codechef lunchtime. Is it possible that the timings might be slightly changed that they don't collide? I'm sure many participants would like to give both contests and don't want to choose between the 2 especially since it is summer vacation and most of us has lot of free time. upd: So the issue has been resolved 23rd codechef contest will be shifted by a day. 30th codeforces contest time will be adjusted.

Full text and comments »

  • Vote: I like it
  • +49
  • Vote: I do not like it

229.
By PopCoder, history, 17 months ago, In English
m2.codeforces not working Hi everyone, I've noticed that during the last couple of contests, the mobile version of Codeforces (m2.codeforces.com) lists all the contest problems correctly, but when I click on any of them, it just says "Description not available." Interestingly, I'm still able to make submissions from the page — just not view the actual problem statements. This has happened consistently for the past two contests. I'm wondering if others are facing the same issue? Any idea how to resolve it, as the main site takes too long to load problems
same issue? Any idea how to resolve it, as the main site takes too long to load problems

Full text and comments »

  • Vote: I like it
  • +42
  • Vote: I do not like it

230.
By Aviraj29, history, 8 months ago, In English
CP Debug Printer — VS Code Extension for Instant cerr Debug Prints Hello Codeforces! I made a VS Code extension that automatically generates cerr debug print statements for any C++ variable with a single shortcut Ctrl+Shift+D. Why I made this I was tired of manually writing: cerr << "adj: "; for(auto& [k,v]: adj){ cerr << k << "->["; for(auto& x: v) cerr << x << " "; cerr << "] "; } cerr << "\n"; every time I wanted to debug a map<int,vector<int>>. So I built an extension that does it in one keypress. How it works: 1) Place cursor on any variable (or select it) 2) Press Ctrl+Shift+D 3) The correct debug print is inserted below automatically Supports all CP templates Every competitive programmer has their own template with custom aliases like ll, pii, vpii, vll or whatever they prefer. The extension automatically reads your using and typedef definitions and fully resolves them — no configuration needed. TLE Warning — and the fix As some of you might know, cerr inside loops can cause TLE on submission...

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

231.
By nuredinbederu10k, history, 18 months ago, In English
Editorial For A2SV Contest #11 [Here](https://codeforces.me/contestInvitation/ebf08ef54eb14b2568eb54315b4d0d23dd8d4a1f) is the link to the contest. All problems are from Codeforces' problem set. [A. Modern Name Generator ](https://codeforces.me/gym/605795/problem/A) <spoiler summary="solution"> Split the input into three strings, take the first character of each, and join them. </spoiler> <spoiler summary="code"> ```python for _ in range(int(input())): print(''.join(x[0] for x in input().split())) ``` </spoiler> [B. Aaron and Repeated Letters](https://codeforces.me/gym/605795/problem/B) <spoiler summary="solution"> We use a stack to keep track of characters. For each character, if it matches the top of the stack, we remove the top (both letters cancel out). Otherwise, we push the current character onto the stack. At the end, the stack contains the corrected string without consecutive duplicates. </spoiler> <spoiler summary="code"> ```python s=input() st=[] for c in s: if st a...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

232.
By offline-bot, history, 3 years ago, In English
Chicken McNugget Theorem explained[Shortly] **What is the Chicken McNugget Theorem?** The Chicken McNugget Theorem states that for any two relatively prime positive integers $m, n$ the greatest integer that cannot be written in the form $am + bn$ for nonnegative integers $a, b$ is $mn - m - n$ **Explain** Let's say you and a friend are playing cricket. You can only score $2$ and $5$, whereas your friend can score in all ranges. You can only now make the following runs: $0, 2, 4, 5, 6, 7,\dots$ Thus, you are unable to score both $1$ and $3$. Notice that after a specific number, all possible numbers are written as the sum of $2$ and $5$. These kinds of issues can be resolved by Chicken McNugget Theorems. The largest number that cannot be represented in the form $a\cdot m + b\cdot n$ for nonnegative integers $a$ and $b$ is $(m-1)\cdot (n-1) - 1$ if $m$ and $n$ are two relatively prime positive integers. Additionally, for nonnegative integers $a$ and $b$, all numbers bigger than $(m-1)\cdot (n-1)- 1$ can be represe...

Full text and comments »

  • Vote: I like it
  • +75
  • Vote: I do not like it

233.
By ivan100sic, history, 8 years ago, In English
Can't submit on Codeforces When I submit a code, I get the error message "You cannot submit the same code twice", although this is clearly not the case. As far as I can see, I'm not the only person affected. Hopefully this will be resolved quickly.

Full text and comments »

  • Vote: I like it
  • +33
  • Vote: I do not like it

234.
By Shiroha_F14, history, 5 years ago, In English
[Resolved] What is this message? Hello. This is my first post and English is not my first language, so please forgive my poor wording. I received a message just a moment ago. I read this but this message made me confused. ![ ](/predownloaded/d7/3f/d73fbaf145b79e9057c521ca66a9ce49055219d8.png) Is this message just a scam? Or really I'm suspected? What is the meaning of this message? I want to think this is one of a kind of something meaningless... I'm not well about English so someone please help me. Thank you for reading. (Fortunately I haven't clicked this link yet) UPD : Thank you for answers! I'm going to keep a lookout.

Full text and comments »

  • Vote: I like it
  • +55
  • Vote: I do not like it

235.
By murugappan_s, history, 9 years ago, In English
June Long Challenge cloning problem Deterministic solution This month's codechef long challenge had a great set of problems. One problem was cloning(https://www.codechef.com/problems/CLONEME/). I couldn't solve it during the contest,but upsolved it just now. I did it finding prefix square sums and prefix sum of the input and used a mergesort tree.To resolve collisions for ranges which have same prefix square sums and prefix sums,I had to do a lot of collision resolution work(computing various prefix power sums). I find the pairs of numbers which differ in the intervals.If that count of pairs is greater than 1,we can answer them easily else find whether they occur at same position by find number of elements strictly lesser than and less than the value,then answer them. Here is my submission : https://www.codechef.com/viewsolution/14267198 Is there a deterministic solution or any better solution which has less collision?? If there is any good editorial please provide the link. Thanks in advance. Please don't down-vote befor...
resolve collisions for ranges which have same prefix square sums and prefix sums,I had to do a lot of

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

236.
By sai_aasish, history, 3 years ago, In English
Why is my code facing a TLE? ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; string s; cin>>s; string a= "";//taking an empty string to store the output int i= n-1; while(i>= 0)//traversing the string from the rear { if(s[i] != 'a' && s[i] != 'e')//if its not a vowel, concatinating the last three elements to the "a" string { a= a+s[i]; a= a+s[i-1]; a= a+s[i-2]; a= a+'.'; i= i-3; } else//else, concatinating the last two elements to the "a" string { a= a+s[i]; a= a+s[i-1]; a= a+'.'; i= i-2; } } a.pop_back();//popping out the last "." reverse(a.begin(), a.end());//reversing the output since I traversed from the...

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

237.
By Yuvraj_Patel, history, 2 years ago, In English
Regarding leaked code from my room in contest still get message that I have leaked it In [contest:1988] round ,in [official standing](https://codeforces.me/contest/1988/standings/participant/186659220#p186659220) you can clearly see that I have completed Problem B in just 12 minutes and the warning message/mail sent by system contains such participants who has mostly lower than my rating and they have submitted code after my submission .And I am 100% sure that this is someone from the same room who have leaked my code .I think that Codeforces should add some features such that participants in same room can not leak the code of other after submitting it . This is my [room](https://codeforces.me/contest/1988/room/545) in which I was assigned during contest. I hope that Codeforces team and [user:MikeMirzayanov,2024-07-17] will look into this and try to resolve the problem of leakage of codes in same room by either removing hacking feature or something else by which other participant in the room can't copy the code...
resolve the problem of leakage of codes in same room by either removing hacking feature or something

Full text and comments »

  • Vote: I like it
  • +50
  • Vote: I do not like it

238.
By qlf9, history, 7 years ago, In English
CHelper Issues Hello, I am unfortunately having some issues with the CHelper plugin. I downloaded it and got it to work completely. I then wrote my own Reader class to use as its input class, after which it still worked. However, after I closed IDEA and reopened it, it has completely stopped working. I can still add new problems and parse them from online, and the tests show up, but when I run the program, absolutely nothing happens. I also got this IDE error, but I don't know if it's related to my issue, because I got the same IDE error when CHelper was working for me. ~~~~~ java.lang.Throwable: AWT events are not allowed inside write action: java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.Timer$DoPostEvent@4057960b,notifier=null,catchExceptions=false,when=1578874736618] on sun.awt.windows.WToolkit@4a2f786 ~~~~~ Has anyone had the same issue, and does anyone know how to resolve it? I would really appreciate any help or guidance on this. -qlf9
Has anyone had the same issue, and does anyone know how to resolve it? I would really appreciate

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

239.
By vdmedragon, history, 6 years ago, In English
Submission issue: Can't find file K:\ramdisk\codeforces61\xxx Admin, I got this issue while submitting code to the problem 234C: ~~~~~ `Participant's output` `Jury's answer` `Checker comment` `Can't find file K:\ramdisk\codeforces61\c53dd23c96013b2e9c8583ab8f05edda\check-d10a4d6b1acf8dcc90e929292a422e5f\run\output.txt [invokerId=9b4df16fc0ab37520967f1d97d3e17aa, location=203279210] (1).` ~~~~~ https://codeforces.me/contest/234/submission/112246561 For other problems, it is ok. Please help to resolve this issue.
Please help to resolve this issue.

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it

240.
By K0DEL, history, 5 years ago, In English
My solution didn't go through system testing [contest:1557] [problem:1557B] I participated in the codeforces round #738 my solution passed the all the pretests but even after the contest was over my solution did not update to wrong answer or accepted. It is continuously showing pretest passed(4) even after the system testing was over This is the solution i submitted while the contest was going on [submission:125370246] I submitted the same solution after the contest which got accepted. [submission:125406123] I just want to know why is it happening. I request the admin to correct this as soon as possible. [user:MikeMirzayanov,2021-08-09] Edit : The issue is now resolved . Thank you Team Codeforces.

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

241.
By coderdhanraj, 22 months ago, In English
Jiangly Became Tourist? ![ ](https://i.ibb.co/Jjy1TQx/A910-C790-A3-BB-450-D-A415-0-F316-D5-A3246.png) Jiangly became Tourist, well I was expecting the rank to be "Jiangly", btw huge congratulations to [user:jiangly,2025-01-20]!! PS: It seems resolved now

Full text and comments »

  • Vote: I like it
  • +53
  • Vote: I do not like it

242.
By SajwalAshish, history, 2 years ago, In English
Submission queue wont end! A few hours ago I tried submitting a problem and noticed that it just wont exit the queue and the testcases never ran. Confident that it would work, I started solving another problem. When i submitted it i noticed the previous solution was still stuck in the queue. I gave it time to wait and went for a 2 hour nap. Turns out it is still stuck in the queue. This triggers my anxiety for today's educational round. Requesting the CF team to look into this issue and fix it ASAP. PS: The issue has been resolved and the questions are being judged fine now.

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it