- Runtime Error: Check memory limits, are there implicit conditions?
- Runtime Error: Do all declared functions return? If a function is int, make sure it returns something!
- Be generous with data type limits: 2,147,483,647 (int), 9,223,372,036,854,775,807 (ll)
- Usually, just set to ll.
- Offline query
- Probabilistic method (anything to do with 1/2)
- Mod can be negative! Do NOT use if (x%2 == 1). Rather, use if (x%2 != 0)
ulimit -s unlimited
- In-program
- Compiler optimisation
-O2
- Index array last (caches)
- long long instead of int
- Array size, ordering, increments
- TLE: use '\n' instead of endl (no intermediate flush)