Hello everyone! In contests when i get the code wrong, one of the things that put me down is styling. In other words,the code works,sometimes,but when something goes wrong and i start debugging, it's very hard to read your own code under the contest conditions. There are lots of top-rated users who have well styled code (eg jiangly) and I just cant write like that.
Questions for you:
How do you manage to have clear variable names that are still easy to type? Do you make many macros/defines or is it a bad practice to do so? Do you have some tips on speeding up debugging process (I write lots of cerrs and doing so is pretty slow)?
Do you use auto-formatter or do manually all formatting? if you use one can you tell me the name or provide the link to it becouse i cant find one. Of course, in CP, clean code doesn't play an as big role as knowledge of algorithms, but I guess it may help me save my time and avoid bugs.
(also my dad said i am writing dirty code and gave me a total of 1000 pages of books about clean coding so i now have to write clean code too)









solve more problems. if you notice a code pattern keeps causing issues while debugging, try to rethink that habit
i am pretty blind of a person and i cannot observe myself can you tell me an example of the code patterns you found that slowed you?
if you're not going to put in the effort into finding the pattern, nobody can give you the answer on a silver platter. nobody lives inside your brain to know how you think and code except you
you cannot know the dark is dark until you see the light
Read the editorial once after you've solved the question, You'll surely find a better and neat implementation.
Pitiful, that don't work on me. After solving a problem i always find out that I am too lazy to think about editorial way.
I would also say that you should think about the answer clearly before you start writing the code.
Learn from other users codes like jiangly
Auto comment: topic has been updated by ilexis (previous revision, new revision, compare).
Clean code come from practicing and looking at others code (so maybe they use a faster techniques or shorter codes) you can see the names of the variables they use . As you mentioned, Jiangly is the best person to look at their code. I use a VSCode builtin formatter, it helps alot in understanding the code . Am not sure if those books are useful but I didn't use any till now and there is no problem with that I think.
You can use Allman programming style like me for easy code understanding. Here is example of the style:
thanks bro thanks to you when i googled Allman programming style i saw "Linux style" and realized how familiar i am with it. i will try to ,mplement my next proplem according to it- while also trying not to spend a lot of time styling my code
allman is just about how to indent and format your code, something that rarely causes issues
use python
good JOKE