Топ комментариев
На jeroenodb → NWERC 2026 Mirror, 2 дня назад
+24

Bump

I haven't reached to WF yet, but I signed the petition as ICPC contestant

На wrusb → Christmas is coming, 41 час назад
+20

Now here's my gift for Christmas: GTA 6 in browser

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 40 часов назад
+17

Defintely the fastest editorial

На simonlindholm → Floating-Point Contest, 23 часа назад
+16

Does anyone know how to solve problem B?

I thought that there were $$$2^{64}(1-\epsilon)$$$ possible values of $$$x$$$, thus requiring $$$64$$$ queries.

На yunoo_ → The 1st day of winter—time to write to Santa., 6 часов назад
+15

Dear Santa Claus, I want OpenAI and Antropic to go bankrupt in 2027.

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 35 часов назад
+14

Problem H has an interesting linear algebraic interpretation:

Spoiler
На adamant → OCPC 2027 Winter Europe, 12 часов назад
+14

nigga nigga nigga

На adamant → OCPC 2027 Winter Europe, 35 часов назад
+13

bro could not get anybody in discord to join so the cf post was necessary

Yeah, you must learn in a way that you can teach that topic (e.g. data structures or algorithms) to other people with ease. But I guess you will develop your own approach that is best for you in your journey, just like I did.

На nigger_boy → [Trick] The Virtual Heavy-Light Decomposition, 45 часов назад
+9

enjoy the ban

На KurtHasan → My steps to contibution -150. Day 3., 44 часа назад
+9

nice profile picture

На wrusb → Christmas is coming, 40 часов назад
+9

count your days, duyminh

На ItsNotMeItsYou → I GOT 400,000,000th SUBMISSION, 44 часа назад
+8

400 million submissions and bro is still hungry for more

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 40 часов назад
+8

Bad C

+5

I gave this to a bunch of AI agents and they claim to have improved the upper bound:

  • Without index splits (fixed values): tight $$$\Theta(\log n)$$$ amortized transitions per operation.
  • All operations: $$$\exp(O(\sqrt{\log n})) = n^{o(1)}$$$ amortized transitions per operation (only beats $$$\sqrt{n}$$$ for huge $$$n$$$, roughly $$$n \gt 2^{50}$$$).

They couldn't find a superlogarithmic lower bound, so I'm guessing it really is $$$\Theta(\log n)$$$. Alleged proofs are here (no idea what they say): https://gist.github.com/caterpillow/1d2d9b29972fe0a10d6683a67899fd21

На 74TrAkToR → Codeforces Round 1137 (Div. 2) Разбор, 15 часов назад
+5

By the way, there is also a direct $$$O(n \log n)$$$ way to do E, instead of the $$$O(n \log^2 n)$$$ small-to-large. I figured I might mention the idea as it wasn't in the editorial and I'm not sure I have seen it discussed in many places, together with the proof.

It starts in the same way — keep, for every match, the set of athletes that can still win it, but stored as a treap keyed by athlete number. At match $$$k$$$ with children sets $$$X$$$ and $$$Y$$$, an athlete $$$x \in X$$$ can win iff $$$x \lt \max(Y) + d$$$ (and symmetrically for $$$Y$$$). So we split off the suffix of $$$X$$$ with keys $$$\ge \max(Y) + d$$$, and the same for $$$Y$$$. Everyone we cut off is eliminated at match $$$k$$$, so their answer is $$$dep_x - dep_k$$$, where $$$dep$$$ is the number of matches above a node. We walk the cut-off treap in $$$O(\text{size})$$$ to record those answers, which is fine as every node is cut at most once.

Now the main part. We need to merge what's left of $$$X$$$ and $$$Y$$$, where the naive way is to iterate the smaller one and insert everything one by one. There is an alternative way to do this though, by making an "unordered" merge: the root with the higher priority splits the other treap by its key, and we recursively do an unordered merge on both sides.

Why it's $$$O(n \log n)$$$. The $$$a$$$ elements of the smaller set cut the bigger one into at most $$$a+1$$$ runs of sizes $$$g_1, g_2, \dots$$$ with $$$\sum g_i \le b$$$, and the unordered merge pays about $$$\log(g_i + 1)$$$ to skip each run (in expectation for treaps). By concavity of $$$\log$$$ this is maximized when all runs are equal, so a merge of sizes $$$a \le b$$$ costs $$$O(a \log \frac{a+b}{a})$$$. Let's re-charge this cost to the elements of the smaller set instead, or $$$\log \frac{a+b}{a}$$$ each. For a fixed athlete, this can be thought of as $$$\log \frac{\text{new size}}{\text{old size}}$$$ of its own set, so its charges telescope. If its set grows $$$1 \to s_1 \to s_2 \to \dots \to s_m$$$, it pays $$$\log s_m \le \log n$$$ in total. When it's on the larger side, it pays nothing. Summing this across athletes, we get the $$$O(n \log n)$$$.

The above is already implementable, but the solution I described also cuts the athletes that can no longer win, so a set can shrink and later grow back, which somewhat breaks the telescoping argument. Think of an athlete's total charge as the total increase of $$$\log(\text{size of its set})$$$: without cuts this is at most $$$\log n$$$, and with cuts we additionally pay at most the total decrease. When we cut $$$k$$$ out of $$$s$$$ elements, each of the $$$s-k$$$ survivors loses $$$\ln \frac{s}{s-k}$$$, which sums to $$$(s-k)\ln\left(1 + \frac{k}{s-k}\right) \le k$$$ using one of our faviorite inequalities $$$\ln(1+t) \le t$$$. So a cut costs at most one unit per removed athlete, and since every athlete is removed once, all cuts add only $$$O(n)$$$. The splits themselves are implemented in $$$O(n \log n)$$$ and the walks over cut-off parts add $$$O(n)$$$, so the total is still $$$O(n \log n)$$$.

Implementation is here: 400424364.

На Subingbupt → Merry Christmas!, 15 часов назад
+4

larp

На xaytbaev.s → Start Of YouKn0wWhoAcademy Journey, 11 часов назад
+4

I would recommend using usaco guide instead. Both are free and usaco guide is more condensed and from what I’ve seen from youknowguide, following it as a guide rather than a reference takes way too long and will spend a lot of time on algorithms that are either extremely advanced or not very useful (although you will have a very complete toolkit of algorithms at the end). To me it feels more like a Wikipedia where specific things may be useful from time to time but knowing everything within it doesn’t make a ton of sense.

На towersfreak2006 → CF Div. 2 and M(IT)^2, December 6, 6 часов назад
+4

I approve the msg

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 38 часов назад
+3

I loved solving F, very nice problem. Orz sunbrey

the wait is over, mac beta is out now :D

vim mode is in since 1.4.0, its in Settings > Editor :D

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 21 час назад
+3

My comment might help you understand that.

На sunbrey → Codeforces Round 1138 (Div. 3), 45 часов назад
+1

Here is how you can solve E problem.

First observation: Distance travelled by Aubrey is of the form $$$2^0 + 2^1 + 2^2 + ...$$$ until she gets flustered (distracted) by Sunny's compliment and starts again like $$$2^0 + 2^1 + 2^2 + ...$$$ adding up to the previous distances traversed by her. Hence we can say that Aubrey's total distance is of the form $$$\left(\underbrace{11111\ldots}_{\text{few times}}\right)_2+\left(\underbrace{11111\ldots}_{\text{few more times}}\right)_2+\left(\underbrace{11111\ldots}_{\text{few more times}}\right)_2+...$$$ and so on. Also the total number of $$$1$$$'s in this expression is the number of rounds for which they have played. Also the number of terms of the form $$$\left(\underbrace{11111\ldots}_{\text{few times}}\right)_2$$$ is equal to $$$k$$$ because $$$k$$$ is the number of times Sunny can compliment Aubrey to distract her.

Second Observation: Now let's fix the number of rounds we are going to have. Let's have $$$mid$$$ number of rounds (Binary search is coming). This simply means that we have $$$mid$$$ number of $$$1$$$'s to use in the expression for Aubrey's distance. And talking about Sunny, he would have travelled a distance equal to $$$mid \times x$$$. Our goal is to minimize the distance distance covered by Aubrey after $$$mid$$$ rounds (because we don't want her to takeover Sunny). It turns out that if we divide the $$$mid$$$ number of $$$1$$$'s we had into $$$k$$$ groups such that each group has almost equal number of $$$1$$$'s, minimum value of Aubrey's distance is achieved in the expression of the first observation. All we need to do is to make sure that this minimum value is less than Sunny's final position, i.e., $$$a+mid \times x$$$.

(I have not discussed how to divide evenly the $$$mid$$$ number of $$$1$$$'s into $$$k$$$ groups to achieve minimum distance because I want you to think and spend time on this).

Third Observation: This is a simple one. If Aubrey can takeover Sunny after $$$mid$$$ rounds, she can do that after $$$mid+1$$$ rounds also. This means that we can binary search on the number $$$mid$$$.

This is my code for your reference:

#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define endl '\n'
void solve(int test) {
    int A, X, K; cin >> A >> X >> K; 
    K++;
    int ans = 0; 
    int l = 0, r = 30*(K); 
    while (l <= r) {
        int m = (l + r) >> 1; 
        int q = m/K; 
        int rem = m%K; 
        if (q >= 63) {r =m-1; continue;} 
        int val1 = rem * ((1LL << (q+1))-1) + (K-rem)*((1LL << q)-1); 
        int val2 = A + m*X; 
        if (val2 > val1) {ans = m; l = m + 1;}
        else {r = m-1;}
    }
    cout << A + ans*X << endl;
}
int32_t main () {
ios::sync_with_stdio(false); 
    cin.tie(nullptr);
    auto start = chrono::high_resolution_clock::now(); 
    int T = 1; 
    cin >> T; 
    for (int i=1; i<=T; ++i) {
        solve (i); 
    }
    auto end = chrono::high_resolution_clock::now();
    auto duration = chrono::duration_cast<chrono::microseconds>(end-start);

    cerr << "Execution time: " << duration.count()/1000.0 << " ms\n";
    return 0; 
}

Yes, I agree, the questions have stayed the same but the ratings are different. That's why I said the current CP-31 sheet is not that helpful, it basically helps you with questions from 500-1500 instead of 800-1900.

Why I said TLE staff should take newer contests is because (I checked) all their members have only taken old contests and have stopped, they aren't aware of how problems are recently. While the CP-31 sheet is free, they provide paid courses for competitive programming. All I'm saying is if my educator hasn't taken contests recently, i don't have confidence that they are rated well with today's ratings so I would not spend money buying the course.

Priyansh31dec — Last contest August 2022 (Oldest)

431jericho — Last contest April 2024

khnhcodingkarlo — Last contest April 2024

AnikateKoul — Last contest August 2024

ninjacoder2209 — Last contest December 2024

Soumojitkgp — Last contest October 2025

tushar19280 — Last contest January 2026

Iamsadscam01 — Last contest April 2024

Hardikaswal — Last contest Nomber 2026

Leelasai_2004 — Last contest January 2026

CoderAbhi27 — Last contest November 2026

Most of the staff (with an exception of 4) haven't taken recent contests to know what is required to move up in ranking.

На sunbrey → Codeforces Round 1138 (Div. 3), 42 часа назад
+1

it should have been me! not sunny

На wrusb → Christmas is coming, 40 часов назад
+1

Which means I can change my username and disguise myself as LGM again:)

На KurtHasan → My steps to contibution -150. Day 3., 39 часов назад
+1

Thanks.

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 38 часов назад
+1

Glad you liked it !

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 22 часа назад
+1

In C its proven that alternating strings are impossible, but why not for all other combinations? This isn't immediately obvious to me because a possible one can still be made impossible

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 22 часа назад
+1

C is easy to be honest...

На sajad → Do you listen to music while solving problems?, 13 часов назад
+1

yeah, i listen rock music while I'm coding :)

first thing i did when it came out https://caterpillow.github.io/byot

Hello, thank you for the interest!

Currently, we have no plan on uploading the problemset to Gym. However, we will share all the problem's component in a public github repo (similar to the previous years), and feel free to deploy it on whatever OJ you need!

I will inform you whenever it is finished.

На towersfreak2006 → CF Div. 2 and M(IT)^2, December 6, 5 часов назад
+1

No reason not to move it back to Saturday

На towersfreak2006 → CF Div. 2 and M(IT)^2, December 6, 5 часов назад
+1

interesting

На theoneandonlytron → General Practice 1600 — 1900, 4 часа назад
+1

Auto comment: topic has been updated by theoneandonlytron (previous revision, new revision, compare).

На Mahfuz_56 → Help me, 2 дня назад
0

ee bruh bitta daun akkauntimdan yozvorgan ekan

tysm ^.^

На sunbrey → Codeforces Round 1138 (Div. 3), 2 дня назад
0

When is the editorial arriving?

На sunbrey → Codeforces Round 1138 (Div. 3), 47 часов назад
0

Thank youuu

На Mahfuz_56 → Help me, 47 часов назад
0

why is someone with 1 contest is giving advice to someone with 50 contests.

На sunbrey → Codeforces Round 1138 (Div. 3), 46 часов назад
0

Where is the editorial

Auto comment: topic has been updated by Zanite (previous revision, new revision, compare).

Go away N1GGA let us sleep peacufully

На Mahfuz_56 → Help me, 46 часов назад
0

can u please guide me how to optimally use usaco guide

На MathModel → Invitation to Eolymp Blitz #29, 46 часов назад
0

Starts in ~2 hours

На BledDest → Kotlin Heroes 15 Announcement, 46 часов назад
0

Syria mentioned. Let's goooo!

Can u also archive the whole problemset in the Codeforces Gym too? I'd appreciate it ._.

На cumbaackkk → Does codeforces just skip submissions?, 45 часов назад
0

Auto comment: topic has been updated by cumbaackkk (previous revision, new revision, compare).

0

steps to -300 contribution, day 1! DOWNVOTED!

0

mambo like your name. and are you hola_grifin

На Wilfredtomato → What tasks should i do to improve , 44 часа назад
0

All the problems here: https://qoj.ac/category

На MathModel → Invitation to Eolymp Blitz #29, 44 часа назад
0

Starts in 15 minutes

0

...I hope you will very much consider deleting this post (and changing your username later this year) after realizing how much it has contributed to the ratism """problem""". Either that or getting banned, whichever comes first.

На Faraz → What's happening to me..., 44 часа назад
0

U can give ur handle to claude then tell it about ur stuck, it will analyze ur work then he will give u a plan.

На Wilfredtomato → What tasks should i do to improve , 44 часа назад
0

i don’t think 2026 noip T4 falls into this category lol (in terms of implementation difficulty)

0

I wonder how to settle the problem C, and I have asked the AI but I can't understand what it said

На Proofy → [Tutorial] Abstract Proofs of DP Algorithms, 43 часа назад
0

It seems like all DP is fundamentally just proved by induction.

tbank is right. If you have a non-EU bachelor's degree, the committee decides whether to accept it for admission to PhD.

Since your profile says SUST, I should mention that we already have a precedent for Bangladesh. A 4-year Bangladeshi BSc was previously declared sufficient for access to our PhD program. We have also accepted Russian and Pakistani BScs in the past.

Usually, for countries without a precedent, if you can do a PhD in your own country without a master's, then GSSI will allow it, too. If not, then the committee has to deliberate further and look deeper into the contents of your degree and courses.

0

When are you going to send the steps to claim prizes?

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 42 часа назад
0

for last point I just changed my used language from python to c++ so thats why I wanted to say about that lol

can someone explain me "B" as my way of thinking is that there is only one way Alice wins if there is a x with frequency of x == 2*k-1 other wise BoB wins but this is not working. Can someone tell me what am i missing.

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 41 час назад
0

its flagging my go template

function init() is defined but never called: extra code is often added to fool plagiarism checks

which is a false flag since init() is called by the go runtime automatically

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 41 час назад
0

Code analysis feature is quite new , I'll look into why default templates get flagged , anyways thanks for feedback.

ok but how will be my life after I finish Phd? If I want to pursue TCS rest of my life and also survive on that how does that look like?

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 40 часов назад
0

Why are there no comments?

На wrusb → Christmas is coming, 40 часов назад
0

You're welcome

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 40 часов назад
0

For some reason it shows the very first contest I took part in(in which I got no problems right with 3 WAs) as a high probability of cheating.

Could this be because of an overly aggressive bias against new accounts? Anyway, I wish you luck on developing this, hopefully one day it can help solve some problems in codeforces.

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 40 часов назад
0

actually , it is because you are a relatively new account with small amounts of submissions. during the training model found a suspicious amount of people that have a high rating while having little to no ACs(except for contests they participated in). So yes there is a small amount of bias , but this bias came from large amount of suspicious accounts

Anyways thanks for feedback

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 40 часов назад
0

I've checked your account , you are pretty legit contestant , and you are way below threshold so there is nothing to worry about , but why do you always start your python code with https://usaco.guide/general/io ?

На wrusb → Christmas is coming, 40 часов назад
0

hello

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 40 часов назад
0

one of the best rounds ive had the pleasure of solving! F and H felt soo hard :c

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 40 часов назад
0

I use an online coding site created by a group that creates material for the United States of America Computing Olympiad(USACO) that lets you run stuff like test cases inside the editor, and whenever you open a new program this:

# Source: https://usaco.guide/general/io

a, b, c = map(int, input().split())
print("The sum of these three numbers is", a + b + c)

is what's open in the editor, so I delete everything except for the top line and write my code. I don't keep the top line for any particular reason, it's just by habit.

На Dardy → [Tutorial] Catalan Numbers and Catalan Convolution, 39 часов назад
0

For the CSES Bracket Sequences II, One could treat them as counting the number of trajectories from the point at which the prefix ends (say) $$$(a,b)$$$ to the pont $$$(n,0)$$$ such that it doesnt cross the x-axis.

Now via reflection principle (reflect it along $$$y=-1$$$), it is the same as finding the number of trajectories from $$$(a,b)$$$ to $$$(n,0)$$$ minus the number of trajectories from $$$(a,b-2(b+1)$$$ to $$$(n,0)$$$

So the answer is simply

$$$\binom{n-a}{\frac{n+b-a}{2}}-\binom{n-a}{\frac{n+b-2b-2-a}{2}}$$$

Note $$$n$$$ is even.

На zDooriqz → Behavioural Anti-Cheat System , WetShore, 39 часов назад
0

Oh ok

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 39 часов назад
0

can anyone tell in question E test case a = 5 x = 1 k = 3 how 13 is coming because when i am dry running its comming 11 . I am checking if aubrey is smaller than sunny when aubrey reaches or exceeds sunny i am resetting v to 1 when k is not 0 if k reaches 0 then break

На sunbrey → Codeforces Round 1138 (Div. 3), 39 часов назад
0

Dear Codeforces Support Team,

I am writing to sincerely appeal for the unblocking of my account, GoldenFishKnight. I was deeply saddened to find that my account has been disabled. I firmly believe this is a false positive, and I would like to explain the circumstances that might have triggered your security system.

After browsing similar cases in the community, I suspect my account was flagged due to the following reasons:

  1. Unintentional VPN Usage (IP Change): I am currently located in Mainland China. During my participation in the recent contest, I forgot to turn off my VPN (proxy). As a result, my login IP appeared to be from Hong Kong. I completely understand that Codeforces has strict rules against IP fluctuations to prevent cheating, but this was purely an unintentional mistake on my part.

  2. Sudden High Performance and Account History: I understand that my sudden high rank in this contest might look suspicious. To be completely transparent: I actually had an old Codeforces account a couple of years ago, but because I stopped participating for the last two years, I completely forgot its password and cannot recover it. Therefore, I created this new account.

However, I am NOT engaging in multi-accounting or cheating. This is the only account I am currently using. The reason I achieved a high score is that although I stopped playing on Codeforces, I have been training rigorously on other platforms over the past two years. I have attached screenshots of my LeetCode (China site) weekly contest stats as proof.    As you can see, I ranked 56th in Contest 421 and 84th in a recent contest. This proves that my recent high performance on Codeforces is the result of my genuine, long-term hard work and consistent practice, not any form of cheating or unauthorized assistance.

I deeply respect the Codeforces community and the rules of fair competition. I apologize if my negligence regarding the VPN caused any trouble for the administration, and I promise to be extremely careful and ensure my network is clean for all future contests.

I kindly request a manual review of my account and my submission history.

Thank you for your time and understanding. I look forward to your reply.

Best regards, GoldenFishKnight

MikeMirzayanov

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 38 часов назад
0

You get 13 instead of 11 because Sunny can give a compliment in a round before Aubrey reaches him, rather than waiting for her to catch up :3

Rule "Only participants who entered a valid ICPC username (email address) during registration are eligible for recognition as a Challenge winner".

However, no email address was asked. Is it taken from the codeforces account?

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 38 часов назад
0

Great contest!

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 38 часов назад
0

Thanks ! :3

На DuyMinh3005 → I apologize..., 38 часов назад
0

Sorry if I am necroposting but I just realised today that I have a Propose a contest/problem option!

And the number of rated contests I have given so far are 38, so the hypothesis that at least 100 contests are required is not true, at least as of 29-11-2026

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 38 часов назад
0

How to improve in dp?

Can you add link of cf Gym, where we can submit problems there pls

На FirstImpression → A way to explain SAM (Suffix Automaton)?, 37 часов назад
0

Orz, this view of SAM is really helpful. Great post!

На Mahfuz_56 → Help me, 37 часов назад
0

Solve so problems and make sure you learn something new every time.

I created this website (https://antinloop.com/games) and it has many games to help you understand how an algorithm or a data structure works, try it out.

Do not overspend time on it just try to learn something that help you solve a problem, remember your goal here is to enhance your problem solving skills,

На sunbrey → Разбор Codeforces Round 1138 (Div. 3), 37 часов назад
0

thankyou

На FirstImpression → A way to explain SAM (Suffix Automaton)?, 36 часов назад
0

I hope this helps you.

  1. step by step demo and you can use custom input and see how it works https://antinloop.com/algorithms/suffix-automaton/demo

  2. An exercise on the extend function to help you understand what is going on https://antinloop.com/games/suffix-automaton?mode=extend

  3. An exercise on the query function https://antinloop.com/games/suffix-automaton?mode=query

Auto comment: topic has been updated by stuwupidwjbu (previous revision, new revision, compare).

mac beta is finally out, run brew install gcc first and tell me if anything breaks :D

На 74TrAkToR → Codeforces Round 1137 (Div. 2) Разбор, 35 часов назад
0

Use next smaller and prev smaller elements concept of monotonic stack.

This gives u a boundary. left=i-pse[i]-1 right=nse[i]-i-1

Now total is n(n+1)/2- Summation of (((left+1)*(right+1)-2)) over all i

hey the mac version is here now, still beta tho, hope ur CF journey is going well :D

Thank you! lemme try it out

thanks

fixed since 1.5.1, my guess about PATH was wrong, it was the astyle that came with the app. sorry about that

this one is fixed since 1.5.1 too, tell me if its still laggy for u

cerr has its own Stderr card next to the output now, its a panel and not an error.txt file tho, does that work for u