Git Merge
题号:NC209996
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Writing code with other people sometimes means wasting time — at least you will spend much time working on merging different branches and testing them for potential bugs. And sometimes, the differences marked by git is only different styles of coding!
#include <bits/stdc++.h>

int main() {
<<<<<<< branch1
    printf("Hello world!");
=======
    puts("Hello World!");
>>>>>>> branch2
}

Here's an example of merging Hello World. The one on branch1 used printf, but the second programmer prefered puts. Well, one solution of that problem is to make some proper defines and make things work when different preset is on. One of the simplest ways is to change the git's mark into define, that is,

#include <bits/stdc++.h>

int main() {
#ifdef branch1
    printf("Hello world!");
#else
    puts("Hello World!");
#endif
}

However, sometimes git will not mark an accurate range for simplicity that replacing the marks will not result one shortest answer. The following code could be shorter if add defines differently.

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b;
<<<<<<< branch1
    cin >> a >> b;
=======
    scanf("%d%d", &a, &b);
>>>>>>> branch2
    if (a < 0 || b < 0) return 1;
<<<<<<< branch1
    cout << a + b << endl;
=======
    printf("%d\n", a + b);
>>>>>>> branch2 
}

Your task here is to output one of the shortest possible merge answers, for some C++ code. Here're some definitions and limitations:
* There will be 1 or more conflicts in the file. The conflicts are marked with exactly the same format with the sample code. That is, 
   * "<<<<<<< branch1" for the beginning.
   * "=======" for separating conflicts.
   * ">>>>>>> branch2" for ending.
   * There're 0 or more lines of code between marks.
* No "<<<<<<< branch2" or ">>>>>>> branch1" will be presented in the code.
* No nesting conflicts will be presented in the code.
* No other lines start with "<<<<<<<", "=======" or ">>>>>>>".
* The input file may not necessarily be output of git, and there's no guarantee of niceness of the marks: it may contain 'surprising' output like later samples. However, it will strictly follow the format.

* You can rearrange code with (only) following commands, as long as they submit to preprocessor standard (https://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html):
#ifdef branch1
#ifdef branch2
#else
#endif

* You're not supposed to insert any other directives apart from the above ones or preprocess any directives in the code.
* There's no other #if #ifdef #ifndef #endif directives in the code and no #define #undef related to "branch1" "branch2", so you don't need to treat preprocessor directives different from normal code.

* Two defines "branch1" or "branch2" will be turned on one at a time.
* Empty lines should also count as lines, and your output should be exactly matched with two files after processing. However, it's granted that input file end with single '\n' before EOF, and no extra spaces before '\n'.

* The char set of input file is all visible ASCII chars (from 33 to 126), '\n', '\t', and space(32).  The line break is granted to be '\n' but not "\r\n".
* 'Shortest' means the number of lines of the code is minimum. It's not necessarily to output a shortest answer in bytes.

输入描述:

Input file consists of at most 4000 lines of code or git marks, with each line at most 256 byte including '\n'.

It's granted that there's at least one conflict and at least one code line.

输出描述:

The code with minimum number of lines that will be the exact match with two branches when different defines on. If there're multiple answers, print any.

The checker will try to fix some unpleasant issues, including ignore spaces at end of line and extra line breaks at end of file. However, you're recommended to output your answer in the format of samples in order to avoid Wrong Answer caused by Presentation Error.

The output must be shorter than 5000 lines with each line at most 300 byte including '\n'. Otherwise, you will receive Wrong Answer verdict.
示例1

输入

复制
#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b;
<<<<<<< branch1
    cin >> a >> b;
=======
    scanf("%d%d", &a, &b);
>>>>>>> branch2
    if (a < 0 || b < 0) return 1;
<<<<<<< branch1
    cout << a + b << endl;
=======
    printf("%d\n", a + b);a
>>>>>>> branch2
}

输出

复制
#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b;
#ifdef branch1
    cin >> a >> b;
    if (a < 0 || b < 0) return 1;
    cout << a + b << endl;
#else
    scanf("%d%d", &a, &b);
    if (a < 0 || b < 0) return 1;
    printf("%d\n", a + b);a
#endif
}
示例2

输入

复制
<<<<<<< branch1
int main() {
    return 0;
}
=======
int main() {
}
>>>>>>> branch2

输出

复制
int main() {
#ifdef branch1
    return 0;
#endif
}
示例3

输入

复制
<<<<<<< branch1
int main() {}
=======
int main() {}
>>>>>>> branch2

输出

复制
int main() {}

备注:

To show precisely how the input file formated, let's take sample 2 for example, the input file can be verified to be equal to the following string:
"<<<<<<< branch1\nint main() {\n    return 0;\n}\n=======\nint main() {\n}\n>>>>>>> branch2\n"
and one possible output (as sample output 2) is:
"int main() {\n#ifdef branch1\n    return 0;\n#endif\n}\n"

Note that if you're running tests on Windows, you have to aware '\r' issue when you are using getline(). The test data will not contain any '\r'.