Programming Olympiads - do they help in real work? Pyotr Mitrichev - Legend of Sports Programming Coming up with such problems is a special skill.

“We won’t go to Facebook and Google”: Why some of the best programmers in the world live and work in Yekaterinburg

An interesting interview with the winners of the World Programming Championship from the Ural Federal University.

I’ve always been interested in understanding why programming competitions are so popular in Russia (more precisely, in the post-Soviet space in general) (probably the term used in this article is better suited: “sports programming”), despite the fact that in the decaying West I’m talking about them For a long time I didn’t even know, and when I knew, for some reason I didn’t feel drawn to it at all. It's like a completely separate world. For many years I actively participated in various online programming communities, for example, I hung out on the mailing lists of various open source projects, sometimes met people in real life, but there was never any talk about TopCoder, say. The fact that TopCoder exists, I found out from a Russian LiveJournal, in my opinion (and having learned about it, I didn’t immediately and urgently go there, create an account and didn’t participate. It’s somehow very funny and interesting to understand why).

Part of this popularity is explained by some remarks from this interview, in my opinion:

"Why did UrFU show the best result this time? Did the stars align?"

Mikhail Rubinchik: We have a stellar team. Oleg, Lesha and all the rest are very strong guys. Oleg is now in his sixth year, he started studying in the second, but by the third he already had a decent level.[...]

"Which is closer to you? A startup? Or a big company?"

Oleg Merkuryev: I haven’t worked anywhere at all. And I’m not going to work anywhere in the next six months. I’ll go to graduate school, I need to study a little science, otherwise I generally spent all my time on sports programming.

Those. it really feels like a sport first and foremost. Including some wild restrictions that are typical for sports competitions:

"Let's talk a little about the championship itself. Three people on the team. One computer. Why one? Why not three?"

Mikhail Rubinchik: The jury once decided so. This was thirty years ago.

Oleg Merkuryev: Then, perhaps, there were additional reasons that do not exist now. And then even one computer per team was a lot, but not much per person.

[...]You can use a printer at the World Cup. The first person sat down, wrote some solution, it didn’t work. He needs to find the mistake. Reading from a computer is expensive, but we only have one resource. Therefore, they print it out on a printer and read it on a piece of paper.

Well, I don't understand how it can be so attractive. Programming is a creative activity. There was no program, and now there is one. You couldn't do something with a computer, but now you can. Does it matter if it took 20 minutes or 40? It's just some uninteresting aspect.

No, I can imagine the restrictions that bring sports excitement - but at the level of several days and really difficult, interesting tasks. Like the Ludum Dare competition - write a game in two days. Or The ICFP Programming Contest, they give three days, and the conditions are usually mind-blowing. Compare this with the tasks of the World Cup in sports programming. If you compete for minutes and seconds (also with one computer between three), then the tasks come out like this - the cunning use of several standard algorithms with some tricky “twist”.

In general, this is a strange world. Don't blame me, those who are afraid of him. But I didn’t understand and don’t understand.

This is already a very old holivar: are sports programmers suitable for harsh applied development, or are they such beautiful white birds, soaring in mathematical-algorithmic clouds and perishing in more mundane conditions? There is a common myth that says that all sports programmers go to Google or, at least, to Yandex, where they work with inspiration on search algorithms and others like them. Simple Belarusian outsourcing is not for them. Perhaps, if not an end, then at least a punctuation mark in this battle of opinions can be put by facts. We collected information about all sports programmers in our country and, based on three criteria:

  • participated in the ACM ICPC finals;
  • spoke on behalf of the Belarusian university;
  • has already completed his studies at the university;

made a selection. The result was a list of twenty-one ACM ICPC finalists from Belarus. We were able to contact most of them and ask three simple questions:

  1. What is your current place of work and what is the position/essence of the work performed?
  2. Why this company/occupation?
  3. What are your plans for the future, how do you see it for yourself? Where would you like to go?

Some of them chose a management career, some remained faithful to sports programming, and who actually develops search algorithms, you will find out from “direct speech”Belarusian finalists of ACM ICPC.

Ivan Mikhnevich (ACM ICPC 2000)

  1. Wargaming Public Company Limited, Director.
  2. This is the result of growth in the group of companies from the very beginning of my working career.
  3. In reality, I’m already tired of all this and it’s time to start a new career, in a new place, in a new field (most likely, not IT).

Sergey Stepantsov (ACM ICPC 2000)

  1. I currently work as Vice President Business Development at Intetics Co.
  2. Most of my career is connected with this company, where I managed to try myself in a variety of roles: I started as a testing specialist, and also worked as a programmer, project manager, and head of a production department. And eventually I came to specialize in business development.
  3. I still don’t feel old enough to stop developing myself :). I think that the future of the business part of my life will still delight me with many exciting turns.

Vladimir Tankovich (ACM ICPC 2000, 2003)

  1. Currently at Microsoft I am working on Computer Vision algorithms for Kinecta. Before that I was in search relevance.
  2. I have been with this company since 2005. They brought me from the Republic of Belarus, and there was no point in moving yet. I joined this team because it allows me to do scientific work, which does not go into a collection of articles, but into a finished product.
  3. There are no specific plans for the future. In IT, money is not a problem, both in Minsk and here. So far, I am very interested in understanding Machine Learning and AI. It turns out that I do whatever I want almost all the time, and I also get paid well for it. That is, for the next 1-2 years I will be doing the same thing, and then we’ll see. I’m gaining a lot of experience, and if I have an idea on how to reliably apply it, I’ll try a startup.

Alexey Kirkovsky (ACM ICPC 2002, 2005)

  1. NT LLC "LuxSoft", software engineer of the 2nd category.
  2. I really wanted to go to the famous Moscow body shop LuxSoft, since since childhood I dreamed of automating hatches, but I didn’t notice one letter and ended up in the Belarusian LuxSoft. There, I signed some papers without looking, and now I’m working under a 20-year contract for a fixed salary in Belarusian rubles, which is only enough for gasoline.
  3. I plan to meet the standard for the number of lines per minute and become a 1st category software engineer. Then get a CMS in programming, which I will be assigned here if there is not a single lateness to work for the entire duration of the contract.

Alexey Danchenko (ACM ICPC 2002, 2005)

  1. NT LLC "LuxSoft" Software engineer. Recently I have been developing a domain-specific programming language for our product.
  2. An opportunity to work with friends to implement an interesting idea.
  3. Continue to enjoy life.

Evgeniy Gonchar (ACM ICPC 2003)

  1. Google Switzerland (Zurich), Senior Software Engineer. I'm working on one of the web search infrastructure projects.
  2. Since childhood I loved programming.
  3. I would like to progress in playing the electric guitar and go to New Zealand again.

Ivan Metelsky (ACM ICPC 2003, 2004)

  1. TopCoder, Inc., Marathon/Algorithm Problem Coordinator. Launch of Marathon and Algorithm Competitions on TopCoder.
  2. In a way, it just happened that way. More seriously, good income, relatively interesting work, it’s difficult to find a better alternative.
  3. Plans for the future - it doesn’t really matter where, but somewhere in the direction of somewhat less busyness and more freedom of action. Perhaps some kind of business, not necessarily in IT.

Victoria Lebed (ACM ICPC 2004)

  1. I was and remain a mathematician. She was the only person on the team who did not touch the computer :) She did all the “side” work. I live and work in Paris. Now I have a temporary position at the University of Paris 7 - research and teaching. Recently received my PhD.
  2. This activity is because it provides a rare opportunity to maintain personal and creative freedom.
  3. I try not to make any plans for the future. Again, so as not to limit yourself to anythen within the framework and not expose yourself personally to the burden of expectations, hopes and other things. I'm fineI imagine continuing the journey I have begun in the university and scientific environment, but I am not closing the door for other options.

Maxim Osipov (ACM ICPC 2004)

  1. VironIT, director. Business management (mainly not operational, but aimed at changing sales processes, development, quality of work, etc.)
  2. VironIT company, because it is my company, I am the owner. This is a class (non-operational management) because figuring out how to grow a business is the most interesting thing for me.
  3. Develop your company, switch, among other things, to a product model, start a family and children. I see the future as interesting, difficult, but definitely positive.

Pavel Irzhavsky (ACM ICPC 2007, 2008)

  1. Teacher at BSU, mathematician-programmer at Orientsoft, teacher at ShAD, graduate student (formally this is study, but in fact it is closer to work).
  2. Each activity has something interesting and useful (besides the fact that they all generate income :)), simple ones that allow me to relax a little, and complex ones that allow me to develop. I think I become generally less effective when I start doing the same thing for, roughly speaking, 8 hours a day, and changing activities daily allows me to be at my peak.
  3. There are no significant changes in plans for the future :)

Vladimir Kerus (ACM ICPC 2007, 2008)

  1. EPAM. Leading software engineer of the mobile development department. I am developing applications for Android.
  2. I love learning new things, and in my current company I can easily change my profile and find the right people-teachers.
  3. I’ve already planted a tree, I’m saving up to build a house, I’m planning to have kids (ideally, my own Barcelona squad).

Sergey Tikhon (ACM ICPC 2009)

  1. EPAM Systems, Lead Software Engineer. Architect/special project developer.
  2. Friendly, strong team, interesting tasks, good opportunities for professional growth.
  3. Work in IT, but on the border with science, work on the implementation of Data Science in real applications and services (machine learning, natural language processing, search technologies, modeling). Propaganda, dissemination and implementation of functional programming (I run a blog on F#).

Alexey Lobanov (ACM ICPC 2010)

  1. Yandex company, developer of Yandex.Maps. In parallel with this, I am studying at the graduate school of BSU and working as an assistant at the Department of DMA FPMI (I teach practical classes in the course “Algorithms and Data Structures”).
  2. Why Yandex: there are interesting tasks (including complex, knowledge-intensive, algorithmic ones), comfortable working conditions and an excellent team. Why FPMI BSU: I think it is important to pass on my knowledge to the next generations of students.
  3. Plans for the future: successfully complete graduate school and try to defend a Ph.D.

Alexey Tolstikov (ACM ICPC 2010)

  1. BSU, assistant at the Department of Computational Mathematics, graduated from graduate school, teaching the course« Parallel and distributed computing» (practice). Yandex,curator of academic programs, head of the Minsk branch of the School of Data Analysis (+ teacher there), search developer.
  2. I can’t do it in one sentence, but because: “I like it!”
  3. Not much to say. I'm moving in all these directions.

Everything is very complicated and at the same time simple. Why does sports programming even exist? Not “why bother with it,” but precisely “why does it exist as a phenomenon.” Why is sport needed at all, be it intellectual or physical. Someone will say that for health, development, all that? Yes, there are so many injuries in professional sports that no amount of health is enough. For money? Yes, everyone there becomes millionaires in a year. The true reason is one: the desire to win, to be different from others, to be better, more perfect, more significant. Do something great for your people. Everything else is a consequence. If it were not for this desire, which gives rise to competition as such, everything else would not exist. It's the same here.

What attracts people in the beginning. Some kind of interest, novelty, a kind of “wow” effect. But it passes. For sustainable motivation to emerge, deeper mechanisms are required. Otherwise, if there is anything left, it will only be enough for “for fun” activities.

Therefore, the first and main thing you can do to motivate a beginner is the opportunity to become the best in your field! Not just a coder, like thousands of thousands, but a champion. After all, every person dreams of something big and meaningful. Maybe that boy as a child dreamed of scoring goals in the Champions League, and this girl dreamed of singing songs at Eurovision. He went to a sports school, and she went to a music school, but it didn’t work out. But mathematics always went with a bang, but what’s cool about being a nerd nerd, solving abstruse problems that are interesting to you alone? And to some excellent student who dreamed of becoming an astronaut, his parents, who didn’t care about his dream, drummed into him that an astronaut should at least know by what physical laws rockets fly, so he began to solve physics, all the more so he went with a bang. And now they have all entered the university and somewhere inside the thought is already beginning to ring alarmingly: “So what? Am I really not going to do anything outstanding in this life?” After all, by and large, any graduate programmer can be replaced at work. And here is your chance: to compete for your city, for your university, for all of Russia, to win, to reach the semi-finals, finals, to do something that if you don’t do it, then no one else will do it.

When we first started programming, in 11th grade, we were told over and over again how it all began. For the first time our teams went to the semi-finals. How did you pass the first task? How they got to the finals for the first time. How we went abroad. How we fought on equal terms with the best minds on the planet! And my heart sank with the desire to become at least a little like them. We looked at the final tables and the names flashed before our eyes: MIT, Harvard, Stanford! Does everyone dream of studying there? But here’s what’s much cooler: tear all the vaunted foreign teams to hell! How Tarasov’s team, in the very first match of the super series, demolished the team of the greatest hockey professionals from Canada 7:3. Here it is, the challenge of our lives! And this is all possible! This is reality! And this is what makes life truly worth living. And maybe someday in our own university the same stories will be told to recruits about us. And everyone will dream of being like us. This is exactly how newcomers look at the Olympics.

You know, we are all accustomed to these phrases: “semi-finalist of the World Championship”, “prizewinner of the North-Eastern European Championship”, etc. This should not surprise us. But for a random person on the street, such achievements are just space! And the newcomers are the people from the street. So why not use it? After all, getting to the semi-finals of the NEERC World Championship for many contestants remains for the rest of their lives the highest peak they have reached, the loudest title they have won. This was no joke now.

You have ten thousand students, and here is the opportunity to become one of those three elite students who will represent the university and the city at the world's main student competition. Each of them is already, as they say, “one of a kind in many thousands”! The elite division of your university.

Yes, then there will be hours of hard work, but who said that becoming a world champion is easy? Working hard will happen by itself when a person knows that he is moving towards a worthy goal. No one will run a marathon or climb Everest without preparation. Everyone understands this. But if you go through this, you will have something for which you can respect yourself. It’s the same here. Not less.

But no one goes to the mountains just for the sake of hardships, or to a marathon only to not get out of bed for a week. No one enters the boxing ring for the love of getting hit in the head. There are few masochists. All these people are driven by something else. Just like sports programmers. Namely: goal!

So, if you are a guitar teacher, then you should not tell your students how their fingers will hurt and let them try to immediately take the barre (“yeah, you can’t? It will be difficult!”). But you can tell how cool it is to be the life of the party at a party around the fire and with what eyes the girls will look at you. If you are an SAF instructor pilot, then you should not immediately talk about how to evaluate, for example, the weather. Try to convey the feeling of flight and romanticism.

It's the same here. If you explain balanced trees and at the end of the lecture you say: “An Olympiad student can write this,” no one will understand you. If you spend five hours competing and analyzing, they will get bored and leave, looking for their childhood dream elsewhere. Some will remain, but without enthusiasm. So, solving problems is still more interesting than solving some crossword puzzles or hanging around on social networks in apps. If you doubt your usefulness, your success, your doubts will be passed on to the recruits. If you yourself are convinced that ICPC is cooler, bigger, more significant than all scientific student conferences and forums combined, that it is possible to win, that it has already worked (or has not worked, but everyone is waiting for it) - they will also believe you. The most important thing is to believe in all this yourself.

Indeed, it is very good when there is competition. It’s even better when the university already has finalists, and there are young and green ones. The youngsters will sleep and see the first contest, where they will finally, at least for five minutes, beat the old guys! For complete beginners, even just being in the monitor above them for a minute is already happiness.

These are the basics of motivation. These are algorithmic problems that no one knows how to solve, when at three in the morning you jump out of bed, turn on the computer to finish the code, finally pass this damn 80th test and get accepted, and then you feel a little like Mendeleev, who had the epiphany in a dream. This is a year of preparation, only five hours for which it was all, and a decisive task submitted at the very last minute. It's an honor to represent your city and country in what you do best. Well, then they will figure it out themselves. It’s unlikely that you need anyone who applied just to get a degree and get a normal job. Everyone else, and, as Mirzayanov wrote, mathematicians and gamers come, if they love the process, if they find echoes of a childhood dream, if they are not afraid of difficulties, if they are ready to play, welcome.

We are often asked about sports programming. What is the point of the Olympics? How important are they when working on a real project? If they are important, is it too late for an 11th grader to start studying this area? We, of course, referred the questions to the experts.

Participation in Olympiads develops skills to work in stressful situations, and it puts a lot of stress on the brain. In general, during the preparation for the competition, I studied a fairly large number of algorithms and approaches to solving problems. In industrial development, you rarely have to deal with standard algorithms; at least, you almost never need to implement them yourself. But knowing what is under the hood of a particular algorithm sometimes allows you to come up with some non-standard approach to solving a specific industrial problem. In any case, it’s worth taking part in the Olympiads regardless of whether these skills are important or not, it’s just interesting :)

It's not too late to start studying in 11th grade. A wonderful example is the person with whom we played the ACM ICPC finals last year. He actively started taking part in Olympiads in his 2nd (!) year and achieved very good results.

Promote Demote

Much depends on what kind of project. The majority (95%) of projects are related to business process automation, graphics, etc. In such projects, Olympiad skills practically do not play a role.

But there are projects in which it is necessary to solve a complex new problem - and here the experience of participating in Olympiads is useful.

So it all depends on what kind of projects you have. The vast majority of programmers do not have to deal with such projects.

Promote Demote

The Olympics are part of the world of sports programming. As in any other sport, the point of the Olympics, in my opinion, is to test one’s strength, improve oneself and receive moral satisfaction. I am sure that the experience of the Olympics is useful in work, because constant training makes the brain more flexible and receptive to new tasks.

It’s not too late for an eleventh-grader to start participating in programming competitions. I have many friends who took up sports programming only at university and achieved significant success. I myself took part in the first Olympiad at the end of my first year and I don’t think it was too late. If this had happened in my last year, then I would have regretted it.

Promote Demote

, Microsoft technology evangelist, associate professor at MIPT, Moscow Aviation Institute, teacher at the JUNIO-R children's camp

Programming Olympiads allow you to master theoretical knowledge in the field of Computer Science, and they often help you get into a university. However, in practice, not all tasks require the skills acquired at the Olympiads.

There is such a thing as overqualification. If you have too much theoretical knowledge of Computer Science, then you will be bored with solving everyday problems, and you will be able to fully realize your potential only in large companies, such as Yandex, Mail.ru, or the same Microsoft. Therefore, the circle of employers you are interested in will be somewhat narrower, but the tasks being solved will be much more interesting and more global.

To gain real skills in working on projects, competitions like Imagine Cup are better suited. In this competition, you need to have more of an entrepreneurial talent in order to choose an interesting problem to solve, create a prototype of a software product and demonstrate it at the competition. In the long term, participation in such competitions is good for developing skills in teamwork and real work on projects, and can also lead you to an entrepreneurial career path and to your own startup.

11th grade is a little late, because there is too much to do to enter a university, and it will be difficult to devote enough time to the Olympiads. But better late than never!

Promote Demote

The Olympics, like any sport, are extremely important for training willpower, focus and other valuable qualities. Sports programming has nothing to do with applied programming, but it allows you to train in a truly competitive environment, which will later be useful anywhere. It's never too late to start.

Promote Demote

An excerpt from ours, Stanislav answers the question “is it true that success at programming (mathematics) competitions negatively correlates with work in a company? Do you have many Olympic athletes on your team?”

The Olympics will not help directly. Just like knowledge of mathematical analysis will not help a person write programs in Java or Python. But Olympiad programming, if you like, is like sports sambo. It does not guarantee success in street fights; moreover, there are many examples when sambo athletes were brutally maimed in street fights, because there are no rules: they can hit with a knife and three of them attack one. But a sambo athlete becomes a fighter much faster by starting to study combat sambo (or other hand-to-hand martial arts) than a person who looks at the monitor screen with popcorn. Therefore, you need to treat it exactly like this: Olympiad programming is a good way to improve your level. It will be easier for a person who does this to master a new area of ​​computer science or a method of programming. This is a beneficial activity and should not be avoided. If a person works professionally in a company and makes products that are widely sold, it becomes like a hobby. A person who works for a company that produces backup products probably becomes a world-class professional in this field within a few years. And Olympiad programming, if he starts participating in it, is unlikely to help him much to make him stand head and shoulders above his colleagues. But this is a useful hobby that develops the necessary skills.

In general, it’s amazing how people refuse to learn. When I was young, the propaganda was very powerful: you need to study, it’s useful, knowledge is power, ignorance is darkness. I don’t understand why your guys might have such questions. Knowledge is never superfluous. Ultimately, life is structured in such a way that if a person understands something very, very deeply, it is easier for him to see how some completely, seemingly unrelated area works. Everything we do ends up being similar. So, I was under an illusion about builders until I started doing my first renovation. First and last. I discovered that the work of construction workers in an apartment is very similar to the work of a team of programmers. And not only that, all the problems that we face are faced by builders in full force. And it's even worse there. Because the average level of a builder is lower than the average level of a programmer, in terms of education and general intelligence. They also make mistakes, they have bugs, there are both good and bad project managers. If it’s bad, they can, figuratively, screw the toilet to the ceiling, and then pretend that it was so. Therefore, there is no need to avoid knowledge. Perhaps this particular knowledge will never be useful to me, but if I understand something, understand why it is this way and not otherwise, it will be useful to me at least in the form of an analogy.

Promote Demote

They say that when he was born, Donald Knuth himself came to see him. They say that when he was invited to work at Google, he rewrote the entire search algorithm 16 times in 15 minutes. They say that he watches the progress of quantum computing with a smile, because when he sees it, the numbers factor themselves out of fear. But we know one thing for sure: Peter is a real god of sports programming.

Data

  • A winner of numerous championships, Peter twice won TopCoder and twice took second place in ACM ICPC.
  • In his free time, Peter writes a blog about regular contests “Algorithmic Problems for Dummies”: petr-mitrichev.blogspot.ru.
  • Mitrichev currently works at Google, where he works on search quality. Peter also helps in preparing Google Code Jam competitions.

Many people think that sports programmers are cool guys, real geeks who understand algorithms and solve complex problems. But they also say that it is very difficult for them to apply themselves somewhere later. This is true?

Sports programming, and in general what we do at the Olympics, is really not something you can do for a living. On the other hand, programming, like any other sport, is development for a person. Thanks to it, a person becomes smarter, a better programmer, and better at finding errors in programs. After such preparation it is easier to work and do other interesting things.

Algorithms are definitely applicable in the practice of a programmer, although at work I have also encountered algorithms that are more complex than those found in Olympiads. But at the Olympiads we are limited to algorithms that, roughly speaking, can be written in half an hour to an hour. Therefore, tasks there use a very specific, limited set of algorithms. In real life, things are just more... expansive.

What language did you write solutions to problems in?

In Java. At school I wrote in Pascal because I didn’t know anything else at the time. And then, when it was necessary to choose what to switch to, Java turned out to be closer to Pascal.

In a competitive environment, you need to write a program in 20–30 minutes, and it should work correctly right away. Therefore, it is very important that the language does not allow bugs to be planted. C++, which most people use, is different in that it is quite easy to write the wrong program. You can accidentally forget something, assign the wrong type to a variable, but all this will somehow compile and somehow work. Most likely not in the way you expect.

In Java, if you make a mistake or typo, the program will most likely simply not compile. Everything is stricter here, as in the case of Pascal. This seemed more appropriate to me. The other side of the coin is that Java programs often run one and a half times slower than C++ programs. Sometimes these one and a half times are not enough for the program to fit into the conditions of the problem.

Everyone can choose their own programming language, right?

There are restrictions. Of course, there are different competitions... let's take Google Code Jam, for example. When we were deciding how best to make it, we came up with the idea that we could work in any language. You download the input file with task data to your computer, run your program on the computer, and then send the result to the server. Whatever compiler/interpreter you have on your computer, that’s what you can use. The disadvantage of this system is that people have different computers. Some people have a computer ten times more powerful than others. Therefore, we have to create problems where the incorrect solution differs from the correct solution in speed by at least a hundred times. So that if a person has a computer ten times slower, the correct solution will work for him, or on a computer ten times faster, the wrong solution will still not work. Therefore, we need problems with a large gap between the correct and incorrect solution in terms of speed.

Topcoder, Codeforces and ACM use a standard system where you send the source code and they run it on their server. Here you are limited by what they have on the server. Most of the participants, 70–80% use C++, another 20% use Java, and very few other languages. This, it seems to me, is a cycle - new people who come to competitions begin to communicate with other, older participants, who teach the newcomers what they themselves can do. As a result, new people also begin to use the same languages. So it’s not that these two languages ​​are particularly suitable for competitions, it’s just how it happened historically.

So, does all this apply in life? After all, it is probably difficult to find a job where this knowledge would be useful. Yes, you can go to Google or Yandex, but is it more difficult to come to any bank?

It seems to me that this is a very useful part of the skill, the part that is responsible for the ability to write a program the first time, without errors, or to find an error in a friend’s program. I haven’t worked in a bank myself, but it seems to me that such skills would be useful there too. Although, of course, the algorithms themselves are not really used in every job. But personally, this background helps me a lot.

You probably had some special story about how you got into Google?

Yes, there is no story, everything was the same as others. Now I am doing the search (the general part of it, which does not depend on the country and language), but, unfortunately, I cannot tell anything about it, since this is a very confidential part.

Sports programming: pros and cons

Let me try to ask you a stupid question :). Why do you think sports programming should be done?

Everything here is very simple and similar to any other sport. You need to do it if you like it, if you get pleasure from it. This should not be an end in itself. You need to think of sports programming as a way to have a good time, meet interesting people, and so on.

What if you try to come up with a reason why you shouldn’t waste time on sports programming?

I think you need to be aware that this is not the main thing in life. Have some other goals besides this one. If something starts to take up absolutely your entire life, this is probably a reason to think about at least taking a break.

But what does practice say? Is it possible, for example, to build a career around sports programming?

There are several people in Russia who are professionally involved in training new sports programmers - coaches. Andrey Stankevich, Misha Mirzayanov and others. All of them teach at universities, but they spend a significant part of their working time preparing students and schoolchildren for programming competitions. For them, this is really a job and, one might say, a career.

Have you ever thought about this yourself? Do you ever participate in a jury or as a problem writer?

I tried to teach schoolchildren at school No. 57, where I myself studied. I tried to prepare teams for the Olympics. Now in Moscow this topic is very active - there are teams at Moscow State University, Physics and Technology, and the Higher School of Economics. But somehow teaching didn’t work out for me.

As for the contests, first of all I help make problems for Google Code Jam, for our competition. Plus I help with the ACM semi-finals, which takes place in St. Petersburg. This is a selection among Russian teams and teams of the former USSR for the finals.

Is it possible to make money from competitions? After all, they give cash prizes for winning.

The probability is too low. One prize for ten thousand participants?.. I wouldn’t call it earnings. Counting on this as the main source of income... it seems to me that there is no chance.

But, as I said, there are many different competitions. The same Topcoder holds program development competitions. Let's say you need to develop a component for a program that does this. Based on the results, they evaluate who got what, and the best is used - the client buys this solution and pays money to the one who made this decision. People who do this full time, as I understand it, earn pretty decent money.

Contests today

Tell us in more detail, what kind of competitions are there now, how does it all happen?

Today there are two types of contests. There are weekly, regular competitions. They are conducted by two main sites - TopCoder and Codeforces. Each contest takes one and a half to two hours. There, participants are given several problems to solve and send the program to the server. The organizers are checking whether the program is working.

TopCoder is the oldest and most famous site with weekly contests. They have the following rules. One hour and fifteen minutes is allotted to solve three problems.

Tasks are usually divided into very simple, medium and difficult. The organizers try to select them so that, say, five people solve all the problems, a hundred people solve two, and everyone else solves at least one. Moreover, for each task it is important when you submit it - the later, the fewer points you will receive. This is how those people who solved the same number of problems are divided. Then the points are summed up. A normal task is worth 250 points. Average 500. Difficult 1000. On average, people in first place get a thousand-something points per competition.

Then they take a break for five minutes and another fifteen minutes are spent looking for mistakes in others. You can open the solution of any person, for any problem in your “room”. A "room" is where people participating in a competition are randomly split into groups of twenty. They are divided into “rooms”. You can open any solution of any person from your “room”. If the solution seems wrong to you, then you can enter the input data on which it will be wrong. And if it actually gives the wrong answer, you get another 50 points for it. This is, of course, less than the cost of the task. But this again is done to divide people. The main points are still awarded for solving problems, and not for finding errors.

After all this, the tasks are tested on tests prepared by the jury. If the task does not work, the person receives 0 points.

There is also a second site, Russian, Codeforces. Their rules are slightly different, but the format is approximately the same - two hours and several tasks. If you like, this format can be called entertaining, in contrast to student competitions, which last five hours.

But are there still large, annual contests?

Yes, in addition to the two described competitions that take place weekly, there are many more annual competitions. Usually they are structured like this: a certain large company (Google, Yandex, TopСoder, IBM) holds a competition with several stages of selection. The first stages take place online. And the final stage is already held in a specific place, where all the finalists are taken. There are only five to ten such competitions, but they are long, so one of them is happening all the time.

Are all these competitions individual?

Most competitions are now individual. Team competitions are mainly student competitions, the main one being ACM ICPC. And other student competitions are also usually made into team competitions, because, roughly speaking, they already have a team. This makes it easier to interest people. Veteran competitions are usually personal.

Weekly competitions have a rating, like chess, which is updated after each competition. Those who performed better receive a plus, those who performed worse receive a minus. If you did not participate at all, the rating does not change. The system is built in such a way as to equalize people who visit often and rarely. There is no pressure to “have to participate all the time.” There are many people who are much older than me, they appear very rarely - once every two months - and still they have a good rating because they continue to solve problems well.

Yes, in first place is Gena Korotkevich, a very smart student from Gomel, now he is studying at ITMO. My results on Codeforces have been worse lately; now I’m sixth or fifth. There, too, Gena comes first.

Probably, playing online and offline is a completely different feeling and experience?

Certainly. It seems to me that a very important positive side of sports programming is that all competitions end with an onsite round, where all the best come together. Thanks to this, I met a lot of cool people from all over the world. In general, the main “prize” in such competitions, it seems to me, is precisely meeting people. You spend time with them, communicate, learn something new. It's very funny that people from other countries, who often speak English poorly, are nevertheless very easy to understand because they have very similar interests.

In such competitions - with selections - there are usually more people participating than in regular ones. If a person has never participated anywhere, weekly competitions can be a problem. There are such problems that a person may not solve anything and get upset. In competitions with qualifying, everything is usually simpler, at least in the first stages. Their main idea is for everyone to have fun. Again, there is a tangible prize at the end - cash prizes for first place. Plus, a trip somewhere, for example to the Google office, is also quite a prize.

Does it happen that companies then try to use in life the developments from the solutions submitted by the competitors?

Quite rare. The main goal of companies that hold such competitions is simply to popularize programming. The second goal is to find new employees. But the second one is not even that important. Typically, a company organizes a competition precisely to get more people interested in programming, and we are not even talking about those who directly participated in the competition. That’s why such competitions are usually held by large companies.

Do competitions change over time? Are they becoming more difficult or, conversely, easier?

They become more complex. More and more algorithms are considered something from the category “everyone should be able to do this”, “everyone knows this”. You need to think as much as you did ten years ago. The number of steps required to build a solution is the same, but the basic blocks that make up the solution have become more complex. People have learned more algorithms. Take, for example, the suffix tree: when it appeared, I was in school, and it seemed that this was a very cool algorithm, everyone who knew it was very smart, and it was generally a revolution. Now the same problems are solved using a suffix automaton, and this is a very simple algorithm that takes ten lines. That is, they have learned to greatly simplify standard things. Therefore, more complex problems are now being solved.

About tasks and their preparation

How are tasks for competitions composed? Are there compilers, people who already know how to do this, or is this some kind of crowdsourcing where everyone can offer something of their own?

In the mentioned weekly competitions this is exactly the case: everyone can propose their own task. But there is a requirement that a person has previously participated in a sufficient number of competitions. A kind of check to see if a person understands what the tasks should be about. Afterwards, you can submit your assignments, and the jury will answer whether they can be used and whether they are suitable. If the problems are suitable, they are then given at competitions, and the author is paid money for it - not very much, but still.

Coming up with such problems is a special skill, isn’t it?

Oh yeah. You can come up with problems based on solutions. Let's say you read some article in a scientific journal about an interesting algorithm. Or I just found a certain algorithm and remembered that I had encountered it before, but recently I haven’t seen it for a long time. You can come up with a task that requires its use.

The second way: when a certain problem arises in work or in life, and you realize that it can be used in a cool way. You may have to complicate things or change the restrictions, but then it will turn out to be an interesting problem for the competition.

There are competitions of varying degrees of closeness to life. Usually the task at competitions is not given in some formal terms, like “given: solve such and such an equation.” Usually a certain background or history is given. As in school mathematics textbooks: “Ten liters of water flow per minute through one pipe.” Therefore, first you need to somehow formalize this story, find a mathematical problem in it, and only then solve it.

There are other competitions. TopCoder calls it Marathon Match, and other companies also hold similar contests. They are designed a little differently. This is no longer a competition in algorithms, but in solving approximate problems. When there is no exact solution and you need to come up with the best option possible. Such competitions usually last two weeks or a month. You can send different solutions and see that, yeah, now my solution is 20% better than the others.

Does “better” mean faster, uses less memory, etc.?

Yes. For example, you need to come up with a scheme for distributing bus traffic on the map of Moscow in order to use as few buses as possible. That is, in the problem statement there is a certain parameter that needs to be optimized, but there is no single “correct solution”, only some approximate algorithms.

The same Topcoder held competitions together with NASA, and they say that the solutions they were offered were then actually adapted and used on the ISS. There they were solving a specific problem, it seems like how to rotate a solar battery so that it receives more energy.

Where to begin

From the point of view of preparing a good algorithmic programmer and participant in various contests - how to prepare yourself for this? If you imagine yourself in the place of a high school student or first-year students?

It seems to me that the most standard way is to try. All competitions have an archive of previously held contests available; there are thousands of problems that can be solved at any time.

What if I take on a task and don’t even know which way to approach it?

So, take it simpler. They are different. There are problems that every second school graduate can solve. There are completely different levels of difficulty. It should be fairly easy to get involved. There is no other way, it seems to me. Plus, this way you will immediately understand whether you like this activity or not.

What needs to be done to gain an algorithmic base? There is hardly any need to immediately rush to read Knuth.

It seems to me that we need to start with tasks. Only later, when you realize that you cannot solve any specific one of them, in these competitions each has an analysis. You can read the solution if you can’t cope on your own. For example, the analysis indicates that a certain algorithm is used to solve the problem. You can read what this algorithm is and where else it is used. This is better than reading from the list “yeah, I have an algorithm that I need to study over the summer.” It’s better to start from a specific problem that you couldn’t solve because you don’t know a specific algorithm. This is more correct. You remember better, your motivation is stronger. This method of learning algorithms probably takes longer than the list, but it leads to better results.

If you want to “pump up” yourself using algorithms, is there any literature or textbooks?

The most standard textbook is Cormen, Leiserson, Rivest with a donkey on the cover. “Algorithms: Construction and Analysis” is called. I don’t know, I haven’t studied for quite some time, now there are probably new textbooks that may be better. But in my time they used Cormen. Knut is, rather, a kind of reference book. If you need to find something and it isn't anywhere, chances are it will be there. But reading Knuth in a row... it's a pretty sad experience.