Hello, Codeforces!
We are happy to invite you Baozii Cup 3, which will take place on Jan/25/2026 08:00 (Moscow time).
You will have $$$5$$$ hours to solve $$$13$$$ problems, including at least one interactive problem.
This is a team contest following ACM/ICPC rules, with teams of up to $$$3$$$ members. The penalty for an incorrect submission is $$$20$$$ minutes.
The standings will be frozen for the last $$$60$$$ minutes of the contest.
Most problems are created and prepared by me, with help from Bronya_H, zeemanz, and 0.1w33hw3.
We would like to thank:
MikeMirzayanov for creating the fantastic CodeForces and Polygon platform.
SSerxhs, SATSKY_2025target_LGM, -WIDA-, fatalerror, and itsiftikar02 for testing the round and providing valuable feedback.
-firefly- for generously letting me copy his Soy Cup #2: Vivian announcement.
fatalerror for preparing the invitation letter.
Tobo for being the biggest ^(* ̄(oo) ̄)^ in history.
You for participating in the round!
Registration
If you are living in China or have a WeChat/QQ account, you may register by filling in this form. Otherwise, you may register by filling in this form. Please do not fill in both forms.
Notes
You may attempt past contests at Baozii Cup 1 and Baozii Cup 2.
If you have any queries regarding the contest, please send a private message on either Codeforces or WeChat.
Good luck and have fun!
UPD 1: Everyone who has registered should have received an invitation link in their private messages. Please message me if you are not invited.
UPD2: Here is the contest link: Baozii Cup 3. If you didn’t register for the contest, you may also view the scoreboard via the link above.
UPD3: Note that rules about third party code for Codeforces still apply in this contest. If you are found out using LLM-generated code, you will be sent to cry's basement. For any queries regarding problem statements, please ask in the clarifications section.
UPD4: The contest has ended. The problems have been uploaded to gym. Please leave any feedback in the comments section!








Auto comment: topic has been updated by __baozii__ (previous revision, new revision, compare).
Will __baozii__ crossdress?
Unfortunately no
Hope to solve at least one problem:)
I love the biggest ^(* ̄(oo) ̄)^ :)
As Baozii Cup's coordinator, I prepared the contest invitation letter. I intended to make serious things interesting in order to attract more people to participate, so I imitated the format of the invitation letter for ICPC EC final, and added various memes that CP contestants could understand. Hope you like it, and hope everyone would learn something more or less in Baozii Cup!
As a tester, I love the biggest ^(* ̄(oo) ̄)^
your god is coming!
As a participant, I can confirm Tobo is indeed the biggest ^(* ̄(oo) ̄)^ in history.
Auto comment: topic has been updated by __baozii__ (previous revision, new revision, compare).
Auto comment: topic has been updated by __baozii__ (previous revision, new revision, compare).
Auto comment: topic has been updated by __baozii__ (previous revision, new revision, compare).
Auto comment: topic has been updated by __baozii__ (previous revision, new revision, compare).
Hi can i join this?
You can register by filling in the google forms.
Is using multiple computers per team allowed?
I just filled the registration form. I still couldn't access the contest. How do I join the contest now?
Auto comment: topic has been updated by __baozii__ (previous revision, new revision, compare).
could someone explain how to do A
For each node $$$u$$$, compute the deepest node outside its subtree, then efficiently sum how the tree depth changes when reattaching $$$u$$$ under all valid $$$v$$$, which are exactly the nodes outside the subtree of $$$u$$$, which is at most two ranges in Euler order, so problem ends up reducing to simply summing $$$\sum_{} \max({m_{u}, d[v] + k)}$$$ where $$$k$$$ = $$$h[u]$$$ $$$-$$$ $$$d[u]$$$ + 1.
Submission for A (AC): Submission