Please subscribe to the official Codeforces channel in Telegram via the link: ×

By KAN, 3 weeks ago, translation, In English,


Tomorrow, at Nov/25/2018 19:35 (Moscow time) we will host the final round of Mail.Ru Cup 2018. The problems were authored and prepared by Codeforces team: me, Dmitry _kun_ Sayutin, Ildar 300iq Gainullin and Mike MikeMirzayanov Mirzayanov, and also Maxim ne0n25 Mezhcheryakov. Huge thanks to Grigory gritukan Reznikov abd Kamil Errichto Debowski for problems' testing!

This round is the final in the new championship called Mail.Ru Cup, you can learn more about it following the link. The round will be rated for everybody!

After the round we will know who will get the following prizes:

  • First place — Apple MacBook Air
  • Second and third place — Apple iPad
  • Fourth, fifth, sixth places — Samsung Gear S3
  • Traditionally, the top 100 championship participants will get cool T-shirts!

In each round, top 100 participants get prize points according to the table. The championship's result of a participant is the sum of the two largest results he gets on the three rounds. The results of the two first rounds are published here. In case of ties in the top six places, they will be broken by the sum of in-round scores in the corresponding (best for the participant) two rounds.

There will be eight problems and two and a half hours to solve them.

Good luck!

P. S. MikeMirzayanov invites everybody to the official Codeforces channel in Telegram:

The round has finished, thanks everybody, hope you liked the problems!

Congratolations to the winners of the third round of Mail.Ru Cup 2018:

  1. Radewoosh
  2. V--o_o--V
  3. ch_egor
  4. ksun48
  5. RAVEman

The results of the Cup will be announced shortly.

The editorial is here.

Read more »

Announcement of Mail.Ru Cup 2018 Round 3
  • Vote: I like it  
  • +198
  • Vote: I do not like it  

By danya.smelskiy, 3 weeks ago, translation, In English,

Hi, Codeforces!

Codeforces Round #524 (Div. 2) will be held on Nov/24/2018 10:35 (Moscow time). The round will be rated for the second division (rating is less than 2100). As usual, participants from the first division will be able to participate out of competition.

You will be given 6 problems and 2 hours and 15 minutes to solve them.

This round was prepared by me, arsijo, and StasyaCat.

Thanks to Markellonchik, iSlava, and I_love_Maria_Ivanova for testing, AHDPIYKO for pictures to the problems, and MikeMirzayanov for wonderful platforms Codeforces and Polygon.

The round is based on the II stage of Ukrainian Olympiad in Informatics, that is why please do not discuss the problems before the system testing start.

UPD: Scoring distribution: 500 — 750 — 1250 — 1750 — 2250 — 2500.

UPD2: Congratulations to the winners:

  1. LingXuan
  2. Laggay
  3. H-C-H
  4. lqs2015
  5. Trrui

UPD3: Editorial.

Read more »

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

By MikeMirzayanov, 3 weeks ago, In English,


As I wrote into a comment, last round we are faced a strong DDOS-attack which ruined the competition. I don't know who did it, I also don't know reasons to do it. I'm very upset about the situation and ready to make effort to be prepared for such issues.

I spend a lot of time to be ready for such incidents.

Here are steps you need to do to be ready for unexpected failures:

  • Join our telegram channel by the link to read urgent news.
  • Be sure that you know the password of your Codeforces account. If you don't remember it, just use the password recovery feature. Please, do it right now.
  • I've implemented a minimalistic website for replacing the main site in case of emergencies. Now you can only read problems, view you submissions (without any details), submit codes. Probably, later I'll add some more features, but anyway the minimalistic version will have only vital features to take part in a contest. I've deployed it in several places, you can visit any of them by the links:,, If any of them is unavailable, just use another. Do not use them if the main website is alive.

Read more »

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

By Ashishgup, history, 3 weeks ago, In English,

Hi everyone!

I would like to invite you to my second Codeforces Round, which I have made with my friend and Snackdown partner Jeel_Vaishnav.

With that said, I bring to your attention our new Codeforces Round #523 (Div. 2) that will take place on Nov/22/2018 18:45 (Moscow time). If your rating is less than 2100, this round will be rated for you; otherwise, you can participate out of competition.

I would really like to thank Jeel_Vaishnav for his help with preparing problems, _kun_ for coordinating our round and Um_nik, gritukan, Aleks5d, Keyuuuu & Mahir83 for testing the problems. I would also like to thank MikeMirzayanov for Codeforces and Polygon platforms.

You will be given 6 problems and 2 hours to solve them. Scoring distribution will be announced later.

Link to My Coding Library for those interested :)

Good luck! :D

UPD: Scoring Distribution: 500-1000-1500-2000-2500-2750

UPD2: Editorial

Read more »

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

By Harbour.Space, 4 weeks ago, translation, In English,

Hello, Codeforces!

We are pleased to announce the 1st "Hello Muscat!" ICPC Programming Bootcamp, organised by Harbour.Space University with Moscow Workshops ICPC in collaboration with Moscow Institute of Physics and Technology, ITMO University, Saint Petersburg State University, GUTech University, and of course Codeforces! The Bootcamp's Gold Sponsor is Phaze Ventures, a venture capital firm and innovation platform based in Oman.

We are inviting all of you to join us during 9 — 15 March, 2019 in Muscat, the capital of Oman, for an intense 7 days of programming! As always, we can't wait to see all of you learn, practice and compete on the international stage, smoothing your road towards the April World Finals in Porto.

How it works: "Hello Muscat!" Programming Bootcamp will run in parallel with the traditional Moscow pre-Finals ICPC Workshop — both Bootcamps' contests will be identical, and contestants will be able to see their position in the General Leaderboard. Every day, both camps will be competing simultaneously, 5,500 kilometers from each other!


Michael Endagorion Tikhomirov will be the Head of Programming Committee for both Muscat and Moscow. The Chief Judge of both camps will be Oleg snarknews Khristenko, and the General Coordinator is Alexey Maleev, the founder of Moscow Workshops ICPC.

All participants will have the opportunity to work under some of the most recognized coaches in the industry: Mike MikeMirzayanov Mirzayanov, Andrew andrewzta Stankevich, Michael Endagorion Tikhomirov, Gleb GlebsHP Evstropov, Artem VArtem Vasilyev, Ivan ifsmirnov Smirnov, Ilya izban Zban, and other world renowned Russian coaches. It will be an important opportunity for teams from all over the world to learn from these well-known and successful coaches in the ICPC world.

You can leave your contact details or register here — you'll be contacted upon registration.

GUtech Campus in Muscat, Oman

The campus is a first-of-its-kind project, and establishes Omani architecture at an international level.

The boot camp in Oman will be available to teams of different skill levels – separated by two divisions of difficulty:

  • Division A. Designed to prepare students to excel and win medals in the next ICPC World Finals.
  • Division B. Designed to help teams prepare for the next season of ICPC Regionals and international competitions. This is an appropriate introduction for teams and students without extensive experience in the world of ICPC and competitive programming competitions in general. The Division B curriculum features thematic lectures and contests.

The participation fee is unchanged: €1270 per person (cultural programme, accommodation and half-board meals included). Single participants and teams must register before 15 December to receive the 15% off Early Bird Discount, or the 20% off Loyalty Discount, which is awarded to teams that participated in previous Hello Programming Bootcamps or Moscow Workshops ICPC Bootcamps.

The final registration deadline is February 25, 2019.


You can ask any questions by email:

Harbour.Space University and Moscow Workshops ICPC collective efforts have resulted in a series of successful programming Hello Bootcamps, which continue to expand across the globe. In order to experience the atmosphere of the events, we suggest you familiarise yourself with the photos and videos from the previous Hello Programming Bootcamps.

Here's a quick recap of the latest 3rd Hello Barcelona ICPC Programming Bootcamp.

Read more »

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

By KAN, 4 weeks ago, translation, In English,

Hi all!

This weekend, at Nov/18/2018 19:05 (Moscow time) we will hold Codeforces Round 522. It is based on problems of Technocup 2019 Elimination Round 3 that will be held at the same time.

Technocup is a major olympiad for Russian-speaking high-school students, so if you fall into this category, please register at Technocup 2019 website and take part in the Elimination Round.

Div. 1 and Div.2 editions are open and rated for everyone. Register and enjoy the contests!

The round was prepared by Alexander Golovanov399 Golovanov, Evgeny white2302 Belyh, Alexandra demon1999 Drozdova, Arsenii senek_k Kirillov, Ivan ifsmirnov Smirnov, Artem komendart Komendantian, Roman Ajosteen Glazov, Daria Dashk0 Kolodzey and me.

Huge thanks to Grigoty gritukan Reznikov, Ildar 300iq Gainullin, Ilia irkstepanov Stepanov, Andrey AndreySergunin Sergunin for testing.

Have fun!

The round is over, we apologize for the issues with platform accessibility. The round is declared unrated.

Congratulations to the winners!

Technocup 2019 - Elimination Round 3

  1. Batrr
  2. Kuyan
  3. paradox
  5. YaDon4ick

Codeforces Round #522 (Div. 1, based on Technocup 2019 Elimination Round 3)

  1. ksun48
  2. FCB1234
  3. LHiC
  4. Um_nik
  5. mnbvmar

Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)

  1. liriKl
  2. Moysenko
  3. mikeweat
  4. fauzdar65
  5. Bismarck

Thank you all for joining!

The editorial is published.

Read more »

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

By MikeMirzayanov, 4 weeks ago, In English,

Hi, Codeforces!

I am glad to announce and invite you to the second launch of my course on algorithms and data structures.

On 7-25 of January, 2019, I will be giving the course "Advanced Algorithms and Data Structures" at Harbour.Space University (Barcelona, Spain). It will be in English, and is not limited to Harbour.Space students — anyone is welcome! Who wants to join?

This course isn't just for Harbour.Space students, it is also open to Codeforces participants, who will be offered a special price, 1000 EUR. The cost does not include travel or accommodation.

Register for the Course →

The curriculum will include a breakdown of algorithms and data structures, a lot of practical exercises, and emphasis not only on the correctness, but also the beauty and structure of the code. My goal is to make classes that are useful and interesting for both those who want to understand the fundamental CS, and for those interested in programming competitions. And of course, we will have the opportunity to meet and talk. I look forward to share stories about the history of Codeforces and future development plans.

The course will consist of three weeks of intensive training, 5 days in each week, 3 hours per day. The program includes daily lectures and practical exercises. It will not be boring for sure!

Here is the expected course outline:

Week Day Topics
1 1 Heap data structure, heap properties and operations. HeapSort. Priority queue. Other heap applications. Mergeable heaps: binomial heap, pairing heap, randomised meldable heap.
1 2 Fenwick tree. Description and motivation. Implementation of Fenwick tree. Generalisation for higher dimensions. Skip list data structure. Implementation details. Indexable skiplist.
1 3 Segment trees. Top-down implementation. Bottom-up implementation. Segment trees applications. Persistent data structures. Persistent stack, persistent array. Persistent Fenwick and segment trees.
1 4 Cartesian trees, treap data structure. Merge and split operations. Treap implementation in detail. Treap applications.
1 5 Treaps with implicit keys. Ropes. Segment reverse operation. Examples of problems.
2 6 Introduction to strings. String searching (matching) problem. Pattern pre processings. Z-function, prefix-function. Their applications. Knuth–Morris–Pratt algorithm. Matching finite state machine.
2 7 Multiple pattern matching. Trie data structure. Aho-Corasick algorithm. Implementation details. Dynamic programming on a trie.
2 8 String hashing. Rabin-Karp algorithm. Fast substrings comparison with hashes. Suffix array. LCP array. Efficient construction algorithm. Applications.
2 9 Suffix tree. Ukkonen's algorithm. Suffix tree construction from LCP array. Suffix tree applications.
2 10 Suffix automaton. Size bounds. Linear Algorithm. Using suffix automata as an index for approximate string searches.
3 11 Introduction to automata theory. Formal languages. Context-free languages. Formal grammars. Context-free grammars. NFA, DFA, convert NFA to DFA. Build automaton by regular expression.
3 12 LL(1) parser. Arithmetic expressions parsing. Shunting-yard algorithm. Simplified Pascal language parsing and interpretation.
3 13 Algorithms for traversing a graph. DFS. Properties. DFS search tree. Edges classification. Linear bridge-finding algorithm. Linear articulation points finding algorithm. Strongly connected components. Tarjan's strongly connected components algorithm.
3 14 Tree problems. Bottom-up approach. LCA problem. LCA algorithms.
3 15 Bipartite graphs. König’s criterion. Problems: maximum matching, minimum edge cover, maximum independent vertex set, minimum vertex cover. Connection of the problems. Berge's lemma. Kuhn algorithm. Kuhn algorithm properties. Minimal vertex cover by maximum matching. Cover DAG by minimal number of paths.

Harbor.Space University is located in Barcelona (Spain). For users of Codeforces, Harbour.Space is known for active participation in the life of the community of sports programming (partnership with Codeforces in the framework of Educational Rounds). The main activity of the university is teaching (there are bachelor's and master's programs) in the following areas:

  • Maths as a Second Language
  • Computer Science
  • Data Science
  • Cyber Security
  • Interaction Design
  • Digital Marketing
  • High Tech Entrepreneurship
  • FinTech
  • BioTech
  • Aerospace Engineering
  • SuperCities UrbanTech

Harbour.Space is also proud to announce the Scholarships to study Msc in Robotics in Barcelona. Follow this link for more information about the opportunity and application process.

Register for my upcoming course via this link.


Read more »

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

By Vovuh, history, 4 weeks ago, translation, In English,

I am so sorry about very long gaps between the contests but I really don't have enough time to prepare the problems. So...



Codeforces Round #521 (Div. 3) will start at Nov/16/2018 17:35 (Moscow time). You will be offered 6 or 7 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. Probably, participants from the first division will not be at all interested by this problems. And for 1600-1899 the problems will be too easy. However, all of you who wish to take part and have rating 1600 or higher, can register for the round unofficially.

The round will be hosted by rules of educational rounds (extended ACM-ICPC). Thus, during the round, solutions will be judged on preliminary tests, and after the round it will be a 12-hour phase of open hacks. I tried to make strong tests — just like you will be upset if many solutions fail after the contest is over.

You will be given 6 or 7 problems and 2 hours to solve them.

Note that the penalty for the wrong submission in this round (and the following Div. 3 rounds) is 10 minutes.

Remember 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 participants of the third division, you must:

  • take part in at least two rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Thanks to MikeMirzayanov for the platform, help with ideas for problems and for coordination of my work. Thanks to my good friends Mikhail PikMike Piklyaev, Maksim Ne0n25 Mescheryakov and Ivan BledDest Androsov for help in round preparation and testing the round.

Good luck!

I also would like to say that participants who will submit wrong solutions on purpose and hack them afterwards (example) will not be shown in the hacking leaders table.



Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 diolG 7 173
2 lyzqs 7 228
3 pvviet001 7 241
3 LVL 7 241
5 lukameladze1 7 250

Congratulations to the best hackers:

Rank Competitor Hack Count
1 PikMike 153:-6
2 ______-__________-______ 186:-85
3 knowbody 128:-6
4 Laggay 113:-6
5 Marcosk 66:-6

1359 successful hacks and 755 unsuccessful hacks were made in total!

And finally people who were the first to solve each problem:

Problem Competitor Penalty
A Laggay 0:01
B Laggay 0:03
C Programmist_111 0:05
D Laggay 0:12
E Programmist_111 0:12
F1 happ1 0:29
F2 Radko 0:32

UPD2: Editorial is published!

Read more »

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

By JATC, history, 5 weeks ago, In English,

Hi everyone. I'm glad to announce that the Codeforces Round #520 (Div. 2) will be held on 14.11.2018 18:35 (Московское время).

The round will be rated for Div 2 participants (whose ratings are lower than 2100). However, all the other participants can compete as well, without worrying about ratings being changed.

You will be given 2 hours to solve 6 problems. It's better to read all the problems. The scoring distribution will be announced soon before the contest starts.

All the problems were prepared by myself, with some help from my friend GiraffeCoder. I want to thank _kun_ for coordinating me in preparing the problems, gritukan, isaf27, demon1999 and Arpa for testing my solutions. I also want to thank csacademy for their graph editor tool. You can check it out at this link.

This is the first round I propose. I put a lot of work into it so I hope that you will enjoy it (smiley face).

Wish you do your best and get a high rating!

Update 1: If you want to discuss about the problems after the contest, here is the link to the CP Community on Discord. Please make sure that you don't give the solutions to other participants during the contest.

Update 2: The score distribution will be the standard one: 500 1000 1500 2000 2500 3000.

Update 3: Congrats to the winner

Official participants:

  1. I_Love_Kirino

  2. Dark_Warlock

  3. wcysai

  4. coriander

  5. fcwwww

Unofficial participants:

  1. BudAlNik

  2. HIR180

  3. KrK

  4. ayaze

  5. FCB1234

Tutorial UPDATED

Read more »

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