Skip to content
CCC Python Course

Fast input and output

Stage
3
Module
M3.10
Lessons
1

In this module

  • Use sys.stdin.read() to read large amounts of input quickly.
  • Parse input using split() for faster token processing.
  • Build output as a list and print it all at once.
  • Apply the house skeleton pattern for high-throughput I/O.

Before this module

Lessons

  1. 1Fast input and output

Practice

Try these on the judges. Each link opens the problem on WMOJ or DMOJ.

  1. 2015 S2
    Jerseys (opens on DMOJ in a new tab) DMOJ

    Process many assignments efficiently; the input size makes fast I/O worth using.

    Why DMOJ: A large-input problem where the house skeleton pattern avoids slow input() calls.

  2. 2025 J4
    Sunny Days (opens on WMOJ in a new tab) WMOJ

    Scan a large run of daily records fast enough to stay inside the time limit.