Recently I thought a lot about optimizing my setup. I don't think it is an important aspect of cp, as it barely affects the performance, but it is fun to think about nonetheless.
In this blog, you will be able to determine whether you have an optimal setup or not. I will list the criteria and points you get for satisfying each one of them. In the end, I do the breakdown for different point ranges.
I won't include things like having a monitor or having an internet connection, but I will be including basically everything else that comes to my mind. If you see something missing from the list, let me know in the comments, I will probably update my list then.
This blog is mainly made for laughs, but if you are new, you will probably learn something new, even though it won't help you to increase your rating.
You can compile and run your code.
- $$$0$$$ points: I don't know how to run my code before submitting
- $$$10$$$ points: I compile my code before submitting
I knew many school kids that never figured out how to run their code locally. I even saw some people like this in the university. Judging by 73 pages of Compilation Error submissions from the last Div 4 contest on problem A alone, I have seen nothing yet.
You have to be able to run your code locally. Even LGMs run their $$$A$$$ solutions on the sample tests.
Your text editor does not lag / crash
- $$$0$$$ points: My editor is laggy and crashes all the time
- $$$2$$$ points: My editor is a bit laggy and crushes sometimes
- $$$4$$$ points: My editor runs perfectly
When I was writing local contests during my school years, I constantly dealt with lags and crashes. Probably I should not have used Visual Studio on a machine that could barely run it. So if you have the same issues, I think you understand why you lose points.
You can compile and run your code with no internet
- $$$0$$$ points: I use an online editor and need internet access to run my code
- $$$2$$$ points: I don't need internet access to compile my code
Some people you online editors like this one. I think not being able to compile without having internet it is a pretty big deal.
You can benefit from syntax highlighting and you use it.
- $$$0$$$ points: I am not using syntax highlighting, but I would use it if I could
- $$$2$$$ points: I use syntax highlighting
- $$$2$$$ points: I don't use syntax highlighting because it is useless for me
If you are not colorblind, or you are not used to mono blue text on a blue screen like my dad, you will probably benefit from making you code more readable by automatically coloring it depending on the context.
You are able to see how many seconds your program took to run
- $$$0$$$ points: When I run my code I don't see how much time has passed
- $$$1$$$ point: When I run my code I see the number of seconds it took to run
Seeing the time your program took to run probably won't help you to $$$100$$$ % accurately predict whether you will get TLE or not. But being able to determine whether your solutions runs slower or faster on a max test after a fix is important.
You can see how much memory your program uses.
- $$$0$$$ points: I cannot check the amount of memory my program used
- $$$1$$$ points: I can check how many megabytes my program used
In certain implementations, it is hard to determine how many megabytes of memory your solution takes, so it is sometimes useful to see that info.
You can see syntax mistakes in your code without running it (in other words, you are using a Language Server)
- $$$0$$$ points: I have to compile my code to see mistakes in the syntax.
- $$$3$$$ points: When I make a typo, my editor tells me about it straight away
If you only can see that you have made a typo only after you compiled your code, then you have to fix the mistake and then compile the program again. It wastes time
You are using a programming language, that can solve all of the problems in the contest you attempt
- $$$0$$$ points: I attempted a problem in the past and failed because of my choice of programming language
- $$$3$$$ points: The programming language I use has never failed me.
Some tasks are impossible to solve using slower languages. Sometimes it is possible to solve a task, but you have to put in extra effort to do so. I am not an expert here, so I won't list "unviable languages". But if you run into this kind of issues, I think you also understand that what you are doing is suboptimal
You have a fast way to copy and paste algorithms/data structures
- $$$0$$$ points: I never copypaste anything / Usually I copy algorithms from the internet
- $$$2$$$ points: I have my own library of algorithms/data structures and when I need something, I search in it and copypaste to my code
- $$$3$$$ points: I have my own library and I have hotkeys (snippets-like) to easily paste needed algorithms into my code without leaving my editor
If you are finding yourself implementing the same Add on a segment, sun on a segment Segment tree algorithm 3 times in a row, you are probably becoming faster and faster at implementing it. In a certain sense, it is optimal in terms of learning. But it always be slower than just copying and pasting it.
You don't have to copy and paste your tests every time you run your program.
- $$$0$$$ points: When I run my program, I have to paste the text in the console every time I run the program
- $$$2$$$ point: I am able to paste 1 test once and run it multiple times
- $$$3$$$ points: I am able to paste several tests at once and run all of them with a push of 1 button
If you have to copy the same tests over and over again to test your solution, you are doing something very wrong: it wastes a lot of time. Also sometimes it is important to be able to input data line by line (when solving interactive problems for example), that is why there is a difference between $$$2$$$ and $$$3$$$ points
You have good warnings/error messages.
- $$$0$$$ points: My warning/error messages are confusing and they don't help me at all
- $$$1$$$ points: My warning/error messages are mostly useful, but sometimes I wish they were better
- $$$2$$$ points: My warning/error messages are always telling me what is wrong with my program, and I don't see a way how to make it better
I use C++ and I have spent some time on adding compilation flags that enable some new warnings. I was not able to get all of the sanitizers working properly, but even the warning messages became a lot more useful. There is a cool blog on this topic.
Auto-parcing contests to copy tests.
- $$$0$$$ points: I copy sample tests from the tasks manually
- $$$1$$$ point: I use tools to automatically copy tests from problems
There are tools like this one that allow you to copy tests from the tasks.
Your code is readable and hackable.
- $$$0$$$ points: I have a > 50 lines template that makes it harder to read my code
- $$$1$$$ point: I don't use a template / my template is <= 50 lines of code / it is > 50 but I am sure it does not prevent anyone from easily understanding my code
Hacks exist, it is always better to get hacked (unless it is some anti-hash hack) than to FST
You can run a debugger (in a form that is easy to use).
- $$$0$$$ points: I cannot run a debugger in a form that is easy to use for me
- $$$1$$$ point: I can run a debugger in a form that is easy to use for me, but I prefer not to use it
- $$$1$$$ point: I can run a debugger in a form that is easy to use for me and I use it
Even if you are not usually using a debugger, the option to be able to is definitely a plus. Printing is not always faster.
You have a good way to print() to debug
- $$$0$$$ points: I use plain cout or print to debug.
- $$$1$$$ points: I use advanced debug printing: like using macros to output the names of the variables with their values, being able to easily output the array.
- $$$3$$$ points: I have a complete debugging library, that is able to output graphs/data structures in an easily readable form
You have a stress testing setup.
- $$$0$$$ points: I don't use stress testing or I have no setup to use it.
- $$$2$$$ points: I have a template that helps me to stress test my solutions
- $$$4$$$ points: I have a script that is able to stress my solutions.
If you don't know about stress testing, you get 0 points and you should also check out this cool video that explains it.
You are using vim motions/ other advanced text editor key bindings.
- $$$0$$$ points: I don't use vim motions or any other advanced text editor key bindings
- $$$2$$$ points: I use vim motions or other advanced text editor key bindings.
Repeatedly grabbing your mouse to select text is definitely suboptimal. Using arrow keys to traverse through code is very slow. Using things like vim motions will speed things up a lot
WPM while typing.
- $$$0$$$ points: I have < 30 WPM while typing
- $$$1$$$ point: I have >= 30 WPM while typing
- $$$2$$$ point: I have >= 100 WPM while typing
You can check your typing speed here. I know typing steep is not really a setup, but it is close enough to include in this blog.
I don't think it really matters, except for the edge cases. Being too slow can hurt your performance, and also being very fast can get you a lot of rating in a speedforces situation.
You can easily use multiple files to code
- $$$0$$$ points: I use a single file to code, if I want to write something in parallel, I copy the old solution to the notepad
- $$$1$$$ point: My setup allows me to code in several windows.
Sometimes you want to jump to another problem while not finishing the current one. If you have to copy your code somewhere before you start coding a new problem, it is some extra time spent on managing something that can be made easier.
You are using a class for modular operations
- $$$0$$$ points: I don't use special classes for modular operations and my code looks like this
d = ((a+b)%mod - c + mod)%mod * e % mod
- $$$1$$$ point: I use a special class for modular operations and my code looks like this
d = (a+b-c)*e
You have a diff tool to compare the results of the tests
- $$$0$$$ points: When I run my tests, I manually check for the differences in the output
- $$$1$$$ point: When I run my tests, my diff tool tells me whether the is a difference in the test outputs or not, so I don't have to check it manually
Sometimes the output of the test is huge, and it is a hustle to check it manually. Let the computer check it for you and don't play the game of "find 5 differences" every time the output is big.
Counting points
Now it is time to sum up all of your points! In the list below you can see what kind of coder you are.
- 46-50) You are either $$$\color{orange}{2300}+$$$ and have a cool optimal setup, or you are ~ $$$\color{green}{1200}$$$ and wasting too much time on optimizing your setup instead of focusing on solving problems
- 36-45) You have a pretty good setup, old ladies who have no clue about how computers work think that you are a "hacker"
- 20-35) You are writing in a suboptimal environment, either because you are a bit too hardcore about "to be better at solving problems I have to solve problems", or because you are a punk $$$\color{black}{L}\color{red}{GM}$$$ that is too cool to care about what tools to use while destroying competitors.
- 13-19) You are a math enthusiast that decided to join codeforces because online math olympiads are not that fun.
- 0-12) You should be the happiest if you got this amount of points. It means you can improve your rating aside from just solving more problems, because it is almost like you are participating from your Nokia phone.
Also, I give online classes, $$${\$25}$$$ per hour for one on one lessons, $$${\$8}$$$ per hour for lessons in groups of 3, free trial lesson. Contact me on Codeforces if you are interested or for more info.