Linux setup for Competitive Programming (with Geany)

Linux setup for Competitive Programming (with Geany)


Many people ask me about the environment I use for competitive programming So here are the setup instructions, the steps are written down in my Github, link is in the description. I use Ubuntu which is a popular, free distribution of linux. I already installed the system and now, click activities in top left or just hit Windows button on your keyboard Here you can type whatever you want to run or search for, I’m looking for terminal. You can also get the same effect by just hitting ctrl+alt+T. I’d like to install Geany, which is my favorite IDE. It isn’t perfect, but it is very convenient for competitive programming. I can install it either by using terminal or Ubuntu Software Center, which is here But I prefer the terminal. If I just type `geany` in terminal It will show me a hint, what I should use in order to install it, here it’s `sudo apt install geany` Copy that, put my password, and yes, I want to continue Wait a moment and it’s done! Now if I type `geany` – – it will open the program, I can also in activities, type `geany` and I can here right-click and add to favorites. Then after closing Geany, I see it still on the left as a shortcut and it’s more convenient to access. Let’s configure Geany, hit Ctrl+Alt+P to open preferences Go to key bindings and there at the bottom, search for switch to editor and switch to VTE, VTE is terminal built-in for geany. Editor, I prefer to switch to F1 Yes, override and VTE is F2. They are two buttons that are very close to each other and it’s very convenient to use them, then hit apply. In terminal tab, mark Follow path of the current file and optionally in editor, I can change Comment toggle marker Here by default, It’s this character that I don’t like, I don’t want it here, hit apply. Ok, because that one is very, very not standard. Open any C++ file, I can do it by typing whatever and Ctrl+S saving it as file(dot)cpp. I’m using, a(dot)cpp. It’s saved and now when I go to build, set build commands, I will see commands for C++. I’m copying my flags to compile and to build. (Basically F8 is fast and F9 is safe) Now hitting F9 and F8 runs build and compile respectively. They are different sets of flags. F8 uses O2 in particular that speeds up the program and then I will get similar running time as almost on any online judge where everything will be as fast as possible, while F9 has sanitizers that are slow- -but they check a lot of out-of-the-array errors and similar ones or overflows. The running time is much slower You shouldn’t measure the time on maximum possible tests this way But by default I use F9 in order to see possible errors on sample tests or just any other small tests. Then F8 only if I want to check something for the max test. When you have a ready C++ program, then hit compile You might get an annoying sound from your PC, that says something was compiled and to get rid of it go to preferences, General tab and Miscellaneous and unmark beep on errors when compilation has finished. Apply, and now there should be no sound. Let me demonstrate how I can use my flags and also the built-in terminal. I’m hitting F9, which is a slow compilation Now F2 goes to terminal, I can say `ls`, that will list the files here, `time ./a` It runs the executable and told me that the time is 1.4. but if I do the compilation with F8, which runs O2 I will get 0.8 or less running time, now it’s indeed faster. But there might be some errors here that would only be caught by sanitizers that slow the program down. I prefer to have two convenient options. When I’m in terminal, I’m typing something I can hit just F1 and I’m again in the editor, then F2, and I’m here again, F1 I can compile and F2 moves me back to the terminal. Finally, I don’t like all those toolbars and sidebars so, I’m going to go to view and unmark show toolbar and unmark sidebar. Now it’s much cleaner and I don’t use those buttons anyway. You might notice a difference between geany built-in terminal and a standard Ubuntu terminal. The latter has colors, which is very convenient for me to use and we can fix it by opening file ~/.bashrc Looking for prompt or prompt color Here it is force prompt color – yes, uncomment it, save and now run `source ~/.bashrc` Now it’s Standard colors and after you reboot your computer because you save this thing in bashrc It will be every time automatically run, just like if I now close geany and open it again It should be here with colors. If you work full screen consider in interface switching message window position from bottom to right, Adjusting it, Now we have terminal on the right and editor on the left, obviously you can change the font size or with Ctrl(plus)-, ctrl(plus)+ or with mouse wheel, change the size here. Also, you can obviously change somewhere here size of the font- -if you wish to.I will show you two more things not related to geany. First one is that I like to use guake I’m going to install it now Now, I never need to run terminal again as a separate window Because I have, kind of a global terminal that I can open with F12 and it is here, I can do it full screen as well So when I do anything including geany, but maybe I’m doing something online and then I want to quickly open the terminal, I don’t need to waste time on arranging windows. It’s just on the top. This is one thing guake, very convenient thing. I recommend that, the other is that I don’t like that sidebar on the left and I can go here go here to dock and mark auto-hide the dock and with auto-hide every time you are fullscreen with any window or just you want to move some window to the left The dock will hide but still you can access it by moving your mouse to the left And here you have you have everything in it. Strongly recommend that as well, especially on laptops- -where you want to get as much of your screen as possible. One more thing useful for laptops is workspaces, if you have multiple windows and you are with several stuff, then you might want to Use workspaces and you can move between workspaces with ctrl+alt+arrow up or down. That basically gives you two sets of windows or programs that are open right now If you have any questions about my setup, feel free to ask them in the comments I will try to reply to everybody and I also strongly recommend my old video about testing in Linux that is especially useful for people competing in IOI or National stages of Olympiad where it’s very important that you test your solution yourself in order to find mistakes, You have five hours for three problems, Then it’s enough time to write the brute-force as well as some generator script Thanks to which you will be able to make sure that your program is correct or find a counterexample. That’s it, see ya 🙂