#competitive-programming #do #use #not

cp_tricks

Tricks for competitive programming. Do not use this crate.

1 unstable release

0.1.0 Jun 28, 2021

#3 in #not

MIT license

8KB
147 lines

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 Scanner or UnsafeScanner for 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 debugging
  • dbg!, when in doubt, pass the reference

lib.rs:

Tricks for competitive programming

Most used ones are

  • Macro [input!] for input parsing all at a time
  • [Scanner]/[UnsafeScanner] for parsing on demand

No runtime deps