By MikeMirzayanov, 12 days ago, translation, In English,


As an allowed language on Codeforces and Polygon C++17 has been added. The compiler we use is 32-bit mingw64 version 7.2.0 (later will be updated when new versions are released). We are using a patch from halyavin to speed up I/O when using scanf/printf (for more details, read here). The exact used distribution can be installed on Windows from our package manager called PBOX using the link

The exact compilation command line is:

g++.exe -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++17 -o %name%.exe %1 2>compilation.log

Wish you successful solutions in C++17,

Read more »

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

By GreenGrape, 2 weeks ago, translation, In English,

Hello, Codeforces! Haven't seen ya for a while :D

Codeforces Round #461 will take place on Wednesday, 20:15 MSK. Note that the round is scheduled a bit later than usual.

The round will be rated for all division 2 participants. Division 1 is heartly welcome aswell :)

My gratitude to Kolya (KAN) for round coordination, Grisha (gritukan), Oleg (x3n), AmirReza (Arpa) and Senya (senek_k) for testing and Mike (MikeMirzayanov) for awesome Codeforces and Polygon. A special thanks goes to Dima (mitterr1999) and Camille (pseuda) for sharing a problem sketch with me.

The main character of this round will be Imp the playful monster. Yet the statements are guaranteed to be short :)

There will be six problems with the following scoring:
500 — 1000 — 1250 — 1500 — 2000 — 2750

GL & HF!

Note that the round has been moved 40 minutes later to avoid clashing with CSAcademy Round.

UPD. The contest is over. Well...

UPD. System testing is over! Editorial.

Congratz to the winners!

Div. 2:

  1. sorry-haghani
  2. spec4r
  3. SashaShlyapik
  4. belic
  5. 4783992

Div. 1 (unofficial):

  1. dotorya
  2. Vercingetorix
  3. dreamoon
  4. kmjp
  5. FCB1234

UPD. The complete editorial is out (D/F).

Read more »

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

By BledDest, history, 3 weeks ago, translation, In English,

Hello, Codeforces!

On February 02, 17:35 MSK Educational Codeforces Round 37 will start.

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

As usual, the round will be rated for Div. 2. It will be held on extented ACM ICPC rules. After the end of the contest you will have one day to hack any solution you want. You will have access to copy any solution and test it locally. You will be given 7 problems and 2 hours to solve them.

The problems were prepared by Mikhail PikMike Piklyaev, Vladimir Vovuh Petrov, Adilbek adedalic Dalabaev and me. One of the problems was proposed by unbelievable02.

Good luck to all participants!

I also have a message from our partners, Harbour.Space University:

We are happy to announce the addition of two new coaches to our Hello India x Russia Programming Bootcamp: Gleb GlebsHP Evstropov, Artem VArtem Vasilyev and Filipp DPR-pavlin Rukhovich will all be attending at our India location, Amrita School of Engineering.

We look forward to seeing you all there this spring! For those of you who haven't registered, there's still time.

The Early Bird discount will be set at 20% for those who register before February 12th, 2018.

If you have any questions we can help you with, please connect with us:

Phone number: +34 674 291 422 Email Address:

UPD. Editorial is here.

Read more »

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

By ArtDitel, history, 3 weeks ago, translation, In English,

Hey Codeforces!

We’d like to invite you to take part in our AIM Tech Mini Marathon 1 to be held this Thursday on the 1st of February at 7 pm MSK.

This is unrated competition. All the participants will be challenged with only one problem, which doesn’t have a fast and full solution and 3 hours to solve it. Solutions will be evaluated independently on each test. The exact formula of points per test will be given in the problem statement. The score for the contest is a sum of scores for each test. You can participate in contest as a team, 3 members maximum.

All the tests will be released at the very beginning of the competition. They will be used both for preliminary and final testing. You will be also provided with a checker and a visualizer, written in Python3. You can find environment setup instruction below. Local checker and vizualizer run is optional, but could help finding the solution. Your solution can be written in any language that is supported by codeforces.

AIM Tech Mini Marathon 1 will take place during the Petrozavodsk training camp, which is traditionally sponsored by AIM Tech. At the end of the competition first five teams will be awarded with AIM Tech T-shirts.

The Marathon was prepared by AIM Tech team: ArtDitel, Kostroma, SirShokoladina, zeliboba, Edvard, zloyplace35.

Special thanks to Mike Mirzayanov MikeMirzayanov for Codeforces and Polygon and to the problems coordinator Nickolay Kalinin KAN for his help with the competition arrangements.

AIM Tech is a high frequency trading company based in Moscow. The key words that describe the essence of our work are big data, low latency and HFT. Effective C++ coding, algorithmic mindset and the mathematical intuition are all very handy in our work. That’s why most of our employees are the winners of different programming and math contests. At free time AIM Tech team usually takes part in various programming competitions as well as challenges itself at hiking and mountaineering.

For more information on AIM Tech follow us on, facebook or instagram. Also feel free to write us any time via CF, VK, FB, Telegram or simply e-mail us. We are open to answer any of your questions including job openings.

We wish you all luck and high rating!

To run visualizer you need python3 with ‘pillow’ library. You can download Python3 here: To install pillow simply run pip3 install pillow on Linux, Windows or MacOs. To check that everything works properly create a script file

from PIL import Image, ImageDraw
im ="RGB", (128, 128))
draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line((0, im.size[1], im.size[0], 0), fill=128)
del draw

and run it: python You will see a red cross with black background.

Please feel free to write a comment below.

UDP. There is no limit on a number of PCs in this contest, you may use up to one PC per participant

TCP. Every test will have it's own separate task, so every task will have only one test

IGMP. You can download the password-protected archive with tests and checked by any of the given links:

Password: aimtechiscool. Please you only one of these links, not all

HTTP. Contest is over, congratulations for the winners:

  1. ИТМО 1: SpyCheese, izban, Belonogov 1191.717
  2. sdya 1188.534
  3. Moscow IPT: Shock Content: amethyst0, AndreySergunin 1179.33
  4. UW3: znirzej, tabasz, e-pluszak 1157.526
  5. Warsaw U: KMR: Errichto, Radewoosh, mareksom 1152.257
  6. Helsinki U: Ukkonen Fan Club: Hansuzu, mango_lassi, kllp 1152.007
  7. admarkov 1145.181
  8. MS TSV: grphil, voidmax, egor.lifar 1115.304
  9. Vilnius University #1: AllSubmissionsMatter: JustasK, Darius0021, jDomantas 1112.618
  10. Ural FU: Dandelion: Um_nik, Merkurev 1112.112

Please write your opinions in comments

Read more »

Announcement of AIM Tech Mini Marathon 1
  • Vote: I like it  
  • +234
  • Vote: I do not like it  

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

Hi, Codeforces! Glad to announce a design competition for Codeforces T-shirts:)


  • Design must reflec- t belonging to Codeforces community.
  • Short and brief motto is important. Phrase outline can be an additional instrument for expression of idea. An interesting motto can also participate in the competition.
  • Idea is important for a printing. It's not neccessary to implement it fully if you don't feel your skill level right. You can describe your idea with a sketch/text description and that would be enough.
  • T-shirt's background can be white or black.
  • The winner will be determined by Codeforces team according to community opinion.

We consider this options as good ones:

We're waiting for your options during this two weeks. Last day – 14 February. We'll send 3 T-shirts with new design to the winner!

May the creative be with you ;)

UPD: Thank you all for participation! Results will be announced on February 22.

Read more »

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

By jinlifu1999, 3 weeks ago, In English,

Hello, Codeforces!

It's my honor to invite you to Codeforces Round #460 (Div. 2), which takes place at 13:05 UTC, January 31st. The round will be rated for all division 2 participants. Also we warmly welcome those division 1 participants to join us out of competition. Note that round starts in the unusual time! :)

This round is prepared by me and my friend wuminyan0607. Many thanks to my friend for helping me testing the round and generating testcases. Besides, many thanks to the Codeforces coordinator KAN for giving me a chance to hold this round, testers cdkrot, cyand1317, demon1999, glebodin, gritukan, neckbosov for testing this round and MikeMirzayanov for the great Codeforces and Polygon platforms. Without their huge effort, this round would't be possible.

Hope you can find these problems interesting. Wish all of you fewer bugs and higher rating!

The scoring distribution will be announced soon.

UPD1: There will be 6 problems and you have 2 hours to solve them. The scoring distribution will be 500-750-1000-1500-2000-2500.

UPD2: System test is over. Hope you will like those problems. Congratulations to the winners!

Div. 2

  1. OO0OOO00O0O0O0O00OOO0OO (Solved all 6 problems and got 4 successful hacking attempts)

  2. pannibal (Solved all 6 problems)

  3. sasasagagaga

  4. velity

  5. Hacker_White

  6. Ren_shimosawa

  7. UoA_Kanade

  8. just_soso

  9. jijiang

  10. wzz

Div. 1 & Div. 2

  1. KrK

  2. Vercingetorix

  3. OO0OOO00O0O0O0O00OOO0OO

  4. uwi

  5. black_horse2014

  6. TonySnark

  7. zscoder

  8. Marco_L_T

  9. quailty

  10. pannibal

UPD3: Editorial is ready!

Read more »

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

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

Hello, Codeforces!

The First International Data Analysis Olympiad (IDAO) Began Online This January — Finals To Be Held This April in Moscow, Russia.

This is the best time to join the competition. It will be running until February 11th and the problems will be in English — if you want to take part and win a prize, register now.

Higher School of Economics, Yandex and Sberbank along with Harbour.Space University are proud to announce an olympiad created by and for data analysts.

The event aims to bridge the gap between the all-increasing complexity of Machine Learning models and performance bottlenecks of the industry. The participants will strive not only to maximize the quality of their predictions, but also to devise resource-efficient algorithms.

This will be a team machine learning competition, divided into two stages:

  • The first stage will be online, open to all participants.
  • The second stage will be the offline on-site finals, in which the top 30 performing teams from the online round will compete at the Yandex office in Moscow.

We would like to thank the IDAO team for their amazing work in problemsetting — Dmitry Vetrov, Andrey Chertok, GlebsHP, Alexander Guschin, Michael, Konstantin Mertsalov, Evgeny Sokolov, Vadim Strijov, Nick Tiden, Dmitry Ulyanov, Andrey Ustyuzhanin.

More information and register


There will be two separate tracks during the online stage. From the machine learning perspective, the tracks will be similar, yet the restrictions put on the solutions are different for each track.

We hope that the two tracks will make the olympiad fascinating for both machine learning competition experts and competitive programming masters, Kaggle winners and ACM champions, as well as everyone eager to solve real world problems with Data. Moreover, we encourage people with different backgrounds, ML and ACM, to team up and push Data Analysis to new frontiers.

The first track will be a traditional data science competition. Having a labeled training data set, participants will be asked to make a prediction for the test data and submit their predictions to the leaderboard. In this track, participants can produce arbitrarily complex models. If you like to use 4-level stacking or deep neural networks, this is the right track for you – you will only need to submit test predictions. However, those who qualify for the finals will be asked to submit the full code of the solution for validation by the judges.

In real world problems, efficiency is as important as quality. Complex and resource-intensive solutions will not fit the strict time and space restrictions often imposed by an application. That is why in the second competition track, your task will be to solve the same problem as was in track one, but with tight restrictions on the time and on the memory used during both learning and inference. You will need to upload the end-to-end code for your solution: both learning and inference. The evaluation server will run training and testing for your model and report the result. Both learning and evaluation must fit into time and memory constraints. If you like the most efficient solutions, this is the right track for you.


Winners of the first stage will be invited to Moscow to take part in the on-site competition. Accommodation, and half-board meals are covered by the organising committee.

All participants have the chance to showcase their skills to the data science community on an international scale — the results will be internships, networking with some of the most passionate and like minded individuals, and job opportunities.

For winners, valuable prizes will be awarded, with both Higher School of Economics and Harbour.Space University offering special awards. Students from outside of Russia will have an opportunity to join a Master's degree programme at HSE, within the Faculty of Computer Science, free of charge. From Harbour.Space University, a 29,000 EUR scholarship will be offered, which also covers living costs in Barcelona, for graduate and undergraduate degrees.

Special prizes might be awarded at the discretion of the jury.

The winners will be determined by the leaderboard ranking based on private test set.

More information and register

Read more »

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

By DarthPrince, history, 4 weeks ago, In English,

I'm honored to announce that Codeforces round #459 is going to take place on January 29th and Reyna and I are the problemsetters of this round.

I'd like to thank keyvankhademi, AlexFetisov, winger, Belonogov, cyand1317 and demon1999, AnPelec for testing, KAN for coordinating the round and MikeMirzayanov for the great Codeforces and Polygon platforms.

The main characters of the round are Stranger Things characters.

The scoring distribution will be announced soon.

Good luck and have fun.

UPD0: The round is over, we hope you enjoyed it. Editorial will be posted soon.

UPD1: System testing is over, congratulations to the winners.

Div.1 winners are:

  2. FizzyDavid
  3. ainta
  4. aid
  5. Swistakk

And Div.2 winners are:

  1. MeshOmarYasser
  2. Chaarzeh (Interesting :-?)
  3. magicalCycloidea
  4. Maxon5
  5. UoA_Kanade

The editorial will be posted in a bit.

UPD2: Here's the editorial. Also please help me and Reyna do better next time by filling out this form.

Read more »

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