Link to blog post in my website: https://mredigonda.github.io/blog/proper-form-in-competitive-programming/
My mind kept telling me that an hour in the gym was an hour I could've spent practicing for competitions, and while that was technically correct, that didn't took into account all of the benefits from exercising, not only to my health but also directly to my performance in competitions.
One important aspect that I think would've benefitted me from exercising more is the analogy of exercise and problem solving. Actually, when practicing for competitive programming competitions, I even call it "training" too.
Not all of the analogies will match perfectly, but I find it interesting to analyze them.
There are the straightforward analogies about challenging yourself. While these are kind of trivial, they can be useful to someone.
For example, the common advice is "practice practice practice", but in the gym, if you "practice practice practice" with the same weights every time, you will have a hard time trying to lift heavier weights.
The same is true for problem solving, if you always solve problems, say, with 1800 rating points on Codeforces, you won't be able to easily solve problems with rating 2300.
So you not only need to practice practice practice, but do so with problems that challenge you enough so that you learn new things, or improve the confidence on already existing knowledge / speed. Something similar is explained in The 'science' of training in competitive programming.
I have a less obvious analogy.
When you are lifting weights, it's extremely important that you do so with a proper form. Not only this is needed to avoid injury, but it's also important to make the exercise you are doing, target the exact muscle you are trying to build.
Some exercises are about moving something from position A to position B, but the way you do it is what matters. If you lack mind-muscle connection, it's common that you compensate using much more your, say, biceps and forearms, than using the exact muscle you are trying to train, say, your lats or traps.
One might think that is capable of lifting, 65kg in a certain exercise, but reality might indicate that he can only do so properly with at most, 40kg. Between training 65kg improperly, or lifting 40kg properly, I always prefer the proper option, to avoid injury, but also to more efficiently target the muscles I want to build.
Now how this relates to competitive programming?
I remember when I was practicing for ICPC World Finals, I used to practice with hard problems. Eventually, after about 2 hours of trying, I was able to get a solution.
My solutions to many problems have a certain common pattern, they are usually overkills. Yes, they work, but there is usually a clever idea that would turn an hour of coding into ten minutes.
What's worse is that I felt succeeded after the problem was done, and the accepted verdict was given.
My conjecture is that by reducing the difficulty of the problems I was solving a bit, and making a stronger effort to really understand solutions and clever ideas to problems, even when I already solved them "my way", then practicing those ideas until they become fully automatic, I would've had a much better performance my competitions.
I suggest you to exercise, and learn about it, even while heavily training for competitions.