I'm currently going through the geo section on usaco and whenever I learn something new I just stick it in my Point template. I worry this may just make my point template egregiously long though as I go on. On the other hand, I don't want to be boned in a contest or something if my Point struct is here, convex hull is there, etc. What is the norm? What do you guys do?









Wherever I have the main submission code, I like to create another folder that just has the stuff that is commonly copy-pasted. But because I mostly use the same computer, I only had to create such folders twice. And ever since my PCs upgraded themselves to windows $$$11$$$, they have been linked, basically I can edit one file from one computer and save it, and it will change on my other computer in real time. I can't help but feel like they're removing local storage for some greater purpose. Anyway, just name the files something you will remember like point.cpp and convexhull.cpp and if you use sublime text, it automatically opens the folder your file is in when you press open file, so you can quickly access anything.
This reduces many lines
auto operator<=>(const point_t &p) const = default;Too bad it only works C++20 and after
2020 is 5 years ago! You are right in case of submitting to old platforms like Spoj or UVa.
or like 50% of OJs
Most IDEs have a code snippet feature that lets you easily insert code into your program. You just type the name of the snippet and the code is automatically inserted for you. I use these and they are extremely quick and useful. Here's what I recommend:
Have one small
Pointstruct with justxandy. Use functions that take thePointstruct as an argument. This way, you only use the code that you need to while also having easy access to all of your code.Example: