P5246 [Training Team Mutual Test 2016] The Disappeared Source Code

Background

Opening an old set of problems, you find the statement has become blurry and unclear. The contestants’ source code has also disappeared. Only the compiled executable program remains. You found the input files and hope to regenerate the output files.

Description

Given the executable program $\texttt{lost}$ and the input files $\texttt{input*.txt}$, for each input file, compute its corresponding output file. $\texttt{lost}$ uses standard input and output. You can redirect input and output in the command line. An executable program $\texttt{lost2}$ is also provided. It reads from $\texttt{input.txt}$ and writes to $\texttt{output.txt}$. Other than that, $\texttt{lost2}$ is exactly the same as $\texttt{lost}$. You may choose $\texttt{lost}$ or $\texttt{lost2}$ according to your habit. $\text{lost}$ is not perfect. When the data size is large, it may fail to run successfully, and in this case it will directly output `invalid input!`.

Input Format

The first line contains an integer representing the data type. $\texttt{lost}$ will perform the corresponding computation based on the data type. For example, when the data type is $0$, $\texttt{lost}$ will compute the $\texttt{A+B Problem}$ ( $\texttt{input0.txt}$, $\texttt{output0.txt}$ ). The second line contains an integer representing the number of test cases. Then follows each test case. The input format is determined by the data type. When the data size does not exceed the first test case, it is guaranteed that $\texttt{lost}$ can run normally. Only when the number of test cases does not exceed one, it is guaranteed that the output of $\texttt{lost}$ is correct.

Output Format

For each test case, output one line.

Explanation/Hint

[Download input data](http://uoj.ac/download.php?type=problem&id=190) Translated by ChatGPT 5