0PricingLogin
Competitive Programming Academy · Lesson

input() vs sys.stdin Showdown

Why plain input() costs you on big tests.

The Hidden Cost of input()

Every input() call does extra work behind the scenes. On a few lines that is fine, but contests can throw thousands of lines at you. ⏱️

Why It Adds Up

The slowdown is the per-call overhead: prompts, flushing, and encoding checks repeat on every single line you read.

All lessons in this course

  1. input() vs sys.stdin Showdown
  2. Parse Many Numbers on One Line
  3. Batch Output the Right Way
  4. Read N Lines and Edge Cases
← Back to Competitive Programming Academy