TEST CASE
PARSERCOMPETITIVE PROGRAMMING TOOLKIT

Raw Input
Lines: 0 Chars: 0 Detected cases: —
Quick Examples
Parsed Cases
0 cases found
⚔

Paste your test input above and hit PARSE.
Supports Codeforces, AtCoder, LeetCode, and custom formats.

How to split contest test input into separate files

Contest problems often give you one block of sample input that actually holds several test cases. To test a solution locally you usually want each case in its own file, so you can run ./solution < 1.txt and compare the output with the expected answer. Splitting by hand is slow and easy to get wrong. The parser above does it in one click, entirely in your browser.

Using the parser

  1. Paste your raw input into the box, or load one of the quick examples (Codeforces style, AtCoder style, multi-case, graph problem, EOF terminated).
  2. Choose a split mode that matches how the cases are separated.
  3. Set an output filename prefix, then press Parse.
  4. Preview each case, open it full size, copy it, or download it as a numbered .txt file. “Download All (.zip)” bundles every case together.

While you type, the counters show the number of lines and characters and a live estimate of how many cases were detected.

The four split modes

Which mode fits which format?

Many Codeforces problems start with a number t followed by t cases that are not separated by blank lines:

3
2
1 2
2
3 4
1
5

Here the cases have different lengths, so “every N lines” will not work. Because there are no blank lines, the “first line = number of cases” mode would also see one big block. In that situation, add a separator line between cases by hand and use the custom delimiter mode. For fixed-shape cases, such as a pair of lines per test, “every N lines” is the quickest choice. For samples that already have blank lines between them, the blank-line mode is the right one.

Things to know

A simple local testing routine

  1. Parse the sample input and download the zip.
  2. Run your program on each file and save the results.
  3. Compare them with the expected output using a tool such as diff.
  4. When a case fails, open it in the preview, shrink it by hand, and debug the smallest failing input.

Frequently asked questions

Is my input uploaded anywhere?
No. Splitting and zipping both happen in your browser, so your input is not sent to a server.
Does it work for LeetCode and AtCoder problems?
Yes, as long as you can describe how the cases are separated. The tool only splits text, so it doesn’t need to know which site the problem came from.
Can I change the file names?
Yes. Set the filename prefix before parsing and every downloaded file will use it with a case number.
Is there a limit on input size?
There is no fixed limit, but very large inputs depend on your browser’s memory, so split huge files in a command-line tool instead.

Verify You're Human

We use cookies to enhance your experience. Optional cookies only run if you consent. See our Privacy Policy.