Tricks for Competitive programming
IO
- Use Scanner directly and parse input step by step
- Use
input!macro for any arbitrary inputs (Codeforces, Codechef requires this) - Or, use
ScannerorUnsafeScannerfor parsing input on demand
dbg! macro
dbg!is so handy, you can place it anywhere in the code, around a variable or even an expression, it outputs the value of expression to stderr. Great for debuggingdbg!, when in doubt, pass the reference