Competitive Programming for Beginners / Chapter 1 — Foundations (lessons 1–5) / Lesson 1

Getting Started with Competitive Programming and Reading Input

Time needed: about 11 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

The first wall isn't algorithms, it's input

In competitive programming, right below the problem statement there's a spec saying "Input is given in the following format."

Even if you come up with the solution, you get zero points if you read this wrong.

There are surprisingly few input shapes: "one value per line," "several values on one line," and "N lines of data" cover almost everything.

First, let's get these three into your fingers.

editor.py

Tab indents. To leave the editor, press Esc, then Tab.

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.