Denys Tereshchenko

Denys Tereshchenko

“If you do not enjoy what you are doing, there is a great risk of burning out fast”
Database →
When exactly did your interest in informatics and programming appear? Why these subjects in particular?

It is actually quite a funny story. At first I was convinced that maths was my karma, since I had a gift for numbers from childhood and took part quite successfully in mathematical logic olympiads several years running.

My first academic olympiad was in maths; in third grade I was a prizewinner in the district round for 4th grade, and I settled on the idea that I had found my calling for the rest of my life.

At the time I had one book on programming, and out of curiosity I tried to learn from it on my own, but in the end I found it more interesting simply to sit and play about with numbers in Python.

The real turn came in 5th grade, when I joined «Kvanta» (ed. — a club for maths, programming and astronomy for students in grades 5–9).

After six months of maths I joined the programming side, at first as a “back-end mathematician”: it was maths that was the lens through which I saw algorithms. But programming was there for the taking and the mentors were wonderful, and I found it incredibly interesting. I felt I could do something in programming too. And that is how it all began.

How did you find out about the informatics olympiads? Do you remember your first olympiad?

I found out about the olympiads at «Kvanta», since that club is a real hive of olympiad competitors. In the first year we prepared to understand the basics, simply to know the fundamentals of programming. We solved easy olympiad problems, but were not yet preparing for particular competitions. In 6th grade I sat my first district informatics olympiad and got a fairly decent result. At the city stage that year things went badly indeed, but I firmly decided that next time I would prepare better.

Incidentally, I remember that city olympiad well: I sat there almost the whole time simply staring at the screen, not knowing where to begin. It frightened me a great deal at the time; I did not understand what I was doing there at all. But I stayed to the very end, never giving up trying to get at the problems somehow. I think that painful failure was very useful, because later on things were not always smooth and victorious either, and that experience taught me to fight back after a fall.

How did you prepare for the olympiads? How much time did it take? What did your preparation and your goal look like?

In truth my preparation was fairly unstructured. On some days I might work 7–8 hours or more, and on others an hour or two at most.

As for the preparation itself: first, I worked with my coach, Valentyn Ivanovych (ed. — Valentyn Melnyk, a coach from Kremenchuk); second, I solved problems, concentrating on the topics where I felt gaps. I also tried to read a lot of theory, because I understood that this was my weak side: I did not always know the theoretical base well and did not fully understand how to apply it in practice.

Constructive problems came most easily to me — they stayed with me right to the end of my time on the Ukrainian teams, including at IOI 2024.

As for the goal, I set it for myself straight away: if I was going to take part in olympiads, then only with the highest possible ambitions — the IOI or something as close to that level as possible. Perhaps in 7th grade that seemed to some an audacious or naive dream, but I simply loved programming and felt that such a bar was within my reach. And I was inspired by the stories of other olympiad competitors; I wanted to be like them, to become part of that community.

Which matters more to you — taking part or winning? How do you take defeats?

Hard to say. In the olympiads there is this dependency: every win opens up the chance to take part in more. Get through the district stage and you reach the city or regional level; do well at the Ukrainian stage and you reach the IOI selections, and finally the IOI itself. The further you go, the more unique the experience you get.

But winning matters a great deal to me too. Especially once I reached the IOI I had dreamed of — there it was genuinely a point of principle to show my best. I wanted to know I had done everything I could; the result mattered not only for the ranking but for me personally.

As for defeats, I have a concept I call “competitive anger”. When I lose, I try not to fixate on the thought of what I did wrong. I do not let myself get stuck in the emotions for long; instead I concentrate on what I can do better next time.

Do you have your own formula for success, or a motto?

I do not know whether you can call it a formula for success, but for me the main thing is to enjoy the process. It is rather a cliché — “just enjoy yourself and it will all work out” — but without that it really is very hard. If you do not enjoy what you are doing, there is a great risk of burning out fast.

That is probably exactly why I stayed in programming: when I was solving problems, I genuinely enjoyed it. Simply sitting and turning some graph problem over in my head — I take pleasure in the process and in the result, when the problem does finally give way.

Of course you also have to work a great deal — but do it sensibly. For instance, I knew I was not one of those people who can work 10 hours a day consistently, so I built my preparation to have a varying load: more here, less there, allowing for my own rhythm. So working actively is necessary, but you have to know yourself and understand what you are really up for.

I also had a sort of talisman — a short phrase that one of the finest olympiad competitors in Ukraine once wrote to me privately after EJOI: «Bazonuv tak bazonuv». It came on an emotional high, and somehow stuck, so that later it came to mind at every “successful success”. Sometimes it was that phrase that set the mood before the next problem or competition.

Which competition was the most important and instructive for you? Why?

One of the most important competitions for me was the selections for the Ukrainian Olympiad in 8th grade. I lost quite a lot of points on very easy problems then, and that became an important lesson for me: at a competition you cannot afford to lose even the smallest number of points, since every problem carries the same weight. If, say, I failed to write a simple binary search and lost 80 points, then however long I thought about the harder problems — even if I got partial marks — my overall result would be far lower. So I had to learn to keep my focus on the basic things too, because what always interests me more is digging into something hard.

Another very instructive experience was preparing for IOI 2024. Here it mattered to take into account not only the problems themselves but many other factors that could affect the result — down to such details as the climate in Egypt, or even whether I had earplugs. So being able to solve problems is not always enough — you need a strategy that allows for a wide range of details and plans several steps ahead.

Do you have a favourite type of problem that you recognise straight away and know exactly how to solve?

Ones where you know the solution for certain at first glance — probably not. But I like interactive problems a great deal, and ones where you have to find something within a given number of operations. I think problem B on the first day of IOI 2024 — Message — was something like that, and it really stayed with me. There you had to sit and optimise, to think about how to implement everything as well as possible. Because in most problems you either pass or you do not, whereas in ones like that you can gradually improve your solution again and again — it is absorbing and it adds excitement.

Which problems were the most interesting, and at which olympiad?

I think this is a fairly controversial view, but I liked the football problem at the Ukrainian stage in 2024. It was not especially hard compared with the others, but it let you warm up and think a little. For instance, when I try writing problems myself, I often run into the fact that a problem is either very easy or impossible. So I have a lot of respect for it when problems like that turn up at an olympiad — where there is room to think, where there are non-obvious moments. That is really great.

If you were offered the chance to add one rule to how an olympiad is run, what would it be?

I have plenty of subjective views on that. I like it when the problems are varied — not only about subtasks and DP. That is, I am in favour of having as many non-standard problems in a contest as possible. Although of course I understand that standard ones matter too, and that not every problem can be non-standard — that really is difficult.

I cannot say there are any problems with the rules or the marking — on the whole the system is fairly well thought out. The one thing I would add concerns the judging systems. Some of them still do not merge subtasks, and you end up having to write everything out separately. We do not have that problem, but at some olympiads I have run into it, and it makes the work a little harder.

What are you doing now — studying, working?

I am studying at Phillips Academy in Andover, Massachusetts, USA. It is a private institution; we both live and study here. Working is not really allowed here, so the focus is on studying.

Does olympiad experience help you in your studies or your work? In what way?

100 per cent. We have plenty of people with better time-management skills, but olympiad experience helps me a great deal: I can focus quickly, get into a working rhythm and work productively right to the end. For example, we had a history dissertation — most people wrote it over the whole term, as intended. I had gathered my material but put off the text for a long time, being busy with other things. In the end I sat down two days before the deadline — and made it, and it turned out perfectly decently.

Another important aspect is the ability to think abstractly. You stop seeing a problem as a set of steps — “substitute this, do that” — and instead try to understand the general concepts. That helps a great deal in study. For instance, I used to think physics was not for me at all: at school my relationship with it was rather formal, unlike with maths. But after the olympiad experience in programming it became much easier, and preparing no longer looks so hard.

Where do you see yourself in the future, what position would you like and where?

In truth it is hard for me to answer that definitively. I have always had the thought that I would like to do something of my own — a startup, or perhaps a non-profit. The idea of working for myself, or in a small team doing something genuinely interesting and not necessarily conventional, appeals to me more.

So I understand that working at Google, say, is great and opens a lot of doors, but it seems to me there are other paths that suit me better. It matters to me to have influence over what I do, how I do it and what good it may bring. And for me that is also about how I can be of use to the world.

Did you ever want to stop doing programming? If so, what motivated you to carry on?

I did, I did. In truth I had periods of a fairly difficult relationship with programming. Especially because of the olympiads: wow, great — but along with that, a plan saying you have to work and work constantly, and I did not always want to work. But I knew it was worth it.

There were times after unsuccessful competitions when it seemed to me that programming was not for me. It felt as though I had gone badly flat, that I would not be capable of moving on. But then new chances would appear: selections, olympiads. For instance, after one such fall and a bout of self-recrimination I made it to the Balkan Olympiad and thought: hold on, not everything is lost. I really can do this, and I want to carry on.

To tell the truth, I did not always want to take part in competitions where I felt I would definitely not be the best or the strongest, where the format was not mine. But another part of me said: keep working, it is all in your hands.

Tell us about your coach — how exactly did he help you: only with the teaching, or with life advice too?

Valentyn Ivanovych (ed. — Valentyn Melnyk, a coach from Kremenchuk) has a very interesting tradition: before every olympiad he would talk to each of us personally. Of course those conversations were mostly about olympiad matters, but it seems to me that many of them gave me important lessons for life as well.

For example, his advice to start with the easy subtasks, to give yourself a little confidence and understand the essence of the problem — that still helps me. Even now, when I am working on some small projects, I recall that thought. Because although you very much want to do everything perfectly and at once, I understand that perfect does not exist, and that it is better to give yourself an easier task at the start, so as to get a concrete result and move on.

As for the teaching, he was a very important mentor to me. We have worked together for a long time. I remember well how at the very beginning he gave me a logic test — no programming at all, no code. That was to understand how I think. And it seems to me that is fairly telling: that I am not merely preparing to write code, I am preparing genuinely to solve hard problems.

When the results at olympiads were not the best, Valentyn Ivanovych always said: we carry on working, we look at what chances there are next, at what else we can do. Already at IOI 2024, when the long marathon of years had been run, we talked, and I was sincerely grateful to Valentyn Ivanovych for helping me reach the point where I could call myself his student with pride.

How do you rest, do you have any hobbies besides programming?

Yes, I have quite a few different interests now. Everyone here has to do some sport, and since December I have been climbing — we have our own wall, and incidentally I had a direct hand in improving it. Sometimes we also go out to climb on real rock, which is really great. It seems to me this is one of the perfect sports for programmers. Because while climbing you have to solve a kind of problem at the same time — among ourselves we even call it “solving problems”, when we work out how to climb something properly. And it is a sport, but a fairly calm one.

On hard sections I move almost like a sloth: slowly, carefully — because if you do something abruptly it can get far harder. After the olympiads that was very useful: at a competition the faster the better, whereas here I get the chance to find a balance.

Another way to switch off after study is the interest clubs. We have a lot of them. Besides the programming club I also do linguistics, and sometimes go to the debating club. Incidentally, I cannot resist boasting — even though the question was about something other than programming — that next academic year I am heading the programming club. And some friends and I are working on a project for a new club to do with technology and finance.

I have also gone back to playing the guitar. There was a long break, but now I find the time and even try to write my own music. My teacher and I are working on arrangements in an American jazz style, which I find very interesting.

And I am probably easy to recognise at school not only by the unusual colour of my hair — the moment there is a chance, I am in my big headphones listening to music. That is another way to rest, to switch over, or simply to tune myself to the right wavelength.

What would you advise students who are only just starting out in programming?

A great many people, having only just started, immediately think about making something big — a million-dollar program, for instance. But it is far more important to think: what do I need to change in myself, what skills do I need to add, so as not merely to create something accidentally successful but so that my work is genuinely worth something. And in that, to my mind, lies the greatest value of olympiad programming — we get into the habit of thinking, of working with fundamentals and algorithms, of getting to the heart of things.

Another very important thing is balance. Keeping your interest alive, not burning out, so that programming stays a joy rather than becoming just another “job”. That is what I always liked about the camps: we had time for solving problems, for talking things over together, and simply for volleyball or conversations “about life”. It was in moments like those that I grew the most. There was a real community there: we inspired one another, helped one another, supported one another — and gave each other room to rest, without pressure.

It really matters to find your community. People you can grow with, be inspired by, learn from, and simply be yourself around. That is what helped me most at the time. And it still does.