CONCEPT · Novice

Contest I/O

also fast input · scanner

Problems specify a rigid input format. In a real contest you parse stdin exactly. In this MVP the arena calls a JavaScript function with parsed arguments instead.

Intuition

Wrong parsing is a WA that looks like a wrong algorithm. Read n, then exactly n tokens. Do not assume a trailing newline saves you.

When to reach for it

  • Every Codeforces / AtCoder / USACO submission
  • Multiple test cases (t up to 1e4 — empty the leftover state)

Usual pits

  • Using slow C++ cin without ios::sync_with_stdio(false)
  • Forgetting to reset arrays between test cases
  • Printing extra debug lines
Open the lesson