I pretty much exclusively use Kotlin for competitive programming, mostly because it's the language I'm currently most comfortable with. Here are some scattered notes and tidbits about my experience which I think might be useful to others; if you have any tips/suggestions, feel free to let me know.
Useful features
A lot less boilerplate than Java. Type inference means a lot less "Pokémon speak". Variables and functions can be declared straight in the top-level of the file. (basically the equivalent of
staticfunctions)data classes – basically custom tuples. Allows convenient destructuring declarations too.Has access to the data structures in the Java standard library (
TreeMap,HashMap,PriorityQueueetc.), and also can useBigIntegerandBigDecimalif neededFunctional idioms for collection manipulation;
map,fold,filter, etc.inline classes – allows the creation of a new type that wraps over a base type, but that is represented by an underlying type at runtime. Especially useful for "modulo $$$10^9 + 7$$$" problems, as I keep aModInttemplate that overloads the arithmetic operators appropriately, but is represented as a plainintin JVM runtimerunfunction – great way to write code that needs to shortcut (e.g.return@run "NO") without having to write a new function and pass every relevant argumentfunctions in functions – functions can be defined within e.g. the
mainfunction, so again, no having to pass lots of arguments or global variables



