Competitive Programming Test Generator — Binary String Copying
Domain: computing_math — Software Engineering

Summary: Write gen.cpp, a C++ test case generator for the Binary String Copying problem that produces adversarial inputs to distinguish correct from incorrect solutions among 10 hidden submissions.

Task prompt:
You are tasked with writing gen.cpp, a C++ program that prints one complete valid test case to stdout per invocation and accepts a single integer seed as argv[1] (e.g. ./gen 1, ./gen 2, ./gen 50) to vary output across invocations.

The problem statement is provided in Binary String Copying Problem Statement.pdf. The 10 submission IDs are listed in Binary String Copying Inputs.xlsx: they are each a single letter, proceeding alphabetically from top to bottom (row 2 is a, row 3 is b, etc). Without knowledge of the submission implementations, the generator must be designed by reasoning purely from the problem structure about what kinds of inputs stress different algorithmic approaches:

To trigger TLE on slow solutions, generate worst-case inputs where the sums of n and m hit their limits (sum of n = sum of m = 200000) using a single large test case with m operations whose [l, r] ranges cover wide spans of a string with many alternating 0/1 segments, forcing per-query string reconstruction or hashing of long substrings.

To trigger WA on incorrect solutions, generate inputs that exercise boundary conditions: operations with l = r (a no-op sort that produces the original string and must be deduplicated against any other no-op operation), strings that are already sorted everywhere except at narrow boundary windows so distinct (l, r) pairs collapse to the same sorted result, all-0 and all-1 strings where every operation is a no-op, and ranges whose sorted result equals the original because the substring is already sorted — all cases where naive comparison or careless hashing diverges from the correct deduplicated count.

To produce both AC and WA verdicts from the same submission across 50 seeds, the 50 generated test cases must include a mix of small inputs (n, m <= 100) and maximum-size inputs so that a randomized or hash-based solution coincidentally agrees on small inputs but collides on large adversarial ones.

gen.cpp must be compiled and verified locally with g++ before submission.

## Input Files
Located at: `default/input`
- `Binary String Copying Problem Statement.pdf` — full problem statement
- `Binary String Copying Inputs.xlsx` — submission IDs

## Output
Save your final generator as: `default/output/gen.cpp`

## Compilation
Use: `g++ -O2 -std=c++17 gen.cpp -o gen`

## Constraints
- Each test case must be valid input for the Binary String Copying problem
- Sum of n across all test cases in one invocation must not exceed 200000
- Sum of m across all test cases in one invocation must not exceed 200000
- Each query must satisfy 1 <= l <= r <= n

## Evaluation
Your generator will be called as `./gen $seed` for seeds 1 through 50 to produce 50 test cases. Submission j serves as the reference solution. Each of the remaining 9 submissions will be run against all 50 test cases with a 2-second time limit and 256MB memory limit per execution. The verdict for each submission is the union of all outcomes (AC, TLE, WA, RE) across the 50 test cases, joined by "/" in the order AC/TLE/WA/RE.


The agent must:
Read the Binary String Copying problem statement PDF and submission IDs from the xlsx.
Analyze the problem structure to identify adversarial test case strategies (TLE, WA, boundary conditions).
Write gen.cpp that generates varied test cases across 50 seeds respecting all constraints.
Compile and verify gen.cpp with g++ -O2 -std=c++17.
Save the final generator to the output directory as gen.cpp.

Software: g++ (C++17)
bash

Input files:
name: Binary String Copying Problem Statement.pdf
format: pdf
description: Full Codeforces problem statement with constraints.
name: Binary String Copying Inputs.xlsx
format: xlsx
description: Lists the 10 submission IDs (a through j).