Hello / Selamat sejahtera / 你好 Codeforces!
credits to gry3125
We, quacksaysduck and _ja are excited to invite you to Order Capital Round 2 (Codeforces Round 1104, Div. 1 + Div. 2), which will start on Jun/18/2026 17:35 (Moscow time)! In this round, you will help Ja the Ghost and Quack the Duck on their daily shenanigans.
This round will be in the format of an IMO mock. There will be $$$9$$$ problems which you will have to solve in $$$3$$$ hours. This round will be combined for Division 1 and Division 2 and will be rated for everyone. Please note that this contest contains at least one run-twice problem, so please read the guide for run-twice problems if you are unfamiliar with them.
All problems in this round were authored by quacksaysduck, _ja, StarSilk and zeemanz.
We would like to thank the following people for their contributions:
- Sugar_fan for his coordination and advice,
- Um_nik for preliminary review,
- Boboge for carrying the problem preparations,
- StarSilk and __baozii__ for providing some cool problems,
- Alexdat2000 for translating statements into Russian,
- _ja, Mitsukasa_Ayase, geospiza, leg, EvenImage, fallleaves01, Tobo, Code937, Boboge, Erica_aaa, andreumat, SSerxhs, Timmyliuyunxi, gongkoufadongji, chyragym, Misumi_Ichika, Syuzi777, __baozii__, _LeMur_, turkhuu622, oToToT, vito1036, FelixArg, SUL, marianoferesin, GILGAMESH, The_Lion_King_777, Hile_Meow, Sakuya_maid, edogawa_something, tiger2005, shendeliliang, Arpa, SergeiFedorov, -XraY-, VadymKa, scorpion, surokpro, lIlIlIlIIll, Buek for testing and providing valuable suggestions,
- MikeMirzayanov and KAN for the amazing Codeforces and Polygon platforms,
- and lastly, You for participating.
The score distribution:
Fun fact: As far as Evirir knows, this is the second round by Malaysians since 2020!
And now, a few words from today's sponsor!

👋Hello Codeforces!
I’m Igor -XraY-, CEO at Order Capital. Last year we ran our first Codeforces round and were genuinely impressed by the community response! So we’re happy to be back with Order Capital Round 2🚀.
We’ve prepared a fresh set of problems with interesting ideas and a few surprises along the way. Whether you’re here to push ratings, enjoy a good contest, or just vibe with interesting problems, jump in.
💸Just like last year, we’ll have prizes and some awesome merch for top performers as well as a few randomly selected participants.
Prizes
- 🥇 🥈 🥉 🎖 1–4 — 1000 USDT
- 5 — 800 USDT
- 6 — 700 USDT
- 7 — 600 USDT
- 8 — 400 USDT
- 9 — 300 USDT
- 10 — 200 USDT
🎁 PLUS:
Top 10 + 20 randomly selected participants ranked between 11 and 200 will get our secret Order Capital merch boxes 🎁
At Order Capital we are constantly developing and looking for talented ambitious people to join our team. Hit the button below to check out the career opportunities in Order Capital.
Enjoy the contest, have fun solving, and we hope to see your name near the top of the standings!
PS We reserve the right to apply strict compliance checks when finalizing the results in order to prevent unfair participation and rule violations.
UPD: Editorial is up.








Why is __baozii__ in the contestants list ??
Ah , he often plays that trick.
Last time he set problems in a round and later he registered .
Don't worry, he won't actually submit problems:)
IT’S A DUCK NOT A PENGUIN tt-tt
looks like a yellow penguin to me. its just asian
.
As a tester, I tested the round last night.
Please note that this contest contains at least one cool problem.
Hope it won't be D1G.
Hope it will be D2A
Run-Twice Problems are fun. I think these types of problems should be made more common in codeforces.
firstly , they're not funny . ultimately , I hope i don't see them again neither in codeforces nor in APIO .
what bro the run twice problems in APIO 2026 (problems B,C) were fun too, it's just our skill issue
nope it ain't skill issue , what in the hell is three procedures , nevertheless that i found the solution for some subtasks and implemented them however I got WA .
... I don't like interactive or 'run-twice' problems. Maybe I just can't adapt to them, but they are hard and very specific..
They just aren't fun!
They are sometimes really not fun to debug.
I would like to Quack the Psyduck :)
The last time I encountered a run-twice problem was back in Round 1071.
Hope to enjoy the rarely seen problem!
The last time we had a run-twice problem was in an Unrated round : 2215C - Oriented Journey. Nice problem though.
That problem was a run-twice interactive problem btw.
Thank you!
In fact I was busy doing my homework then and only solved Problem A,B and C in that unrated contest:) So I didn't remember.
This round will be in the format of an IMO mock.
Does It mean that the round will be mathforces again?
As a participant, the weather is not cool.
.
Bro... Again?
orz
Ever since the last time I had a problem here, i have been staying up late to learn coding. Now let's see if those grinds are worth it or not. Also, good luck to yall. To the RNG God, please bless me with astronomical luck in case i'm in the top 200 for the insane merch.
As a tester, I truly appreciate all the effort that the problemsetters, testers, and the coordinator have put into making the problems more interesting. Hope all the participants enjoy this contest!
Top 10 are fighting for USDT, ranks 11–200 are fighting for merch, and I'm fighting to solve problem A before the editorial comes out.
It looks like a duck...
I from Chinese.
Malaysia for the win!! I will be looking forward to this contest :)
Edit: Coincidentally, the contest ID is also my birthday
So, is it March 22nd? And the '7' stands for the year?
Maybe it's 4th November
Contest ID = 2237 btw. Am i right? Or?
Xeqr meant the contest number (1104), not ID ig
ok
Excited for Communication Problems!! Hope other OJs like AtCoder also adds them in one of their ABCs or ARCs.
A very cute duck
When score distribution?
Wow, the duck in the picture looks so cute. 🧡
yeah it is definitely a duck
MALAYSIA BOLEH RAHHHH
So no one told me that the communication problem is also interactive
they swapped problem B with C
I spent too much on B and then realized that C is significantly easier.
Now I realized that one of my thought was correct, but I could not make it work. That skill problem :(
B is so hard
I was very demotivated not able to solve B :( was it really tough?
I didn't solve it either. It's just too hard.
how? you are a grandmaster and solved till F
B was just bubble sort with some extra logic.
you are an anomaly.
won't it be solved using dp ?
this was my first intuition !!!
btw i was also unable to solve it :/
I didnt even try to think of dp. the swap operation forced me to try bubbble sort. I figured out the extra logic. But confirming, formalizing, coding and debugging took me quite some time. 1hr50min in total. I think i probably lucked out with this one. :)
Same. I think B and C were very hard (for B and C), especially if one tries solving them instead of guessing. By the way, I was surprised when I solved them, that the solutions were so simple. I feel those two problems rewarded guessing significantly more than average Codeforces B and C do.
Say, for B, 4 out of top20 participants spent >= 10min to AC it. While in the previous div1+2 only 1 out of top20 spent >= 10min on B.
..
real lol
Yes, A=C<D<B for me
Don't say B>D it's sad to hear. It took me around 2 hours to do D :(
Such bad problems. All guess no proof.
Its not 'bad'. its just greedy. Also, if you are really up for it, you can prove the greedy approach too.
Can someone help me in the problem D? i was trying dp but didnt work
Try testing Cnt(1) — Cnt(0) for beautiful strings and non-beautiful strings and guess some property. There will be one exception for alternating strings
How to prove if difference is not 0 mod 3 and a string is not alternating sequence then it is valid? I understand each operation does +1 on Cnt(1) and -2 on Cnt(0) (or vice versa) which is why difference mod 3 is preserved, but if alternating sequence is an exception, then there could be other exceptions too, right?
You can use induction. There will always be a way to make the string shorter and not alternating.
1 If diff is 0 mod 3, you will lose
Because -1/+2 preserves the difference and thus you will eventually end up with
000or111and be cooked.2 If alternating, you will lose
Lose instantly.
3 If not alternating and not 0 mod 3, you will win
If not alternating, there exists a
00or11somewhere.If:
000000...0or11...1then just perform operations s.t. the string is always partitioned in half, and you will always be able to make deletions as long as there are at least two 0s or two 1s.xxis surrounded by aysomewhere. Then just delete at the border:xxybecomesyy, oryxxbecomesyy.The mod guarantees you will not end up in a losing
000or111state.Yo greateric, but how do you count the number substrings using that information.
$$$B \gt C \approx A$$$
Problem A constrain on n is too small
What do you mean is too small, all A problems has n very small
For problem A, an O(n) solution exists. But since $$$1 \le n \le 100$$$ an $$$O(n^2)$$$ solution would also pass
This makes the problem too easy for a Div. 1+2
Just because it exists a O(n) solution it doesnt mean n is too small, all Div 1 + Div2 A problems are too easy
There is also a BIT solution for B, but it doesnt mean that it should be applied
B involves more thinking. But, A is a straight forward question (the formal definition describes the exact implementation to do)
The O(n) solution is well known. So, the $$$O(n^2)$$$ solution feels too easy for a Div 1+2 (usually easy implementation problems are given only in Div. 4 or Div. 3)
Why are you so bothered that the first problem was easy, that is supposed to be like that. Do you really think that the problem creators didnt know a O(n^2) solution was going to pass? You should check every other problem A, most of them has n <= 100 purposely.
Pretty sure half of top100 are cheaters...
Where do they cheat from?? I dont think llms can solve these
LLMs can definitely solve these... only I1 and I2 are an issue for an llm, at least when constrained to python
All hard problems now solved, took some time for GPT-5.5 pro to solve I2, and would not be viable in a contest (and would get you instantly banned).
Up until G, every problem can be solved in a single query, H and I1 took each ~140min of reasoning, I2 require manually showing how to work it through.
So, cheating would, with ease, give you the number 1 spot, however youd be detected in no-time.
Just wanted to show the problem isn't anymore the incapability of llms, though theres a steep dropoff in capability on the highend of implementation (see I2, many timeouts due to bad structure, and subsequent fixes dont fix the method.)
All problems have now been solved in python (Pypy).
In any case, Im not participating in the contests so Im not ruining anyone's fun, but be realistic ;P
-6 for telling people a truth they don't want to hear wow
I mean its kinda logical, since it can be seen as if Im advertising or advocating on how to cheat. But, I think its important for the general public to know that a decent programmer can hide their cheats very effectively and perform at the top. If hidden well by someone reputable, a cheater could have taken the number one spot in this contest with ease.
What was that B!!!!, and then C felt like the same difficulty as A. The difficulty progression in this contest was all over the place.....disappointed.......with the contest and myself too
i know right ,wasted so much time on B before seeing C was so much easier
Exactly, wasted so much time forcing B only to realise later that C was basically free compared to it
I found C harder than B
D not a good problem.
I don't think that E is easier than F
Why can so many people solve E in a short time
E is just an observation that $$$len_i = len_{b_i}$$$, where $$$len_i$$$ is the length of cycle of $$$a$$$, which contains $$$i$$$. Some people can observe that quickly, especially if they've seen a similar idea. F, as far as I understand, is some dp with segment tree, implementation heavy.
I used a deque for F, F was definitely easier than E in both concept and implementation for me
E is the implementation heavy one. You only need deque for F, and its very short impl.
ig solves are 1000+ cause question being implementation heavy doesn't bother ChatGPT.
crazy contest for me D>B>C=A
like i spend 2 hrs in solving D then i moved to c
I get rank1400+ because of E,I want to know why so many people can accepted E that 1000+,I think E is so difficult.I think CF AI maybe>1000.
Actually, if you're not new to permutations, it's not hard to find out the conclusion.
I mentioned my solution in the fifth comment of https://www.luogu.com.cn/discuss/1307318. Quite short.
Copied from my code:
Though, I actually agree that there's probably lots of AI.
I failed to finish my code of F.
Will my rating drop for that?
Upd: How could my rating still increase by 19 with such a bad performance?
B>(A+C), bro it took me 1 hour to solve B, but not even 15 minutes for C.
1 hour 30 minutes on D and 1 hour on E...
guessforces
I guess I'm one of the few who found B < C. Anyways, I guess I wasted time on C, but still, a rating drop after A-D in 1.30 ;-;. Was E that easy ?
No, the reason you lost rating is CHEATERS
brilliant construction on G (bugged in the base converting part during contest :sob:)
I love that problem
How did today's D got 4k solves!! Its not that easy imo..
Maybe because llm can solve it easily.
If you have solved this problem, then problem D is easy to solve.
Solving 3 problems every contest just to reach newbie from pupil.
Is D a reference to this problem? :)
zipongster said it's too easy
Problem C was easier than B
Awesome, I hope this will be a great contest.
ShadowCoder24 Attention!
Your solution 379389894 for the problem 2237D significantly coincides with solutions ShadowCoder24/379389894, Mahishah_26/379405609. 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 would like to clarify that I do not know either of the mentioned users personally. They are not from my college, hometown, or social circle, and I have never communicated or collaborated with them in any way regarding this contest or any other programming activity.
The similarity appears to be purely coincidental. The solution was written entirely by me during the contest, and I fully understand every part of the code. If required, I am willing to explain the logic, approach, and implementation details of my solution to demonstrate that it is my own work.
I have always tried to follow the Codeforces rules and fair-play guidelines. I did not share my code with anyone, nor did I obtain code from any other participant. Therefore, I believe this may be a misunderstanding caused by multiple participants arriving at a similar implementation for the same problem.
I respectfully request that my case be reviewed individually. I am happy to provide any further clarification if needed.
Thank you for your time and consideration.
Hello Codeforces administration, I am writing to explain the code similarity. The account meili.heen is my newly registered secondary account, and both submissions belong to me personally. I did not realize that submitting the same solution across my own different accounts would violate the platform’s anti-cheating rules. I feel sorry for my ignorance and the trouble caused. I promise I will fully learn and follow all Codeforces rules in future contests.!
All the progress I’ve made didn’t come easily; it is the result of countless hours of persistent practice and hard work. I have devoted a great deal of time and energy to preparing for this competition. Since this was merely an honest mistake caused by my unfamiliarity with platform regulations, I sincerely and humbly beg you not to invalidate my contest score.
Hello Codeforces team, This is meili.heen, my newly created alternate account. I submitted the same code on my main account and this alt just for personal testing, and I truly had no idea that submitting identical code across my own two accounts violates platform rules. I take full responsibility for my ignorance. I spent a lot of time thinking and writing this solution independently by myself, and I put tremendous effort into this contest. I sincerely beg you not to invalidate my contest results and rating for this honest mistake. I promise I will never use multiple accounts to submit codes in future competitions and strictly abide by all Codeforces regulations. Thank you very much for your understanding.
Dear Codeforces,
This message is regarding the matching of my solution with many others in Order Capital Round 2 (Codeforces Round 1104, Div. 1 + Div. 2) held on 18th june 2026.
First, I don't know any of the people whose solutions and mine solution is matching with. Now, I have analyzed almost all the solutions that were matching, and I think your system has detected too many same solutions due to standard structures used in the solution code for problem 2237C.
The solution code was a bit short. I mean a logic that is: ~~~~~~~~~~~~~~~~~~~~
while ((int)st.size() >= 2 && st[(int)st.size() — 2] > st.back()) { long long a = st.back(); st.pop_back(); st.back() += a; } ~~~~~~~~~~~~~~~~~~~~
This was the part matching with others, but not exactly with many.
Now, talking about other parts like: ~~~~~~~~~~~~~~~~~~~~
int t; cin >> t;
while (t--) { int n; cin >> n; ~~~~~~~~~~~~~~~~~~~~
This part I use in almost every solution code. For proof, you can match it with my other solutions. It is standard for many.
Now again, for another part, i.e.:
vector st;
for (int i = 0; i < n; i++) { long long x; cin >> x; st.push_back(x); } This is also kind of standard for many, as for taking elements in a vector we usually use this structure. For proof, you can match my other code structures; they will look similar. Also, I know it is standard for many.
Now again, see: ~~~~~~~~~~~~~~~~~~~~
long long ans = 0;
for (long long x : st) { ans = max(ans, x); }
cout << ans << endl; }
return 0;
~~~~~~~~~~~~~~~~~~~~
This is what many people do for iterating through a vector, then taking the maximum, and then printing the maximum answer. It is also standard for many.
If you allow me, I can show, or even you can match, whatever questions I have done among the 650+ problems I have solved. I use the standard structures shown above.
Now, talking about variable names, I take v, v1, v2, v3... for vectors, and in this question I also do. But the logic for this question was like taking a stack, so initially I took:
stack st;
i.e. it is standard for me to use st for a stack. Later, I changed it to a vector and didn't think of changing st, as it doesn't matter for acceptance.
I am explaining all this, and I know it looks long to read. I am explaining it in so much detail because I don't know those people and didn't share any code with others. It is basically a coincidence of using standard structures, or the same standard structures, which I think your system has caught.
The solution for this problem really contained standard structures that many people use.
So, I kindly request you to remove this plagiarism mark from my account.
You can see my hard work on my account profile. Banning my account just for matching some standard structures, or maybe a coincidence match, is really unfair.
So, I request you to remove this false allegation. I respect your system and will definitely take care of this issue in future contests and try to use different code structures.
Thank You.
Hello coordinators,
I received plagiarism warnings for both problem 2237D (submission 379411516) and problem 2237E (submission 379416416). I want to sincerely clarify that both solutions were written entirely by me during the contest, and these flags are highly likely false positives due to structural constraints.
Please consider the following points in my defense:
Mass Coincidence on Problem D: My submission for Problem D was flagged alongside more than 20 other users. When dozens of participants independently produce code that triggers the similarity tool, it strongly indicates that the problem's optimal implementation is exceptionally rigid, leaving almost no room for structural variation.
Active Progression on Problem E: For Problem E, I didn't just submit a final solution out of nowhere; I made 5 separate submissions during the round, actively debugging and refining my logic until it passed. This clear step-by-step progression demonstrates an independent problem-solving process.
Clean Account History: My account (_nothuman444) is 6 months old. I have a completely clean track record with zero prior warnings, blocks, or violations.
Consistent Activity: As shown by my profile heatmap, I practice and solve problems on Codeforces daily. I value my account and have absolutely no reason to jeopardize my rating or standing by copying or leaking code.
I did not use public IDEs (like Ideone) or share my code anywhere. Given my consistent history, my active submission debugging, and the sheer volume of users flagged on Problem D, I kindly request the coordinators to review these cases. Thank you for your time and fair evaluation.
Hello coordinators,
I received plagiarism warnings for both problem 2237D (submission 379411516) and problem 2237E (submission 379416416). I want to clarify that these solutions were written entirely by me during the contest, and these flags are highly likely false positives due to structural constraints.
Please look closely at my submission timeline, which clearly demonstrates an organic and authentic contest progression:
Natural Time Gaps: My submissions are systematically spaced out, reflecting the actual time it takes to read, think, and code. I submitted Problem A at 20:40, Problem B at 21:21 (a 41-minute gap), Problem C at 21:28, Problem D at 22:12 (a 44-minute gap), and Problem E at 22:39 (a 27-minute gap). If I were copying leaked solutions, I would have dumped them rapidly within a few minutes. Instead, my logs show a steady, realistic solving pace over the span of 2.5 hours.
Active Engagement Until the End: I was actively struggling with Problem H across multiple attempts right up until the final minutes of the round (22:17, 22:53, and 23:01). This shows genuine contest engagement.
Mass Overlap on Problem D: My submission for Problem D was flagged alongside more than 20 other users. This massive cluster strongly indicates that the optimal implementation logic for this problem is exceptionally rigid, forcing identical structural code blocks naturally.
Consistent Profile Activity: My account (_nothuman444) is 6 months old with a completely clean track record (zero prior warnings). I have solved 235 problems all-time, including 40 problems just in the last month, maintaining a 27-day max solving streak.
As a Specialist at 1596 rating, I value my account and daily practice immensely and have absolutely no reason to jeopardize my standing. I did not use public IDEs or leak my code anywhere. Given the undeniable timestamp timeline, the mass volume of flags on D, and my consistent daily heatmap, I kindly request the coordinators to review and dismiss these flags. Thank you for your time.
https://codeforces.me/contest/2237/submission/379418889
Provide some context here
Look at the comments in YOUR code, They are obviously written by ChatGPT or a similar LLM.
nah, he did it to help us understand the code easier.
27 for E and 41 for B is wild
Also coding H in 5 minutes with !if(cin) and 150+ lines of code
MikeMirzayanov Please carefully check the code format of the contestants. I recall that line compression and similar behaviors are not allowed in problems that support hacks. For example, this submission with the ID 379410120 has serious line compression issues.
Hello,
This message is regarding the similarity warning on my submission for Problem 2237C in Order Capital Round 2 (Codeforces Round 1104, Div. 1 + Div. 2), held on 18 June 2026.
I would like to clarify that I solved this problem independently. I do not personally know any of the users whose submissions were reported as similar to mine, and I have never shared or received code from them.
Problem 2237C was relatively straightforward, and the core logic consisted of only a few lines. Due to the simplicity of the problem, there are only a limited number of natural ways to implement the idea, making coincidental similarities more likely.
The main logic of my solution was essentially:
while ((int)st.size() >= 2 && st[(int)st.size() — 2] > st.back()) { long long a = st.back(); st.pop_back(); st.back() += a; }
Apart from this, most of the remaining code consisted of standard competitive programming constructs, such as:
while (t--).These are common coding patterns that I use in many of my submissions. You may verify this by comparing my previous solutions, where similar structures and coding style are consistently present.
Regarding the variable name
st, I initially intended to use a stack and therefore chose that name. Later, I switched to using a vector but kept the same variable name, since variable names do not affect the correctness of the solution.I solved the problem by understanding the idea, performing my own dry runs, and then writing the implementation myself. I understand and respect the Codeforces rules regarding plagiarism and fair participation, and I have always tried to follow them.
I believe that the similarity detected in this case is the result of common implementation patterns and the limited length of the solution rather than any exchange of code.
Therefore, I kindly request you to reconsider this case and remove the plagiarism mark from my account. I value the integrity of the platform and will continue to participate fairly in future contests.
Thank you for your time and consideration.
cheater
can anyone help me understand why is doing the leftmost first the optimal choice i am not able to use exchange arguments to prove that
why 3rd problem is soo easy. Never Expected this. disappointment at it's Peak
hello codeforces)
Congratulations to the winners! Within the next few weeks you will be contacted via private messages with instructions how to receive your prize.
As usual, we used the following two scripts for generating random winners, seed is the score of the winner.