{"task_id": "timing_test/timing_task_01", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[1];\n\nry(2.07532276) q[0];\nry(2.2737106) q[1];\ntdg q[2];\nswap q[2], q[4];\nt q[1];\nry(0.5235987756) q[3];\nrz(0.2617993878) q[3];\ncz q[4], q[1];\nh q[4];\nswap q[4], q[0];\nrx(-2.843171334) q[3];\nry(0.7853981634) q[0];\nh q[0];\ncz q[4], q[2];\nswap q[3], q[2];\nrx(0.1636543366) q[1];\nswap q[2], q[4];\nz q[0];\ndelay[15ns] q[4];\nrz(0.2617993878) q[0];\nrx(-1.570796327) q[3];\nsdg q[1];\nsdg q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a delay of 38 nanoseconds to qubit three, followed by an RX rotation\n// with an angle of approximately π/2 radians on the same qubit. The operation sequence affects\n// only qubit three, leaving the other qubits unchanged. The delay introduces a time shift in\n// the quantum evolution, while the subsequent rotation performs a state transformation around\n// the X-axis of the Bloch sphere. No measurements or classical interactions occur within this\n// segment. The overall effect is a delayed rotation that may be part of a larger timing or\n// control sequence in the quantum circuit.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[1];\n\nry(2.07532276) q[0];\nry(2.2737106) q[1];\ntdg q[2];\nswap q[2], q[4];\nt q[1];\nry(0.5235987756) q[3];\nrz(0.2617993878) q[3];\ncz q[4], q[1];\nh q[4];\nswap q[4], q[0];\nrx(-2.843171334) q[3];\nry(0.7853981634) q[0];\nh q[0];\ncz q[4], q[2];\nswap q[3], q[2];\nrx(0.1636543366) q[1];\nswap q[2], q[4];\nz q[0];\ndelay[15ns] q[4];\nrz(0.2617993878) q[0];\nrx(-1.570796327) q[3];\nsdg q[1];\nsdg q[1];\n\n// === CORE_TASK_START ===\n// basic_delay_units | single_delay_then_rx: Apply a single delay on one qubit, then an RX rotation.\ndelay[38ns] q[3];\nrx(1.5708) q[3];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// basic_delay_units | single_delay_then_rx: Apply a single delay on one qubit, then an RX rotation.\ndelay[38ns] q[3];\nrx(1.5708) q[3];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_02", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nswap q[2], q[0];\nsdg q[2];\nh q[2];\nswap q[0], q[2];\nry(0.7853981634) q[2];\ndelay[50ns] q[0];\nry(1.570796327) q[1];\ncx q[0], q[2];\ncz q[0], q[1];\ncx q[1], q[2];\ny q[0];\nt q[0];\ncz q[0], q[1];\nry(-2.762160353) q[2];\nrx(-1.570796327) q[0];\ntdg q[1];\nswap q[1], q[0];\ncx q[1], q[0];\ny q[1];\ncx q[0], q[1];\ny q[0];\nrx(0) q[2];\ny q[2];\nswap q[1], q[0];\ncz q[2], q[1];\nry(1.047197551) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a delay of 67 time units (in discrete time steps) to the second qubit,\n// followed by an X gate operation on the same qubit. This sequence effectively pauses the\n// evolution of the second qubit's state before flipping its phase and amplitude components.\n// The delay uses a specific timing resolution defined by the discrete time unit, while the X\n// gate performs a standard bit-flip operation. Only the second qubit is involved in this\n// particular sequence of operations. The duration and gate parameters are fixed constants\n// within the overall circuit context.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nswap q[2], q[0];\nsdg q[2];\nh q[2];\nswap q[0], q[2];\nry(0.7853981634) q[2];\ndelay[50ns] q[0];\nry(1.570796327) q[1];\ncx q[0], q[2];\ncz q[0], q[1];\ncx q[1], q[2];\ny q[0];\nt q[0];\ncz q[0], q[1];\nry(-2.762160353) q[2];\nrx(-1.570796327) q[0];\ntdg q[1];\nswap q[1], q[0];\ncx q[1], q[0];\ny q[1];\ncx q[0], q[1];\ny q[0];\nrx(0) q[2];\ny q[2];\nswap q[1], q[0];\ncz q[2], q[1];\nry(1.047197551) q[1];\n\n// === CORE_TASK_START ===\n// dt_delay | dt_delay_then_x: Use a dt-based delay on one qubit, then apply X.\ndelay[67dt] q[1];\nx q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// dt_delay | dt_delay_then_x: Use a dt-based delay on one qubit, then apply X.\ndelay[67dt] q[1];\nx q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_03", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\ncx q[1], q[2];\nry(-1.34575396) q[2];\nrx(2.961985006) q[2];\nbarrier q;\ncz q[2], q[0];\ncx q[3], q[0];\ncz q[2], q[3];\nrz(3.141592654) q[0];\nry(1.047197551) q[0];\nswap q[0], q[2];\nswap q[3], q[0];\ncz q[0], q[1];\nrz(1.570796327) q[3];\ndelay[67ns] q[0];\ntdg q[3];\ntdg q[1];\nt q[3];\ny q[0];\nrz(0.3926990817) q[1];\nsdg q[1];\nbarrier q;\nswap q[1], q[3];\ns q[3];\nh q[0];\nrz(0.5235987756) q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a delay to qubit one followed by a Pauli-X operation. The delay lasts\n// for the sum of two time intervals, specifically thirty-one nanoseconds plus twenty-seven\n// nanoseconds. After the combined delay, a bit-flip operation is performed on the same qubit.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\ncx q[1], q[2];\nry(-1.34575396) q[2];\nrx(2.961985006) q[2];\nbarrier q;\ncz q[2], q[0];\ncx q[3], q[0];\ncz q[2], q[3];\nrz(3.141592654) q[0];\nry(1.047197551) q[0];\nswap q[0], q[2];\nswap q[3], q[0];\ncz q[0], q[1];\nrz(1.570796327) q[3];\ndelay[67ns] q[0];\ntdg q[3];\ntdg q[1];\nt q[3];\ny q[0];\nrz(0.3926990817) q[1];\nsdg q[1];\nbarrier q;\nswap q[1], q[3];\ns q[3];\nh q[0];\nrz(0.5235987756) q[2];\n\n// === CORE_TASK_START ===\n// duration_arithmetic | sum_of_durations: Delay by a+b with the same unit, then apply X.\ndelay[31ns + 27ns] q[1];\nx q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// duration_arithmetic | sum_of_durations: Delay by a+b with the same unit, then apply X.\ndelay[31ns + 27ns] q[1];\nx q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_04", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\nrx(-2.33019055) q[2];\nrz(0) q[1];\nry(-2.718387052) q[1];\nswap q[1], q[0];\ncz q[0], q[2];\nrx(0) q[1];\nswap q[2], q[0];\ny q[0];\nbarrier q;\ncx q[1], q[0];\nt q[2];\nswap q[2], q[1];\nx q[2];\nswap q[0], q[1];\nry(2.35619449) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a delay operation to the first qubit using a duration expressed in mixed\n// time units, specifically fifty-three microseconds plus twelve nanoseconds. After this delay,\n// a Pauli-X gate is applied to the same qubit. The operation affects only the zeroth qubit\n// throughout the sequence.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\nrx(-2.33019055) q[2];\nrz(0) q[1];\nry(-2.718387052) q[1];\nswap q[1], q[0];\ncz q[0], q[2];\nrx(0) q[1];\nswap q[2], q[0];\ny q[0];\nbarrier q;\ncx q[1], q[0];\nt q[2];\nswap q[2], q[1];\nx q[2];\nswap q[0], q[1];\nry(2.35619449) q[1];\n\n// === CORE_TASK_START ===\n// mixed_units_duration | mixed_units_add: Delay by a*u1 + b*u2, then apply X.\ndelay[53us + 12ns] q[0];\nx q[0];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// mixed_units_duration | mixed_units_add: Delay by a*u1 + b*u2, then apply X.\ndelay[53us + 12ns] q[0];\nx q[0];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_05", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[2];\n\nry(0.08247198134) q[1];\nrz(0) q[0];\nrz(2.35619449) q[3];\nrx(-0.6099818947) q[0];\nrx(-2.877169272) q[0];\nh q[4];\ntdg q[0];\ndelay[15ns] q[4];\ns q[2];\nrz(1.570796327) q[0];\nswap q[2], q[1];\ny q[3];\nswap q[2], q[4];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a quantum operation on qubit 4 within a time-constrained box lasting 218\n// nanoseconds. Inside this box, an X gate is first applied to qubit 4, followed by a variable\n// delay that stretches to fill the remaining time in the box. The delay duration is determined\n// by the stretch parameter g, which ensures the total execution time matches the specified 218\n// nanosecond duration. This sequence effectively left-aligns the X gate within the time window\n// while stretching the trailing delay to meet the timing constraint.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[2];\n\nry(0.08247198134) q[1];\nrz(0) q[0];\nrz(2.35619449) q[3];\nrx(-0.6099818947) q[0];\nrx(-2.877169272) q[0];\nh q[4];\ntdg q[0];\ndelay[15ns] q[4];\ns q[2];\nrz(1.570796327) q[0];\nswap q[2], q[1];\ny q[3];\nswap q[2], q[4];\n\n// === CORE_TASK_START ===\n// left_alignment_stretch | left_align_x_then_stretch: Left-align: apply X early, fill remaining time with stretch delay.\nstretch g;\nbox[218ns] {\n x q[4];\n delay[g] q[4];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// left_alignment_stretch | left_align_x_then_stretch: Left-align: apply X early, fill remaining time with stretch delay.\nstretch g;\nbox[218ns] {\n x q[4];\n delay[g] q[4];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_06", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[0];\n\ntdg q[1];\ncx q[1], q[2];\nh q[3];\nswap q[3], q[2];\nz q[3];\ny q[3];\nrx(-1.196420825) q[1];\ncz q[3], q[1];\nrx(0.2617993878) q[1];\nz q[2];\nsdg q[4];\ncx q[3], q[1];\nh q[1];\nh q[2];\ncz q[1], q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines a timing alignment operation on qubit three that involves stretching the\n// duration of a delay and applying an X gate at the end of a specified time window. A\n// stretchable delay of unspecified initial duration is applied to qubit three, followed by an\n// X rotation that is right-aligned within a fixed 230 nanosecond time box. The stretch\n// parameter allows the delay to expand to fill the available time before the X gate executes.\n// Qubit three is the only quantum object involved in this timing sequence. The key timing\n// parameter is the fixed 230 nanosecond duration of the box constraint.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[0];\n\ntdg q[1];\ncx q[1], q[2];\nh q[3];\nswap q[3], q[2];\nz q[3];\ny q[3];\nrx(-1.196420825) q[1];\ncz q[3], q[1];\nrx(0.2617993878) q[1];\nz q[2];\nsdg q[4];\ncx q[3], q[1];\nh q[1];\nh q[2];\ncz q[1], q[3];\n\n// === CORE_TASK_START ===\n// right_alignment_stretch | right_align_stretch_then_x: Right-align: stretch first, then X at the end of the box.\nstretch g;\nbox[230ns] {\n delay[g] q[3];\n x q[3];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// right_alignment_stretch | right_align_stretch_then_x: Right-align: stretch first, then X at the end of the box.\nstretch g;\nbox[230ns] {\n delay[g] q[3];\n x q[3];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_07", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\nx q[1];\nry(0.3926990817) q[1];\nrz(2.094395102) q[2];\ncx q[3], q[1];\nz q[1];\nswap q[2], q[0];\nbarrier q;\nrx(0.7849876585) q[3];\nbarrier q;\ncx q[0], q[3];\nt q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a Y gate to qubit 2 while centering it within a 200 nanosecond time\n// window. This is achieved by symmetrically stretching delays before and after the Y gate\n// operation. The stretch parameter g determines the duration of each delay segment, ensuring\n// the total sequence fits exactly within the specified 200 nanosecond box constraint. The\n// operation effectively centers the single-qubit Y rotation in time relative to the\n// surrounding circuit elements.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\nx q[1];\nry(0.3926990817) q[1];\nrz(2.094395102) q[2];\ncx q[3], q[1];\nz q[1];\nswap q[2], q[0];\nbarrier q;\nrx(0.7849876585) q[3];\nbarrier q;\ncx q[0], q[3];\nt q[0];\n\n// === CORE_TASK_START ===\n// center_alignment_stretch | center_align_single_gate: Center-align a single 1-qubit gate by symmetric stretch delays.\nstretch g;\nbox[200ns] {\n delay[g] q[2];\n y q[2];\n delay[g] q[2];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// center_alignment_stretch | center_align_single_gate: Center-align a single 1-qubit gate by symmetric stretch delays.\nstretch g;\nbox[200ns] {\n delay[g] q[2];\n y q[2];\n delay[g] q[2];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_08", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\ncz q[0], q[1];\nrx(-2.512786179) q[0];\nry(-2.191398225) q[2];\ncx q[2], q[1];\nt q[1];\nry(0.7853981634) q[0];\nz q[0];\nh q[2];\nry(3.141592654) q[0];\ndelay[42ns] q[0];\ncz q[1], q[2];\ncx q[3], q[0];\nbarrier q;\ns q[0];\nrx(-1.199266413) q[0];\nrz(0.5235987756) q[1];\ncz q[1], q[3];\nrz(2.35619449) q[0];\ns q[2];\ncx q[1], q[0];\ncx q[0], q[1];\ns q[1];\nrz(1.047197551) q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines a stretchable time interval and uses it to schedule a sequence of\n// operations on qubit q[1]. First, a delay lasting one unit of the stretchable time is\n// applied, followed by an X gate. Then, another delay is applied that lasts twice the\n// stretchable time unit. All of these operations are enclosed within a fixed-duration box of\n// 259 nanoseconds, ensuring the entire sequence fits within that timeframe. The proportional\n// placement directive indicates that the X gate is positioned after one part of the\n// stretchable duration, with the remaining two parts following the gate. This creates a time-\n// stretched pulse sequence on qubit q[1] with specific timing constraints.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\ncz q[0], q[1];\nrx(-2.512786179) q[0];\nry(-2.191398225) q[2];\ncx q[2], q[1];\nt q[1];\nry(0.7853981634) q[0];\nz q[0];\nh q[2];\nry(3.141592654) q[0];\ndelay[42ns] q[0];\ncz q[1], q[2];\ncx q[3], q[0];\nbarrier q;\ns q[0];\nrx(-1.199266413) q[0];\nrz(0.5235987756) q[1];\ncz q[1], q[3];\nrz(2.35619449) q[0];\ns q[2];\ncx q[1], q[0];\ncx q[0], q[1];\ns q[1];\nrz(1.047197551) q[2];\n\n// === CORE_TASK_START ===\n// proportional_placement | ratio_1_to_2: Place a gate after 1 part stretch, then leave 2 parts stretch.\nstretch g;\nbox[259ns] {\n delay[g] q[1];\n x q[1];\n delay[2*g] q[1];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// proportional_placement | ratio_1_to_2: Place a gate after 1 part stretch, then leave 2 parts stretch.\nstretch g;\nbox[259ns] {\n delay[g] q[1];\n x q[1];\n delay[2*g] q[1];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_09", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nh q[2];\ncz q[1], q[2];\nx q[0];\nswap q[2], q[1];\ndelay[36dt] q[0];\nry(0.5235987756) q[2];\nrx(0.6353594081) q[1];\ny q[1];\nt q[1];\nrx(0.7853981634) q[1];\nbarrier q;\ns q[0];\ndelay[45dt] q[0];\nry(-0.7853981634) q[1];\nx q[0];\ny q[0];\nbarrier q;\ncz q[0], q[1];\ncz q[2], q[1];\ny q[1];\ntdg q[1];\nt q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet acts only on qubit q[0]. It first inserts an idle delay on q[0] whose length is\n// exactly the hardware-defined duration of a single X gate applied to q[0]. After waiting for\n// that X-gate-equivalent time, it applies a Hadamard operation to q[0], putting it into a\n// superposition relative to its prior state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nh q[2];\ncz q[1], q[2];\nx q[0];\nswap q[2], q[1];\ndelay[36dt] q[0];\nry(0.5235987756) q[2];\nrx(0.6353594081) q[1];\ny q[1];\nt q[1];\nrx(0.7853981634) q[1];\nbarrier q;\ns q[0];\ndelay[45dt] q[0];\nry(-0.7853981634) q[1];\nx q[0];\ny q[0];\nbarrier q;\ncz q[0], q[1];\ncz q[2], q[1];\ny q[1];\ntdg q[1];\nt q[2];\n\n// === CORE_TASK_START ===\n// durationof_single_gate | durationof_x: Delay by durationof({x}), then apply H.\ndelay[durationof({ x q[0]; })] q[0];\nh q[0];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// durationof_single_gate | durationof_x: Delay by durationof({x}), then apply H.\ndelay[durationof({ x q[0]; })] q[0];\nh q[0];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_10", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nrz(3.141592654) q[1];\nry(0.7853981634) q[0];\ns q[0];\ncz q[3], q[2];\nz q[2];\ncz q[0], q[1];\nry(0.3926990817) q[1];\ntdg q[2];\nry(1.570796327) q[3];\ndelay[12ns] q[1];\nrx(2.89692248) q[0];\nz q[1];\ntdg q[3];\ncx q[1], q[3];\nt q[0];\nsdg q[1];\nrx(-2.950382667) q[0];\nz q[3];\nrx(-0.7853981634) q[0];\nrz(-2.357495733) q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): On qubit q1, the program first inserts an idle delay whose length is defined to equal the\n// combined duration of performing an H gate followed by an X gate on that same qubit.\n// Immediately after this calibrated delay, it applies a Z-axis rotation on q1 with angle\n// 0.392699 radians.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nrz(3.141592654) q[1];\nry(0.7853981634) q[0];\ns q[0];\ncz q[3], q[2];\nz q[2];\ncz q[0], q[1];\nry(0.3926990817) q[1];\ntdg q[2];\nry(1.570796327) q[3];\ndelay[12ns] q[1];\nrx(2.89692248) q[0];\nz q[1];\ntdg q[3];\ncx q[1], q[3];\nt q[0];\nsdg q[1];\nrx(-2.950382667) q[0];\nz q[3];\nrx(-0.7853981634) q[0];\nrz(-2.357495733) q[3];\n\n// === CORE_TASK_START ===\n// durationof_subcircuit | durationof_two_1q_ops: Delay by durationof({H;X}), then apply RZ.\ndelay[durationof({ h q[1]; x q[1]; })] q[1];\nrz(0.392699) q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// durationof_subcircuit | durationof_two_1q_ops: Delay by durationof({H;X}), then apply RZ.\ndelay[durationof({ h q[1]; x q[1]; })] q[1];\nrz(0.392699) q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_11", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nz q[2];\ncz q[0], q[2];\ncx q[0], q[2];\nz q[1];\nrz(-0.7548701021) q[2];\nbarrier q;\nry(0.6253890372) q[0];\ncx q[1], q[0];\ncz q[0], q[1];\nz q[2];\ncx q[0], q[1];\ncz q[0], q[2];\nswap q[2], q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): A timing-alignment delay is applied to qubit q2 whose duration is computed as the duration\n// of the two-operation sequence consisting of an H then an X on q2, minus the duration of just\n// an H on q2, plus an extra 16 ns of padding. After this calibrated delay on q2, a Z gate is\n// applied to q2.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nz q[2];\ncz q[0], q[2];\ncx q[0], q[2];\nz q[1];\nrz(-0.7548701021) q[2];\nbarrier q;\nry(0.6253890372) q[0];\ncx q[1], q[0];\ncz q[0], q[1];\nz q[2];\ncx q[0], q[1];\ncz q[0], q[2];\nswap q[2], q[1];\n\n// === CORE_TASK_START ===\n// dynamic_padding_safe | padding_from_full_minus_prefix_len2: Safe padding: durationof(full)-durationof(prefix)+pad (2 vs 1 ops).\ndelay[durationof({ h q[2]; x q[2]; }) - durationof({ h q[2]; }) + 16ns] q[2];\nz q[2];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// dynamic_padding_safe | padding_from_full_minus_prefix_len2: Safe padding: durationof(full)-durationof(prefix)+pad (2 vs 1 ops).\ndelay[durationof({ h q[2]; x q[2]; }) - durationof({ h q[2]; }) + 16ns] q[2];\nz q[2];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_12", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nry(-0.7853981634) q[0];\ncz q[2], q[1];\ntdg q[0];\ncz q[2], q[0];\nswap q[0], q[1];\nz q[2];\nrx(0.2617993878) q[1];\nrz(2.094395102) q[1];\ny q[2];\nswap q[1], q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a boxed sequence of two single-qubit gates on qubit q1: first a\n// Hadamard, then a Pauli X, with no other qubits involved. After the box completes, it applies\n// a Pauli Z gate to the same qubit q1 outside the box. No measurements or classical registers\n// are used in this snippet.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nry(-0.7853981634) q[0];\ncz q[2], q[1];\ntdg q[0];\ncz q[2], q[0];\nswap q[0], q[1];\nz q[2];\nrx(0.2617993878) q[1];\nrz(2.094395102) q[1];\ny q[2];\nswap q[1], q[0];\n\n// === CORE_TASK_START ===\n// basic_box_boundary | box_two_1q_ops_then_outside_op: Put two 1-qubit ops inside a box, then another op outside.\nbox {\n h q[1];\n x q[1];\n}\nz q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// basic_box_boundary | box_two_1q_ops_then_outside_op: Put two 1-qubit ops inside a box, then another op outside.\nbox {\n h q[1];\n x q[1];\n}\nz q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_13", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nswap q[0], q[2];\nx q[2];\nh q[2];\ncx q[2], q[1];\ncz q[0], q[1];\nx q[0];\nswap q[0], q[1];\nry(-1.570796327) q[0];\nh q[1];\nh q[2];\nbarrier q;\ncz q[0], q[2];\nh q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): A stretchable duration parameter g is introduced and used inside a timed box whose total\n// duration is fixed at 152 nanoseconds. Within that 152-nanosecond window, qubit q1 undergoes\n// a 74-nanosecond delay, then an additional delay of length g, and then a 15-nanosecond delay,\n// with g implicitly chosen to fill the remaining time in the box. After the timed box\n// completes, an X gate is applied to qubit q1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nswap q[0], q[2];\nx q[2];\nh q[2];\ncx q[2], q[1];\ncz q[0], q[1];\nx q[0];\nswap q[0], q[1];\nry(-1.570796327) q[0];\nh q[1];\nh q[2];\nbarrier q;\ncz q[0], q[2];\nh q[2];\n\n// === CORE_TASK_START ===\n// timed_box_known_duration | timed_box_fixed_plus_stretch: Use a timed box with fixed delays and a stretch to fill the remainder.\nstretch g;\nbox[152ns] {\n delay[74ns] q[1];\n delay[g] q[1];\n delay[15ns] q[1];\n}\nx q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// timed_box_known_duration | timed_box_fixed_plus_stretch: Use a timed box with fixed delays and a stretch to fill the remainder.\nstretch g;\nbox[152ns] {\n delay[74ns] q[1];\n delay[g] q[1];\n delay[15ns] q[1];\n}\nx q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_14", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nrz(-0.7853981634) q[1];\ncx q[2], q[1];\nry(1.570796327) q[1];\nt q[1];\nswap q[1], q[0];\ncx q[0], q[1];\ny q[0];\ncz q[2], q[0];\nrz(2.35619449) q[2];\nrz(0.9550131259) q[2];\ncx q[2], q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): A stretchable duration parameter named g is introduced. Within a timed box whose total\n// length is fixed at 229 ns, qubit q[1] first undergoes a fixed idle delay of 27 ns, then an\n// additional idle delay whose length is the stretchable duration g chosen to fill the\n// remaining time budget. After these delays, an X gate is applied to q[1] within the same 229\n// ns time window.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nrz(-0.7853981634) q[1];\ncx q[2], q[1];\nry(1.570796327) q[1];\nt q[1];\nswap q[1], q[0];\ncx q[0], q[1];\ny q[0];\ncz q[2], q[0];\nrz(2.35619449) q[2];\nrz(0.9550131259) q[2];\ncx q[2], q[1];\n\n// === CORE_TASK_START ===\n// box_with_stretch_fill | fixed_then_stretch_then_gate: In a timed box: fixed delay, stretch fill, then gate.\nstretch g;\nbox[229ns] {\n delay[27ns] q[1];\n delay[g] q[1];\n x q[1];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// box_with_stretch_fill | fixed_then_stretch_then_gate: In a timed box: fixed delay, stretch fill, then gate.\nstretch g;\nbox[229ns] {\n delay[27ns] q[1];\n delay[g] q[1];\n x q[1];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_15", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nry(1.570796327) q[0];\nrx(0.3926990817) q[2];\nrx(0.5235987756) q[0];\nswap q[2], q[3];\ncx q[1], q[2];\ncz q[1], q[0];\ncz q[0], q[3];\nswap q[1], q[2];\nrz(0.7853981634) q[1];\nt q[0];\nrz(-0.7853981634) q[0];\nrx(1.570796327) q[2];\ncx q[1], q[0];\ny q[2];\ncx q[3], q[1];\nswap q[2], q[1];\nsdg q[2];\ncx q[3], q[2];\nry(0.5235987756) q[3];\ncx q[1], q[3];\nswap q[0], q[3];\ncx q[1], q[3];\ncz q[2], q[3];\nz q[0];\nry(0.3926990817) q[3];\ncx q[2], q[0];\nh q[1];\nt q[3];\nz q[2];\nrx(3.141592654) q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a Pauli X gate to qubit q1, flipping its computational basis state. It\n// then inserts a barrier across the entire 4-qubit register q0 through q3 to enforce that no\n// reordering or optimization moves operations across this point. After the barrier, it applies\n// a Pauli Z gate to qubit q1, adding a phase flip on the q1 state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nry(1.570796327) q[0];\nrx(0.3926990817) q[2];\nrx(0.5235987756) q[0];\nswap q[2], q[3];\ncx q[1], q[2];\ncz q[1], q[0];\ncz q[0], q[3];\nswap q[1], q[2];\nrz(0.7853981634) q[1];\nt q[0];\nrz(-0.7853981634) q[0];\nrx(1.570796327) q[2];\ncx q[1], q[0];\ny q[2];\ncx q[3], q[1];\nswap q[2], q[1];\nsdg q[2];\ncx q[3], q[2];\nry(0.5235987756) q[3];\ncx q[1], q[3];\nswap q[0], q[3];\ncx q[1], q[3];\ncz q[2], q[3];\nz q[0];\nry(0.3926990817) q[3];\ncx q[2], q[0];\nh q[1];\nt q[3];\nz q[2];\nrx(3.141592654) q[2];\n\n// === CORE_TASK_START ===\n// barrier_ordering | barrier_between_x_and_z: Use barrier between two single-qubit gates to enforce ordering.\nx q[1];\nbarrier q;\nz q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// barrier_ordering | barrier_between_x_and_z: Use barrier between two single-qubit gates to enforce ordering.\nx q[1];\nbarrier q;\nz q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_16", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\ncz q[1], q[3];\nz q[0];\nsdg q[1];\nswap q[4], q[0];\ny q[4];\ncx q[1], q[0];\nrz(0.2617993878) q[4];\ndelay[69ns] q[1];\nry(-1.961961682) q[2];\ncz q[3], q[4];\nbarrier q;\ns q[2];\nrx(2.094395102) q[0];\nry(3.141592654) q[2];\ny q[0];\nrx(2.35619449) q[3];\nswap q[2], q[0];\nrz(2.35619449) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a Hadamard gate to qubit q3 to place it into a superposition, then\n// performs a Hahn echo sequence on the same qubit within a fixed 373 ns timed window. Inside\n// that window, it inserts a variable-duration delay g on q3, applies an X (bit-flip) pulse to\n// q3 at the midpoint, and then applies the same delay g again on q3, so the two delays plus\n// the X pulse fit within the 373 ns box. This implements an echo refocusing operation on q3,\n// with g stretched as needed to center the X pulse in the timed interval.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\ncz q[1], q[3];\nz q[0];\nsdg q[1];\nswap q[4], q[0];\ny q[4];\ncx q[1], q[0];\nrz(0.2617993878) q[4];\ndelay[69ns] q[1];\nry(-1.961961682) q[2];\ncz q[3], q[4];\nbarrier q;\ns q[2];\nrx(2.094395102) q[0];\nry(3.141592654) q[2];\ny q[0];\nrx(2.35619449) q[3];\nswap q[2], q[0];\nrz(2.35619449) q[1];\n\n// === CORE_TASK_START ===\n// hahn_echo_midpoint | hahn_echo_x_mid: Hahn echo: H, then X at midpoint inside a timed box.\nh q[3];\nstretch g;\nbox[373ns] {\n delay[g] q[3];\n x q[3];\n delay[g] q[3];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// hahn_echo_midpoint | hahn_echo_x_mid: Hahn echo: H, then X at midpoint inside a timed box.\nh q[3];\nstretch g;\nbox[373ns] {\n delay[g] q[3];\n x q[3];\n delay[g] q[3];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_17", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[1];\n\nrz(1.243296822) q[3];\nbarrier q;\ncx q[0], q[2];\nbarrier q;\ndelay[64dt] q[2];\ndelay[2ns] q[3];\ncz q[1], q[2];\nrz(0) q[1];\nt q[1];\ncx q[2], q[1];\nbarrier q;\nrx(-2.630225093) q[0];\ncx q[3], q[0];\nrx(0.04746870698) q[3];\nswap q[1], q[3];\ndelay[34ns] q[4];\nrz(2.167651609) q[1];\ntdg q[2];\nbarrier q;\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies idle delays to qubits q0 and q4 to align timing: q0 waits for 172 ns,\n// while q4 waits for a total of 97 ns split into 75 ns and 22 ns. After these delays, it\n// applies an X gate (bit-flip) to q0 and an X gate to q4.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[1];\n\nrz(1.243296822) q[3];\nbarrier q;\ncx q[0], q[2];\nbarrier q;\ndelay[64dt] q[2];\ndelay[2ns] q[3];\ncz q[1], q[2];\nrz(0) q[1];\nt q[1];\ncx q[2], q[1];\nbarrier q;\nrx(-2.630225093) q[0];\ncx q[3], q[0];\nrx(0.04746870698) q[3];\nswap q[1], q[3];\ndelay[34ns] q[4];\nrz(2.167651609) q[1];\ntdg q[2];\nbarrier q;\n\n// === CORE_TASK_START ===\n// center_align_halfdiff_known | center_align_two_known_durations: Align centers of two known-duration delays by leading delay on the shorter one.\ndelay[172ns] q[0];\ndelay[75ns] q[4];\ndelay[22ns] q[4];\nx q[0];\nx q[4];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// center_align_halfdiff_known | center_align_two_known_durations: Align centers of two known-duration delays by leading delay on the shorter one.\ndelay[172ns] q[0];\ndelay[75ns] q[4];\ndelay[22ns] q[4];\nx q[0];\nx q[4];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_18", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\ns q[2];\nrx(-1.570796327) q[1];\ntdg q[0];\nsdg q[1];\ncz q[0], q[2];\ny q[0];\ny q[2];\ndelay[14dt] q[0];\nrz(-1.300895772) q[1];\ncz q[0], q[1];\ndelay[39dt] q[1];\nrx(1.047197551) q[2];\nrx(0.5235987756) q[2];\nswap q[2], q[1];\nrz(1.224605339) q[1];\ndelay[57ns] q[1];\nry(-0.7853981634) q[1];\nry(0) q[0];\nz q[0];\nswap q[0], q[2];\nswap q[1], q[0];\nbarrier q;\nz q[1];\ndelay[24ns] q[2];\nswap q[0], q[2];\nx q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet first idles qubit q2 for 79 ns, then applies a simultaneous global idle of 50 ns\n// to all three qubits q0, q1, and q2. After these delays, it applies a Hadamard gate to qubit\n// q2, putting q2 into a superposition (relative to its state after the idling).\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\ns q[2];\nrx(-1.570796327) q[1];\ntdg q[0];\nsdg q[1];\ncz q[0], q[2];\ny q[0];\ny q[2];\ndelay[14dt] q[0];\nrz(-1.300895772) q[1];\ncz q[0], q[1];\ndelay[39dt] q[1];\nrx(1.047197551) q[2];\nrx(0.5235987756) q[2];\nswap q[2], q[1];\nrz(1.224605339) q[1];\ndelay[57ns] q[1];\nry(-0.7853981634) q[1];\nry(0) q[0];\nz q[0];\nswap q[0], q[2];\nswap q[1], q[0];\nbarrier q;\nz q[1];\ndelay[24ns] q[2];\nswap q[0], q[2];\nx q[2];\n\n// === CORE_TASK_START ===\n// multi_qubit_delay_semantics | pre_delay_then_global_delay: Apply a pre-delay on one qubit, then delay all qubits together.\ndelay[79ns] q[2];\ndelay[50ns] q;\nh q[2];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// multi_qubit_delay_semantics | pre_delay_then_global_delay: Apply a pre-delay on one qubit, then delay all qubits together.\ndelay[79ns] q[2];\ndelay[50ns] q;\nh q[2];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_19", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nbarrier q;\nrx(0.5235987756) q[3];\nbarrier q;\nry(-1.038552932) q[1];\nbarrier q;\nt q[2];\nbarrier q;\nbarrier q;\ns q[0];\nswap q[3], q[1];\nrx(1.047197551) q[0];\ntdg q[3];\nrx(-2.838554789) q[3];\nrx(1.726496784) q[1];\ncz q[3], q[0];\nry(3.141592654) q[3];\nry(2.35619449) q[1];\ncz q[0], q[1];\nz q[1];\ncz q[2], q[0];\nsdg q[3];\nswap q[3], q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): A timed box of total duration 114 ns is used to synchronize qubits q0 and q1: q0 undergoes\n// two consecutive idle delays of 26 ns and 88 ns (114 ns total), while q1 performs a no-\n// operation for the same overall interval. After this synchronization period, an X gate is\n// applied to q1, flipping its state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nbarrier q;\nrx(0.5235987756) q[3];\nbarrier q;\nry(-1.038552932) q[1];\nbarrier q;\nt q[2];\nbarrier q;\nbarrier q;\ns q[0];\nswap q[3], q[1];\nrx(1.047197551) q[0];\ntdg q[3];\nrx(-2.838554789) q[3];\nrx(1.726496784) q[1];\ncz q[3], q[0];\nry(3.141592654) q[3];\nry(2.35619449) q[1];\ncz q[0], q[1];\nz q[1];\ncz q[2], q[0];\nsdg q[3];\nswap q[3], q[1];\n\n// === CORE_TASK_START ===\n// nop_sync_in_box | nop_sync_with_partial_delay: Use nop on one qubit to keep it synchronized with a delay on another qubit.\nbox[114ns] {\n delay[26ns] q[0];\n nop q[1];\n delay[88ns] q[0];\n}\nx q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// nop_sync_in_box | nop_sync_with_partial_delay: Use nop on one qubit to keep it synchronized with a delay on another qubit.\nbox[114ns] {\n delay[26ns] q[0];\n nop q[1];\n delay[88ns] q[0];\n}\nx q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_20", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nrz(1.047197551) q[0];\nswap q[2], q[1];\nrx(-1.743282753) q[0];\nsdg q[2];\nrz(-1.570796327) q[2];\nsdg q[0];\nbarrier q;\nbarrier q;\ny q[2];\ncz q[1], q[0];\ncx q[1], q[2];\ny q[2];\ntdg q[0];\nry(2.070017648) q[1];\ny q[1];\nrx(3.141592654) q[0];\nry(2.094395102) q[0];\nry(3.141592654) q[1];\ncz q[0], q[2];\nrz(2.094395102) q[1];\nx q[2];\nt q[0];\ncz q[0], q[2];\nry(-2.202253704) q[0];\nry(0) q[2];\nrz(3.141592654) q[2];\nx q[0];\nsdg q[2];\nz q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): A duration variable named d is created and set to 45 nanoseconds, and qubit q0 is then idled\n// for that 45 ns delay. The same duration variable is reassigned to 49 nanoseconds, and q0 is\n// idled again for 49 ns. After these two timed delays on q0, an X gate is applied to q0,\n// flipping its computational basis state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nrz(1.047197551) q[0];\nswap q[2], q[1];\nrx(-1.743282753) q[0];\nsdg q[2];\nrz(-1.570796327) q[2];\nsdg q[0];\nbarrier q;\nbarrier q;\ny q[2];\ncz q[1], q[0];\ncx q[1], q[2];\ny q[2];\ntdg q[0];\nry(2.070017648) q[1];\ny q[1];\nrx(3.141592654) q[0];\nry(2.094395102) q[0];\nry(3.141592654) q[1];\ncz q[0], q[2];\nrz(2.094395102) q[1];\nx q[2];\nt q[0];\ncz q[0], q[2];\nry(-2.202253704) q[0];\nry(0) q[2];\nrz(3.141592654) q[2];\nx q[0];\nsdg q[2];\nz q[0];\n\n// === CORE_TASK_START ===\n// duration_update | assign_then_reassign_duration: Assign a duration variable, delay, reassign it, delay again.\nduration d = 45ns;\ndelay[d] q[0];\nd = 49ns;\ndelay[d] q[0];\nx q[0];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// duration_update | assign_then_reassign_duration: Assign a duration variable, delay, reassign it, delay again.\nduration d = 45ns;\ndelay[d] q[0];\nd = 49ns;\ndelay[d] q[0];\nx q[0];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_21", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[4];\n\nh q[1];\nt q[3];\nh q[4];\ncx q[2], q[3];\nswap q[1], q[3];\ncz q[2], q[1];\nrz(0.6817784858) q[4];\ncz q[1], q[4];\nrz(2.094395102) q[3];\ncz q[3], q[1];\ncz q[3], q[2];\ndelay[26dt] q[1];\ncx q[0], q[3];\nrz(0.7853981634) q[3];\nrz(0.2617993878) q[0];\nx q[0];\nrz(0.3926990817) q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies a Hadamard gate to qubit q1, then makes q1 explicitly idle by inserting\n// a delay of 85 nanoseconds on that same qubit, and finally applies another Hadamard gate to\n// q1. This creates a Hadamard–wait–Hadamard sequence on q1, with the only timing parameter\n// being the 85 ns delay duration.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[4];\n\nh q[1];\nt q[3];\nh q[4];\ncx q[2], q[3];\nswap q[1], q[3];\ncz q[2], q[1];\nrz(0.6817784858) q[4];\ncz q[1], q[4];\nrz(2.094395102) q[3];\ncz q[3], q[1];\ncz q[3], q[2];\ndelay[26dt] q[1];\ncx q[0], q[3];\nrz(0.7853981634) q[3];\nrz(0.2617993878) q[0];\nx q[0];\nrz(0.3926990817) q[0];\n\n// === CORE_TASK_START ===\n// explicit_delay_as_structure | delay_between_h_gates: Make idle explicit by inserting a delay between two H gates.\nh q[1];\ndelay[85ns] q[1];\nh q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// explicit_delay_as_structure | delay_between_h_gates: Make idle explicit by inserting a delay between two H gates.\nh q[1];\ndelay[85ns] q[1];\nh q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_22", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[1];\n\ny q[2];\nrx(-1.644448404) q[3];\ndelay[61ns] q[3];\nx q[0];\nz q[1];\nswap q[3], q[1];\ncz q[0], q[2];\nrx(-2.985602368) q[2];\nbarrier q;\nrx(-2.016370883) q[1];\ns q[2];\nswap q[2], q[0];\ncz q[1], q[0];\nbarrier q;\ndelay[62dt] q[2];\nz q[0];\ndelay[27dt] q[0];\ns q[1];\ny q[2];\ns q[3];\nt q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet applies an X gate to qubit q2, then inserts an explicit zero-duration delay of 0\n// nanoseconds on q2 to enforce ordering, and finally applies a Z gate to the same qubit. No\n// other qubits or any classical registers are involved in this segment.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[1];\n\ny q[2];\nrx(-1.644448404) q[3];\ndelay[61ns] q[3];\nx q[0];\nz q[1];\nswap q[3], q[1];\ncz q[0], q[2];\nrx(-2.985602368) q[2];\nbarrier q;\nrx(-2.016370883) q[1];\ns q[2];\nswap q[2], q[0];\ncz q[1], q[0];\nbarrier q;\ndelay[62dt] q[2];\nz q[0];\ndelay[27dt] q[0];\ns q[1];\ny q[2];\ns q[3];\nt q[0];\n\n// === CORE_TASK_START ===\n// delay_zero_ordering | delay_zero_between_ops: Use delay[0] as an explicit ordering point between two gates.\nx q[2];\ndelay[0ns] q[2];\nz q[2];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// delay_zero_ordering | delay_zero_between_ops: Use delay[0] as an explicit ordering point between two gates.\nx q[2];\ndelay[0ns] q[2];\nz q[2];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_23", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[0];\n\nx q[2];\nrz(-0.7853981634) q[1];\ntdg q[0];\nbarrier q;\nt q[2];\nrz(-2.490868252) q[1];\nrz(1.047197551) q[2];\nrx(-1.428841255) q[0];\nrz(-2.479935277) q[0];\nrx(1.570796327) q[1];\ns q[0];\ncx q[2], q[3];\ncx q[1], q[3];\ns q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): A timed region of total duration 206 nanoseconds is applied to qubit q1. Inside it, there is\n// first a nested timed subregion of 59 nanoseconds that consists solely of a 59-nanosecond\n// delay on q1, then a second delay on q1 whose duration is a stretch parameter chosen to fill\n// the remaining time so the outer region totals 206 nanoseconds. After these delays complete,\n// an X gate is applied to q1, flipping its state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[0];\n\nx q[2];\nrz(-0.7853981634) q[1];\ntdg q[0];\nbarrier q;\nt q[2];\nrz(-2.490868252) q[1];\nrz(1.047197551) q[2];\nrx(-1.428841255) q[0];\nrz(-2.479935277) q[0];\nrx(1.570796327) q[1];\ns q[0];\ncx q[2], q[3];\ncx q[1], q[3];\ns q[3];\n\n// === CORE_TASK_START ===\n// nested_box | nested_timed_box_with_stretch: Nested timed boxes: inner fixed delay, outer uses stretch to fill.\nbox[206ns] {\n box[59ns] { delay[59ns] q[1]; }\n stretch g;\n delay[g] q[1];\n}\nx q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// nested_box | nested_timed_box_with_stretch: Nested timed boxes: inner fixed delay, outer uses stretch to fill.\nbox[206ns] {\n box[59ns] { delay[59ns] q[1]; }\n stretch g;\n delay[g] q[1];\n}\nx q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_24", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nswap q[0], q[3];\ncx q[4], q[0];\ncz q[0], q[3];\ncx q[0], q[4];\nsdg q[0];\nry(-0.7853981634) q[4];\nrz(0.7853981634) q[0];\nh q[1];\nrz(0.3926990817) q[4];\ntdg q[3];\ntdg q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet introduces two stretchable timing variables, a and b, and uses them to\n// parameterize delays applied to qubit q4 inside two fixed-duration timed regions. In the\n// first 229 ns region, q4 undergoes a delay of duration a followed by a delay of duration b;\n// in the second 155 ns region, q4 undergoes a delay of duration 2a followed by a delay of\n// duration b. These two timed regions together constrain a and b to satisfy the total-duration\n// requirements. After the timing constraints, an X gate is applied to qubit q4, flipping its\n// state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nswap q[0], q[3];\ncx q[4], q[0];\ncz q[0], q[3];\ncx q[0], q[4];\nsdg q[0];\nry(-0.7853981634) q[4];\nrz(0.7853981634) q[0];\nh q[1];\nrz(0.3926990817) q[4];\ntdg q[3];\ntdg q[2];\n\n// === CORE_TASK_START ===\n// multi_stretch_solve_system | two_equations_two_unknowns: Use two timed boxes to constrain stretch variables (a,b).\nstretch a;\nstretch b;\nbox[229ns] { delay[a] q[4]; delay[b] q[4]; }\nbox[155ns] { delay[2*a] q[4]; delay[b] q[4]; }\nx q[4];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// multi_stretch_solve_system | two_equations_two_unknowns: Use two timed boxes to constrain stretch variables (a,b).\nstretch a;\nstretch b;\nbox[229ns] { delay[a] q[4]; delay[b] q[4]; }\nbox[155ns] { delay[2*a] q[4]; delay[b] q[4]; }\nx q[4];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "timing_test/timing_task_25", "domain": "timing", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[0];\n\ncx q[1], q[0];\ny q[3];\nx q[3];\ncx q[1], q[2];\nry(1.047197551) q[2];\nry(0.08358689371) q[3];\ncx q[0], q[3];\ncx q[3], q[2];\nbarrier q;\nrz(3.141592654) q[1];\ns q[1];\ncx q[2], q[1];\nz q[3];\nrx(0.5235987756) q[1];\ntdg q[1];\nry(1.766945954) q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): On qubit q0, the program first inserts an idle delay whose length is set to the duration of\n// a boxed X operation on q0, plus an additional 13 nanoseconds of padding. After this\n// calibrated wait, it applies a Hadamard gate to q0 to place it into a superposition relative\n// to its current state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[0];\n\ncx q[1], q[0];\ny q[3];\nx q[3];\ncx q[1], q[2];\nry(1.047197551) q[2];\nry(0.08358689371) q[3];\ncx q[0], q[3];\ncx q[3], q[2];\nbarrier q;\nrz(3.141592654) q[1];\ns q[1];\ncx q[2], q[1];\nz q[3];\nrx(0.5235987756) q[1];\ntdg q[1];\nry(1.766945954) q[0];\n\n// === CORE_TASK_START ===\n// durationof_on_box_compound | durationof_box_plus_pad: Delay by durationof(a box) plus a small pad, then H.\ndelay[durationof({ box { x q[0]; } }) + 13ns] q[0];\nh q[0];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[1] = measure q[1];\nc[2] = measure q[2];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// durationof_on_box_compound | durationof_box_plus_pad: Delay by durationof(a box) plus a small pad, then H.\ndelay[durationof({ box { x q[0]; } }) + 13ns] q[0];\nh q[0];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_01", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[4];\n\ncz q[0], q[4];\nry(2.2737106) q[1];\ntdg q[2];\nswap q[2], q[4];\nt q[1];\nry(0.5235987756) q[3];\nrz(0.2617993878) q[3];\nswap q[5], q[4];\ny q[4];\ncx q[4], q[5];\nswap q[4], q[0];\nrx(-2.843171334) q[3];\nry(0.7853981634) q[0];\nh q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): A single classical bit named __cc_m is allocated to store a measurement result. Qubit q[2]\n// is measured and the outcome is written into __cc_m. If the measurement result is 1, q[2] is\n// reset to the ground state; otherwise, an X gate is applied to q[2], flipping its state.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[4];\n\ncz q[0], q[4];\nry(2.2737106) q[1];\ntdg q[2];\nswap q[2], q[4];\nt q[1];\nry(0.5235987756) q[3];\nrz(0.2617993878) q[3];\nswap q[5], q[4];\ny q[4];\ncx q[4], q[5];\nswap q[4], q[0];\nrx(-2.843171334) q[3];\nry(0.7853981634) q[0];\nh q[0];\n\n// === CORE_TASK_START ===\n// measure_then_reset_branch | if_meas_then_reset_else_x: Measure one qubit; if 1 then reset, else apply X.\nbit __cc_m;\n__cc_m = measure q[2];\nif (__cc_m) {\n reset q[2];\n} else {\n x q[2];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n", "completion": "// measure_then_reset_branch | if_meas_then_reset_else_x: Measure one qubit; if 1 then reset, else apply X.\nbit __cc_m;\n__cc_m = measure q[2];\nif (__cc_m) {\n reset q[2];\n} else {\n x q[2];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_02", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nswap q[2], q[0];\nsdg q[2];\nh q[2];\nswap q[0], q[2];\nry(0.7853981634) q[2];\ndelay[50ns] q[0];\nry(1.570796327) q[1];\ncx q[0], q[2];\ncz q[0], q[1];\ncx q[1], q[2];\ny q[0];\nt q[0];\ncz q[0], q[1];\nry(-2.762160353) q[2];\nrx(-1.570796327) q[0];\ntdg q[1];\nswap q[1], q[0];\ncx q[1], q[0];\ny q[1];\ncx q[0], q[1];\ny q[0];\nrx(0) q[2];\ny q[2];\nswap q[1], q[0];\ncz q[2], q[1];\nry(1.047197551) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet introduces a classical bit __cc_m to store measurement results and an integer\n// counter __cc_t initialized to 0, then enters a loop that can run at most 3 times. In each\n// iteration it measures qubit q[2] into __cc_m and immediately stops looping if the outcome is\n// 0. If the outcome is 1, it resets q[2] to the ground state and increments __cc_t, repeating\n// until either a 0 is observed or the 3-try limit is reached.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[2];\n\nswap q[2], q[0];\nsdg q[2];\nh q[2];\nswap q[0], q[2];\nry(0.7853981634) q[2];\ndelay[50ns] q[0];\nry(1.570796327) q[1];\ncx q[0], q[2];\ncz q[0], q[1];\ncx q[1], q[2];\ny q[0];\nt q[0];\ncz q[0], q[1];\nry(-2.762160353) q[2];\nrx(-1.570796327) q[0];\ntdg q[1];\nswap q[1], q[0];\ncx q[1], q[0];\ny q[1];\ncx q[0], q[1];\ny q[0];\nrx(0) q[2];\ny q[2];\nswap q[1], q[0];\ncz q[2], q[1];\nry(1.047197551) q[1];\n\n// === CORE_TASK_START ===\n// repeat_until_success | while_until_measure_zero: Repeat measure-reset until measurement becomes 0 or max tries reached.\nbit __cc_m;\nint __cc_t = 0;\nwhile (__cc_t < 3) {\n __cc_m = measure q[2];\n if (!__cc_m) { break; }\n reset q[2];\n __cc_t = __cc_t + 1;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// repeat_until_success | while_until_measure_zero: Repeat measure-reset until measurement becomes 0 or max tries reached.\nbit __cc_m;\nint __cc_t = 0;\nwhile (__cc_t < 3) {\n __cc_m = measure q[2];\n if (!__cc_m) { break; }\n reset q[2];\n __cc_t = __cc_t + 1;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_03", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[4];\n\nrx(2.038164162) q[3];\ncz q[3], q[2];\nry(1.047197551) q[2];\nh q[1];\ns q[3];\nry(1.570796327) q[0];\nbarrier q;\nswap q[2], q[3];\ntdg q[0];\ntdg q[4];\nbarrier q;\nx q[1];\nswap q[2], q[1];\nry(-0.7853981634) q[4];\ncz q[0], q[2];\nry(2.261209557) q[4];\ndelay[67ns] q[0];\ntdg q[3];\ntdg q[1];\nt q[3];\nh q[4];\nx q[1];\nt q[1];\nrx(2.35619449) q[1];\nrx(-0.7853981634) q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet allocates a 2-bit classical register named __cc_b, then measures qubit q0 into\n// __cc_b at index 0 and qubit q2 into __cc_b at index 1. It converts these two measurement\n// results into an integer value __cc_idx and uses it to choose a conditional correction. If\n// the integer equals 1, it applies an X (bit-flip) to q0; otherwise it applies a Z (phase-\n// flip) to q2.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[4];\n\nrx(2.038164162) q[3];\ncz q[3], q[2];\nry(1.047197551) q[2];\nh q[1];\ns q[3];\nry(1.570796327) q[0];\nbarrier q;\nswap q[2], q[3];\ntdg q[0];\ntdg q[4];\nbarrier q;\nx q[1];\nswap q[2], q[1];\nry(-0.7853981634) q[4];\ncz q[0], q[2];\nry(2.261209557) q[4];\ndelay[67ns] q[0];\ntdg q[3];\ntdg q[1];\nt q[3];\nh q[4];\nx q[1];\nt q[1];\nrx(2.35619449) q[1];\nrx(-0.7853981634) q[2];\n\n// === CORE_TASK_START ===\n// conditional_correction_multibit | measure_2bits_branch_on_int: Measure 2 qubits into bit[2], branch on int value.\nbit[2] __cc_b;\n__cc_b[0] = measure q[0];\n__cc_b[1] = measure q[2];\nint __cc_idx = int(__cc_b);\nif (__cc_idx == 1) { x q[0]; } else { z q[2]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// conditional_correction_multibit | measure_2bits_branch_on_int: Measure 2 qubits into bit[2], branch on int value.\nbit[2] __cc_b;\n__cc_b[0] = measure q[0];\n__cc_b[1] = measure q[2];\nint __cc_idx = int(__cc_b);\nif (__cc_idx == 1) { x q[0]; } else { z q[2]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_04", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nrz(3.141592654) q[1];\nsdg q[2];\ns q[0];\ncz q[0], q[1];\ncx q[3], q[2];\nsdg q[1];\ntdg q[2];\nrx(0) q[3];\ncx q[0], q[3];\nswap q[2], q[0];\nswap q[0], q[1];\nz q[3];\nswap q[3], q[2];\nz q[0];\ndelay[45dt] q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet initializes an integer accumulator named __cc_sum to 0, then iterates a loop\n// variable __cc_i over the set of values 0, 1, 2, and 3. When __cc_i equals 0, that iteration\n// is skipped entirely via a continue, so no quantum operation or update happens for that case.\n// For each of the remaining three iterations, it applies an X gate to qubit q0, and then\n// increments __cc_sum by the parity of the loop index, adding __cc_i modulo 2 each time. As a\n// result, q0 is flipped three times overall, and __cc_sum ends with the value 2.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nrz(3.141592654) q[1];\nsdg q[2];\ns q[0];\ncz q[0], q[1];\ncx q[3], q[2];\nsdg q[1];\ntdg q[2];\nrx(0) q[3];\ncx q[0], q[3];\nswap q[2], q[0];\nswap q[0], q[1];\nz q[3];\nswap q[3], q[2];\nz q[0];\ndelay[45dt] q[1];\n\n// === CORE_TASK_START ===\n// for_loop_continue_pattern | for_continue_skip_one_iter: For-loop over a set; skip one iteration via continue.\nint __cc_sum = 0;\nfor int __cc_i in {0,1,2,3} {\n if (__cc_i == 0) { continue; }\n x q[0];\n __cc_sum = __cc_sum + (__cc_i % 2);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// for_loop_continue_pattern | for_continue_skip_one_iter: For-loop over a set; skip one iteration via continue.\nint __cc_sum = 0;\nfor int __cc_i in {0,1,2,3} {\n if (__cc_i == 0) { continue; }\n x q[0];\n __cc_sum = __cc_sum + (__cc_i % 2);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_05", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\nz q[1];\nrz(0) q[0];\nrz(2.35619449) q[1];\nrx(-0.6099818947) q[0];\nrx(-2.877169272) q[0];\nh q[2];\nx q[2];\nrx(0.2617993878) q[2];\ns q[1];\nrz(1.570796327) q[0];\nswap q[1], q[0];\ntdg q[2];\ncz q[0], q[2];\nx q[1];\nbarrier q;\nrz(1.957524824) q[1];\nt q[0];\nrz(-0.7853981634) q[2];\nrz(0.5235987756) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet initializes an integer loop counter __cc_t to 0 and then runs a while loop that\n// can iterate up to 6 times. On each iteration it applies an X gate to qubit q0, then computes\n// a boolean flag __cc_m that is true exactly when __cc_t is odd, using the condition __cc_t\n// modulo 2 equals 1. If that flag is true the loop breaks immediately; otherwise the counter\n// is incremented by 1 and the loop continues. As a result, q0 receives X operations for __cc_t\n// equal to 0 and 1, and the loop exits when __cc_t reaches 1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\nz q[1];\nrz(0) q[0];\nrz(2.35619449) q[1];\nrx(-0.6099818947) q[0];\nrx(-2.877169272) q[0];\nh q[2];\nx q[2];\nrx(0.2617993878) q[2];\ns q[1];\nrz(1.570796327) q[0];\nswap q[1], q[0];\ntdg q[2];\ncz q[0], q[2];\nx q[1];\nbarrier q;\nrz(1.957524824) q[1];\nt q[0];\nrz(-0.7853981634) q[2];\nrz(0.5235987756) q[1];\n\n// === CORE_TASK_START ===\n// while_loop_break_on_measure | while_break_on_one: While-loop: break based on __cc_m.\nint __cc_t = 0;\nwhile (__cc_t < 6) {\n x q[0];\n bool __cc_m = ((__cc_t % 2) == 1);\n if (__cc_m) { break; }\n __cc_t = __cc_t + 1;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// while_loop_break_on_measure | while_break_on_one: While-loop: break based on __cc_m.\nint __cc_t = 0;\nwhile (__cc_t < 6) {\n x q[0];\n bool __cc_m = ((__cc_t % 2) == 1);\n if (__cc_m) { break; }\n __cc_t = __cc_t + 1;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_06", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\nswap q[3], q[1];\ncz q[0], q[3];\nry(2.35619449) q[1];\nsdg q[2];\nt q[1];\ncx q[1], q[0];\nt q[2];\nswap q[3], q[2];\nswap q[3], q[2];\nry(2.315540005) q[0];\nswap q[1], q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet creates an angle variable initialized to 0.959352 and then adds 4.738026 to it,\n// using wrap-around modular angle semantics. It then applies a Z-axis rotation to qubit q1\n// with the resulting rotation angle of 5.697378 radians.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\nswap q[3], q[1];\ncz q[0], q[3];\nry(2.35619449) q[1];\nsdg q[2];\nt q[1];\ncx q[1], q[0];\nt q[2];\nswap q[3], q[2];\nswap q[3], q[2];\nry(2.315540005) q[0];\nswap q[1], q[2];\n\n// === CORE_TASK_START ===\n// angle_arithmetic_mod_wrap | angle_add_then_rz: Compute angle = a + b (wrap semantics), then apply RZ.\nangle __cc_th = 0.959352;\n__cc_th = __cc_th + 4.738026;\nrz(__cc_th) q[1];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// angle_arithmetic_mod_wrap | angle_add_then_rz: Compute angle = a + b (wrap semantics), then apply RZ.\nangle __cc_th = 0.959352;\n__cc_th = __cc_th + 4.738026;\nrz(__cc_th) q[1];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_07", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[2];\n\nz q[4];\ndelay[56dt] q[1];\nrz(3.141592654) q[1];\ncz q[3], q[2];\ntdg q[4];\nrx(0.5235987756) q[5];\nswap q[2], q[0];\nbarrier q;\nrx(0.7849876585) q[3];\nbarrier q;\nswap q[4], q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): A 10-bit unsigned integer variable is set to the constant value 6, then converted to a\n// floating-point value and scaled by 0.088215 to produce 0.52929. That scaled float is cast to\n// an angle and used as the rotation parameter for a Z-axis rotation applied to qubit q[0].\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[2];\n\nz q[4];\ndelay[56dt] q[1];\nrz(3.141592654) q[1];\ncz q[3], q[2];\ntdg q[4];\nrx(0.5235987756) q[5];\nswap q[2], q[0];\nbarrier q;\nrx(0.7849876585) q[3];\nbarrier q;\nswap q[4], q[0];\n\n// === CORE_TASK_START ===\n// angle_scaled_by_uint | uint_to_float_to_angle: Convert uint to float, scale, cast to angle, then RZ.\nuint[10] __cc_k = 6;\nfloat __cc_f = float(__cc_k) * 0.088215;\nangle __cc_th = angle(__cc_f);\nrz(__cc_th) q[0];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n", "completion": "// angle_scaled_by_uint | uint_to_float_to_angle: Convert uint to float, scale, cast to angle, then RZ.\nuint[10] __cc_k = 6;\nfloat __cc_f = float(__cc_k) * 0.088215;\nangle __cc_th = angle(__cc_f);\nrz(__cc_th) q[0];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_08", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[2];\n\ncz q[0], q[1];\nrz(0.3926990817) q[5];\ny q[0];\ns q[2];\nt q[1];\ncx q[2], q[4];\ny q[5];\nrz(1.570796327) q[0];\nswap q[2], q[4];\nsdg q[1];\nry(1.570796327) q[5];\nswap q[0], q[3];\ncz q[0], q[1];\ncz q[1], q[3];\ncx q[3], q[1];\nbarrier q;\ns q[0];\nrx(-1.199266413) q[0];\nrx(0.7853981634) q[5];\ncx q[5], q[4];\nrx(2.35619449) q[3];\nry(0.5235987756) q[2];\ncx q[1], q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet computes a floating-point value by adding the constants 0.249597 and 1.586853 to\n// get 1.83645. It then casts this numeric result into an angle parameter. Finally, it applies\n// a Z-axis rotation on qubit q3 with rotation angle 1.83645 radians.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[2];\n\ncz q[0], q[1];\nrz(0.3926990817) q[5];\ny q[0];\ns q[2];\nt q[1];\ncx q[2], q[4];\ny q[5];\nrz(1.570796327) q[0];\nswap q[2], q[4];\nsdg q[1];\nry(1.570796327) q[5];\nswap q[0], q[3];\ncz q[0], q[1];\ncz q[1], q[3];\ncx q[3], q[1];\nbarrier q;\ns q[0];\nrx(-1.199266413) q[0];\nrx(0.7853981634) q[5];\ncx q[5], q[4];\nrx(2.35619449) q[3];\nry(0.5235987756) q[2];\ncx q[1], q[0];\n\n// === CORE_TASK_START ===\n// float_expr_cast_to_angle | float_add_cast_angle: Compute float = f1 + f2, cast to angle, apply RZ.\nfloat __cc_f = 0.249597 + 1.586853;\nangle __cc_th = angle(__cc_f);\nrz(__cc_th) q[3];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n", "completion": "// float_expr_cast_to_angle | float_add_cast_angle: Compute float = f1 + f2, cast to angle, apply RZ.\nfloat __cc_f = 0.249597 + 1.586853;\nangle __cc_th = angle(__cc_f);\nrz(__cc_th) q[3];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_09", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nh q[2];\ncz q[1], q[2];\nx q[0];\nswap q[2], q[1];\ndelay[36dt] q[0];\nry(0.5235987756) q[2];\nrx(0.6353594081) q[1];\ny q[1];\nt q[1];\nrx(0.7853981634) q[1];\nbarrier q;\ns q[0];\ndelay[45dt] q[0];\nry(-0.7853981634) q[1];\nx q[0];\ny q[0];\nbarrier q;\ncz q[0], q[1];\ncz q[2], q[1];\ny q[1];\ntdg q[1];\nt q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines three 12-bit unsigned classical constants a = 4, b = 6, and c = 5, then\n// computes a 12-bit classical index idx as (a times b plus c) modulo 3, yielding idx = 2. It\n// then performs a classical conditional branch comparing idx against the threshold 0; since\n// idx is always at least 0 for an unsigned value, the condition is true here. As a result, it\n// applies an X (bit-flip) gate to qubit q[1] and never applies the alternative Z gate.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nh q[2];\ncz q[1], q[2];\nx q[0];\nswap q[2], q[1];\ndelay[36dt] q[0];\nry(0.5235987756) q[2];\nrx(0.6353594081) q[1];\ny q[1];\nt q[1];\nrx(0.7853981634) q[1];\nbarrier q;\ns q[0];\ndelay[45dt] q[0];\nry(-0.7853981634) q[1];\nx q[0];\ny q[0];\nbarrier q;\ncz q[0], q[1];\ncz q[2], q[1];\ny q[1];\ntdg q[1];\nt q[2];\n\n// === CORE_TASK_START ===\n// integer_arithmetic_controls_flow | arith_then_if_threshold: Compute idx=(a*b+c)%M; branch by threshold to choose a gate.\nuint[12] __cc_a = 4; uint[12] __cc_b = 6; uint[12] __cc_c = 5;\nuint[12] __cc_idx = (__cc_a * __cc_b + __cc_c) % 3;\nif (__cc_idx >= 0) { x q[1]; } else { z q[1]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// integer_arithmetic_controls_flow | arith_then_if_threshold: Compute idx=(a*b+c)%M; branch by threshold to choose a gate.\nuint[12] __cc_a = 4; uint[12] __cc_b = 6; uint[12] __cc_c = 5;\nuint[12] __cc_idx = (__cc_a * __cc_b + __cc_c) % 3;\nif (__cc_idx >= 0) { x q[1]; } else { z q[1]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_10", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[4];\n\nx q[4];\nswap q[1], q[4];\nrx(1.047197551) q[4];\nx q[2];\nx q[2];\ncz q[3], q[1];\nz q[1];\ntdg q[0];\nry(0.3926990817) q[1];\ntdg q[2];\nry(1.570796327) q[3];\ndelay[12ns] q[5];\ndelay[30ns] q[0];\ntdg q[4];\nrx(1.52168778) q[1];\ncz q[2], q[1];\nrx(-2.950382667) q[0];\nz q[3];\nrx(-0.7853981634) q[0];\nry(1.311122002) q[5];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines an angle constant 4.898461, casts it to a floating-point value, and\n// compares that float to the constant 1.798271. If the cast value is greater than 1.798271, it\n// applies an X gate (bit-flip) to qubit q0; otherwise, it applies a Z gate (phase flip) to\n// qubit q0. This conditional affects only q0 and uses no measurements or classical registers\n// beyond the temporary float used for the comparison.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[4];\n\nx q[4];\nswap q[1], q[4];\nrx(1.047197551) q[4];\nx q[2];\nx q[2];\ncz q[3], q[1];\nz q[1];\ntdg q[0];\nry(0.3926990817) q[1];\ntdg q[2];\nry(1.570796327) q[3];\ndelay[12ns] q[5];\ndelay[30ns] q[0];\ntdg q[4];\nrx(1.52168778) q[1];\ncz q[2], q[1];\nrx(-2.950382667) q[0];\nz q[3];\nrx(-0.7853981634) q[0];\nry(1.311122002) q[5];\n\n// === CORE_TASK_START ===\n// mixed_comparison_with_cast | compare_float_of_angle: Compare float(angle) to a float constant and branch.\nangle __cc_th = 4.898461;\nfloat __cc_f = float(__cc_th);\nif (__cc_f > 1.798271) { x q[0]; } else { z q[0]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n", "completion": "// mixed_comparison_with_cast | compare_float_of_angle: Compare float(angle) to a float constant and branch.\nangle __cc_th = 4.898461;\nfloat __cc_f = float(__cc_th);\nif (__cc_f > 1.798271) { x q[0]; } else { z q[0]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_11", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nry(0.3926990817) q[1];\nz q[3];\nrz(0) q[1];\nz q[3];\nrz(-0.7853981634) q[3];\nrz(-0.002145644986) q[2];\nrx(0.2617993878) q[2];\ncz q[0], q[1];\ny q[1];\ncx q[0], q[1];\ncz q[1], q[2];\ncx q[3], q[2];\nswap q[2], q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): A 6-bit unsigned classical value named __cc_x is set to 12. The program then computes\n// another 6-bit value __cc_b by right-shifting __cc_x by 0 bits and masking with 1,\n// effectively extracting the least significant bit of 12. Since that least significant bit is\n// 0, the conditional applies a Z gate to qubit q[3] (and would apply an X gate to q[3] only if\n// the extracted bit were 1).\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[3];\n\nry(0.3926990817) q[1];\nz q[3];\nrz(0) q[1];\nz q[3];\nrz(-0.7853981634) q[3];\nrz(-0.002145644986) q[2];\nrx(0.2617993878) q[2];\ncz q[0], q[1];\ny q[1];\ncx q[0], q[1];\ncz q[1], q[2];\ncx q[3], q[2];\nswap q[2], q[3];\n\n// === CORE_TASK_START ===\n// bit_shift_and_mask_test | test_lsb_after_shift: Right-shift and test LSB to decide a gate.\nuint[6] __cc_x = 12;\nuint[6] __cc_b = (__cc_x >> 0) & 1;\nif (__cc_b == 1) { x q[3]; } else { z q[3]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// bit_shift_and_mask_test | test_lsb_after_shift: Right-shift and test LSB to decide a gate.\nuint[6] __cc_x = 12;\nuint[6] __cc_b = (__cc_x >> 0) & 1;\nif (__cc_b == 1) { x q[3]; } else { z q[3]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_12", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nry(-0.7853981634) q[0];\ncz q[2], q[1];\ntdg q[0];\ncz q[2], q[0];\nswap q[0], q[1];\nz q[2];\nrx(0.2617993878) q[1];\nrz(2.094395102) q[1];\ny q[2];\nswap q[1], q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): A 16-bit unsigned constant value 25 is created and its popcount is computed, producing an\n// integer equal to the number of 1 bits in that value. The result is compared against a\n// threshold of 4. If the popcount is at least 4, an X gate is applied to qubit q1; otherwise,\n// a Z gate is applied to qubit q1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[0];\n\nry(-0.7853981634) q[0];\ncz q[2], q[1];\ntdg q[0];\ncz q[2], q[0];\nswap q[0], q[1];\nz q[2];\nrx(0.2617993878) q[1];\nrz(2.094395102) q[1];\ny q[2];\nswap q[1], q[0];\n\n// === CORE_TASK_START ===\n// popcount_triggered_gate | popcount_threshold_gate: Compute popcount; if >= threshold apply X else Z.\nuint[16] __cc_x = 25;\nint __cc_p = popcount(__cc_x);\nif (__cc_p >= 4) { x q[1]; } else { z q[1]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// popcount_triggered_gate | popcount_threshold_gate: Compute popcount; if >= threshold apply X else Z.\nuint[16] __cc_x = 25;\nint __cc_p = popcount(__cc_x);\nif (__cc_p >= 4) { x q[1]; } else { z q[1]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_13", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\nrz(0.3131711611) q[2];\nz q[0];\ny q[2];\ncx q[1], q[3];\nz q[3];\ndelay[48dt] q[0];\ncz q[2], q[0];\nh q[2];\nx q[0];\ncz q[1], q[0];\nrz(-1.714954256) q[0];\ncz q[1], q[3];\nsdg q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): A 12-bit unsigned constant value 245 is created and then circularly left-rotated by 2 bit\n// positions to produce a second 12-bit value. That rotated value is compared against the\n// 12-bit constant 10 to decide a conditional single-qubit operation on qubit q1. Because the\n// comparison fails for this rotation, the snippet applies a Z gate to q1 rather than an X\n// gate.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[2];\n\nrz(0.3131711611) q[2];\nz q[0];\ny q[2];\ncx q[1], q[3];\nz q[3];\ndelay[48dt] q[0];\ncz q[2], q[0];\nh q[2];\nx q[0];\ncz q[1], q[0];\nrz(-1.714954256) q[0];\ncz q[1], q[3];\nsdg q[3];\n\n// === CORE_TASK_START ===\n// rotl_rotr_pattern_match | rotl_match_constant: rotl(x,k) and compare to pattern to choose a gate.\nuint[12] __cc_x = 245;\nuint[12] __cc_y = rotl(__cc_x, 2);\nif (__cc_y == 10) { x q[1]; } else { z q[1]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// rotl_rotr_pattern_match | rotl_match_constant: rotl(x,k) and compare to pattern to choose a gate.\nuint[12] __cc_x = 245;\nuint[12] __cc_y = rotl(__cc_x, 2);\nif (__cc_y == 10) { x q[1]; } else { z q[1]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_14", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[1];\n\nrz(-0.7853981634) q[3];\ncz q[3], q[0];\ncx q[3], q[1];\nt q[3];\nswap q[3], q[2];\ncx q[2], q[0];\ny q[1];\ncz q[1], q[2];\ny q[0];\nrz(2.35619449) q[3];\nx q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines two 12-bit unsigned classical values, __cc_a set to 95 and __cc_b set to\n// 15, then computes a third 12-bit value __cc_c as the bitwise XOR of __cc_a and __cc_b masked\n// by the constant 15. It performs a classical conditional branch based on whether __cc_c\n// equals zero. If __cc_c is zero it applies an X gate (bit-flip) to qubit q[2]; otherwise it\n// applies a Z gate (phase flip) to qubit q[2].\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[1];\n\nrz(-0.7853981634) q[3];\ncz q[3], q[0];\ncx q[3], q[1];\nt q[3];\nswap q[3], q[2];\ncx q[2], q[0];\ny q[1];\ncz q[1], q[2];\ny q[0];\nrz(2.35619449) q[3];\nx q[3];\n\n// === CORE_TASK_START ===\n// bitwise_and_xor_pipeline | xor_and_mask_then_branch: Compute (a^b)&mask then branch on zero.\nuint[12] __cc_a = 95; uint[12] __cc_b = 15;\nuint[12] __cc_c = (__cc_a ^ __cc_b) & 15;\nif (__cc_c == 0) { x q[2]; } else { z q[2]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// bitwise_and_xor_pipeline | xor_and_mask_then_branch: Compute (a^b)&mask then branch on zero.\nuint[12] __cc_a = 95; uint[12] __cc_b = 15;\nuint[12] __cc_c = (__cc_a ^ __cc_b) & 15;\nif (__cc_c == 0) { x q[2]; } else { z q[2]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_15", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[4];\n\ncz q[5], q[0];\nry(-2.516721983) q[3];\ndelay[60ns] q[0];\ncz q[1], q[3];\nt q[2];\nry(2.094395102) q[1];\ncx q[3], q[1];\nt q[2];\nswap q[1], q[3];\nrx(-1.644399301) q[5];\nh q[1];\nswap q[5], q[0];\ncx q[5], q[4];\nrx(1.570796327) q[0];\ncx q[4], q[1];\ndelay[32ns] q[2];\nswap q[5], q[4];\nrx(2.094395102) q[0];\nsdg q[1];\nswap q[4], q[3];\nh q[5];\ncz q[3], q[1];\ndelay[34ns] q[5];\nrz(0.5235987756) q[5];\nry(0.7853981634) q[2];\nx q[4];\nrz(1.047197551) q[1];\nrx(0) q[1];\ndelay[74dt] q[0];\nt q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet computes an integer control value __cc_idx as the modular sum of two constants:\n// it adds 20 and 23 and then takes the result modulo 3, yielding __cc_idx = 1. It then uses\n// this computed index in a switch to apply exactly one single-qubit gate to qubit q0: for\n// index 0 it would apply an X, for index 1 it applies a Z, for index 2 it would apply an H,\n// and otherwise it would apply a Y. With the given constants, the Z gate is applied to q0.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[6] q;\n\nh q[4];\n\ncz q[5], q[0];\nry(-2.516721983) q[3];\ndelay[60ns] q[0];\ncz q[1], q[3];\nt q[2];\nry(2.094395102) q[1];\ncx q[3], q[1];\nt q[2];\nswap q[1], q[3];\nrx(-1.644399301) q[5];\nh q[1];\nswap q[5], q[0];\ncx q[5], q[4];\nrx(1.570796327) q[0];\ncx q[4], q[1];\ndelay[32ns] q[2];\nswap q[5], q[4];\nrx(2.094395102) q[0];\nsdg q[1];\nswap q[4], q[3];\nh q[5];\ncz q[3], q[1];\ndelay[34ns] q[5];\nrz(0.5235987756) q[5];\nry(0.7853981634) q[2];\nx q[4];\nrz(1.047197551) q[1];\nrx(0) q[1];\ndelay[74dt] q[0];\nt q[3];\n\n// === CORE_TASK_START ===\n// integer_switch_on_computed_index | switch_on_mod_index: Compute idx=(a+b)%M then switch to choose a gate.\nint __cc_idx = (20 + 23) % 3;\nswitch (__cc_idx) {\n case 0 { x q[0]; }\n case 1 { z q[0]; }\n case 2 { h q[0]; }\n default { y q[0]; }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[6] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n__cc_out[5] = measure q[5];\n// === MEASUREMENT_END ===\n", "completion": "// integer_switch_on_computed_index | switch_on_mod_index: Compute idx=(a+b)%M then switch to choose a gate.\nint __cc_idx = (20 + 23) % 3;\nswitch (__cc_idx) {\n case 0 { x q[0]; }\n case 1 { z q[0]; }\n case 2 { h q[0]; }\n default { y q[0]; }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_16", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nbarrier q;\ncx q[0], q[2];\nswap q[4], q[0];\ny q[4];\ncx q[1], q[0];\nrz(0.2617993878) q[4];\ndelay[69ns] q[1];\nry(-1.961961682) q[2];\ncz q[3], q[4];\nbarrier q;\ns q[2];\nrx(2.094395102) q[0];\nry(3.141592654) q[2];\ny q[0];\nrx(2.35619449) q[3];\nswap q[2], q[0];\nrz(2.35619449) q[1];\nrz(-1.352334677) q[1];\nh q[3];\nrz(0) q[1];\ny q[2];\ncz q[2], q[1];\nrz(-0.1437271028) q[3];\ny q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): A 2-bit classical register named __cc_b is created, and qubits q3 and q4 are measured into\n// __cc_b0 and __cc_b1 respectively. The two measurement bits are then interpreted as an\n// integer and used to classically control a single-qubit operation on q3. If the integer value\n// is 0, an X is applied to q3; if it is 1, a Z is applied; if it is 2, an H is applied;\n// otherwise (value 3) a Y is applied to q3.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nbarrier q;\ncx q[0], q[2];\nswap q[4], q[0];\ny q[4];\ncx q[1], q[0];\nrz(0.2617993878) q[4];\ndelay[69ns] q[1];\nry(-1.961961682) q[2];\ncz q[3], q[4];\nbarrier q;\ns q[2];\nrx(2.094395102) q[0];\nry(3.141592654) q[2];\ny q[0];\nrx(2.35619449) q[3];\nswap q[2], q[0];\nrz(2.35619449) q[1];\nrz(-1.352334677) q[1];\nh q[3];\nrz(0) q[1];\ny q[2];\ncz q[2], q[1];\nrz(-0.1437271028) q[3];\ny q[3];\n\n// === CORE_TASK_START ===\n// switch_on_int_from_bit_literal | switch_on_int_bit2: Measure 2 bits, switch on int(bit[2]).\nbit[2] __cc_b;\n__cc_b[0] = measure q[3];\n__cc_b[1] = measure q[4];\nswitch (int(__cc_b)) {\n case 0 { x q[3]; }\n case 1 { z q[3]; }\n case 2 { h q[3]; }\n default { y q[3]; }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// switch_on_int_from_bit_literal | switch_on_int_bit2: Measure 2 bits, switch on int(bit[2]).\nbit[2] __cc_b;\n__cc_b[0] = measure q[3];\n__cc_b[1] = measure q[4];\nswitch (int(__cc_b)) {\n case 0 { x q[3]; }\n case 1 { z q[3]; }\n case 2 { h q[3]; }\n default { y q[3]; }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_17", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nrz(0.7853981634) q[4];\ncx q[0], q[2];\nbarrier q;\ndelay[64dt] q[2];\ndelay[2ns] q[3];\ncz q[1], q[2];\nrz(0) q[1];\nt q[1];\ncx q[2], q[1];\nbarrier q;\nrx(-2.630225093) q[0];\ncx q[3], q[0];\nrx(0.04746870698) q[3];\nswap q[1], q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines a base rotation angle of 0.158116 and then iterates over the discrete\n// set of integer values 0, 2, 3, 5, and 6. For each value, it computes a Z-rotation angle\n// equal to that integer multiplied by the base angle, and applies an RZ rotation by that\n// computed angle to qubit q[3]. This results in five sequential Z-axis phase rotations on\n// q[3], including a zero-angle rotation when the integer is 0.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nrz(0.7853981634) q[4];\ncx q[0], q[2];\nbarrier q;\ndelay[64dt] q[2];\ndelay[2ns] q[3];\ncz q[1], q[2];\nrz(0) q[1];\nt q[1];\ncx q[2], q[1];\nbarrier q;\nrx(-2.630225093) q[0];\ncx q[3], q[0];\nrx(0.04746870698) q[3];\nswap q[1], q[3];\n\n// === CORE_TASK_START ===\n// set_iteration_discrete | for_set_apply_param_rz: Iterate a discrete set; each element scales angle for RZ.\nangle __cc_base = 0.158116;\nfor int __cc_i in {0,2,3,5,6} {\n angle __cc_th = angle(float(__cc_i) * float(__cc_base));\n rz(__cc_th) q[3];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// set_iteration_discrete | for_set_apply_param_rz: Iterate a discrete set; each element scales angle for RZ.\nangle __cc_base = 0.158116;\nfor int __cc_i in {0,2,3,5,6} {\n angle __cc_th = angle(float(__cc_i) * float(__cc_base));\n rz(__cc_th) q[3];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_18", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\ns q[2];\nrx(-1.570796327) q[1];\ntdg q[0];\nsdg q[1];\ncz q[0], q[2];\ny q[0];\ny q[2];\ndelay[14dt] q[0];\nrz(-1.300895772) q[1];\ncz q[0], q[1];\ndelay[39dt] q[1];\nrx(1.047197551) q[2];\nrx(0.5235987756) q[2];\nswap q[2], q[1];\nrz(1.224605339) q[1];\ndelay[57ns] q[1];\nry(-0.7853981634) q[1];\nry(0) q[0];\nz q[0];\nswap q[0], q[2];\nswap q[1], q[0];\nbarrier q;\nz q[1];\ndelay[24ns] q[2];\nswap q[0], q[2];\nx q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): An array of five rotation angles is defined with values 1.540158, 0.946781, 2.550669,\n// 2.858269, and 4.082898. The program then iterates through this angle list and, for each\n// value, applies a Z-axis rotation to qubit q1 by that angle. This results in five consecutive\n// RZ rotations on q1, one per array element, in the given order.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\ns q[2];\nrx(-1.570796327) q[1];\ntdg q[0];\nsdg q[1];\ncz q[0], q[2];\ny q[0];\ny q[2];\ndelay[14dt] q[0];\nrz(-1.300895772) q[1];\ncz q[0], q[1];\ndelay[39dt] q[1];\nrx(1.047197551) q[2];\nrx(0.5235987756) q[2];\nswap q[2], q[1];\nrz(1.224605339) q[1];\ndelay[57ns] q[1];\nry(-0.7853981634) q[1];\nry(0) q[0];\nz q[0];\nswap q[0], q[2];\nswap q[1], q[0];\nbarrier q;\nz q[1];\ndelay[24ns] q[2];\nswap q[0], q[2];\nx q[2];\n\n// === CORE_TASK_START ===\n// array_iteration_angles_or_ints | iterate_angle_array_rz: Iterate an angle array; apply RZ for each element.\narray[angle, 5] __cc_angles = {1.540158,0.946781,2.550669,2.858269,4.082898};\nfor angle __cc_a in __cc_angles {\n rz(__cc_a) q[1];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// array_iteration_angles_or_ints | iterate_angle_array_rz: Iterate an angle array; apply RZ for each element.\narray[angle, 5] __cc_angles = {1.540158,0.946781,2.550669,2.858269,4.082898};\nfor angle __cc_a in __cc_angles {\n rz(__cc_a) q[1];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_19", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nbarrier q;\nry(0.6158420474) q[4];\ny q[0];\ny q[2];\nsdg q[3];\nsdg q[4];\nt q[2];\nbarrier q;\nbarrier q;\ns q[0];\nswap q[3], q[4];\nrx(1.047197551) q[0];\ntdg q[4];\nrx(-2.838554789) q[3];\nrx(1.726496784) q[1];\ncx q[4], q[3];\nry(-2.167952698) q[3];\nrz(0.3926990817) q[0];\nrz(-3.094238244) q[2];\nrz(0.7853981634) q[1];\ncz q[0], q[4];\nt q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet declares an external classical function that maps a 16-bit unsigned integer to a\n// 16-bit unsigned integer, then sets a 16-bit value to 16 and computes a new 16-bit result by\n// calling that external function on 16. It inspects the least significant bit of the returned\n// 16-bit result by masking with 1 and comparing to 1. If that low bit is 1, it applies an X\n// gate to qubit q1; otherwise, it applies a Z gate to qubit q1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[3];\n\nbarrier q;\nry(0.6158420474) q[4];\ny q[0];\ny q[2];\nsdg q[3];\nsdg q[4];\nt q[2];\nbarrier q;\nbarrier q;\ns q[0];\nswap q[3], q[4];\nrx(1.047197551) q[0];\ntdg q[4];\nrx(-2.838554789) q[3];\nrx(1.726496784) q[1];\ncx q[4], q[3];\nry(-2.167952698) q[3];\nrz(0.3926990817) q[0];\nrz(-3.094238244) q[2];\nrz(0.7853981634) q[1];\ncz q[0], q[4];\nt q[2];\n\n// === CORE_TASK_START ===\n// single_extern_call | extern_uint_to_uint: Declare extern f(uint[w])->uint[w], call it, branch on low bit.\nextern __cc_f(uint[16]) -> uint[16];\nuint[16] __cc_x = 16;\nuint[16] __cc_y = __cc_f(__cc_x);\nif ((__cc_y & 1) == 1) { x q[1]; } else { z q[1]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// single_extern_call | extern_uint_to_uint: Declare extern f(uint[w])->uint[w], call it, branch on low bit.\nextern __cc_f(uint[16]) -> uint[16];\nuint[16] __cc_x = 16;\nuint[16] __cc_y = __cc_f(__cc_x);\nif ((__cc_y & 1) == 1) { x q[1]; } else { z q[1]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_20", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[0];\n\ny q[1];\ntdg q[0];\ny q[3];\ndelay[76dt] q[1];\ntdg q[1];\nrx(-2.784585885) q[3];\nswap q[3], q[1];\nswap q[2], q[3];\ncz q[2], q[1];\nrz(0.7853981634) q[0];\ncz q[0], q[2];\ny q[3];\nrx(3.141592654) q[1];\nry(2.094395102) q[1];\nry(3.141592654) q[2];\ncz q[0], q[2];\nrz(2.094395102) q[3];\nz q[0];\ncx q[3], q[0];\ncz q[2], q[0];\nh q[1];\nrx(0.9541898231) q[2];\ntdg q[1];\nbarrier q;\nz q[2];\nswap q[3], q[1];\nry(2.93419407) q[2];\nh q[3];\nx q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): A loop runs six iterations with an integer index taking\n// values 0 through 5, and in each iteration it applies exactly one\n// single-qubit gate to qubit q3 based on the value of the index modulo 3.\n// When the index modulo 3 equals 0, it applies an X to q3; \n// When the index modulo 3 equals 1, it applies H to q3 for indices 1 or less, \n// but applies Z to q3 for indices greater than 1. \n// In other conditions, applies Y to q3\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[0];\n\ny q[1];\ntdg q[0];\ny q[3];\ndelay[76dt] q[1];\ntdg q[1];\nrx(-2.784585885) q[3];\nswap q[3], q[1];\nswap q[2], q[3];\ncz q[2], q[1];\nrz(0.7853981634) q[0];\ncz q[0], q[2];\ny q[3];\nrx(3.141592654) q[1];\nry(2.094395102) q[1];\nry(3.141592654) q[2];\ncz q[0], q[2];\nrz(2.094395102) q[3];\nz q[0];\ncx q[3], q[0];\ncz q[2], q[0];\nh q[1];\nrx(0.9541898231) q[2];\ntdg q[1];\nbarrier q;\nz q[2];\nswap q[3], q[1];\nry(2.93419407) q[2];\nh q[3];\nx q[0];\n\n// === CORE_TASK_START ===\n// nested_control_switch_in_loop_with_if | loop_switch_then_if: Inside loop: switch(i%3), and one case has an if guard.\nfor int __cc_i in {0,1,2,3,4,5} {\n switch (__cc_i % 3) {\n case 0 { x q[3]; }\n case 1 { if (__cc_i > 1) { z q[3]; } else { h q[3]; } }\n default { y q[3]; }\n }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// nested_control_switch_in_loop_with_if | loop_switch_then_if: Inside loop: switch(i%3), and one case has an if guard.\nfor int __cc_i in {0,1,2,3,4,5} {\n switch (__cc_i % 3) {\n case 0 { x q[3]; }\n case 1 { if (__cc_i > 1) { z q[3]; } else { h q[3]; } }\n default { y q[3]; }\n }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_21", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[1];\n\nry(3.141592654) q[0];\ns q[2];\ncz q[1], q[0];\nrx(1.047197551) q[2];\nry(1.06735687) q[0];\ncz q[3], q[2];\nry(2.094395102) q[3];\ncz q[3], q[0];\ncx q[2], q[1];\ncx q[1], q[2];\ncz q[0], q[3];\ny q[3];\nswap q[3], q[0];\nrx(0.5045600568) q[0];\nrz(3.141592654) q[0];\ncx q[1], q[3];\ncx q[0], q[3];\nx q[1];\nrx(0.2617993878) q[3];\nry(0.5235987756) q[1];\nswap q[1], q[2];\ncz q[0], q[1];\nswap q[3], q[1];\nswap q[2], q[1];\nrz(2.35619449) q[0];\ncx q[3], q[2];\ncx q[3], q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet initializes an integer counter to 0, then performs three rounds where it\n// measures qubit q0 into a temporary classical bit, adds the measured value (0 or 1) into the\n// counter, and applies an X gate to q0 after each measurement. After the three measurements,\n// it applies a conditional single-qubit gate on q0 based on the total number of measured ones:\n// if the counter is at least 3 (meaning all three measurements were 1), it applies X to q0;\n// otherwise it applies Z to q0.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[4] q;\n\nh q[1];\n\nry(3.141592654) q[0];\ns q[2];\ncz q[1], q[0];\nrx(1.047197551) q[2];\nry(1.06735687) q[0];\ncz q[3], q[2];\nry(2.094395102) q[3];\ncz q[3], q[0];\ncx q[2], q[1];\ncx q[1], q[2];\ncz q[0], q[3];\ny q[3];\nswap q[3], q[0];\nrx(0.5045600568) q[0];\nrz(3.141592654) q[0];\ncx q[1], q[3];\ncx q[0], q[3];\nx q[1];\nrx(0.2617993878) q[3];\nry(0.5235987756) q[1];\nswap q[1], q[2];\ncz q[0], q[1];\nswap q[3], q[1];\nswap q[2], q[1];\nrz(2.35619449) q[0];\ncx q[3], q[2];\ncx q[3], q[0];\n\n// === CORE_TASK_START ===\n// measurement_accumulation_counter | count_ones_then_threshold_gate: Repeat measurement in for-loop, count ones, threshold decides a gate.\nint __cc_cnt = 0;\nfor int __cc_i in {0,1,2} {\n bit __cc_m = measure q[0];\n __cc_cnt = __cc_cnt + int(__cc_m);\n x q[0];\n}\nif (__cc_cnt >= 3) { x q[0]; } else { z q[0]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// measurement_accumulation_counter | count_ones_then_threshold_gate: Repeat measurement in for-loop, count ones, threshold decides a gate.\nint __cc_cnt = 0;\nfor int __cc_i in {0,1,2} {\n bit __cc_m = measure q[0];\n __cc_cnt = __cc_cnt + int(__cc_m);\n x q[0];\n}\nif (__cc_cnt >= 3) { x q[0]; } else { z q[0]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_22", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[1];\n\ny q[2];\nrx(-1.644448404) q[3];\ndelay[61ns] q[3];\nx q[0];\nz q[1];\nswap q[3], q[2];\ncz q[0], q[4];\nrx(-2.985602368) q[2];\nbarrier q;\nrz(2.094395102) q[4];\ncx q[2], q[3];\nbarrier q;\nbarrier q;\ndelay[43ns] q[2];\ndelay[62dt] q[2];\nz q[0];\ndelay[44ns] q[4];\nz q[1];\nswap q[2], q[1];\ncx q[2], q[4];\nrz(-2.926750479) q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet measures qubit q0 and stores the single-bit result in the classical bit __cc_m.\n// If the measurement outcome is 1, the program terminates immediately via an early-exit. If\n// the outcome is 0, execution continues and an X gate is applied to q0, flipping it from 0 to\n// 1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[1];\n\ny q[2];\nrx(-1.644448404) q[3];\ndelay[61ns] q[3];\nx q[0];\nz q[1];\nswap q[3], q[2];\ncz q[0], q[4];\nrx(-2.985602368) q[2];\nbarrier q;\nrz(2.094395102) q[4];\ncx q[2], q[3];\nbarrier q;\nbarrier q;\ndelay[43ns] q[2];\ndelay[62dt] q[2];\nz q[0];\ndelay[44ns] q[4];\nz q[1];\nswap q[2], q[1];\ncx q[2], q[4];\nrz(-2.926750479) q[3];\n\n// === CORE_TASK_START ===\n// early_termination_end | end_if_meas_one: Measure; if 1 then end immediately, else continue.\nbit __cc_m = measure q[0];\nif (__cc_m) { end; }\nx q[0];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// early_termination_end | end_if_meas_one: Measure; if 1 then end immediately, else continue.\nbit __cc_m = measure q[0];\nif (__cc_m) { end; }\nx q[0];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_23", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[0];\n\nx q[2];\nrz(-0.7853981634) q[1];\ntdg q[0];\nbarrier q;\nt q[2];\nrz(-2.490868252) q[1];\nrz(1.047197551) q[2];\nrx(-1.428841255) q[0];\nrz(-2.479935277) q[0];\nrx(1.570796327) q[1];\nx q[4];\nrz(2.35619449) q[1];\ncx q[1], q[2];\ncx q[2], q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): A 4-bit classical register named __cc_b is created, and qubits q1 and q4 are measured into\n// __cc_b index 0 and index 1, respectively. A 2-bit slice __cc_s is then taken from __cc_b\n// covering indices 0 and 1, and an integer counter __cc_cnt is initialized to 0 and\n// incremented by iterating over those two slice bits to count how many measured ones occurred.\n// Finally, a conditional is applied to qubit q1: if the count is greater than 0 (meaning at\n// least one of q1 or q4 measured as 1), an X gate is applied to q1; otherwise a Z gate is\n// applied to q1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[0];\n\nx q[2];\nrz(-0.7853981634) q[1];\ntdg q[0];\nbarrier q;\nt q[2];\nrz(-2.490868252) q[1];\nrz(1.047197551) q[2];\nrx(-1.428841255) q[0];\nrz(-2.479935277) q[0];\nrx(1.570796327) q[1];\nx q[4];\nrz(2.35619449) q[1];\ncx q[1], q[2];\ncx q[2], q[0];\n\n// === CORE_TASK_START ===\n// bit_slice_alias_and_iteration | slice_iterate_count_ones: Measure into bit[n], slice first half, iterate slice to count ones.\nbit[4] __cc_b;\n__cc_b[0] = measure q[1];\n__cc_b[1] = measure q[4];\nlet __cc_s = __cc_b[0:2];\nint __cc_cnt = 0;\nfor bit __cc_x in __cc_s { __cc_cnt = __cc_cnt + int(__cc_x); }\nif (__cc_cnt > 0) { x q[1]; } else { z q[1]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// bit_slice_alias_and_iteration | slice_iterate_count_ones: Measure into bit[n], slice first half, iterate slice to count ones.\nbit[4] __cc_b;\n__cc_b[0] = measure q[1];\n__cc_b[1] = measure q[4];\nlet __cc_s = __cc_b[0:2];\nint __cc_cnt = 0;\nfor bit __cc_x in __cc_s { __cc_cnt = __cc_cnt + int(__cc_x); }\nif (__cc_cnt > 0) { x q[1]; } else { z q[1]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_24", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\nry(0.7853981634) q[2];\nh q[2];\ndelay[17dt] q[1];\nrx(-2.709893048) q[1];\nry(-0.7853981634) q[2];\nrz(0.7853981634) q[0];\nh q[0];\nrz(-1.570796327) q[2];\ntdg q[0];\nry(1.570796327) q[1];\ncx q[1], q[0];\nswap q[0], q[1];\nx q[0];\ncz q[0], q[2];\nbarrier q;\nry(0.3926990817) q[0];\ncz q[1], q[2];\nrx(1.047197551) q[1];\nrz(2.969400896) q[2];\nx q[1];\nh q[0];\nt q[2];\nt q[0];\nbarrier q;\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet runs a loop over an integer index taking the eight values 0 through 7. On each\n// iteration it conditionally applies a Pauli operation to qubit q2: it applies an X gate only\n// when the index equals 6 or 7, and otherwise applies a Z gate. As a result, q2 receives six Z\n// applications and two X applications in total, in the order determined by the loop.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[3] q;\n\nh q[1];\n\nry(0.7853981634) q[2];\nh q[2];\ndelay[17dt] q[1];\nrx(-2.709893048) q[1];\nry(-0.7853981634) q[2];\nrz(0.7853981634) q[0];\nh q[0];\nrz(-1.570796327) q[2];\ntdg q[0];\nry(1.570796327) q[1];\ncx q[1], q[0];\nswap q[0], q[1];\nx q[0];\ncz q[0], q[2];\nbarrier q;\nry(0.3926990817) q[0];\ncz q[1], q[2];\nrx(1.047197551) q[1];\nrz(2.969400896) q[2];\nx q[1];\nh q[0];\nt q[2];\nt q[0];\nbarrier q;\n\n// === CORE_TASK_START ===\n// membership_test_in_set | if_i_in_subset_then_x: Loop; if index is in subset then apply X else Z (membership expanded to ==/||).\nfor int __cc_i in {0,1,2,3,4,5,6,7} {\n if ((__cc_i == 6) || (__cc_i == 7)) { x q[2]; } else { z q[2]; }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// membership_test_in_set | if_i_in_subset_then_x: Loop; if index is in subset then apply X else Z (membership expanded to ==/||).\nfor int __cc_i in {0,1,2,3,4,5,6,7} {\n if ((__cc_i == 6) || (__cc_i == 7)) { x q[2]; } else { z q[2]; }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "classical_test/classical_task_25", "domain": "classical", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[4];\n\ndelay[15ns] q[1];\nrz(0.2617993878) q[1];\ncx q[1], q[3];\nrz(1.047197551) q[4];\ny q[2];\nry(0.2617993878) q[4];\nry(2.805149491) q[2];\nbarrier q;\nrz(3.141592654) q[1];\ns q[1];\ncx q[2], q[3];\nz q[3];\nrx(0.5235987756) q[4];\ntdg q[1];\nry(1.766945954) q[0];\ndelay[77ns] q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines two compile-time integer constants __cc_A and __cc_B, both equal to 2,\n// and a runtime integer variable __cc_x initialized to 1. It then performs a switch on __cc_x\n// with two case labels given by constant expressions: one equal to __cc_A plus 1, which\n// evaluates to 3 and would apply an X gate to qubit q[1], and one equal to __cc_B plus 2,\n// which evaluates to 4 and would apply a Z gate to qubit q[1]. Since __cc_x is 1, neither case\n// matches, so no operation is applied to q[1] in this snippet.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\nqubit[5] q;\n\nh q[4];\n\ndelay[15ns] q[1];\nrz(0.2617993878) q[1];\ncx q[1], q[3];\nrz(1.047197551) q[4];\ny q[2];\nry(0.2617993878) q[4];\nry(2.805149491) q[2];\nbarrier q;\nrz(3.141592654) q[1];\ns q[1];\ncx q[2], q[3];\nz q[3];\nrx(0.5235987756) q[4];\ntdg q[1];\nry(1.766945954) q[0];\ndelay[77ns] q[0];\n\n// === CORE_TASK_START ===\n// switch_const_expression_cases_no_default | case_const_expr_no_default: Switch with case labels as const-expressions, no default (no-op allowed).\nconst int __cc_A = 2;\nconst int __cc_B = 2;\nint __cc_x = 1;\nswitch (__cc_x) {\n case __cc_A + 1 { x q[1]; }\n case __cc_B + 2 { z q[1]; }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// switch_const_expression_cases_no_default | case_const_expr_no_default: Switch with case labels as const-expressions, no default (no-op allowed).\nconst int __cc_A = 2;\nconst int __cc_B = 2;\nint __cc_x = 1;\nswitch (__cc_x) {\n case __cc_A + 1 { x q[1]; }\n case __cc_B + 2 { z q[1]; }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_01", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000001\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.225346e9;\nconst float meas_freq_0 = 7.125852e9;\nconst float drive_freq_1 = 6.729561e9;\nconst float meas_freq_1 = 6.003384e9;\nconst float drive_freq_2 = 6.172801e9;\nconst float meas_freq_2 = 6.070281e9;\nconst float drive_freq_3 = 5.544791e9;\nconst float meas_freq_3 = 6.155913e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 31dt, 22dt);\n shift_phase(q2_drive, -0.183025);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 2769834.0));\n delay[37dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.320498);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -6113833.0));\n delay[21dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.691387) q[1];\nh q[2];\nx q[2];\ncx q[2], q[1];\nrz(-0.958278) q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): In calibration context, it creates a single Gaussian-shaped complex pulse waveform with\n// amplitude 0.5 plus 0.0 imaginary, total duration 315 dt, and Gaussian width parameter sigma\n// 45 dt. It then plays this pulse once on the q2_drive frame, applying it to qubit 2’s drive\n// port using whatever phase and frequency are currently set for that frame.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000001\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.225346e9;\nconst float meas_freq_0 = 7.125852e9;\nconst float drive_freq_1 = 6.729561e9;\nconst float meas_freq_1 = 6.003384e9;\nconst float drive_freq_2 = 6.172801e9;\nconst float meas_freq_2 = 6.070281e9;\nconst float drive_freq_3 = 5.544791e9;\nconst float meas_freq_3 = 6.155913e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 31dt, 22dt);\n shift_phase(q2_drive, -0.183025);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 2769834.0));\n delay[37dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.320498);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -6113833.0));\n delay[21dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.691387) q[1];\nh q[2];\nx q[2];\ncx q[2], q[1];\nrz(-0.958278) q[3];\n\n// === CORE_TASK_START ===\n// x_gaussian_play | cal_play_gaussian_once: Create gaussian waveform and play once on the drive frame.\ncal {\n waveform w = gaussian(0.5+0.0im, 315dt, 45dt);\n play(q2_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// x_gaussian_play | cal_play_gaussian_once: Create gaussian waveform and play once on the drive frame.\ncal {\n waveform w = gaussian(0.5+0.0im, 315dt, 45dt);\n play(q2_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_02", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000002\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.190303e9;\nconst float meas_freq_0 = 6.479896e9;\nconst float drive_freq_1 = 6.160229e9;\nconst float meas_freq_1 = 6.031293e9;\nconst float drive_freq_2 = 6.412279e9;\nconst float meas_freq_2 = 6.677964e9;\nconst float drive_freq_3 = 5.282711e9;\nconst float meas_freq_3 = 6.795719e9;\nconst float drive_freq_4 = 4.672408e9;\nconst float meas_freq_4 = 6.864890e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 50dt, 27dt);\n shift_phase(q1_drive, 0.556885);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -12538389.0));\n delay[66dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.504095);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 5704355.0));\n delay[26dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.340456);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -16343780.0));\n delay[22dt] q3_drive;\n play(q3_drive, _bg_wf);\n shift_phase(q4_drive, -0.440536);\n set_frequency(q4_drive, (get_frequency(q4_drive) + -11819093.0));\n delay[26dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q1_drive, q2_drive, q3_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nh q[4];\nh q[4];\nx q[2];\nrx(0.356813) q[2];\nrx(0.782476) q[0];\nrz(-0.521408) q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): In calibration context, a Gaussian waveform with complex amplitude 0.5 and duration 123 dt\n// with sigma 51 dt is prepared. A virtual Z rotation is applied to qubit 3 by shifting the\n// phase of its drive frame q3_drive by −0.208738 radians. Immediately after this phase update,\n// the Gaussian pulse is played on q3_drive, so the pulse is applied in the rotated phase\n// reference.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000002\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.190303e9;\nconst float meas_freq_0 = 6.479896e9;\nconst float drive_freq_1 = 6.160229e9;\nconst float meas_freq_1 = 6.031293e9;\nconst float drive_freq_2 = 6.412279e9;\nconst float meas_freq_2 = 6.677964e9;\nconst float drive_freq_3 = 5.282711e9;\nconst float meas_freq_3 = 6.795719e9;\nconst float drive_freq_4 = 4.672408e9;\nconst float meas_freq_4 = 6.864890e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 50dt, 27dt);\n shift_phase(q1_drive, 0.556885);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -12538389.0));\n delay[66dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.504095);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 5704355.0));\n delay[26dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.340456);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -16343780.0));\n delay[22dt] q3_drive;\n play(q3_drive, _bg_wf);\n shift_phase(q4_drive, -0.440536);\n set_frequency(q4_drive, (get_frequency(q4_drive) + -11819093.0));\n delay[26dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q1_drive, q2_drive, q3_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nh q[4];\nh q[4];\nx q[2];\nrx(0.356813) q[2];\nrx(0.782476) q[0];\nrz(-0.521408) q[3];\n\n// === CORE_TASK_START ===\n// virtual_z_shift_phase | shift_phase_then_play: Implement a virtual-Z by shifting the phase of the drive frame before a play.\ncal {\n waveform w = gaussian(0.5+0.0im, 123dt, 51dt);\n shift_phase(q3_drive, -0.208738);\n play(q3_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// virtual_z_shift_phase | shift_phase_then_play: Implement a virtual-Z by shifting the phase of the drive frame before a play.\ncal {\n waveform w = gaussian(0.5+0.0im, 123dt, 51dt);\n shift_phase(q3_drive, -0.208738);\n play(q3_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_03", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000003\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.966505e9;\nconst float meas_freq_0 = 6.055231e9;\nconst float drive_freq_1 = 5.319152e9;\nconst float meas_freq_1 = 6.182550e9;\nconst float drive_freq_2 = 5.278240e9;\nconst float meas_freq_2 = 6.165589e9;\nconst float drive_freq_3 = 6.171254e9;\nconst float meas_freq_3 = 6.389720e9;\nconst float drive_freq_4 = 5.774558e9;\nconst float meas_freq_4 = 6.452674e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 62dt, 19dt);\n shift_phase(q1_drive, 0.023612);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 11866658.0));\n delay[13dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.099810);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 3977418.0));\n delay[61dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q4_drive, 0.449029);\n set_frequency(q4_drive, (get_frequency(q4_drive) + 7461046.0));\n delay[34dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q1_drive, q2_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nx q[3];\nx q[0];\ncx q[4], q[0];\nx q[0];\nrz(1.190150) q[3];\ncx q[0], q[4];\nh q[1];\nrx(-0.184324) q[4];\nx q[4];\nh q[0];\ncx q[1], q[4];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, it creates a constant complex waveform with zero amplitude\n// lasting 99 dt to serve as a capture filter. It then performs a capture on the q2 acquisition\n// frame q2_acq using that filter and immediately converts the captured response into a single\n// classical bit m available within the calibration scope (independent of any later gate-level\n// measurement).\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000003\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.966505e9;\nconst float meas_freq_0 = 6.055231e9;\nconst float drive_freq_1 = 5.319152e9;\nconst float meas_freq_1 = 6.182550e9;\nconst float drive_freq_2 = 5.278240e9;\nconst float meas_freq_2 = 6.165589e9;\nconst float drive_freq_3 = 6.171254e9;\nconst float meas_freq_3 = 6.389720e9;\nconst float drive_freq_4 = 5.774558e9;\nconst float meas_freq_4 = 6.452674e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 62dt, 19dt);\n shift_phase(q1_drive, 0.023612);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 11866658.0));\n delay[13dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.099810);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 3977418.0));\n delay[61dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q4_drive, 0.449029);\n set_frequency(q4_drive, (get_frequency(q4_drive) + 7461046.0));\n delay[34dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q1_drive, q2_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nx q[3];\nx q[0];\ncx q[4], q[0];\nx q[0];\nrz(1.190150) q[3];\ncx q[0], q[4];\nh q[1];\nrx(-0.184324) q[4];\nx q[4];\nh q[0];\ncx q[1], q[4];\n\n// === CORE_TASK_START ===\n// measure_capture_bit | cal_capture_bit_direct: Use capture(acq_frame, filter) to obtain a bit inside cal.\ncal {\n waveform f = constant(0.0+0.0im, 99dt);\n bit m = capture(q2_acq, f);\n // m is an observable classical result within cal; final QASM measure is still provided below\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// measure_capture_bit | cal_capture_bit_direct: Use capture(acq_frame, filter) to obtain a bit inside cal.\ncal {\n waveform f = constant(0.0+0.0im, 99dt);\n bit m = capture(q2_acq, f);\n // m is an observable classical result within cal; final QASM measure is still provided below\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_04", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000004\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.505186e9;\nconst float meas_freq_0 = 7.020468e9;\nconst float drive_freq_1 = 4.721848e9;\nconst float meas_freq_1 = 7.083899e9;\nconst float drive_freq_2 = 6.065573e9;\nconst float meas_freq_2 = 7.175697e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 22dt, 11dt);\n shift_phase(q0_drive, -0.394631);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -8330071.0));\n delay[64dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.063810);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -10107080.0));\n delay[34dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.033009);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -7229094.0));\n delay[32dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nx q[2];\nrz(0.950586) q[0];\nrx(-0.880218) q[1];\nh q[1];\nrz(0.111617) q[2];\nx q[2];\ncx q[0], q[2];\nh q[2];\nrx(-0.333825) q[0];\nx q[0];\ncx q[2], q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): Within the calibration block, a single-qubit drive pulse is applied on the q0_drive frame\n// (the drive port for qubit 0). The pulse is a DRAG-shaped waveform with complex amplitude 0.5\n// plus 0.0 imaginary, total duration 79 dt, Gaussian width parameter sigma of 8 dt, and DRAG\n// beta parameter 1.253. This waveform is then played once on q0’s drive channel to implement a\n// shaped control rotation while suppressing leakage.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000004\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.505186e9;\nconst float meas_freq_0 = 7.020468e9;\nconst float drive_freq_1 = 4.721848e9;\nconst float meas_freq_1 = 7.083899e9;\nconst float drive_freq_2 = 6.065573e9;\nconst float meas_freq_2 = 7.175697e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 22dt, 11dt);\n shift_phase(q0_drive, -0.394631);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -8330071.0));\n delay[64dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.063810);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -10107080.0));\n delay[34dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.033009);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -7229094.0));\n delay[32dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nx q[2];\nrz(0.950586) q[0];\nrx(-0.880218) q[1];\nh q[1];\nrz(0.111617) q[2];\nx q[2];\ncx q[0], q[2];\nh q[2];\nrx(-0.333825) q[0];\nx q[0];\ncx q[2], q[1];\n\n// === CORE_TASK_START ===\n// sx_drag_play | cal_play_drag: Play a DRAG waveform on the drive frame.\ncal {\n waveform w = drag(0.5+0.0im, 79dt, 8dt, 1.253);\n play(q0_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// sx_drag_play | cal_play_drag: Play a DRAG waveform on the drive frame.\ncal {\n waveform w = drag(0.5+0.0im, 79dt, 8dt, 1.253);\n play(q0_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_05", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000005\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.910869e9;\nconst float meas_freq_0 = 7.197958e9;\nconst float drive_freq_1 = 5.697100e9;\nconst float meas_freq_1 = 6.570797e9;\nconst float drive_freq_2 = 5.291930e9;\nconst float meas_freq_2 = 6.540000e9;\nconst float drive_freq_3 = 5.661014e9;\nconst float meas_freq_3 = 6.536111e9;\nconst float drive_freq_4 = 6.252873e9;\nconst float meas_freq_4 = 6.248912e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 66dt, 7dt);\n shift_phase(q0_drive, -0.116319);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -13344102.0));\n delay[9dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q2_drive, 0.122536);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 15849220.0));\n delay[71dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.464064);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -3489838.0));\n delay[72dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrx(-0.247408) q[2];\nx q[2];\nrx(-1.161095) q[3];\nrx(-0.571850) q[0];\ncx q[0], q[4];\nh q[3];\ncx q[1], q[0];\nh q[4];\nrx(0.956590) q[0];\nh q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, two shaped microwave pulses are generated and applied in\n// parallel on two drive frames: a Gaussian-square pulse wc with complex amplitude 0.5, total\n// duration 126 dt, square width 46 dt, and Gaussian edge sigma 117 dt on the q0_drive frame,\n// and a Gaussian pulse wt with complex amplitude 0.2, duration 126 dt, and sigma 117 dt on the\n// q2_drive frame. After both plays are issued, a barrier synchronizes q0_drive and q2_drive to\n// ensure the composite CR-like parallel action completes before any subsequent operations on\n// those frames.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000005\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.910869e9;\nconst float meas_freq_0 = 7.197958e9;\nconst float drive_freq_1 = 5.697100e9;\nconst float meas_freq_1 = 6.570797e9;\nconst float drive_freq_2 = 5.291930e9;\nconst float meas_freq_2 = 6.540000e9;\nconst float drive_freq_3 = 5.661014e9;\nconst float meas_freq_3 = 6.536111e9;\nconst float drive_freq_4 = 6.252873e9;\nconst float meas_freq_4 = 6.248912e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 66dt, 7dt);\n shift_phase(q0_drive, -0.116319);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -13344102.0));\n delay[9dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q2_drive, 0.122536);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 15849220.0));\n delay[71dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.464064);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -3489838.0));\n delay[72dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrx(-0.247408) q[2];\nx q[2];\nrx(-1.161095) q[3];\nrx(-0.571850) q[0];\ncx q[0], q[4];\nh q[3];\ncx q[1], q[0];\nh q[4];\nrx(0.956590) q[0];\nh q[0];\n\n// === CORE_TASK_START ===\n// cr_composite_multi_frame | cr_like_parallel_pulses: CR-like composite: play shaped pulse on control and target frames in parallel.\ncal {\n waveform wc = gaussian_square(0.5+0.0im, 126dt, 46dt, 117dt);\n waveform wt = gaussian(0.2+0.0im, 126dt, 117dt);\n play(q0_drive, wc);\n play(q2_drive, wt);\n barrier q0_drive, q2_drive;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// cr_composite_multi_frame | cr_like_parallel_pulses: CR-like composite: play shaped pulse on control and target frames in parallel.\ncal {\n waveform wc = gaussian_square(0.5+0.0im, 126dt, 46dt, 117dt);\n waveform wt = gaussian(0.2+0.0im, 126dt, 117dt);\n play(q0_drive, wc);\n play(q2_drive, wt);\n barrier q0_drive, q2_drive;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_06", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000006\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.163612e9;\nconst float meas_freq_0 = 6.691681e9;\nconst float drive_freq_1 = 5.386283e9;\nconst float meas_freq_1 = 6.406657e9;\nconst float drive_freq_2 = 5.709846e9;\nconst float meas_freq_2 = 6.542280e9;\nconst float drive_freq_3 = 5.279943e9;\nconst float meas_freq_3 = 6.395227e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 35dt, 28dt);\n shift_phase(q0_drive, 0.190335);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -14467372.0));\n delay[57dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.595682);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 495989.0));\n delay[25dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, -0.059786);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 5191062.0));\n delay[67dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.438023);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -10745092.0));\n delay[48dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[3];\nrx(0.418600) q[2];\nh q[0];\ncx q[2], q[0];\nx q[3];\ncx q[3], q[1];\nrz(0.798967) q[1];\nrx(1.085538) q[0];\nrx(-0.600306) q[1];\nrz(-0.016018) q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): A classical bit b_reset is created by measuring qubit q0. If the measurement result is 1, a\n// Gaussian pulse of complex amplitude 0.5 and duration 125 dt with sigma 38 dt is played on\n// the q0_drive frame, followed by an idle delay of 220 dt on that same frame. If the result is\n// 0, the program instead waits 220 dt on q0_drive and then plays the same Gaussian pulse, so\n// both branches include the same pulse and delay but in opposite order to keep the total\n// branch timing equal.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000006\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.163612e9;\nconst float meas_freq_0 = 6.691681e9;\nconst float drive_freq_1 = 5.386283e9;\nconst float meas_freq_1 = 6.406657e9;\nconst float drive_freq_2 = 5.709846e9;\nconst float meas_freq_2 = 6.542280e9;\nconst float drive_freq_3 = 5.279943e9;\nconst float meas_freq_3 = 6.395227e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 35dt, 28dt);\n shift_phase(q0_drive, 0.190335);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -14467372.0));\n delay[57dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.595682);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 495989.0));\n delay[25dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, -0.059786);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 5191062.0));\n delay[67dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.438023);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -10745092.0));\n delay[48dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[3];\nrx(0.418600) q[2];\nh q[0];\ncx q[2], q[0];\nx q[3];\ncx q[3], q[1];\nrz(0.798967) q[1];\nrx(1.085538) q[0];\nrx(-0.600306) q[1];\nrz(-0.016018) q[3];\n\n// === CORE_TASK_START ===\n// active_reset_equal_time_branches | if_measure_then_pulse_else_idle: Measure, then if=1 play a pulse; else idle, with equal dt duration in both branches.\nbit b_reset;\nb_reset = measure q[0];\nif (b_reset) {\n cal {\n waveform w = gaussian(0.5+0.0im, 125dt, 38dt);\n play(q0_drive, w);\n delay[220dt] q0_drive;\n }\n} else {\n cal {\n delay[220dt] q0_drive;\n waveform w = gaussian(0.5+0.0im, 125dt, 38dt);\n play(q0_drive, w);\n }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// active_reset_equal_time_branches | if_measure_then_pulse_else_idle: Measure, then if=1 play a pulse; else idle, with equal dt duration in both branches.\nbit b_reset;\nb_reset = measure q[0];\nif (b_reset) {\n cal {\n waveform w = gaussian(0.5+0.0im, 125dt, 38dt);\n play(q0_drive, w);\n delay[220dt] q0_drive;\n }\n} else {\n cal {\n delay[220dt] q0_drive;\n waveform w = gaussian(0.5+0.0im, 125dt, 38dt);\n play(q0_drive, w);\n }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_07", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000007\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.483957e9;\nconst float meas_freq_0 = 6.787346e9;\nconst float drive_freq_1 = 6.149196e9;\nconst float meas_freq_1 = 6.083779e9;\nconst float drive_freq_2 = 5.624798e9;\nconst float meas_freq_2 = 7.182227e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 18dt, 23dt);\n shift_phase(q0_drive, -0.109635);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -19398962.0));\n delay[51dt] q0_drive;\n play(q0_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nx q[1];\ncx q[2], q[0];\nrz(0.735814) q[2];\nx q[1];\ncx q[1], q[2];\nx q[1];\nrx(0.078446) q[1];\ncx q[2], q[1];\nrz(-0.652864) q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): In the calibration block, an external waveform mixer is declared and used to combine two 314\n// dt waveforms: a Gaussian envelope on q0’s drive channel with complex amplitude 0.5 and sigma\n// 104 dt, and a sine tone with complex amplitude 1.0 at 21,000,000 Hz and phase −0.491769. The\n// mixed result is then played on the q0_drive frame, applying a sideband-modulated, Gaussian-\n// shaped drive pulse to qubit q0.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000007\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.483957e9;\nconst float meas_freq_0 = 6.787346e9;\nconst float drive_freq_1 = 6.149196e9;\nconst float meas_freq_1 = 6.083779e9;\nconst float drive_freq_2 = 5.624798e9;\nconst float meas_freq_2 = 7.182227e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 18dt, 23dt);\n shift_phase(q0_drive, -0.109635);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -19398962.0));\n delay[51dt] q0_drive;\n play(q0_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nx q[1];\ncx q[2], q[0];\nrz(0.735814) q[2];\nx q[1];\ncx q[1], q[2];\nx q[1];\nrx(0.078446) q[1];\ncx q[2], q[1];\nrz(-0.652864) q[0];\n\n// === CORE_TASK_START ===\n// sideband_modulation_mix | mix_gaussian_and_sine: Declare extern mix, then mix gaussian envelope with a sine tone and play.\ncal {\n extern mix(waveform a, waveform b) -> waveform;\n waveform env = gaussian(0.5+0.0im, 314dt, 104dt);\n waveform tone = sine(1.0+0.0im, 314dt, 21000000.0, -0.491769);\n waveform w = mix(env, tone);\n play(q0_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// sideband_modulation_mix | mix_gaussian_and_sine: Declare extern mix, then mix gaussian envelope with a sine tone and play.\ncal {\n extern mix(waveform a, waveform b) -> waveform;\n waveform env = gaussian(0.5+0.0im, 314dt, 104dt);\n waveform tone = sine(1.0+0.0im, 314dt, 21000000.0, -0.491769);\n waveform w = mix(env, tone);\n play(q0_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_08", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000008\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.630202e9;\nconst float meas_freq_0 = 6.698647e9;\nconst float drive_freq_1 = 5.541161e9;\nconst float meas_freq_1 = 6.522237e9;\nconst float drive_freq_2 = 6.456281e9;\nconst float meas_freq_2 = 6.528283e9;\nconst float drive_freq_3 = 6.051888e9;\nconst float meas_freq_3 = 6.027222e9;\nconst float drive_freq_4 = 6.202230e9;\nconst float meas_freq_4 = 6.865485e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 72dt, 12dt);\n shift_phase(q1_drive, 0.507989);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -6684110.0));\n delay[22dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q4_drive, 0.232299);\n set_frequency(q4_drive, (get_frequency(q4_drive) + -19032216.0));\n delay[78dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q1_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nh q[4];\nh q[3];\nrx(-0.608903) q[2];\nrx(-0.123362) q[1];\nh q[3];\ncx q[2], q[1];\nh q[4];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, a short arbitrary complex waveform named w is defined\n// explicitly by three samples: 1 plus 0i, 0 plus 1i, and 1 over square root of 2 plus i times\n// 1 over square root of 2. This 3-sample waveform is then played on the q1_drive frame,\n// applying a custom drive pulse to qubit 1’s drive port with those exact I/Q sample values.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000008\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.630202e9;\nconst float meas_freq_0 = 6.698647e9;\nconst float drive_freq_1 = 5.541161e9;\nconst float meas_freq_1 = 6.522237e9;\nconst float drive_freq_2 = 6.456281e9;\nconst float meas_freq_2 = 6.528283e9;\nconst float drive_freq_3 = 6.051888e9;\nconst float meas_freq_3 = 6.027222e9;\nconst float drive_freq_4 = 6.202230e9;\nconst float meas_freq_4 = 6.865485e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 72dt, 12dt);\n shift_phase(q1_drive, 0.507989);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -6684110.0));\n delay[22dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q4_drive, 0.232299);\n set_frequency(q4_drive, (get_frequency(q4_drive) + -19032216.0));\n delay[78dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q1_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nh q[4];\nh q[3];\nrx(-0.608903) q[2];\nrx(-0.123362) q[1];\nh q[3];\ncx q[2], q[1];\nh q[4];\n\n// === CORE_TASK_START ===\n// raw_samples_waveform_literal | arb_waveform_short: Define a short arbitrary waveform from complex samples and play.\ncal {\n waveform w = [1+0im, 0+1im, 1/sqrt(2)+1/sqrt(2)im];\n play(q1_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// raw_samples_waveform_literal | arb_waveform_short: Define a short arbitrary waveform from complex samples and play.\ncal {\n waveform w = [1+0im, 0+1im, 1/sqrt(2)+1/sqrt(2)im];\n play(q1_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_09", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000009\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.694655e9;\nconst float meas_freq_0 = 6.693135e9;\nconst float drive_freq_1 = 4.886993e9;\nconst float meas_freq_1 = 6.273453e9;\nconst float drive_freq_2 = 6.438222e9;\nconst float meas_freq_2 = 6.948558e9;\nconst float drive_freq_3 = 5.383212e9;\nconst float meas_freq_3 = 6.523003e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 45dt, 25dt);\n shift_phase(q0_drive, -0.567007);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -19708825.0));\n delay[78dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, 0.322158);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 7058652.0));\n delay[28dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.390769);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -6859214.0));\n delay[43dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.239347);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 14934585.0));\n delay[54dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[0];\nrx(-0.846095) q[2];\ncx q[0], q[3];\nrx(-0.480869) q[0];\nrz(-0.792007) q[2];\nrz(-0.401021) q[0];\nrz(0.664386) q[0];\nrz(0.391921) q[2];\ncx q[3], q[2];\nrz(0.635147) q[2];\nh q[1];\ncx q[2], q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, the program inserts a delay of 71 dt on the q0_drive frame. It\n// then applies a barrier involving q0_drive and q2_drive to synchronize them, ensuring both\n// drive frames are aligned in time before any subsequent pulse activity on either frame.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000009\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.694655e9;\nconst float meas_freq_0 = 6.693135e9;\nconst float drive_freq_1 = 4.886993e9;\nconst float meas_freq_1 = 6.273453e9;\nconst float drive_freq_2 = 6.438222e9;\nconst float meas_freq_2 = 6.948558e9;\nconst float drive_freq_3 = 5.383212e9;\nconst float meas_freq_3 = 6.523003e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 45dt, 25dt);\n shift_phase(q0_drive, -0.567007);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -19708825.0));\n delay[78dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, 0.322158);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 7058652.0));\n delay[28dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.390769);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -6859214.0));\n delay[43dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.239347);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 14934585.0));\n delay[54dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[0];\nrx(-0.846095) q[2];\ncx q[0], q[3];\nrx(-0.480869) q[0];\nrz(-0.792007) q[2];\nrz(-0.401021) q[0];\nrz(0.664386) q[0];\nrz(0.391921) q[2];\ncx q[3], q[2];\nrz(0.635147) q[2];\nh q[1];\ncx q[2], q[3];\n\n// === CORE_TASK_START ===\n// frame_sync_barrier | barrier_two_drive_frames: Delay on one frame, then barrier-align with another frame.\ncal {\n delay[71dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// frame_sync_barrier | barrier_two_drive_frames: Delay on one frame, then barrier-align with another frame.\ncal {\n delay[71dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_10", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000010\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.566910e9;\nconst float meas_freq_0 = 6.349642e9;\nconst float drive_freq_1 = 5.017487e9;\nconst float meas_freq_1 = 6.254279e9;\nconst float drive_freq_2 = 5.445520e9;\nconst float meas_freq_2 = 6.445986e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 39dt, 7dt);\n shift_phase(q2_drive, -0.547625);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -6963774.0));\n delay[37dt] q2_drive;\n play(q2_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nrx(1.148160) q[2];\nrz(0.710344) q[1];\nrx(0.215424) q[2];\nrz(0.094807) q[2];\nrz(-0.472190) q[2];\nx q[1];\ncx q[2], q[0];\nrx(-0.709786) q[0];\ncx q[0], q[2];\nrz(0.568366) q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, it performs a single raw acquisition on the qubit-2\n// acquisition frame q2_acq. The capture lasts for 360 dt and returns the recorded I/Q time-\n// series as a waveform named trace, without applying discrimination to produce a classical\n// bit.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000010\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.566910e9;\nconst float meas_freq_0 = 6.349642e9;\nconst float drive_freq_1 = 5.017487e9;\nconst float meas_freq_1 = 6.254279e9;\nconst float drive_freq_2 = 5.445520e9;\nconst float meas_freq_2 = 6.445986e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 39dt, 7dt);\n shift_phase(q2_drive, -0.547625);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -6963774.0));\n delay[37dt] q2_drive;\n play(q2_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nrx(1.148160) q[2];\nrz(0.710344) q[1];\nrx(0.215424) q[2];\nrz(0.094807) q[2];\nrz(-0.472190) q[2];\nx q[1];\ncx q[2], q[0];\nrx(-0.709786) q[0];\ncx q[0], q[2];\nrz(0.568366) q[0];\n\n// === CORE_TASK_START ===\n// raw_capture_trace | capture_trace_once: Capture a raw trace waveform from the acq frame.\ncal {\n waveform trace = capture_v1(q2_acq, 360dt);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// raw_capture_trace | capture_trace_once: Capture a raw trace waveform from the acq frame.\ncal {\n waveform trace = capture_v1(q2_acq, 360dt);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_11", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000011\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.224191e9;\nconst float meas_freq_0 = 6.165303e9;\nconst float drive_freq_1 = 6.630659e9;\nconst float meas_freq_1 = 6.291561e9;\nconst float drive_freq_2 = 5.164544e9;\nconst float meas_freq_2 = 6.446011e9;\nconst float drive_freq_3 = 5.671673e9;\nconst float meas_freq_3 = 6.792017e9;\nconst float drive_freq_4 = 6.300803e9;\nconst float meas_freq_4 = 7.013428e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 59dt, 18dt);\n shift_phase(q0_drive, -0.265264);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -15072855.0));\n delay[50dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q2_drive, -0.482484);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 5694868.0));\n delay[8dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q4_drive, 0.523574);\n set_frequency(q4_drive, (get_frequency(q4_drive) + 10393284.0));\n delay[32dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q0_drive, q2_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nrx(0.555598) q[0];\nx q[0];\nrz(-1.027355) q[0];\nrx(-0.921062) q[3];\nx q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): A custom calibration definition is provided for an X operation on physical qubit 4,\n// indicating that this gate has a specialized, hardware-level implementation for that specific\n// qubit. In a calibration block, a Gaussian-shaped complex drive pulse with amplitude 0.5 plus\n// 0.0 imaginary, total duration 229 dt, and sigma 77 dt is created and then played on the\n// q4_drive frame associated with qubit 4’s drive port. This explicitly applies a calibrated\n// drive pulse to qubit 4 independent of the earlier gate-level operations.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000011\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.224191e9;\nconst float meas_freq_0 = 6.165303e9;\nconst float drive_freq_1 = 6.630659e9;\nconst float meas_freq_1 = 6.291561e9;\nconst float drive_freq_2 = 5.164544e9;\nconst float meas_freq_2 = 6.446011e9;\nconst float drive_freq_3 = 5.671673e9;\nconst float meas_freq_3 = 6.792017e9;\nconst float drive_freq_4 = 6.300803e9;\nconst float meas_freq_4 = 7.013428e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 59dt, 18dt);\n shift_phase(q0_drive, -0.265264);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -15072855.0));\n delay[50dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q2_drive, -0.482484);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 5694868.0));\n delay[8dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q4_drive, 0.523574);\n set_frequency(q4_drive, (get_frequency(q4_drive) + 10393284.0));\n delay[32dt] q4_drive;\n play(q4_drive, _bg_wf);\n barrier q0_drive, q2_drive, q4_drive;\n}\n\n// --- gate-level background circuit ---\nrx(0.555598) q[0];\nx q[0];\nrz(-1.027355) q[0];\nrx(-0.921062) q[3];\nx q[2];\n\n// === CORE_TASK_START ===\n// defcal_q_vs_physical_qubit | define_defcal_x_on_physical_then_cal_play: Define a defcal x $q skeleton, and also do an explicit cal play on that qubit frame.\ndefcal x $4 {\n // specialized calibration for a physical qubit (skeleton)\n}\ncal {\n waveform w = gaussian(0.5+0.0im, 229dt, 77dt);\n play(q4_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// defcal_q_vs_physical_qubit | define_defcal_x_on_physical_then_cal_play: Define a defcal x $q skeleton, and also do an explicit cal play on that qubit frame.\ndefcal x $4 {\n // specialized calibration for a physical qubit (skeleton)\n}\ncal {\n waveform w = gaussian(0.5+0.0im, 229dt, 77dt);\n play(q4_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_12", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000012\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.740481e9;\nconst float meas_freq_0 = 6.769247e9;\nconst float drive_freq_1 = 4.956268e9;\nconst float meas_freq_1 = 7.125114e9;\nconst float drive_freq_2 = 6.079767e9;\nconst float meas_freq_2 = 6.467048e9;\nconst float drive_freq_3 = 5.893035e9;\nconst float meas_freq_3 = 6.089363e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 32dt, 28dt);\n shift_phase(q0_drive, 0.063702);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -15204947.0));\n delay[67dt] q0_drive;\n play(q0_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nh q[2];\nx q[1];\nrx(1.195659) q[3];\nrx(0.480025) q[3];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, it defines a constant waveform f with zero complex amplitude and\n// a duration of 103 dt, then performs two capture operations using that same waveform on the\n// q0_acq acquisition frame. Each capture returns a classical bit result, stored separately as\n// b0 and b1, effectively taking two back-to-back readout captures from the same acquisition\n// channel for qubit 0.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000012\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.740481e9;\nconst float meas_freq_0 = 6.769247e9;\nconst float drive_freq_1 = 4.956268e9;\nconst float meas_freq_1 = 7.125114e9;\nconst float drive_freq_2 = 6.079767e9;\nconst float meas_freq_2 = 6.467048e9;\nconst float drive_freq_3 = 5.893035e9;\nconst float meas_freq_3 = 6.089363e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 32dt, 28dt);\n shift_phase(q0_drive, 0.063702);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -15204947.0));\n delay[67dt] q0_drive;\n play(q0_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nh q[2];\nx q[1];\nrx(1.195659) q[3];\nrx(0.480025) q[3];\n\n// === CORE_TASK_START ===\n// multiplexed_readout_multi_frame | two_qubit_parallel_capture: Multiplexed readout: capture two acq frames in the same cal.\ncal {\n waveform f = constant(0.0+0.0im, 103dt);\n bit b0 = capture(q0_acq, f);\n bit b1 = capture(q0_acq, f);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// multiplexed_readout_multi_frame | two_qubit_parallel_capture: Multiplexed readout: capture two acq frames in the same cal.\ncal {\n waveform f = constant(0.0+0.0im, 103dt);\n bit b0 = capture(q0_acq, f);\n bit b1 = capture(q0_acq, f);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_13", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000013\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.427517e9;\nconst float meas_freq_0 = 6.668338e9;\nconst float drive_freq_1 = 5.379398e9;\nconst float meas_freq_1 = 6.318173e9;\nconst float drive_freq_2 = 5.284283e9;\nconst float meas_freq_2 = 6.360632e9;\nconst float drive_freq_3 = 6.246416e9;\nconst float meas_freq_3 = 6.733126e9;\nconst float drive_freq_4 = 5.545595e9;\nconst float meas_freq_4 = 7.061803e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 18dt, 27dt);\n shift_phase(q1_drive, -0.569595);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 6996074.0));\n delay[78dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.280034);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 14575738.0));\n delay[74dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.967427) q[0];\nrx(-0.701055) q[0];\nx q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, a single Gaussian waveform w is created with complex amplitude\n// 0.5 plus 0.0 imaginary, total duration 136 dt, and sigma 80 dt. That same waveform is then\n// played on the q2_drive and q1_drive frames with no intervening delay, so the two drive\n// pulses start at the same time and run in parallel on qubits 2 and 1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000013\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.427517e9;\nconst float meas_freq_0 = 6.668338e9;\nconst float drive_freq_1 = 5.379398e9;\nconst float meas_freq_1 = 6.318173e9;\nconst float drive_freq_2 = 5.284283e9;\nconst float meas_freq_2 = 6.360632e9;\nconst float drive_freq_3 = 6.246416e9;\nconst float meas_freq_3 = 6.733126e9;\nconst float drive_freq_4 = 5.545595e9;\nconst float meas_freq_4 = 7.061803e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 18dt, 27dt);\n shift_phase(q1_drive, -0.569595);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 6996074.0));\n delay[78dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.280034);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 14575738.0));\n delay[74dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.967427) q[0];\nrx(-0.701055) q[0];\nx q[0];\n\n// === CORE_TASK_START ===\n// simultaneous_plays_parallel_frames | two_frames_simultaneous_play: Play on two drive frames back-to-back (same start time => parallel).\ncal {\n waveform w = gaussian(0.5+0.0im, 136dt, 80dt);\n play(q2_drive, w); play(q1_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// simultaneous_plays_parallel_frames | two_frames_simultaneous_play: Play on two drive frames back-to-back (same start time => parallel).\ncal {\n waveform w = gaussian(0.5+0.0im, 136dt, 80dt);\n play(q2_drive, w); play(q1_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_14", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000014\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.786640e9;\nconst float meas_freq_0 = 7.076056e9;\nconst float drive_freq_1 = 6.389961e9;\nconst float meas_freq_1 = 6.648262e9;\nconst float drive_freq_2 = 5.202235e9;\nconst float meas_freq_2 = 7.199194e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 48dt, 10dt);\n shift_phase(q0_drive, -0.429108);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 12329298.0));\n delay[33dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q2_drive, 0.534703);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -14678792.0));\n delay[70dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nh q[2];\nh q[0];\nrx(0.069842) q[1];\nx q[0];\nrx(0.457772) q[1];\nrx(0.289197) q[2];\nrx(0.336971) q[1];\nrz(-0.921445) q[1];\ncx q[2], q[0];\nh q[2];\nrz(-0.145715) q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a new calibration block, it reuses the already-defined drive frame for qubit 2, named\n// q2_drive, which is associated with port d2 and the previously established drive frequency\n// and phase context. It constructs a Gaussian waveform with complex amplitude 0.5 plus 0.0\n// imaginary, total duration 137 dt, and sigma 70 dt. It then plays this Gaussian pulse on\n// q2_drive, applying a drive pulse to qubit 2 using the existing frame settings.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000014\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.786640e9;\nconst float meas_freq_0 = 7.076056e9;\nconst float drive_freq_1 = 6.389961e9;\nconst float meas_freq_1 = 6.648262e9;\nconst float drive_freq_2 = 5.202235e9;\nconst float meas_freq_2 = 7.199194e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 48dt, 10dt);\n shift_phase(q0_drive, -0.429108);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 12329298.0));\n delay[33dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q2_drive, 0.534703);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -14678792.0));\n delay[70dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nh q[2];\nh q[0];\nrx(0.069842) q[1];\nx q[0];\nrx(0.457772) q[1];\nrx(0.289197) q[2];\nrx(0.336971) q[1];\nrz(-0.921445) q[1];\ncx q[2], q[0];\nh q[2];\nrz(-0.145715) q[2];\n\n// === CORE_TASK_START ===\n// global_cal_scope_reuse | reuse_background_frames: Reuse pre-created drive frame from background in a new cal block.\ncal {\n waveform w = gaussian(0.5+0.0im, 137dt, 70dt);\n play(q2_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// global_cal_scope_reuse | reuse_background_frames: Reuse pre-created drive frame from background in a new cal block.\ncal {\n waveform w = gaussian(0.5+0.0im, 137dt, 70dt);\n play(q2_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_15", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000015\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.335324e9;\nconst float meas_freq_0 = 6.494714e9;\nconst float drive_freq_1 = 6.170263e9;\nconst float meas_freq_1 = 6.425921e9;\nconst float drive_freq_2 = 4.862878e9;\nconst float meas_freq_2 = 6.703568e9;\nconst float drive_freq_3 = 6.022788e9;\nconst float meas_freq_3 = 6.362379e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 80dt, 23dt);\n shift_phase(q0_drive, 0.500199);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -12001303.0));\n delay[20dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.071518);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 3563037.0));\n delay[76dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, -0.513625);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 8192366.0));\n delay[49dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.446080);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 12957243.0));\n delay[58dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[3];\ncx q[2], q[1];\nh q[3];\ncx q[0], q[2];\nrx(-0.450038) q[2];\nrx(-0.511383) q[2];\nh q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, the program advances the timing on the q1_drive frame by\n// inserting a delay of 85 dt. After this time advance, it reads out the current phase of\n// q1_drive using phase tracking and stores that value in an angle variable named p.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000015\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.335324e9;\nconst float meas_freq_0 = 6.494714e9;\nconst float drive_freq_1 = 6.170263e9;\nconst float meas_freq_1 = 6.425921e9;\nconst float drive_freq_2 = 4.862878e9;\nconst float meas_freq_2 = 6.703568e9;\nconst float drive_freq_3 = 6.022788e9;\nconst float meas_freq_3 = 6.362379e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 80dt, 23dt);\n shift_phase(q0_drive, 0.500199);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -12001303.0));\n delay[20dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.071518);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 3563037.0));\n delay[76dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, -0.513625);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 8192366.0));\n delay[49dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.446080);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 12957243.0));\n delay[58dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[3];\ncx q[2], q[1];\nh q[3];\ncx q[0], q[2];\nrx(-0.450038) q[2];\nrx(-0.511383) q[2];\nh q[0];\n\n// === CORE_TASK_START ===\n// phase_tracking_with_time_advance | delay_then_get_phase: Advance time by delay, then read phase.\ncal {\n delay[85dt] q1_drive;\n angle p = get_phase(q1_drive);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// phase_tracking_with_time_advance | delay_then_get_phase: Advance time by delay, then read phase.\ncal {\n delay[85dt] q1_drive;\n angle p = get_phase(q1_drive);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_16", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000016\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.394507e9;\nconst float meas_freq_0 = 6.565692e9;\nconst float drive_freq_1 = 5.775043e9;\nconst float meas_freq_1 = 6.633887e9;\nconst float drive_freq_2 = 6.446505e9;\nconst float meas_freq_2 = 6.268269e9;\nconst float drive_freq_3 = 4.878730e9;\nconst float meas_freq_3 = 6.082384e9;\nconst float drive_freq_4 = 5.351993e9;\nconst float meas_freq_4 = 6.902461e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 77dt, 7dt);\n shift_phase(q0_drive, 0.288921);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 13744601.0));\n delay[29dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.319288);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -1107479.0));\n delay[19dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.242026);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 16169156.0));\n delay[32dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nh q[4];\nx q[4];\nrx(0.428108) q[2];\ncx q[3], q[1];\nrz(-0.565761) q[1];\ncx q[1], q[3];\nrz(-0.975879) q[4];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, a Gaussian drive waveform p is created with complex amplitude\n// 0.8 plus 0.0 imaginary, total duration 176 dt, and sigma 21 dt. This pulse is played on the\n// q1_drive frame, followed by an idle delay of 95 dt on the same drive channel, and then the\n// same Gaussian pulse is played again on q1_drive. Overall, it implements a simple dynamical-\n// decoupling-like sequence on qubit 1 consisting of pulse, wait, pulse with the specified\n// timing.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000016\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.394507e9;\nconst float meas_freq_0 = 6.565692e9;\nconst float drive_freq_1 = 5.775043e9;\nconst float meas_freq_1 = 6.633887e9;\nconst float drive_freq_2 = 6.446505e9;\nconst float meas_freq_2 = 6.268269e9;\nconst float drive_freq_3 = 4.878730e9;\nconst float meas_freq_3 = 6.082384e9;\nconst float drive_freq_4 = 5.351993e9;\nconst float meas_freq_4 = 6.902461e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(1.0, 77dt, 7dt);\n shift_phase(q0_drive, 0.288921);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 13744601.0));\n delay[29dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.319288);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -1107479.0));\n delay[19dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.242026);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 16169156.0));\n delay[32dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nh q[4];\nx q[4];\nrx(0.428108) q[2];\ncx q[3], q[1];\nrz(-0.565761) q[1];\ncx q[1], q[3];\nrz(-0.975879) q[4];\n\n// === CORE_TASK_START ===\n// dd_sequence_delay_play | pi_pulse_delay_pi_pulse: DD-like: play, delay, play.\ncal {\n waveform p = gaussian(0.8+0.0im, 176dt, 21dt);\n play(q1_drive, p);\n delay[95dt] q1_drive;\n play(q1_drive, p);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// dd_sequence_delay_play | pi_pulse_delay_pi_pulse: DD-like: play, delay, play.\ncal {\n waveform p = gaussian(0.8+0.0im, 176dt, 21dt);\n play(q1_drive, p);\n delay[95dt] q1_drive;\n play(q1_drive, p);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_17", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000017\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.824469e9;\nconst float meas_freq_0 = 7.043153e9;\nconst float drive_freq_1 = 6.194591e9;\nconst float meas_freq_1 = 6.611496e9;\nconst float drive_freq_2 = 4.821974e9;\nconst float meas_freq_2 = 7.156527e9;\nconst float drive_freq_3 = 5.548131e9;\nconst float meas_freq_3 = 6.878161e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 17dt, 20dt);\n shift_phase(q3_drive, 0.595695);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -17650991.0));\n delay[9dt] q3_drive;\n play(q3_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nh q[3];\nrz(0.963454) q[0];\nrx(-0.726271) q[1];\nrx(0.816480) q[2];\nrx(-0.053528) q[2];\nx q[3];\nrx(-0.534404) q[0];\nrz(-0.140734) q[0];\nrz(-0.028110) q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, it prepares two 76 dt-long waveforms: a Gaussian pulse with\n// complex amplitude 0.5 and sigma 16 dt, and a constant pulse with complex amplitude 0.1. It\n// adds these two waveforms sample-by-sample to form a single composite waveform. That summed\n// waveform is then played on the q3_drive frame (the drive port for qubit 3, using its\n// previously established frequency and phase context).\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000017\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.824469e9;\nconst float meas_freq_0 = 7.043153e9;\nconst float drive_freq_1 = 6.194591e9;\nconst float meas_freq_1 = 6.611496e9;\nconst float drive_freq_2 = 4.821974e9;\nconst float meas_freq_2 = 7.156527e9;\nconst float drive_freq_3 = 5.548131e9;\nconst float meas_freq_3 = 6.878161e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 17dt, 20dt);\n shift_phase(q3_drive, 0.595695);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -17650991.0));\n delay[9dt] q3_drive;\n play(q3_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nh q[3];\nrz(0.963454) q[0];\nrx(-0.726271) q[1];\nrx(0.816480) q[2];\nrx(-0.053528) q[2];\nx q[3];\nrx(-0.534404) q[0];\nrz(-0.140734) q[0];\nrz(-0.028110) q[0];\n\n// === CORE_TASK_START ===\n// waveform_dsp_add_scale_phase_shift | add_two_waveforms: Add a gaussian and a constant waveform, then play.\ncal {\n extern add(waveform a, waveform b) -> waveform;\n extern scale(waveform a, float[32] k) -> waveform;\n extern phase_shift(waveform a, angle theta) -> waveform;\n waveform g = gaussian(0.5+0.0im, 76dt, 16dt);\n waveform c = constant(0.1+0.0im, 76dt);\n waveform w = add(g, c);\n play(q3_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// waveform_dsp_add_scale_phase_shift | add_two_waveforms: Add a gaussian and a constant waveform, then play.\ncal {\n extern add(waveform a, waveform b) -> waveform;\n extern scale(waveform a, float[32] k) -> waveform;\n extern phase_shift(waveform a, angle theta) -> waveform;\n waveform g = gaussian(0.5+0.0im, 76dt, 16dt);\n waveform c = constant(0.1+0.0im, 76dt);\n waveform w = add(g, c);\n play(q3_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_18", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000018\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.949007e9;\nconst float meas_freq_0 = 6.081709e9;\nconst float drive_freq_1 = 6.284148e9;\nconst float meas_freq_1 = 6.732974e9;\nconst float drive_freq_2 = 5.661147e9;\nconst float meas_freq_2 = 6.373287e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 19dt, 25dt);\n shift_phase(q0_drive, 0.007761);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -18590463.0));\n delay[71dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, 0.584782);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 5259953.0));\n delay[30dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.350254);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -5691459.0));\n delay[21dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nrx(-0.966907) q[2];\ncx q[0], q[2];\nx q[2];\nrx(0.041512) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): In the calibration block, the program queries the current drive-frame frequency of qubit 1\n// on the q1_drive frame and stores it in a 64-bit floating-point variable f0. It then\n// temporarily shifts that drive frequency upward by 6,500,512.0 relative to f0, and\n// immediately restores the q1_drive frequency back to the original stored value f0. No pulses\n// are played and no qubits are measured during this snippet; it only performs a brief\n// frequency set-and-restore on the qubit 1 drive frame.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000018\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.949007e9;\nconst float meas_freq_0 = 6.081709e9;\nconst float drive_freq_1 = 6.284148e9;\nconst float meas_freq_1 = 6.732974e9;\nconst float drive_freq_2 = 5.661147e9;\nconst float meas_freq_2 = 6.373287e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 19dt, 25dt);\n shift_phase(q0_drive, 0.007761);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -18590463.0));\n delay[71dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, 0.584782);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 5259953.0));\n delay[30dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.350254);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -5691459.0));\n delay[21dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nrx(-0.966907) q[2];\ncx q[0], q[2];\nx q[2];\nrx(0.041512) q[1];\n\n// === CORE_TASK_START ===\n// frequency_control_set_shift | set_frequency_absolute: Store current frequency, set to a new value, then restore.\ncal {\n float[64] f0 = get_frequency(q1_drive);\n set_frequency(q1_drive, f0 + 6500512.0);\n set_frequency(q1_drive, f0);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// frequency_control_set_shift | set_frequency_absolute: Store current frequency, set to a new value, then restore.\ncal {\n float[64] f0 = get_frequency(q1_drive);\n set_frequency(q1_drive, f0 + 6500512.0);\n set_frequency(q1_drive, f0);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_19", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000019\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.090787e9;\nconst float meas_freq_0 = 6.302542e9;\nconst float drive_freq_1 = 5.080798e9;\nconst float meas_freq_1 = 6.322612e9;\nconst float drive_freq_2 = 5.449852e9;\nconst float meas_freq_2 = 6.882981e9;\nconst float drive_freq_3 = 5.576776e9;\nconst float meas_freq_3 = 6.701915e9;\nconst float drive_freq_4 = 4.617583e9;\nconst float meas_freq_4 = 6.267899e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 55dt, 23dt);\n shift_phase(q0_drive, 0.136587);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -1309585.0));\n delay[40dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.170828);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -18686953.0));\n delay[13dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.441303);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 17746839.0));\n delay[29dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.459817);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -18192357.0));\n delay[69dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.138815) q[2];\nrz(-1.143261) q[2];\ncx q[0], q[2];\nrx(-0.983966) q[2];\ncx q[1], q[3];\nrx(-0.931502) q[4];\n\n// === CORE_TASK_START ===\n// TODO(core task): In a calibration block, the program reads the current phase of the q0_drive frame and the\n// q3_drive frame into two angle variables p0 and p1. It then swaps these phases by setting\n// q0_drive’s phase to the previously read phase of q3_drive and setting q3_drive’s phase to\n// the previously read phase of q0_drive. This operation affects only the phase reference of\n// the two drive frames and does not apply any waveform playback or measurement.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000019\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.090787e9;\nconst float meas_freq_0 = 6.302542e9;\nconst float drive_freq_1 = 5.080798e9;\nconst float meas_freq_1 = 6.322612e9;\nconst float drive_freq_2 = 5.449852e9;\nconst float meas_freq_2 = 6.882981e9;\nconst float drive_freq_3 = 5.576776e9;\nconst float meas_freq_3 = 6.701915e9;\nconst float drive_freq_4 = 4.617583e9;\nconst float meas_freq_4 = 6.267899e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 55dt, 23dt);\n shift_phase(q0_drive, 0.136587);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -1309585.0));\n delay[40dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.170828);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -18686953.0));\n delay[13dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.441303);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 17746839.0));\n delay[29dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, 0.459817);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -18192357.0));\n delay[69dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.138815) q[2];\nrz(-1.143261) q[2];\ncx q[0], q[2];\nrx(-0.983966) q[2];\ncx q[1], q[3];\nrx(-0.931502) q[4];\n\n// === CORE_TASK_START ===\n// frame_state_get_set_swap | swap_phase: Swap phases of two frames.\ncal {\n angle p0 = get_phase(q0_drive); angle p1 = get_phase(q3_drive);\n set_phase(q0_drive, p1); set_phase(q3_drive, p0);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[0] = measure q[0];\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// frame_state_get_set_swap | swap_phase: Swap phases of two frames.\ncal {\n angle p0 = get_phase(q0_drive); angle p1 = get_phase(q3_drive);\n set_phase(q0_drive, p1); set_phase(q3_drive, p0);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_20", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000020\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.472765e9;\nconst float meas_freq_0 = 6.203690e9;\nconst float drive_freq_1 = 4.900014e9;\nconst float meas_freq_1 = 6.607376e9;\nconst float drive_freq_2 = 6.050883e9;\nconst float meas_freq_2 = 6.616152e9;\nconst float drive_freq_3 = 5.274597e9;\nconst float meas_freq_3 = 7.168127e9;\nconst float drive_freq_4 = 4.892385e9;\nconst float meas_freq_4 = 6.797321e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 52dt, 24dt);\n shift_phase(q2_drive, 0.248508);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 19508037.0));\n delay[22dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.210509);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -16885446.0));\n delay[22dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[3];\ncx q[4], q[3];\nrx(0.500208) q[4];\nh q[0];\nh q[2];\nrx(0.278908) q[2];\nx q[0];\nx q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet defines two calibration entries for an X gate: a generic definition that applies\n// to any qubit and a more specific, physical definition targeting qubit index 3, demonstrating\n// that the qubit-specific calibration has priority. In the calibration block, it creates a\n// Gaussian waveform with complex amplitude 0.5 plus 0.0 imaginary, duration 103 dt, and sigma\n// 51 dt, and plays it on the q3_drive frame. It then applies an X gate to qubit q[3], which is\n// intended to use the qubit-3-specific calibration.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000020\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.472765e9;\nconst float meas_freq_0 = 6.203690e9;\nconst float drive_freq_1 = 4.900014e9;\nconst float meas_freq_1 = 6.607376e9;\nconst float drive_freq_2 = 6.050883e9;\nconst float meas_freq_2 = 6.616152e9;\nconst float drive_freq_3 = 5.274597e9;\nconst float meas_freq_3 = 7.168127e9;\nconst float drive_freq_4 = 4.892385e9;\nconst float meas_freq_4 = 6.797321e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 52dt, 24dt);\n shift_phase(q2_drive, 0.248508);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 19508037.0));\n delay[22dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.210509);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -16885446.0));\n delay[22dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nh q[3];\ncx q[4], q[3];\nrx(0.500208) q[4];\nh q[0];\nh q[2];\nrx(0.278908) q[2];\nx q[0];\nx q[0];\n\n// === CORE_TASK_START ===\n// defcal_matching_priority | generic_vs_physical_x: Provide generic and physical x defcal skeletons (priority demo).\ndefcal x q { /* generic */ }\ndefcal x $3 { /* physical */ }\ncal {\n waveform w = gaussian(0.5+0.0im, 103dt, 51dt); play(q3_drive, w);\n}\nx q[3];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// defcal_matching_priority | generic_vs_physical_x: Provide generic and physical x defcal skeletons (priority demo).\ndefcal x q { /* generic */ }\ndefcal x $3 { /* physical */ }\ncal {\n waveform w = gaussian(0.5+0.0im, 103dt, 51dt); play(q3_drive, w);\n}\nx q[3];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_21", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000021\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.014638e9;\nconst float meas_freq_0 = 6.313799e9;\nconst float drive_freq_1 = 5.760008e9;\nconst float meas_freq_1 = 6.465497e9;\nconst float drive_freq_2 = 4.781458e9;\nconst float meas_freq_2 = 6.142025e9;\nconst float drive_freq_3 = 5.605408e9;\nconst float meas_freq_3 = 7.185870e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 48dt, 14dt);\n shift_phase(q0_drive, -0.545302);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 19041945.0));\n delay[62dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.379309);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 8907350.0));\n delay[71dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.015513);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 6262257.0));\n delay[32dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.528604);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 11570018.0));\n delay[75dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nx q[1];\nx q[1];\nx q[1];\nrz(0.349386) q[0];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, the program creates a temporary drive frame named ftmp on the d0\n// port using the same drive frequency drive_freq_0 and an initial phase of 0.0, with an\n// absolute time origin for the calibration context. It then applies an idle delay of 20 dt on\n// this temporary frame without playing any waveform or performing measurement.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000021\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.014638e9;\nconst float meas_freq_0 = 6.313799e9;\nconst float drive_freq_1 = 5.760008e9;\nconst float meas_freq_1 = 6.465497e9;\nconst float drive_freq_2 = 4.781458e9;\nconst float meas_freq_2 = 6.142025e9;\nconst float drive_freq_3 = 5.605408e9;\nconst float meas_freq_3 = 7.185870e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 48dt, 14dt);\n shift_phase(q0_drive, -0.545302);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 19041945.0));\n delay[62dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, -0.379309);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 8907350.0));\n delay[71dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.015513);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 6262257.0));\n delay[32dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.528604);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 11570018.0));\n delay[75dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nx q[1];\nx q[1];\nx q[1];\nrz(0.349386) q[0];\n\n// === CORE_TASK_START ===\n// newframe_time_origin_cal_vs_defcal | newframe_in_cal: Create a new frame in a cal block (absolute time origin).\ncal {\n frame ftmp = newframe(d0, drive_freq_0, 0.0);\n delay[20dt] ftmp;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[0] = measure q[0];\n// === MEASUREMENT_END ===\n", "completion": "// newframe_time_origin_cal_vs_defcal | newframe_in_cal: Create a new frame in a cal block (absolute time origin).\ncal {\n frame ftmp = newframe(d0, drive_freq_0, 0.0);\n delay[20dt] ftmp;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_22", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000022\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 4.632435e9;\nconst float meas_freq_0 = 6.563191e9;\nconst float drive_freq_1 = 4.673891e9;\nconst float meas_freq_1 = 6.401244e9;\nconst float drive_freq_2 = 5.277173e9;\nconst float meas_freq_2 = 6.586294e9;\nconst float drive_freq_3 = 6.208039e9;\nconst float meas_freq_3 = 6.785060e9;\nconst float drive_freq_4 = 6.080997e9;\nconst float meas_freq_4 = 6.474289e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 29dt, 14dt);\n shift_phase(q1_drive, 0.435919);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -5223852.0));\n delay[46dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, -0.591063);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 10211271.0));\n delay[70dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.291928);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -6433684.0));\n delay[19dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.225048) q[1];\nrx(0.434451) q[0];\nrz(-0.663738) q[0];\nrx(-0.596185) q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a calibration block, the program applies two consecutive fixed-duration idle periods\n// on the q1_drive frame. The first delay lasts 65 dt and is immediately followed by a second\n// delay of 36 dt, with no pulses or measurements in between, for a total wait time of 101 dt\n// on that drive channel.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000022\nqubit[5] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 4.632435e9;\nconst float meas_freq_0 = 6.563191e9;\nconst float drive_freq_1 = 4.673891e9;\nconst float meas_freq_1 = 6.401244e9;\nconst float drive_freq_2 = 5.277173e9;\nconst float meas_freq_2 = 6.586294e9;\nconst float drive_freq_3 = 6.208039e9;\nconst float meas_freq_3 = 6.785060e9;\nconst float drive_freq_4 = 6.080997e9;\nconst float meas_freq_4 = 6.474289e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 29dt, 14dt);\n shift_phase(q1_drive, 0.435919);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -5223852.0));\n delay[46dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, -0.591063);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 10211271.0));\n delay[70dt] q2_drive;\n play(q2_drive, _bg_wf);\n shift_phase(q3_drive, -0.291928);\n set_frequency(q3_drive, (get_frequency(q3_drive) + -6433684.0));\n delay[19dt] q3_drive;\n play(q3_drive, _bg_wf);\n barrier q1_drive, q2_drive, q3_drive;\n}\n\n// --- gate-level background circuit ---\nrz(0.225048) q[1];\nrx(0.434451) q[0];\nrz(-0.663738) q[0];\nrx(-0.596185) q[1];\n\n// === CORE_TASK_START ===\n// compile_time_determinable_duration | fixed_duration_sequence: Use only fixed dt durations (compile-time determinable).\ncal {\n delay[65dt] q1_drive;\n delay[36dt] q1_drive;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// compile_time_determinable_duration | fixed_duration_sequence: Use only fixed dt durations (compile-time determinable).\ncal {\n delay[65dt] q1_drive;\n delay[36dt] q1_drive;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_23", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000023\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.450531e9;\nconst float meas_freq_0 = 6.188497e9;\nconst float drive_freq_1 = 5.899172e9;\nconst float meas_freq_1 = 6.836988e9;\nconst float drive_freq_2 = 4.891145e9;\nconst float meas_freq_2 = 6.306281e9;\nconst float drive_freq_3 = 5.136080e9;\nconst float meas_freq_3 = 7.051214e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 72dt, 12dt);\n shift_phase(q2_drive, -0.228121);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 14389461.0));\n delay[77dt] q2_drive;\n play(q2_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nrx(0.664876) q[2];\nrz(0.497002) q[0];\nh q[1];\nh q[0];\nrz(-0.820177) q[3];\nx q[1];\nrz(1.078842) q[1];\ncx q[1], q[0];\nrz(0.781562) q[1];\ncx q[2], q[1];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, a single Gaussian waveform named w is created with complex\n// amplitude 0.5 plus 0.0 imaginary, total duration 98 dt, and sigma 59 dt. That same waveform\n// is then played twice in sequence on the q2_drive frame (the drive frame associated with\n// qubit 2), with the second play starting only after the first has finished so there is no\n// overlap on the frame.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000023\nqubit[4] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.450531e9;\nconst float meas_freq_0 = 6.188497e9;\nconst float drive_freq_1 = 5.899172e9;\nconst float meas_freq_1 = 6.836988e9;\nconst float drive_freq_2 = 4.891145e9;\nconst float meas_freq_2 = 6.306281e9;\nconst float drive_freq_3 = 5.136080e9;\nconst float meas_freq_3 = 7.051214e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.8, 72dt, 12dt);\n shift_phase(q2_drive, -0.228121);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 14389461.0));\n delay[77dt] q2_drive;\n play(q2_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nrx(0.664876) q[2];\nrz(0.497002) q[0];\nh q[1];\nh q[0];\nrz(-0.820177) q[3];\nx q[1];\nrz(1.078842) q[1];\ncx q[1], q[0];\nrz(0.781562) q[1];\ncx q[2], q[1];\n\n// === CORE_TASK_START ===\n// frame_collision_avoidance | sequential_two_plays_same_frame: Two plays on same frame are sequenced (no overlap).\ncal {\n waveform w = gaussian(0.5+0.0im, 98dt, 59dt);\n play(q2_drive, w);\n play(q2_drive, w);\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// frame_collision_avoidance | sequential_two_plays_same_frame: Two plays on same frame are sequenced (no overlap).\ncal {\n waveform w = gaussian(0.5+0.0im, 98dt, 59dt);\n play(q2_drive, w);\n play(q2_drive, w);\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_24", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000024\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.455184e9;\nconst float meas_freq_0 = 6.047596e9;\nconst float drive_freq_1 = 4.947864e9;\nconst float meas_freq_1 = 6.284351e9;\nconst float drive_freq_2 = 5.378180e9;\nconst float meas_freq_2 = 6.751289e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 67dt, 6dt);\n shift_phase(q1_drive, -0.239629);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -3715166.0));\n delay[31dt] q1_drive;\n play(q1_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nrx(0.048579) q[1];\nrz(-0.856881) q[2];\ncx q[0], q[1];\nrx(1.043468) q[1];\nrz(0.257838) q[1];\nrz(1.140896) q[1];\ncx q[1], q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside the calibration block, it creates an additional pulse frame named f1 on the same\n// physical drive port d1 used for qubit 1, with the same drive frequency drive_freq_1 and an\n// initial phase of 0.0. It then applies a barrier that synchronizes timing between the\n// existing q1_drive frame and the newly created f1 frame, ensuring subsequent pulse actions on\n// either frame are aligned in time.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000024\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.455184e9;\nconst float meas_freq_0 = 6.047596e9;\nconst float drive_freq_1 = 4.947864e9;\nconst float meas_freq_1 = 6.284351e9;\nconst float drive_freq_2 = 5.378180e9;\nconst float meas_freq_2 = 6.751289e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.5, 67dt, 6dt);\n shift_phase(q1_drive, -0.239629);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -3715166.0));\n delay[31dt] q1_drive;\n play(q1_drive, _bg_wf);\n}\n\n// --- gate-level background circuit ---\nrx(0.048579) q[1];\nrz(-0.856881) q[2];\ncx q[0], q[1];\nrx(1.043468) q[1];\nrz(0.257838) q[1];\nrz(1.140896) q[1];\ncx q[1], q[2];\n\n// === CORE_TASK_START ===\n// multi_frames_same_port_patterns | two_frames_same_port_barrier: Create a second frame on the same port and barrier-align.\ncal {\n frame f1 = newframe(d1, drive_freq_1, 0.0);\n barrier q1_drive, f1;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[1] = measure q[1];\n// === MEASUREMENT_END ===\n", "completion": "// multi_frames_same_port_patterns | two_frames_same_port_barrier: Create a second frame on the same port and barrier-align.\ncal {\n frame f1 = newframe(d1, drive_freq_1, 0.0);\n barrier q1_drive, f1;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "pulse_test/pulse_task_25", "domain": "pulse", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000025\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.039042e9;\nconst float meas_freq_0 = 6.394179e9;\nconst float drive_freq_1 = 5.981327e9;\nconst float meas_freq_1 = 6.589077e9;\nconst float drive_freq_2 = 6.402400e9;\nconst float meas_freq_2 = 6.476547e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 54dt, 7dt);\n shift_phase(q0_drive, -0.166553);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -11602371.0));\n delay[20dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, 0.509673);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -1892782.0));\n delay[70dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.254832);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -2358133.0));\n delay[64dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nrx(0.515611) q[0];\nh q[0];\nrz(-0.453994) q[1];\nh q[2];\nh q[2];\nx q[1];\ncx q[0], q[1];\nh q[2];\nx q[0];\nx q[1];\nrx(0.477929) q[2];\n\n// === CORE_TASK_START ===\n// TODO(core task): In the calibration block, a constant zero-amplitude waveform of duration 78 dt is defined\n// and used as a filter for a capture on the q2 acquisition frame q2_acq, producing a single\n// classical bit result b. In addition, a raw measurement trace waveform t is captured from the\n// same q2_acq frame over the same 78 dt duration. The snippet then enforces synchronization\n// with a barrier between the q2 measurement frame q2_meas and the q2 acquisition frame q2_acq.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Pulse background 000025\nqubit[3] q;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.039042e9;\nconst float meas_freq_0 = 6.394179e9;\nconst float drive_freq_1 = 5.981327e9;\nconst float meas_freq_1 = 6.589077e9;\nconst float drive_freq_2 = 6.402400e9;\nconst float meas_freq_2 = 6.476547e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (phase/freq/time context) ---\n waveform _bg_wf = gaussian(0.2, 54dt, 7dt);\n shift_phase(q0_drive, -0.166553);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -11602371.0));\n delay[20dt] q0_drive;\n play(q0_drive, _bg_wf);\n shift_phase(q1_drive, 0.509673);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -1892782.0));\n delay[70dt] q1_drive;\n play(q1_drive, _bg_wf);\n shift_phase(q2_drive, 0.254832);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -2358133.0));\n delay[64dt] q2_drive;\n play(q2_drive, _bg_wf);\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- gate-level background circuit ---\nrx(0.515611) q[0];\nh q[0];\nrz(-0.453994) q[1];\nh q[2];\nh q[2];\nx q[1];\ncx q[0], q[1];\nh q[2];\nx q[0];\nx q[1];\nrx(0.477929) q[2];\n\n// === CORE_TASK_START ===\n// measurement_return_type_variants | bit_measure_and_trace_capture: Produce a bit via capture and also a raw trace via capture_v1.\ncal {\n waveform f = constant(0.0+0.0im, 78dt);\n bit b = capture(q2_acq, f);\n waveform t = capture_v1(q2_acq, 78dt);\n barrier q2_meas, q2_acq;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] c;\nc[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// measurement_return_type_variants | bit_measure_and_trace_capture: Produce a bit via capture and also a raw trace via capture_v1.\ncal {\n waveform f = constant(0.0+0.0im, 78dt);\n bit b = capture(q2_acq, f);\n waveform t = capture_v1(q2_acq, 78dt);\n barrier q2_meas, q2_acq;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_01", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000001\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.406287e9;\nconst float meas_freq_0 = 6.109105e9;\nconst float drive_freq_1 = 4.848509e9;\nconst float meas_freq_1 = 6.281497e9;\nconst float drive_freq_2 = 6.744155e9;\nconst float meas_freq_2 = 6.368663e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.266398);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -2611143.0));\n delay[18dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nry(-0.760302) q[0];\nrz(1.159948) q[2];\nz q[0];\nry(-0.999231) q[1];\nrx(-0.237197) q[2];\ncz q[1], q[0];\ntdg q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within a fixed timing window labeled BOX_WIN, the program performs a single-shot active\n// reset on qubit 2 using its measurement and drive frames. It plays a Gaussian-square readout\n// pulse of complex amplitude 0.35, total duration 428 dt, square width 167 dt, and sigma 19 dt\n// on the q2_meas frame, then captures the response on the q2_acq frame to produce a classical\n// bit result __cx_m. If __cx_m indicates the qubit was measured in the excited state, it\n// conditionally applies a Gaussian pi-like pulse of complex amplitude 0.8, duration 194 dt,\n// and sigma 63 dt on the q2_drive frame to flip qubit 2. Finally, it delays qubit 2 by a\n// stretchable duration __cx_g to equalize the total time of the conditional branches and keep\n// the schedule deterministic within the same BOX_WIN.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000001\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.406287e9;\nconst float meas_freq_0 = 6.109105e9;\nconst float drive_freq_1 = 4.848509e9;\nconst float meas_freq_1 = 6.281497e9;\nconst float drive_freq_2 = 6.744155e9;\nconst float meas_freq_2 = 6.368663e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.266398);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -2611143.0));\n delay[18dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nry(-0.760302) q[0];\nrz(1.159948) q[2];\nz q[0];\nry(-0.999231) q[1];\nrx(-0.237197) q[2];\ncz q[1], q[0];\ntdg q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// active_reset_loop | single_shot_reset_equalized_box: Single-shot active reset: capture -> if 1 then apply X pulse; equalize branch time in a fixed box.\nbit __cx_m;\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_ro = gaussian_square(0.35+0.0im, 428dt, 167dt, 19dt);\n play(q2_meas, __cx_ro);\n __cx_m = capture(q2_acq, __cx_ro);\n }\n if (__cx_m) {\n cal {\n waveform __cx_pi = gaussian(0.8+0.0im, 194dt, 63dt);\n play(q2_drive, __cx_pi);\n }\n }\n // fill remaining time to keep deterministic schedule\n delay[__cx_g] q[2];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// active_reset_loop | single_shot_reset_equalized_box: Single-shot active reset: capture -> if 1 then apply X pulse; equalize branch time in a fixed box.\nbit __cx_m;\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_ro = gaussian_square(0.35+0.0im, 428dt, 167dt, 19dt);\n play(q2_meas, __cx_ro);\n __cx_m = capture(q2_acq, __cx_ro);\n }\n if (__cx_m) {\n cal {\n waveform __cx_pi = gaussian(0.8+0.0im, 194dt, 63dt);\n play(q2_drive, __cx_pi);\n }\n }\n // fill remaining time to keep deterministic schedule\n delay[__cx_g] q[2];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_02", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000002\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.763608e9;\nconst float meas_freq_0 = 6.036850e9;\nconst float drive_freq_1 = 5.978295e9;\nconst float meas_freq_1 = 6.648425e9;\nconst float drive_freq_2 = 5.185341e9;\nconst float meas_freq_2 = 6.681947e9;\nconst float drive_freq_3 = 5.304630e9;\nconst float meas_freq_3 = 6.144239e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.508540);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -4719683.0));\n delay[18dt] q0_drive;\n barrier q0_drive, q1_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nrx(0.975030) q[3];\nx q[1];\nrz(0.436734) q[0];\nrz(1.161330) q[0];\nrx(0.766448) q[3];\nt q[3];\ncx q[3], q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within the fixed timing window BOX_WIN, the snippet runs a Ramsey experiment on qubit q0\n// using the q0_drive frame: it plays a Gaussian pi/2 pulse with complex amplitude 0.5 and\n// duration 64dt (sigma 62dt), then idles q0 for 133dt. It then applies a phase update of\n// −0.441303 on the q0_drive frame and plays a second identical Gaussian pi/2 pulse to complete\n// the Ramsey sequence with a controlled relative phase. Immediately after, it performs readout\n// by playing a constant measurement pulse of amplitude 0.2 for 471dt on the q0_meas frame and\n// captures the response on the q0_acq frame into the classical bit __cx_m.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000002\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.763608e9;\nconst float meas_freq_0 = 6.036850e9;\nconst float drive_freq_1 = 5.978295e9;\nconst float meas_freq_1 = 6.648425e9;\nconst float drive_freq_2 = 5.185341e9;\nconst float meas_freq_2 = 6.681947e9;\nconst float drive_freq_3 = 5.304630e9;\nconst float meas_freq_3 = 6.144239e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.508540);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -4719683.0));\n delay[18dt] q0_drive;\n barrier q0_drive, q1_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nrx(0.975030) q[3];\nx q[1];\nrz(0.436734) q[0];\nrz(1.161330) q[0];\nrx(0.766448) q[3];\nt q[3];\ncx q[3], q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// ramsey_feedback_phase_comp | ramsey_fixed_tau_readout: Basic Ramsey: pi/2 - delay(tau) - pi/2 with phase shift; capture for fringe.\nbit __cx_m;\nbox[BOX_WIN] {\n cal {\n waveform __cx_pi2 = gaussian(0.5+0.0im, 64dt, 62dt);\n play(q0_drive, __cx_pi2);\n }\n delay[133dt] q[0];\n cal {\n shift_phase(q0_drive, -0.441303);\n waveform __cx_pi2b = gaussian(0.5+0.0im, 64dt, 62dt);\n play(q0_drive, __cx_pi2b);\n waveform __cx_ro = constant(0.2+0.0im, 471dt);\n play(q0_meas, __cx_ro);\n __cx_m = capture(q0_acq, __cx_ro);\n }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// ramsey_feedback_phase_comp | ramsey_fixed_tau_readout: Basic Ramsey: pi/2 - delay(tau) - pi/2 with phase shift; capture for fringe.\nbit __cx_m;\nbox[BOX_WIN] {\n cal {\n waveform __cx_pi2 = gaussian(0.5+0.0im, 64dt, 62dt);\n play(q0_drive, __cx_pi2);\n }\n delay[133dt] q[0];\n cal {\n shift_phase(q0_drive, -0.441303);\n waveform __cx_pi2b = gaussian(0.5+0.0im, 64dt, 62dt);\n play(q0_drive, __cx_pi2b);\n waveform __cx_ro = constant(0.2+0.0im, 471dt);\n play(q0_meas, __cx_ro);\n __cx_m = capture(q0_acq, __cx_ro);\n }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_03", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000003\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 4.669190e9;\nconst float meas_freq_0 = 6.298333e9;\nconst float drive_freq_1 = 6.271909e9;\nconst float meas_freq_1 = 6.338207e9;\nconst float drive_freq_2 = 5.371958e9;\nconst float meas_freq_2 = 7.152105e9;\nconst float drive_freq_3 = 4.879090e9;\nconst float meas_freq_3 = 7.010265e9;\nconst float drive_freq_4 = 6.279241e9;\nconst float meas_freq_4 = 6.479976e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.426630);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 1069446.0));\n delay[30dt] q0_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(1.186326) q[0];\nry(0.322174) q[4];\ncz q[3], q[4];\nh q[4];\ntdg q[1];\nrz(0.575717) q[4];\nrx(-0.034703) q[4];\nx q[3];\nrz(0.862666) q[2];\nrz(0.896444) q[0];\nrx(-0.248348) q[2];\nswap q[3], q[2];\nrz(0.016893) q[3];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a fixed timing window labeled BOX_WIN, the snippet performs a pulse-level Hahn echo\n// sequence on qubit q0 using the q0_drive frame. It first plays a Gaussian pi over 2 pulse\n// with complex amplitude 0.5 and duration 188 dt with sigma 39 dt, then idles q0 for 135 dt,\n// then plays a Gaussian pi pulse with amplitude 0.9 and duration 172 dt with sigma 36 dt, then\n// idles another 135 dt, and finally plays the same Gaussian pi over 2 pulse again. After the\n// echo sequence, it adds an additional delay on q0 of a stretched duration parameter named\n// __cx_g, all still contained within the same BOX_WIN scheduling box.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000003\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 4.669190e9;\nconst float meas_freq_0 = 6.298333e9;\nconst float drive_freq_1 = 6.271909e9;\nconst float meas_freq_1 = 6.338207e9;\nconst float drive_freq_2 = 5.371958e9;\nconst float meas_freq_2 = 7.152105e9;\nconst float drive_freq_3 = 4.879090e9;\nconst float meas_freq_3 = 7.010265e9;\nconst float drive_freq_4 = 6.279241e9;\nconst float meas_freq_4 = 6.479976e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.426630);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 1069446.0));\n delay[30dt] q0_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(1.186326) q[0];\nry(0.322174) q[4];\ncz q[3], q[4];\nh q[4];\ntdg q[1];\nrz(0.575717) q[4];\nrx(-0.034703) q[4];\nx q[3];\nrz(0.862666) q[2];\nrz(0.896444) q[0];\nrx(-0.248348) q[2];\nswap q[3], q[2];\nrz(0.016893) q[3];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// hahn_echo_characterization | echo_fixed_tau: Hahn echo: pi/2 - tau/2 - pi - tau/2 - pi/2 (pulse-level), scheduled inside a fixed box.\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_pi2 = gaussian(0.5+0.0im, 188dt, 39dt);\n waveform __cx_pi = gaussian(0.9+0.0im, 172dt, 36dt);\n play(q0_drive, __cx_pi2);\n }\n delay[135dt] q[0];\n cal {\n play(q0_drive, __cx_pi);\n }\n delay[135dt] q[0];\n cal {\n play(q0_drive, __cx_pi2);\n }\n delay[__cx_g] q[0];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// hahn_echo_characterization | echo_fixed_tau: Hahn echo: pi/2 - tau/2 - pi - tau/2 - pi/2 (pulse-level), scheduled inside a fixed box.\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_pi2 = gaussian(0.5+0.0im, 188dt, 39dt);\n waveform __cx_pi = gaussian(0.9+0.0im, 172dt, 36dt);\n play(q0_drive, __cx_pi2);\n }\n delay[135dt] q[0];\n cal {\n play(q0_drive, __cx_pi);\n }\n delay[135dt] q[0];\n cal {\n play(q0_drive, __cx_pi2);\n }\n delay[__cx_g] q[0];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_04", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000004\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.595739e9;\nconst float meas_freq_0 = 6.146284e9;\nconst float drive_freq_1 = 5.684229e9;\nconst float meas_freq_1 = 7.129015e9;\nconst float drive_freq_2 = 5.803180e9;\nconst float meas_freq_2 = 6.059513e9;\nconst float drive_freq_3 = 6.316479e9;\nconst float meas_freq_3 = 6.840166e9;\nconst float drive_freq_4 = 5.375484e9;\nconst float meas_freq_4 = 6.885641e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, 0.023200);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 1074312.0));\n delay[20dt] q2_drive;\n barrier q0_drive, q1_drive, q2_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.007352) q[2];\ncx q[1], q[2];\nswap q[1], q[0];\nh q[4];\nry(1.180872) q[0];\nry(0.644359) q[1];\nsdg q[0];\ncz q[3], q[1];\ncz q[0], q[1];\nt q[3];\nrz(-0.282028) q[2];\ncz q[2], q[3];\nry(-0.290528) q[1];\nswap q[3], q[4];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs a single-point T1-style relaxation experiment on qubit 0: it first\n// excites q0 by playing a Gaussian pi pulse of complex amplitude 0.9 and duration 150 dt on\n// the q0_drive frame (with sigma 75 dt). It then waits for 135 ns on q0 to allow relaxation.\n// Inside a fixed readout window labeled RO_RING, it applies a constant measurement pulse of\n// amplitude 0.2 and duration 281 dt on the q0_meas frame while simultaneously capturing on the\n// q0_acq frame using the same waveform, producing a single classical bit result stored in\n// __cx_m and synchronizing q0_meas and q0_acq with a barrier. If the captured bit __cx_m is 1,\n// it sets syndrome_b at index 0 to 1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000004\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.595739e9;\nconst float meas_freq_0 = 6.146284e9;\nconst float drive_freq_1 = 5.684229e9;\nconst float meas_freq_1 = 7.129015e9;\nconst float drive_freq_2 = 5.803180e9;\nconst float meas_freq_2 = 6.059513e9;\nconst float drive_freq_3 = 6.316479e9;\nconst float meas_freq_3 = 6.840166e9;\nconst float drive_freq_4 = 5.375484e9;\nconst float meas_freq_4 = 6.885641e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, 0.023200);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 1074312.0));\n delay[20dt] q2_drive;\n barrier q0_drive, q1_drive, q2_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.007352) q[2];\ncx q[1], q[2];\nswap q[1], q[0];\nh q[4];\nry(1.180872) q[0];\nry(0.644359) q[1];\nsdg q[0];\ncz q[3], q[1];\ncz q[0], q[1];\nt q[3];\nrz(-0.282028) q[2];\ncz q[2], q[3];\nry(-0.290528) q[1];\nswap q[3], q[4];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// t1_relaxation_gated_readout | single_t1_point: T1 single point: excite with pi pulse, wait, then gated readout inside RO_RING-like box.\nbit __cx_m;\n// excite\ncal { waveform __cx_pi = gaussian(0.9+0.0im, 150dt, 75dt); play(q0_drive, __cx_pi); }\ndelay[135ns] q[0];\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 281dt);\n play(q0_meas, __cx_ro);\n __cx_m = capture(q0_acq, __cx_ro);\n barrier q0_meas, q0_acq;\n }\n}\nif (__cx_m) { syndrome_b[0] = 1; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// t1_relaxation_gated_readout | single_t1_point: T1 single point: excite with pi pulse, wait, then gated readout inside RO_RING-like box.\nbit __cx_m;\n// excite\ncal { waveform __cx_pi = gaussian(0.9+0.0im, 150dt, 75dt); play(q0_drive, __cx_pi); }\ndelay[135ns] q[0];\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 281dt);\n play(q0_meas, __cx_ro);\n __cx_m = capture(q0_acq, __cx_ro);\n barrier q0_meas, q0_acq;\n }\n}\nif (__cx_m) { syndrome_b[0] = 1; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_05", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000005\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.978841e9;\nconst float meas_freq_0 = 7.280206e9;\nconst float drive_freq_1 = 5.705029e9;\nconst float meas_freq_1 = 6.499337e9;\nconst float drive_freq_2 = 5.504054e9;\nconst float meas_freq_2 = 6.429816e9;\nconst float drive_freq_3 = 5.396362e9;\nconst float meas_freq_3 = 6.280653e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.635156);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 3024699.0));\n delay[37dt] q3_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[0], q[3];\ny q[0];\nrz(1.129440) q[0];\nry(-0.230986) q[0];\nry(-0.797129) q[1];\nx q[2];\ncx q[2], q[3];\ncz q[1], q[3];\nrx(-0.933908) q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs a four-point Rabi amplitude scan on qubit 2 using the q2_drive frame:\n// it loops over indices 0 through 3 and, within a fixed BOX_WIN timing window, plays a\n// Gaussian drive pulse of duration 222 dt and sigma 87 dt with amplitudes 0.09, 0.19, 0.28,\n// and 0.37 respectively. After each drive pulse, it performs readout on qubit 2 by playing a\n// constant measurement waveform of amplitude 0.2 for 376 dt on q2_meas and capturing the\n// result on q2_acq into a temporary bit. It accumulates the number of measured 1 outcomes\n// across the four shots into an integer counter. If more than one of the four measurements is\n// 1, it applies a Hadamard gate to qubit q2.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000005\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.978841e9;\nconst float meas_freq_0 = 7.280206e9;\nconst float drive_freq_1 = 5.705029e9;\nconst float meas_freq_1 = 6.499337e9;\nconst float drive_freq_2 = 5.504054e9;\nconst float meas_freq_2 = 6.429816e9;\nconst float drive_freq_3 = 5.396362e9;\nconst float meas_freq_3 = 6.280653e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.635156);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 3024699.0));\n delay[37dt] q3_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[0], q[3];\ny q[0];\nrz(1.129440) q[0];\nry(-0.230986) q[0];\nry(-0.797129) q[1];\nx q[2];\ncx q[2], q[3];\ncz q[1], q[3];\nrx(-0.933908) q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// rabi_amplitude_scan | simple_amp_loop: Rabi scan: loop over 4 amplitudes, play gaussian drive, capture each time; count number of 1s.\nint __cx_hits = 0;\nfor int __cx_k in {0,1,2,3} {\n bit __cx_m;\n box[BOX_WIN] {\n // Select amplitude based on loop index\n switch (__cx_k) {\n case 0 { cal { play(q2_drive, gaussian(0.09+0.0im, 222dt, 87dt)); } }\n case 1 { cal { play(q2_drive, gaussian(0.19+0.0im, 222dt, 87dt)); } }\n case 2 { cal { play(q2_drive, gaussian(0.28+0.0im, 222dt, 87dt)); } }\n case 3 { cal { play(q2_drive, gaussian(0.37+0.0im, 222dt, 87dt)); } }\n }\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 376dt);\n play(q2_meas, __cx_ro);\n __cx_m = capture(q2_acq, __cx_ro);\n }\n }\n __cx_hits = __cx_hits + int(__cx_m);\n}\nif (__cx_hits > 1) { h q[2]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// rabi_amplitude_scan | simple_amp_loop: Rabi scan: loop over 4 amplitudes, play gaussian drive, capture each time; count number of 1s.\nint __cx_hits = 0;\nfor int __cx_k in {0,1,2,3} {\n bit __cx_m;\n box[BOX_WIN] {\n // Select amplitude based on loop index\n switch (__cx_k) {\n case 0 { cal { play(q2_drive, gaussian(0.09+0.0im, 222dt, 87dt)); } }\n case 1 { cal { play(q2_drive, gaussian(0.19+0.0im, 222dt, 87dt)); } }\n case 2 { cal { play(q2_drive, gaussian(0.28+0.0im, 222dt, 87dt)); } }\n case 3 { cal { play(q2_drive, gaussian(0.37+0.0im, 222dt, 87dt)); } }\n }\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 376dt);\n play(q2_meas, __cx_ro);\n __cx_m = capture(q2_acq, __cx_ro);\n }\n }\n __cx_hits = __cx_hits + int(__cx_m);\n}\nif (__cx_hits > 1) { h q[2]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_06", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000006\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.562424e9;\nconst float meas_freq_0 = 7.164560e9;\nconst float drive_freq_1 = 5.134415e9;\nconst float meas_freq_1 = 6.066137e9;\nconst float drive_freq_2 = 6.303775e9;\nconst float meas_freq_2 = 6.219660e9;\nconst float drive_freq_3 = 6.182905e9;\nconst float meas_freq_3 = 6.904713e9;\nconst float drive_freq_4 = 5.407340e9;\nconst float meas_freq_4 = 6.861556e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.750742);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 1464363.0));\n delay[19dt] q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\ncx q[1], q[2];\nrx(-0.870902) q[1];\nt q[4];\ny q[4];\nt q[2];\nx q[4];\nrx(1.145047) q[4];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs a coarse qubit spectroscopy scan on qubit 3 using the frames q3_drive,\n// q3_meas, and q3_acq, stepping through 7 frequency offsets indexed by __cx_k from 0 to 6. In\n// each iteration, it shifts the q3_drive frequency by (__cx_k minus 3) times 955766.0 relative\n// to its current value, then plays a Gaussian excitation pulse of complex amplitude 0.25 and\n// duration 221 dt with sigma 23 dt on q3_drive. It immediately follows with a constant readout\n// pulse of complex amplitude 0.2 and duration 246 dt on q3_meas, captures a single bit result\n// __cx_m on q3_acq using the same readout waveform as the capture filter, and synchronizes the\n// three frames with a barrier inside a fixed box window BOX_WIN. It accumulates the number of\n// detected excitations in __cx_hits and breaks out of the scan early on the first iteration\n// where __cx_m is true; if any hit occurred, it sets syndrome_b\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000006\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.562424e9;\nconst float meas_freq_0 = 7.164560e9;\nconst float drive_freq_1 = 5.134415e9;\nconst float meas_freq_1 = 6.066137e9;\nconst float drive_freq_2 = 6.303775e9;\nconst float meas_freq_2 = 6.219660e9;\nconst float drive_freq_3 = 6.182905e9;\nconst float meas_freq_3 = 6.904713e9;\nconst float drive_freq_4 = 5.407340e9;\nconst float meas_freq_4 = 6.861556e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.750742);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 1464363.0));\n delay[19dt] q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\ncx q[1], q[2];\nrx(-0.870902) q[1];\nt q[4];\ny q[4];\nt q[2];\nx q[4];\nrx(1.145047) q[4];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// qubit_spectroscopy_scan | coarse_scan_break_on_hit: Coarse spectroscopy scan over a few frequency offsets; break early when excitation is detected.\nint __cx_hits = 0;\nfor int __cx_k in {0,1,2,3,4,5,6} {\n if (__cx_k >= 7) { break; }\n bit __cx_m;\n box[BOX_WIN] {\n cal {\n set_frequency(q3_drive, get_frequency(q3_drive) + float(__cx_k - 3) * 955766.0);\n waveform __cx_spec = gaussian(0.25+0.0im, 221dt, 23dt);\n play(q3_drive, __cx_spec);\n waveform __cx_ro = constant(0.2+0.0im, 246dt);\n play(q3_meas, __cx_ro);\n __cx_m = capture(q3_acq, __cx_ro);\n barrier q3_drive, q3_meas, q3_acq;\n }\n }\n __cx_hits = __cx_hits + int(__cx_m);\n if (__cx_m) { break; }\n}\nif (__cx_hits > 0) { syndrome_b[3] = 1; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// qubit_spectroscopy_scan | coarse_scan_break_on_hit: Coarse spectroscopy scan over a few frequency offsets; break early when excitation is detected.\nint __cx_hits = 0;\nfor int __cx_k in {0,1,2,3,4,5,6} {\n if (__cx_k >= 7) { break; }\n bit __cx_m;\n box[BOX_WIN] {\n cal {\n set_frequency(q3_drive, get_frequency(q3_drive) + float(__cx_k - 3) * 955766.0);\n waveform __cx_spec = gaussian(0.25+0.0im, 221dt, 23dt);\n play(q3_drive, __cx_spec);\n waveform __cx_ro = constant(0.2+0.0im, 246dt);\n play(q3_meas, __cx_ro);\n __cx_m = capture(q3_acq, __cx_ro);\n barrier q3_drive, q3_meas, q3_acq;\n }\n }\n __cx_hits = __cx_hits + int(__cx_m);\n if (__cx_m) { break; }\n}\nif (__cx_hits > 0) { syndrome_b[3] = 1; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_07", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000007\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.093613e9;\nconst float meas_freq_0 = 6.111479e9;\nconst float drive_freq_1 = 4.998421e9;\nconst float meas_freq_1 = 6.749166e9;\nconst float drive_freq_2 = 6.463273e9;\nconst float meas_freq_2 = 6.929145e9;\nconst float drive_freq_3 = 6.782134e9;\nconst float meas_freq_3 = 6.806760e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.063528);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -4364313.0));\n delay[14dt] q0_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[1], q[3];\nry(-0.458919) q[3];\nbarrier q;\nt q[0];\ncx q[2], q[3];\ndelay[66ns] q[0];\nrz(-0.165798) q[3];\ncx q[3], q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within the fixed BOX_WIN window, the program performs an echoed cross-resonance style\n// verification sequence using qubit 0’s drive frame q0_drive: it plays a Gaussian pulse with\n// complex amplitude 0.18 and duration 319dt with sigma 137dt after shifting the drive phase by\n// +0.25, applies an X gate to qubit q0, then shifts the drive phase by −0.25 and plays the\n// same Gaussian pulse again to echo the interaction. It then reads out qubit 0 by playing a\n// constant measurement pulse of amplitude 0.2 and duration 301dt on q0_meas while capturing on\n// q0_acq into the bit __cx_m. After an additional delay of variable duration __cx_g on q0, it\n// conditionally sets syndrome_b at index 0 to 1 if the captured measurement bit __cx_m is\n// true.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000007\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.093613e9;\nconst float meas_freq_0 = 6.111479e9;\nconst float drive_freq_1 = 4.998421e9;\nconst float meas_freq_1 = 6.749166e9;\nconst float drive_freq_2 = 6.463273e9;\nconst float meas_freq_2 = 6.929145e9;\nconst float drive_freq_3 = 6.782134e9;\nconst float meas_freq_3 = 6.806760e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.063528);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -4364313.0));\n delay[14dt] q0_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[1], q[3];\nry(-0.458919) q[3];\nbarrier q;\nt q[0];\ncx q[2], q[3];\ndelay[66ns] q[0];\nrz(-0.165798) q[3];\ncx q[3], q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// echoed_cr_gate_verification | echoed_cr_basic: Echoed CR-style verification: CR(+phase) - X(control) - CR(-phase) then read target.\nbit __cx_m;\nstretch __cx_g;\nbox[BOX_WIN] {\n // echoed CR pulses on control drive frame\n cal {\n waveform __cx_cr = gaussian(0.18+0.0im, 319dt, 137dt);\n shift_phase(q0_drive, 0.25);\n play(q0_drive, __cx_cr);\n barrier q0_drive, q0_drive;\n }\n x q[0];\n cal {\n shift_phase(q0_drive, -0.25);\n play(q0_drive, __cx_cr);\n }\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 301dt);\n play(q0_meas, __cx_ro);\n __cx_m = capture(q0_acq, __cx_ro);\n }\n delay[__cx_g] q[0];\n}\nif (__cx_m) { syndrome_b[0] = 1; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// echoed_cr_gate_verification | echoed_cr_basic: Echoed CR-style verification: CR(+phase) - X(control) - CR(-phase) then read target.\nbit __cx_m;\nstretch __cx_g;\nbox[BOX_WIN] {\n // echoed CR pulses on control drive frame\n cal {\n waveform __cx_cr = gaussian(0.18+0.0im, 319dt, 137dt);\n shift_phase(q0_drive, 0.25);\n play(q0_drive, __cx_cr);\n barrier q0_drive, q0_drive;\n }\n x q[0];\n cal {\n shift_phase(q0_drive, -0.25);\n play(q0_drive, __cx_cr);\n }\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 301dt);\n play(q0_meas, __cx_ro);\n __cx_m = capture(q0_acq, __cx_ro);\n }\n delay[__cx_g] q[0];\n}\nif (__cx_m) { syndrome_b[0] = 1; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_08", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000008\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.664505e9;\nconst float meas_freq_0 = 6.579247e9;\nconst float drive_freq_1 = 5.484166e9;\nconst float meas_freq_1 = 6.611007e9;\nconst float drive_freq_2 = 4.665705e9;\nconst float meas_freq_2 = 6.932972e9;\nconst float drive_freq_3 = 4.627711e9;\nconst float meas_freq_3 = 7.270001e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, 0.578403);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 404439.0));\n delay[37dt] q3_drive;\n barrier q0_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[3], q[0];\ntdg q[0];\ncz q[3], q[2];\nrz(0.093001) q[0];\nh q[0];\nx q[1];\nrx(-0.762607) q[0];\ncz q[0], q[3];\nry(-1.105702) q[1];\nry(-0.056178) q[3];\nrz(1.010762) q[2];\nsdg q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within a stretched timing parameter named __cx_g, the program opens a fixed-duration control\n// window BOX_WIN and applies a CNOT operation with q0 as control and q3 as target. During that\n// same window, it enters a calibration block that synthesizes a sine waveform of complex\n// amplitude 0.05, duration 277 dt, frequency 5.0 MHz, and phase 0.0, and plays this low-\n// amplitude rotary tone on the q0_drive frame while enforcing a barrier synchronization across\n// q0_drive and q3_drive. It then inserts a delay of length __cx_g on qubit q0 to pad or align\n// the overall timing inside the box.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000008\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.664505e9;\nconst float meas_freq_0 = 6.579247e9;\nconst float drive_freq_1 = 5.484166e9;\nconst float meas_freq_1 = 6.611007e9;\nconst float drive_freq_2 = 4.665705e9;\nconst float meas_freq_2 = 6.932972e9;\nconst float drive_freq_3 = 4.627711e9;\nconst float meas_freq_3 = 7.270001e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, 0.578403);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 404439.0));\n delay[37dt] q3_drive;\n barrier q0_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[3], q[0];\ntdg q[0];\ncz q[3], q[2];\nrz(0.093001) q[0];\nh q[0];\nx q[1];\nrx(-0.762607) q[0];\ncz q[0], q[3];\nry(-1.105702) q[1];\nry(-0.056178) q[3];\nrz(1.010762) q[2];\nsdg q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// dynamic_cnot_spectator_comp | spectator_rotary_overlap: Run a CNOT-like gate sequence while playing a low-amplitude rotary tone on a spectator drive frame within the same box.\nstretch __cx_g;\nbox[BOX_WIN] {\n // logical gate domain interaction\n cx q[0], q[3];\n cal {\n waveform __cx_rot = sine(0.05+0.0im, 277dt, 5.0e6, 0.0);\n play(q0_drive, __cx_rot);\n barrier q0_drive, q3_drive, q0_drive;\n }\n delay[__cx_g] q[0];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// dynamic_cnot_spectator_comp | spectator_rotary_overlap: Run a CNOT-like gate sequence while playing a low-amplitude rotary tone on a spectator drive frame within the same box.\nstretch __cx_g;\nbox[BOX_WIN] {\n // logical gate domain interaction\n cx q[0], q[3];\n cal {\n waveform __cx_rot = sine(0.05+0.0im, 277dt, 5.0e6, 0.0);\n play(q0_drive, __cx_rot);\n barrier q0_drive, q3_drive, q0_drive;\n }\n delay[__cx_g] q[0];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_09", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000009\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.661814e9;\nconst float meas_freq_0 = 6.193045e9;\nconst float drive_freq_1 = 4.632748e9;\nconst float meas_freq_1 = 6.155443e9;\nconst float drive_freq_2 = 4.604854e9;\nconst float meas_freq_2 = 6.400861e9;\nconst float drive_freq_3 = 5.987517e9;\nconst float meas_freq_3 = 6.592811e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, -0.043300);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -3116530.0));\n delay[28dt] q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\ncx q[3], q[1];\nt q[0];\nrx(1.034308) q[2];\ncz q[0], q[1];\nrz(-1.177740) q[0];\nh q[3];\ndelay[36ns] q[0];\nrz(-0.454432) q[3];\ns q[0];\nh q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet allocates two temporary classical bits, __cx_m0 and __cx_m1, then opens a timing\n// box labeled RO_RING to perform a multiplexed readout sequence on qubit 2 using its\n// measurement frame q2_meas and acquisition frame q2_acq. Inside the calibration block, it\n// constructs two identical constant readout waveforms with complex amplitude 0.2 plus 0.0\n// imaginary and duration 488 dt, plays both of these pulses on q2_meas, and performs two\n// captures on q2_acq using the corresponding waveforms as filters, storing the resulting bits\n// into __cx_m0 and __cx_m1. A barrier is applied to q2_meas and q2_acq to enforce\n// synchronization of the measurement and acquisition actions. After the box, it writes the two\n// captured bits into the same classical array element bg_m at index 2 in sequence, so the\n// second assignment overwrites the first.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000009\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.661814e9;\nconst float meas_freq_0 = 6.193045e9;\nconst float drive_freq_1 = 4.632748e9;\nconst float meas_freq_1 = 6.155443e9;\nconst float drive_freq_2 = 4.604854e9;\nconst float meas_freq_2 = 6.400861e9;\nconst float drive_freq_3 = 5.987517e9;\nconst float meas_freq_3 = 6.592811e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, -0.043300);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -3116530.0));\n delay[28dt] q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\ncx q[3], q[1];\nt q[0];\nrx(1.034308) q[2];\ncz q[0], q[1];\nrz(-1.177740) q[0];\nh q[3];\ndelay[36ns] q[0];\nrz(-0.454432) q[3];\ns q[0];\nh q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// multiplexed_readout | simultaneous_dual_capture: Simultaneous readout on two qubits: play both RO pulses and capture both bits in the same timing box.\nbit __cx_m0;\nbit __cx_m1;\nbox[RO_RING] {\n cal {\n waveform __cx_ro0 = constant(0.2+0.0im, 488dt);\n waveform __cx_ro1 = constant(0.2+0.0im, 488dt);\n play(q2_meas, __cx_ro0);\n play(q2_meas, __cx_ro1);\n __cx_m0 = capture(q2_acq, __cx_ro0);\n __cx_m1 = capture(q2_acq, __cx_ro1);\n barrier q2_meas, q2_meas, q2_acq, q2_acq;\n }\n}\nbg_m[2] = __cx_m0;\nbg_m[2] = __cx_m1;\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// multiplexed_readout | simultaneous_dual_capture: Simultaneous readout on two qubits: play both RO pulses and capture both bits in the same timing box.\nbit __cx_m0;\nbit __cx_m1;\nbox[RO_RING] {\n cal {\n waveform __cx_ro0 = constant(0.2+0.0im, 488dt);\n waveform __cx_ro1 = constant(0.2+0.0im, 488dt);\n play(q2_meas, __cx_ro0);\n play(q2_meas, __cx_ro1);\n __cx_m0 = capture(q2_acq, __cx_ro0);\n __cx_m1 = capture(q2_acq, __cx_ro1);\n barrier q2_meas, q2_meas, q2_acq, q2_acq;\n }\n}\nbg_m[2] = __cx_m0;\nbg_m[2] = __cx_m1;\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_10", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000010\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.679303e9;\nconst float meas_freq_0 = 7.236120e9;\nconst float drive_freq_1 = 6.260612e9;\nconst float meas_freq_1 = 7.100523e9;\nconst float drive_freq_2 = 6.378546e9;\nconst float meas_freq_2 = 6.244444e9;\nconst float drive_freq_3 = 6.271100e9;\nconst float meas_freq_3 = 6.934620e9;\nconst float drive_freq_4 = 6.179536e9;\nconst float meas_freq_4 = 6.245479e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.130700);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 3569422.0));\n delay[40dt] q0_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\ndelay[59ns] q[0];\nry(0.640147) q[3];\ny q[3];\ncx q[4], q[3];\ncx q[3], q[0];\ndelay[29ns] q[0];\nrx(0.326637) q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within a readout-ring time window labeled RO_RING, the program performs a calibrated readout\n// on qubit 4 using the measurement frame q4_meas and acquisition frame q4_acq. It generates a\n// constant complex waveform of amplitude 0.2 plus 0.0 imaginary with duration 383 dt and plays\n// it on q4_meas, then captures a raw acquisition waveform from q4_acq for 124 dt. In the same\n// window it also performs a filtered capture on q4_acq using that same constant waveform as\n// the filter, producing a single classical bit result stored in the temporary bit __cx_m.\n// After the window, this bit is written into the classical array element bg_m at index 4.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000010\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.679303e9;\nconst float meas_freq_0 = 7.236120e9;\nconst float drive_freq_1 = 6.260612e9;\nconst float meas_freq_1 = 7.100523e9;\nconst float drive_freq_2 = 6.378546e9;\nconst float meas_freq_2 = 6.244444e9;\nconst float drive_freq_3 = 6.271100e9;\nconst float meas_freq_3 = 6.934620e9;\nconst float drive_freq_4 = 6.179536e9;\nconst float meas_freq_4 = 6.245479e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.130700);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 3569422.0));\n delay[40dt] q0_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\ndelay[59ns] q[0];\nry(0.640147) q[3];\ny q[3];\ncx q[4], q[3];\ncx q[3], q[0];\ndelay[29ns] q[0];\nrx(0.326637) q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// raw_waveform_capture_and_filter | raw_capture_plus_bit_capture: Capture a raw waveform (capture_v1) and also do a filtered capture returning a bit; store bit into bg_m.\nbit __cx_m;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 383dt);\n play(q4_meas, __cx_ro);\n waveform __cx_raw = capture_v1(q4_acq, 124dt);\n __cx_m = capture(q4_acq, __cx_ro);\n }\n}\nbg_m[4] = __cx_m;\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// raw_waveform_capture_and_filter | raw_capture_plus_bit_capture: Capture a raw waveform (capture_v1) and also do a filtered capture returning a bit; store bit into bg_m.\nbit __cx_m;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 383dt);\n play(q4_meas, __cx_ro);\n waveform __cx_raw = capture_v1(q4_acq, 124dt);\n __cx_m = capture(q4_acq, __cx_ro);\n }\n}\nbg_m[4] = __cx_m;\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_11", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000011\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.347713e9;\nconst float meas_freq_0 = 6.120003e9;\nconst float drive_freq_1 = 6.627020e9;\nconst float meas_freq_1 = 6.204930e9;\nconst float drive_freq_2 = 5.040419e9;\nconst float meas_freq_2 = 7.114221e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.001557);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -1280300.0));\n delay[40dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[2], q[0];\nry(1.015976) q[2];\nx q[1];\ndelay[31dt] q[1];\ncx q[1], q[2];\nrx(0.702769) q[0];\ncz q[0], q[1];\nrx(0.798903) q[2];\nrz(0.934489) q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within a dedicated readout-ring window, the calibration block defines two temporary\n// measurement bits, __cx_m0 and __cx_m1, and performs a crosstalk-style experiment using the\n// q0 and q2 hardware frames. It plays a constant readout pulse of complex amplitude 0.2 and\n// duration 239 dt on the q0 measurement frame q0_meas and immediately captures a bit on the q0\n// acquisition frame q0_acq using the same waveform as the capture filter, storing the result\n// in __cx_m0. In parallel sequence, it applies a Gaussian drive pulse of amplitude 0.18,\n// duration 289 dt, and sigma 88 dt on the q2 drive frame q2_drive, then plays a second\n// constant readout pulse of amplitude 0.2 and duration 239 dt on q2_meas and captures the\n// corresponding bit on q2_acq into __cx_m1, followed by a barrier synchronizing q0_meas,\n// q2_drive, and q2_meas. After the box, if both captured bits are true,\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000011\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.347713e9;\nconst float meas_freq_0 = 6.120003e9;\nconst float drive_freq_1 = 6.627020e9;\nconst float meas_freq_1 = 6.204930e9;\nconst float drive_freq_2 = 5.040419e9;\nconst float meas_freq_2 = 7.114221e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.001557);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -1280300.0));\n delay[40dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[2], q[0];\nry(1.015976) q[2];\nx q[1];\ndelay[31dt] q[1];\ncx q[1], q[2];\nrx(0.702769) q[0];\ncz q[0], q[1];\nrx(0.798903) q[2];\nrz(0.934489) q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// measurement_crosstalk_calibration | meas_on_q0_drive_on_q1: Apply readout on q0 while driving q1; then read out q1 to observe crosstalk-like effect.\nbit __cx_m0;\nbit __cx_m1;\nbox[RO_RING] {\n cal {\n waveform __cx_ro0 = constant(0.2+0.0im, 239dt);\n waveform __cx_drv1 = gaussian(0.18+0.0im, 289dt, 88dt);\n play(q0_meas, __cx_ro0);\n __cx_m0 = capture(q0_acq, __cx_ro0);\n play(q2_drive, __cx_drv1);\n waveform __cx_ro1 = constant(0.2+0.0im, 239dt);\n play(q2_meas, __cx_ro1);\n __cx_m1 = capture(q2_acq, __cx_ro1);\n barrier q0_meas, q2_drive, q2_meas;\n }\n}\nif (__cx_m0 && __cx_m1) { syndrome_b[2] = 1; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// measurement_crosstalk_calibration | meas_on_q0_drive_on_q1: Apply readout on q0 while driving q1; then read out q1 to observe crosstalk-like effect.\nbit __cx_m0;\nbit __cx_m1;\nbox[RO_RING] {\n cal {\n waveform __cx_ro0 = constant(0.2+0.0im, 239dt);\n waveform __cx_drv1 = gaussian(0.18+0.0im, 289dt, 88dt);\n play(q0_meas, __cx_ro0);\n __cx_m0 = capture(q0_acq, __cx_ro0);\n play(q2_drive, __cx_drv1);\n waveform __cx_ro1 = constant(0.2+0.0im, 239dt);\n play(q2_meas, __cx_ro1);\n __cx_m1 = capture(q2_acq, __cx_ro1);\n barrier q0_meas, q2_drive, q2_meas;\n }\n}\nif (__cx_m0 && __cx_m1) { syndrome_b[2] = 1; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_12", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000012\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.471031e9;\nconst float meas_freq_0 = 7.095864e9;\nconst float drive_freq_1 = 6.032842e9;\nconst float meas_freq_1 = 7.365806e9;\nconst float drive_freq_2 = 6.670492e9;\nconst float meas_freq_2 = 6.125804e9;\nconst float drive_freq_3 = 5.371471e9;\nconst float meas_freq_3 = 6.712414e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.557199);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 4526399.0));\n delay[35dt] q3_drive;\n barrier q1_drive, q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\ndelay[57ns] q[1];\ncx q[2], q[1];\nsdg q[1];\ndelay[67ns] q[0];\nbarrier q;\ndelay[40ns] q[3];\nrx(0.090277) q[2];\ncz q[0], q[2];\nry(-0.849887) q[3];\nrz(0.232010) q[0];\nrx(-0.928919) q[3];\ncx q[2], q[3];\nswap q[1], q[0];\nry(0.800286) q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within the fixed control window BOX_WIN, the program performs a two-shot readout of qubit 3\n// using its measurement and acquisition frames q3_meas and q3_acq. It plays a constant readout\n// waveform of complex amplitude 0.2 and duration 424 dt, captures the first measurement bit\n// __cx_m1, waits 58 dt on the acquisition path, then captures a second measurement bit __cx_m2\n// using the same readout pulse. If both captured bits are 1, it applies a corrective X-like\n// pulse to qubit 3 by playing a Gaussian drive waveform on q3_drive with amplitude 0.85,\n// duration 100 dt, and sigma 80 dt. The block then includes a stretchable delay __cx_g on\n// qubit 3 to fill or align timing within the window.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000012\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.471031e9;\nconst float meas_freq_0 = 7.095864e9;\nconst float drive_freq_1 = 6.032842e9;\nconst float meas_freq_1 = 7.365806e9;\nconst float drive_freq_2 = 6.670492e9;\nconst float meas_freq_2 = 6.125804e9;\nconst float drive_freq_3 = 5.371471e9;\nconst float meas_freq_3 = 6.712414e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.557199);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 4526399.0));\n delay[35dt] q3_drive;\n barrier q1_drive, q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\ndelay[57ns] q[1];\ncx q[2], q[1];\nsdg q[1];\ndelay[67ns] q[0];\nbarrier q;\ndelay[40ns] q[3];\nrx(0.090277) q[2];\ncz q[0], q[2];\nry(-0.849887) q[3];\nrz(0.232010) q[0];\nrx(-0.928919) q[3];\ncx q[2], q[3];\nswap q[1], q[0];\nry(0.800286) q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// realtime_feedback_correction | two_shot_majority_vote: Measure twice and do a majority-like vote (2 samples); if both are 1 apply an X correction pulse.\nbit __cx_m1;\nbit __cx_m2;\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 424dt);\n play(q3_meas, __cx_ro);\n __cx_m1 = capture(q3_acq, __cx_ro);\n delay[58dt] q3_acq;\n __cx_m2 = capture(q3_acq, __cx_ro);\n }\n if (__cx_m1 && __cx_m2) {\n cal {\n waveform __cx_pi = gaussian(0.85+0.0im, 100dt, 80dt);\n play(q3_drive, __cx_pi);\n }\n }\n delay[__cx_g] q[3];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// realtime_feedback_correction | two_shot_majority_vote: Measure twice and do a majority-like vote (2 samples); if both are 1 apply an X correction pulse.\nbit __cx_m1;\nbit __cx_m2;\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 424dt);\n play(q3_meas, __cx_ro);\n __cx_m1 = capture(q3_acq, __cx_ro);\n delay[58dt] q3_acq;\n __cx_m2 = capture(q3_acq, __cx_ro);\n }\n if (__cx_m1 && __cx_m2) {\n cal {\n waveform __cx_pi = gaussian(0.85+0.0im, 100dt, 80dt);\n play(q3_drive, __cx_pi);\n }\n }\n delay[__cx_g] q[3];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_13", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000013\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.306044e9;\nconst float meas_freq_0 = 6.556303e9;\nconst float drive_freq_1 = 5.419598e9;\nconst float meas_freq_1 = 7.122793e9;\nconst float drive_freq_2 = 5.054242e9;\nconst float meas_freq_2 = 7.145294e9;\nconst float drive_freq_3 = 5.552825e9;\nconst float meas_freq_3 = 7.385005e9;\nconst float drive_freq_4 = 6.663646e9;\nconst float meas_freq_4 = 6.903180e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.490388);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -760113.0));\n delay[23dt] q0_drive;\n barrier q0_drive, q1_drive, q3_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[3], q[2];\nrz(-0.709316) q[4];\ncz q[3], q[1];\nrz(0.171763) q[2];\ndelay[58dt] q[4];\nrx(-0.224905) q[0];\nswap q[3], q[0];\ncz q[0], q[3];\ndelay[6dt] q[0];\ny q[1];\nrz(-0.882799) q[0];\ny q[0];\nx q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within a single fixed timing window labeled BOX_WIN, the program performs two calibrated\n// pulse-level actions in parallel: it plays a constant readout waveform of complex amplitude\n// 0.2 plus 0.0i for 453 dt on the q1 measurement frame q1_meas while simultaneously capturing\n// on the q1 acquisition frame q1_acq using the same waveform as the capture filter, storing\n// the resulting single-shot bit in the classical variable __cx_m0. At the same time, it\n// applies a Gaussian-shaped drive pulse with complex amplitude 0.45 plus 0.0i and duration 114\n// dt with sigma 58 dt on the q3 drive frame q3_drive, intended as an approximate pi/2-style\n// preparation pulse. After these parallel operations, it inserts a stretchable delay of\n// duration __cx_g on qubit q1, and then conditionally applies an X gate to q1 if the captured\n// measurement bit __cx_m0 is true.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000013\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.306044e9;\nconst float meas_freq_0 = 6.556303e9;\nconst float drive_freq_1 = 5.419598e9;\nconst float meas_freq_1 = 7.122793e9;\nconst float drive_freq_2 = 5.054242e9;\nconst float meas_freq_2 = 7.145294e9;\nconst float drive_freq_3 = 5.552825e9;\nconst float meas_freq_3 = 7.385005e9;\nconst float drive_freq_4 = 6.663646e9;\nconst float meas_freq_4 = 6.903180e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.490388);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -760113.0));\n delay[23dt] q0_drive;\n barrier q0_drive, q1_drive, q3_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[3], q[2];\nrz(-0.709316) q[4];\ncz q[3], q[1];\nrz(0.171763) q[2];\ndelay[58dt] q[4];\nrx(-0.224905) q[0];\nswap q[3], q[0];\ncz q[0], q[3];\ndelay[6dt] q[0];\ny q[1];\nrz(-0.882799) q[0];\ny q[0];\nx q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// pipeline_measure_reset_prep | measure_q0_prep_q1_parallel: Pipeline: measure q0 while preparing q1 in the same timing box (parallel-friendly scheduling).\nbit __cx_m0;\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 453dt);\n play(q1_meas, __cx_ro);\n __cx_m0 = capture(q1_acq, __cx_ro);\n }\n // in parallel: prepare q1 with a pulse-level pi/2 (approx)\n cal {\n waveform __cx_pi2 = gaussian(0.45+0.0im, 114dt, 58dt);\n play(q3_drive, __cx_pi2);\n }\n delay[__cx_g] q[1];\n}\nif (__cx_m0) { x q[1]; }\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// pipeline_measure_reset_prep | measure_q0_prep_q1_parallel: Pipeline: measure q0 while preparing q1 in the same timing box (parallel-friendly scheduling).\nbit __cx_m0;\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 453dt);\n play(q1_meas, __cx_ro);\n __cx_m0 = capture(q1_acq, __cx_ro);\n }\n // in parallel: prepare q1 with a pulse-level pi/2 (approx)\n cal {\n waveform __cx_pi2 = gaussian(0.45+0.0im, 114dt, 58dt);\n play(q3_drive, __cx_pi2);\n }\n delay[__cx_g] q[1];\n}\nif (__cx_m0) { x q[1]; }\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_14", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000014\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.472013e9;\nconst float meas_freq_0 = 7.012325e9;\nconst float drive_freq_1 = 6.681315e9;\nconst float meas_freq_1 = 6.673760e9;\nconst float drive_freq_2 = 5.653087e9;\nconst float meas_freq_2 = 6.115783e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.421883);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -924920.0));\n delay[8dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nrx(-0.098235) q[0];\ncx q[0], q[2];\ndelay[14ns] q[2];\nsdg q[0];\nt q[2];\ncz q[1], q[0];\ncx q[2], q[1];\ntdg q[0];\nrz(0.166586) q[1];\ncz q[1], q[2];\ncx q[2], q[0];\ncz q[1], q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet updates a classical integer mask by XORing it with the constant 0x9e3779b9, then\n// runs a 7-iteration controller-driven randomized-benchmarking loop that repeatedly advances\n// the mask using a linear-congruential update with multiplier 1664525 and increment\n// 1013904223. On each iteration it takes the two least significant bits of the updated mask to\n// select one of four single-qubit Clifford-like operations applied to qubit q0: a Hadamard, an\n// X gate, an S gate, or (by default) an S-dagger gate. After each selected gate on q0, it\n// inserts a fixed 16 ns delay on q0 before proceeding to the next iteration.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000014\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.472013e9;\nconst float meas_freq_0 = 7.012325e9;\nconst float drive_freq_1 = 6.681315e9;\nconst float meas_freq_1 = 6.673760e9;\nconst float drive_freq_2 = 5.653087e9;\nconst float meas_freq_2 = 6.115783e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, -0.421883);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -924920.0));\n delay[8dt] q0_drive;\n barrier q0_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nrx(-0.098235) q[0];\ncx q[0], q[2];\ndelay[14ns] q[2];\nsdg q[0];\nt q[2];\ncz q[1], q[0];\ncx q[2], q[1];\ntdg q[0];\nrz(0.166586) q[1];\ncz q[1], q[2];\ncx q[2], q[0];\ncz q[1], q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// randomized_benchmarking_controller | rb_switch_on_mask: Controller-side RB: update mask and use switch on low bits to choose simple Clifford-like gates (<=7 steps).\nmask = mask ^ 0x9e3779b9;\nfor int __cx_k in {0,1,2,3,4,5,6} {\n if (__cx_k >= 7) { break; }\n mask = mask * 1664525 + 1013904223;\n int __cx_sel = int(mask & 3);\n switch (__cx_sel) {\n case 0 { h q[0]; }\n case 1 { x q[0]; }\n case 2 { s q[0]; }\n default { sdg q[0]; }\n }\n delay[16ns] q[0];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// randomized_benchmarking_controller | rb_switch_on_mask: Controller-side RB: update mask and use switch on low bits to choose simple Clifford-like gates (<=7 steps).\nmask = mask ^ 0x9e3779b9;\nfor int __cx_k in {0,1,2,3,4,5,6} {\n if (__cx_k >= 7) { break; }\n mask = mask * 1664525 + 1013904223;\n int __cx_sel = int(mask & 3);\n switch (__cx_sel) {\n case 0 { h q[0]; }\n case 1 { x q[0]; }\n case 2 { s q[0]; }\n default { sdg q[0]; }\n }\n delay[16ns] q[0];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_15", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000015\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.310552e9;\nconst float meas_freq_0 = 6.888570e9;\nconst float drive_freq_1 = 5.443310e9;\nconst float meas_freq_1 = 6.854627e9;\nconst float drive_freq_2 = 5.982396e9;\nconst float meas_freq_2 = 7.279348e9;\nconst float drive_freq_3 = 6.268198e9;\nconst float meas_freq_3 = 6.251238e9;\nconst float drive_freq_4 = 6.139314e9;\nconst float meas_freq_4 = 6.808653e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.665610);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 1423452.0));\n delay[33dt] q3_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\ndelay[62dt] q[0];\ncx q[2], q[4];\nry(0.576629) q[2];\nry(-0.810932) q[3];\nrx(0.568950) q[4];\nz q[4];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet implements a repeat-until-success routine on qubit 3, using a classical bit\n// __cx_m as the success flag and a classical counter tries capped at 5 attempts. On each\n// attempt, within a fixed timing window BOX_WIN, it plays a Gaussian preparation pulse of\n// complex amplitude 0.55 and duration 214 dt with sigma 68 dt on the q3_drive frame, then\n// plays a constant readout pulse of amplitude 0.2 and duration 494 dt on the q3_meas frame and\n// captures a measurement result on the q3_acq frame into __cx_m. A stretchable delay __cx_g is\n// applied to q3 to fill the remainder of the window. If the captured bit indicates success\n// (__cx_m equals 0), the loop exits early; otherwise tries is incremented and the attempt\n// repeats until the cap is reached.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000015\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.310552e9;\nconst float meas_freq_0 = 6.888570e9;\nconst float drive_freq_1 = 5.443310e9;\nconst float meas_freq_1 = 6.854627e9;\nconst float drive_freq_2 = 5.982396e9;\nconst float meas_freq_2 = 7.279348e9;\nconst float drive_freq_3 = 6.268198e9;\nconst float meas_freq_3 = 6.251238e9;\nconst float drive_freq_4 = 6.139314e9;\nconst float meas_freq_4 = 6.808653e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q3_drive, -0.665610);\n set_frequency(q3_drive, (get_frequency(q3_drive) + 1423452.0));\n delay[33dt] q3_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\ndelay[62dt] q[0];\ncx q[2], q[4];\nry(0.576629) q[2];\nry(-0.810932) q[3];\nrx(0.568950) q[4];\nz q[4];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// repeat_until_success_prep | while_loop_until_success: Repeat preparation + measurement until success (m=0) or tries hits cap (<=7).\nbit __cx_m;\ntries = 0;\nwhile (tries < 5) {\n stretch __cx_g;\n box[BOX_WIN] {\n cal {\n waveform __cx_prep = gaussian(0.55+0.0im, 214dt, 68dt);\n play(q3_drive, __cx_prep);\n waveform __cx_ro = constant(0.2+0.0im, 494dt);\n play(q3_meas, __cx_ro);\n __cx_m = capture(q3_acq, __cx_ro);\n }\n delay[__cx_g] q[3];\n }\n if (!__cx_m) { break; }\n tries = tries + 1;\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// repeat_until_success_prep | while_loop_until_success: Repeat preparation + measurement until success (m=0) or tries hits cap (<=7).\nbit __cx_m;\ntries = 0;\nwhile (tries < 5) {\n stretch __cx_g;\n box[BOX_WIN] {\n cal {\n waveform __cx_prep = gaussian(0.55+0.0im, 214dt, 68dt);\n play(q3_drive, __cx_prep);\n waveform __cx_ro = constant(0.2+0.0im, 494dt);\n play(q3_meas, __cx_ro);\n __cx_m = capture(q3_acq, __cx_ro);\n }\n delay[__cx_g] q[3];\n }\n if (!__cx_m) { break; }\n tries = tries + 1;\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_16", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000016\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.676209e9;\nconst float meas_freq_0 = 7.057536e9;\nconst float drive_freq_1 = 6.171333e9;\nconst float meas_freq_1 = 6.686063e9;\nconst float drive_freq_2 = 6.794144e9;\nconst float meas_freq_2 = 6.186655e9;\nconst float drive_freq_3 = 5.357550e9;\nconst float meas_freq_3 = 7.182608e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, 0.764119);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -2744116.0));\n delay[17dt] q2_drive;\n barrier q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nbarrier q;\ncx q[2], q[1];\ncz q[0], q[2];\nrx(0.945318) q[2];\ns q[0];\nswap q[2], q[3];\ncz q[3], q[2];\ndelay[44dt] q[2];\ndelay[2dt] q[3];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs a leakage-detection check on qubit 3 by running a readout ring in a\n// RO_RING timing box: it plays a constant measurement pulse of complex amplitude 0.2 and\n// duration 500 dt on the q3_meas frame, captures a first bit result on the q3_acq frame, waits\n// 46 dt on q3_acq, then captures a second bit result using the same pulse. A stretchable delay\n// on q3 is included to align the overall timing of the box. If both captured bits are 1, it\n// treats this as a leakage flag and applies a recovery pulse on the q3_drive frame using a\n// Gaussian waveform with amplitude 0.9, duration 132 dt, and sigma 99 dt.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000016\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.676209e9;\nconst float meas_freq_0 = 7.057536e9;\nconst float drive_freq_1 = 6.171333e9;\nconst float meas_freq_1 = 6.686063e9;\nconst float drive_freq_2 = 6.794144e9;\nconst float meas_freq_2 = 6.186655e9;\nconst float drive_freq_3 = 5.357550e9;\nconst float meas_freq_3 = 7.182608e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, 0.764119);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -2744116.0));\n delay[17dt] q2_drive;\n barrier q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nbarrier q;\ncx q[2], q[1];\ncz q[0], q[2];\nrx(0.945318) q[2];\ns q[0];\nswap q[2], q[3];\ncz q[3], q[2];\ndelay[44dt] q[2];\ndelay[2dt] q[3];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// leakage_detection_and_recovery | double_capture_leak_flag: Two captures separated by a short idle; if both are 1, treat as leakage flag and apply recovery pulse.\nbit __cx_m1;\nbit __cx_m2;\nstretch __cx_g;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 500dt);\n play(q3_meas, __cx_ro);\n __cx_m1 = capture(q3_acq, __cx_ro);\n delay[46dt] q3_acq;\n __cx_m2 = capture(q3_acq, __cx_ro);\n }\n delay[__cx_g] q[3];\n}\nif (__cx_m1 && __cx_m2) {\n cal {\n waveform __cx_rec = gaussian(0.9+0.0im, 132dt, 99dt);\n play(q3_drive, __cx_rec);\n }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// leakage_detection_and_recovery | double_capture_leak_flag: Two captures separated by a short idle; if both are 1, treat as leakage flag and apply recovery pulse.\nbit __cx_m1;\nbit __cx_m2;\nstretch __cx_g;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 500dt);\n play(q3_meas, __cx_ro);\n __cx_m1 = capture(q3_acq, __cx_ro);\n delay[46dt] q3_acq;\n __cx_m2 = capture(q3_acq, __cx_ro);\n }\n delay[__cx_g] q[3];\n}\nif (__cx_m1 && __cx_m2) {\n cal {\n waveform __cx_rec = gaussian(0.9+0.0im, 132dt, 99dt);\n play(q3_drive, __cx_rec);\n }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_17", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000017\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.249843e9;\nconst float meas_freq_0 = 7.261734e9;\nconst float drive_freq_1 = 4.891818e9;\nconst float meas_freq_1 = 7.032796e9;\nconst float drive_freq_2 = 6.752025e9;\nconst float meas_freq_2 = 6.368401e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q1_drive, 0.397687);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 3279148.0));\n delay[13dt] q1_drive;\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nt q[2];\nrz(0.715519) q[1];\nry(-0.090249) q[2];\nh q[2];\nsdg q[0];\nt q[1];\ndelay[41ns] q[0];\ncx q[2], q[1];\ntdg q[0];\nz q[2];\nh q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet initializes a floating-point phase accumulator __cx_phi to 0 and then, over 6\n// iterations indexed by __cx_k from 0 through 5, increments it by 0.02104 each time and\n// applies that accumulated value as a phase shift on the q2_drive frame, inserting a 79 dt\n// delay on qubit q2 after each update. After a barrier synchronizing all qubits, it performs a\n// readout of qubit 2 inside a RO_RING timing box by playing a constant measurement pulse of\n// complex amplitude 0.2 and duration 477 dt on the q2_meas frame and capturing the\n// corresponding response on q2_acq into the bit __cx_m. Finally, it stores the captured\n// measurement result into the classical array element bg_m at index 2.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000017\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.249843e9;\nconst float meas_freq_0 = 7.261734e9;\nconst float drive_freq_1 = 4.891818e9;\nconst float meas_freq_1 = 7.032796e9;\nconst float drive_freq_2 = 6.752025e9;\nconst float meas_freq_2 = 6.368401e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q1_drive, 0.397687);\n set_frequency(q1_drive, (get_frequency(q1_drive) + 3279148.0));\n delay[13dt] q1_drive;\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nt q[2];\nrz(0.715519) q[1];\nry(-0.090249) q[2];\nh q[2];\nsdg q[0];\nt q[1];\ndelay[41ns] q[0];\ncx q[2], q[1];\ntdg q[0];\nz q[2];\nh q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// virtual_z_phase_tracking_test | phase_walk_then_measure: Accumulate small virtual-Z steps (<=7) and then measure; checks consistent phase tracking under timing gaps.\nfloat[64] __cx_phi;\n__cx_phi = 0.0;\nfor int __cx_k in {0,1,2,3,4,5} {\n __cx_phi = __cx_phi + 0.02104;\n cal { shift_phase(q2_drive, __cx_phi); }\n delay[79dt] q[2];\n}\nbarrier q;\nbit __cx_m;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 477dt);\n play(q2_meas, __cx_ro);\n __cx_m = capture(q2_acq, __cx_ro);\n }\n}\nbg_m[2] = __cx_m;\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// virtual_z_phase_tracking_test | phase_walk_then_measure: Accumulate small virtual-Z steps (<=7) and then measure; checks consistent phase tracking under timing gaps.\nfloat[64] __cx_phi;\n__cx_phi = 0.0;\nfor int __cx_k in {0,1,2,3,4,5} {\n __cx_phi = __cx_phi + 0.02104;\n cal { shift_phase(q2_drive, __cx_phi); }\n delay[79dt] q[2];\n}\nbarrier q;\nbit __cx_m;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 477dt);\n play(q2_meas, __cx_ro);\n __cx_m = capture(q2_acq, __cx_ro);\n }\n}\nbg_m[2] = __cx_m;\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_18", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000018\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 4.656638e9;\nconst float meas_freq_0 = 6.498025e9;\nconst float drive_freq_1 = 5.634834e9;\nconst float meas_freq_1 = 6.094448e9;\nconst float drive_freq_2 = 5.188005e9;\nconst float meas_freq_2 = 6.533960e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, -0.564055);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -1367138.0));\n delay[11dt] q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\ncz q[2], q[1];\nrz(0.442467) q[2];\ndelay[56ns] q[0];\ncz q[2], q[1];\nrx(0.253606) q[1];\nx q[1];\ns q[1];\ncx q[1], q[2];\ncz q[0], q[1];\nswap q[1], q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet saves the current frequency of the q2 drive frame, then temporarily retunes that\n// drive frequency downward by 4,616,145.0 Hz. It applies a Gaussian probe pulse on q2_drive\n// with complex amplitude 0.35, duration 157 dt, and sigma 72 dt. Inside a readout-ring window\n// labeled RO_RING, it plays a constant measurement pulse of amplitude 0.2 on q2_meas for 449\n// dt and simultaneously captures the response on q2_acq to produce a single classical bit\n// result. Finally, it restores q2_drive to the original saved frequency and stores the\n// captured bit into bg_m at index 2.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000018\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 4.656638e9;\nconst float meas_freq_0 = 6.498025e9;\nconst float drive_freq_1 = 5.634834e9;\nconst float meas_freq_1 = 6.094448e9;\nconst float drive_freq_2 = 5.188005e9;\nconst float meas_freq_2 = 6.533960e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, -0.564055);\n set_frequency(q2_drive, (get_frequency(q2_drive) + -1367138.0));\n delay[11dt] q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\ncz q[2], q[1];\nrz(0.442467) q[2];\ndelay[56ns] q[0];\ncz q[2], q[1];\nrx(0.253606) q[1];\nx q[1];\ns q[1];\ncx q[1], q[2];\ncz q[0], q[1];\nswap q[1], q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// calibration_hot_swap_local_override | retune_frequency_then_probe: Temporarily retune drive frequency, play a probe pulse, then measure in a gated window.\nfloat[64] __cx_f0;\ncal { __cx_f0 = get_frequency(q2_drive); set_frequency(q2_drive, __cx_f0 + -4616145.0); }\ncal {\n waveform __cx_p = gaussian(0.35+0.0im, 157dt, 72dt);\n play(q2_drive, __cx_p);\n}\nbit __cx_m;\nbox[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 449dt); play(q2_meas, __cx_ro); __cx_m = capture(q2_acq, __cx_ro); } }\ncal { set_frequency(q2_drive, __cx_f0); }\nbg_m[2] = __cx_m;\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// calibration_hot_swap_local_override | retune_frequency_then_probe: Temporarily retune drive frequency, play a probe pulse, then measure in a gated window.\nfloat[64] __cx_f0;\ncal { __cx_f0 = get_frequency(q2_drive); set_frequency(q2_drive, __cx_f0 + -4616145.0); }\ncal {\n waveform __cx_p = gaussian(0.35+0.0im, 157dt, 72dt);\n play(q2_drive, __cx_p);\n}\nbit __cx_m;\nbox[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 449dt); play(q2_meas, __cx_ro); __cx_m = capture(q2_acq, __cx_ro); } }\ncal { set_frequency(q2_drive, __cx_f0); }\nbg_m[2] = __cx_m;\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_19", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000019\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.142185e9;\nconst float meas_freq_0 = 6.859238e9;\nconst float drive_freq_1 = 6.193450e9;\nconst float meas_freq_1 = 7.383313e9;\nconst float drive_freq_2 = 5.059220e9;\nconst float meas_freq_2 = 6.006984e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.697149);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -3044711.0));\n delay[33dt] q0_drive;\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[0], q[2];\ncx q[1], q[2];\ncx q[0], q[1];\nrx(0.991270) q[1];\nswap q[2], q[0];\ncx q[2], q[1];\ntdg q[0];\nrx(-0.553815) q[1];\nrz(0.266683) q[0];\ncz q[1], q[0];\ny q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet first computes a duration value named __cx_d as the execution time of an X\n// rotation on qubit q2 with angle −0.845523, and then applies that same rx rotation to q2. It\n// then opens a timed control window whose length is exactly __cx_d: inside this window, it\n// plays a Gaussian-shaped complex drive pulse of amplitude 0.25 on the q2_drive frame with\n// total duration __cx_d and sigma 20 dt, while simultaneously inserting a stretchable delay\n// __cx_s on qubit q0 to fill/align timing. Finally, it enforces a barrier across all qubits q\n// to prevent subsequent operations from being scheduled across this aligned window.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000019\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.142185e9;\nconst float meas_freq_0 = 6.859238e9;\nconst float drive_freq_1 = 6.193450e9;\nconst float meas_freq_1 = 7.383313e9;\nconst float drive_freq_2 = 5.059220e9;\nconst float meas_freq_2 = 6.006984e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.697149);\n set_frequency(q0_drive, (get_frequency(q0_drive) + -3044711.0));\n delay[33dt] q0_drive;\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[0], q[2];\ncx q[1], q[2];\ncx q[0], q[1];\nrx(0.991270) q[1];\nswap q[2], q[0];\ncx q[2], q[1];\ntdg q[0];\nrx(-0.553815) q[1];\nrz(0.266683) q[0];\ncz q[1], q[0];\ny q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// durationof_alignment_scheduling | match_rotary_to_gate_duration: Compute durationof a parametric gate, then stretch a pulse box to match that duration (rotary fill).\nduration __cx_d;\n__cx_d = durationof({ rx(-0.845523) q[2]; });\nrx(-0.845523) q[2];\nstretch __cx_s;\nbox[__cx_d] {\n cal {\n waveform __cx_w = gaussian(0.25+0.0im, __cx_d, 20dt);\n play(q2_drive, __cx_w);\n }\n delay[__cx_s] q[0];\n}\nbarrier q;\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// durationof_alignment_scheduling | match_rotary_to_gate_duration: Compute durationof a parametric gate, then stretch a pulse box to match that duration (rotary fill).\nduration __cx_d;\n__cx_d = durationof({ rx(-0.845523) q[2]; });\nrx(-0.845523) q[2];\nstretch __cx_s;\nbox[__cx_d] {\n cal {\n waveform __cx_w = gaussian(0.25+0.0im, __cx_d, 20dt);\n play(q2_drive, __cx_w);\n }\n delay[__cx_s] q[0];\n}\nbarrier q;\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_20", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000020\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.154942e9;\nconst float meas_freq_0 = 6.057337e9;\nconst float drive_freq_1 = 5.408822e9;\nconst float meas_freq_1 = 6.667478e9;\nconst float drive_freq_2 = 5.750346e9;\nconst float meas_freq_2 = 6.738436e9;\nconst float drive_freq_3 = 6.589266e9;\nconst float meas_freq_3 = 6.956741e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.606329);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 156209.0));\n delay[19dt] q0_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nz q[3];\nx q[3];\nswap q[2], q[1];\nry(-1.126472) q[3];\nrz(-0.321515) q[1];\nsdg q[2];\nswap q[1], q[2];\ntdg q[2];\nrx(0.464237) q[1];\nt q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Inside a fixed-duration control window BOX_WIN, the program applies an XY4-style dynamical\n// decoupling sequence to qubit 2 using its drive frame q2_drive. It defines two identical\n// Gaussian control pulses with complex amplitude 0.85, duration 180 dt, and sigma 59 dt, and\n// plays them as an X, then a Y, then an X, then a Y pulse by shifting the drive phase by plus\n// pi over 2 and minus pi over 2 to switch between X and Y axes. Between each pulse it inserts\n// an equalized idle gap of length __cx_g, where __cx_g is a stretched duration chosen to make\n// the inter-pulse spacings fit evenly within the box. After the four pulses, it adds one more\n// delay of length __cx_g on qubit 2 to complete the timing within the same BOX_WIN window.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000020\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.154942e9;\nconst float meas_freq_0 = 6.057337e9;\nconst float drive_freq_1 = 5.408822e9;\nconst float meas_freq_1 = 6.667478e9;\nconst float drive_freq_2 = 5.750346e9;\nconst float meas_freq_2 = 6.738436e9;\nconst float drive_freq_3 = 6.589266e9;\nconst float meas_freq_3 = 6.956741e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.606329);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 156209.0));\n delay[19dt] q0_drive;\n barrier q0_drive, q1_drive, q2_drive, q3_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nz q[3];\nx q[3];\nswap q[2], q[1];\nry(-1.126472) q[3];\nrz(-0.321515) q[1];\nsdg q[2];\nswap q[1], q[2];\ntdg q[2];\nrx(0.464237) q[1];\nt q[2];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// boxed_dynamic_decoupling | xy4_in_box: XY4-like decoupling sequence inside a fixed box using stretch to equalize gaps (<=4 pulses).\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_x = gaussian(0.85+0.0im, 180dt, 59dt);\n waveform __cx_y = gaussian(0.85+0.0im, 180dt, 59dt);\n play(q2_drive, __cx_x);\n delay[__cx_g] q2_drive;\n shift_phase(q2_drive, 1.570796); play(q2_drive, __cx_y);\n delay[__cx_g] q2_drive;\n shift_phase(q2_drive, -1.570796); play(q2_drive, __cx_x);\n delay[__cx_g] q2_drive;\n shift_phase(q2_drive, 1.570796); play(q2_drive, __cx_y);\n }\n delay[__cx_g] q[2];\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// boxed_dynamic_decoupling | xy4_in_box: XY4-like decoupling sequence inside a fixed box using stretch to equalize gaps (<=4 pulses).\nstretch __cx_g;\nbox[BOX_WIN] {\n cal {\n waveform __cx_x = gaussian(0.85+0.0im, 180dt, 59dt);\n waveform __cx_y = gaussian(0.85+0.0im, 180dt, 59dt);\n play(q2_drive, __cx_x);\n delay[__cx_g] q2_drive;\n shift_phase(q2_drive, 1.570796); play(q2_drive, __cx_y);\n delay[__cx_g] q2_drive;\n shift_phase(q2_drive, -1.570796); play(q2_drive, __cx_x);\n delay[__cx_g] q2_drive;\n shift_phase(q2_drive, 1.570796); play(q2_drive, __cx_y);\n }\n delay[__cx_g] q[2];\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_21", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000021\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.751792e9;\nconst float meas_freq_0 = 6.781803e9;\nconst float drive_freq_1 = 5.026857e9;\nconst float meas_freq_1 = 7.069423e9;\nconst float drive_freq_2 = 4.621962e9;\nconst float meas_freq_2 = 6.523306e9;\nconst float drive_freq_3 = 6.036769e9;\nconst float meas_freq_3 = 7.229985e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, -0.383929);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 389389.0));\n delay[20dt] q2_drive;\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.980867) q[2];\nrz(-0.887543) q[3];\nrx(-0.746518) q[0];\ncx q[3], q[1];\ncx q[2], q[1];\nswap q[3], q[1];\nswap q[2], q[3];\nbarrier q;\nz q[1];\nry(0.871399) q[2];\nx q[2];\nrz(0.499463) q[1];\nry(-0.270408) q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): Within a readout-ring timing box named RO_RING, the program performs simultaneous-style\n// readout on qubits 2 and 1 by playing a constant measurement pulse of complex amplitude 0.2\n// plus 0.0i and duration 247 dt on the q2_meas and q1_meas frames, and capturing one bit from\n// the corresponding acquisition frames q2_acq and q1_acq into the classical bits __cx_m0 and\n// __cx_m1. It then encodes these two measurement outcomes into a 32-bit integer __cx_code by\n// placing __cx_m0 as the high bit and __cx_m1 as the low bit. A switch on this 2-bit code\n// applies a conditional correction: code 0 applies an X on q2, code 1 applies a Z on q2, code\n// 2 applies an X on q1, and any other code applies a Z on q1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000021\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 6.751792e9;\nconst float meas_freq_0 = 6.781803e9;\nconst float drive_freq_1 = 5.026857e9;\nconst float meas_freq_1 = 7.069423e9;\nconst float drive_freq_2 = 4.621962e9;\nconst float meas_freq_2 = 6.523306e9;\nconst float drive_freq_3 = 6.036769e9;\nconst float meas_freq_3 = 7.229985e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q2_drive, -0.383929);\n set_frequency(q2_drive, (get_frequency(q2_drive) + 389389.0));\n delay[20dt] q2_drive;\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.980867) q[2];\nrz(-0.887543) q[3];\nrx(-0.746518) q[0];\ncx q[3], q[1];\ncx q[2], q[1];\nswap q[3], q[1];\nswap q[2], q[3];\nbarrier q;\nz q[1];\nry(0.871399) q[2];\nx q[2];\nrz(0.499463) q[1];\nry(-0.270408) q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// switch_routed_feedforward | two_bit_code_switch: Capture two bits, encode into int, and route to different corrective pulses via switch/case.\nbit __cx_m0;\nbit __cx_m1;\nint[32] __cx_code;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 247dt);\n play(q2_meas, __cx_ro); __cx_m0 = capture(q2_acq, __cx_ro);\n play(q1_meas, __cx_ro); __cx_m1 = capture(q1_acq, __cx_ro);\n }\n}\n__cx_code = (int(__cx_m0) << 1) | int(__cx_m1);\nswitch (__cx_code) {\n case 0 { x q[2]; }\n case 1 { z q[2]; }\n case 2 { x q[1]; }\n default { z q[1]; }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// switch_routed_feedforward | two_bit_code_switch: Capture two bits, encode into int, and route to different corrective pulses via switch/case.\nbit __cx_m0;\nbit __cx_m1;\nint[32] __cx_code;\nbox[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.2+0.0im, 247dt);\n play(q2_meas, __cx_ro); __cx_m0 = capture(q2_acq, __cx_ro);\n play(q1_meas, __cx_ro); __cx_m1 = capture(q1_acq, __cx_ro);\n }\n}\n__cx_code = (int(__cx_m0) << 1) | int(__cx_m1);\nswitch (__cx_code) {\n case 0 { x q[2]; }\n case 1 { z q[2]; }\n case 2 { x q[1]; }\n default { z q[1]; }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_22", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000022\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.775184e9;\nconst float meas_freq_0 = 7.074431e9;\nconst float drive_freq_1 = 5.544079e9;\nconst float meas_freq_1 = 7.260550e9;\nconst float drive_freq_2 = 4.869178e9;\nconst float meas_freq_2 = 7.283171e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.742226) q[2];\ns q[2];\ncz q[2], q[0];\nrx(-0.385037) q[2];\ncx q[0], q[2];\nry(0.142924) q[1];\nsdg q[2];\nt q[1];\ndelay[47ns] q[1];\nswap q[0], q[2];\nry(-0.834561) q[2];\ncz q[1], q[0];\ncz q[0], q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs in-shot micro-averaged readout of qubit 0 by repeating a short\n// measurement up to five times and then taking a majority vote. It initializes a 32-bit\n// integer accumulator to zero, and for each of five iterations it enters a readout ring\n// window, plays a constant measurement pulse of complex amplitude 0.18 on the q0 measurement\n// frame for 346 dt, and captures a single bit from the q0 acquisition frame using the same\n// waveform as the capture filter. After each capture, it adds the captured bit value to the\n// accumulator and inserts a 11 dt delay on qubit 0 before the next mini-readout. Finally, it\n// sets the classical result bg_m[0] to true if at least 3 of the 5 captured bits were 1,\n// implementing a 5-sample majority vote.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000022\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.775184e9;\nconst float meas_freq_0 = 7.074431e9;\nconst float drive_freq_1 = 5.544079e9;\nconst float meas_freq_1 = 7.260550e9;\nconst float drive_freq_2 = 4.869178e9;\nconst float meas_freq_2 = 7.283171e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n barrier q0_drive, q1_drive, q2_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.742226) q[2];\ns q[2];\ncz q[2], q[0];\nrx(-0.385037) q[2];\ncx q[0], q[2];\nry(0.142924) q[1];\nsdg q[2];\nt q[1];\ndelay[47ns] q[1];\nswap q[0], q[2];\nry(-0.834561) q[2];\ncz q[1], q[0];\ncz q[0], q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// in_shot_micro_averaging | majority_vote_5: Take <=5 short readouts in one shot, sum bits, and majority-vote into bg_m.\nint[32] __cx_sum;\nbit __cx_b;\n__cx_sum = 0;\nfor int __cx_k in {0,1,2,3,4} {\n box[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.18+0.0im, 346dt);\n play(q0_meas, __cx_ro);\n __cx_b = capture(q0_acq, __cx_ro);\n }\n }\n __cx_sum = __cx_sum + int(__cx_b);\n delay[11dt] q[0];\n}\nbg_m[0] = (__cx_sum >= 3);\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// in_shot_micro_averaging | majority_vote_5: Take <=5 short readouts in one shot, sum bits, and majority-vote into bg_m.\nint[32] __cx_sum;\nbit __cx_b;\n__cx_sum = 0;\nfor int __cx_k in {0,1,2,3,4} {\n box[RO_RING] {\n cal {\n waveform __cx_ro = constant(0.18+0.0im, 346dt);\n play(q0_meas, __cx_ro);\n __cx_b = capture(q0_acq, __cx_ro);\n }\n }\n __cx_sum = __cx_sum + int(__cx_b);\n delay[11dt] q[0];\n}\nbg_m[0] = (__cx_sum >= 3);\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_23", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000023\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.526581e9;\nconst float meas_freq_0 = 6.172911e9;\nconst float drive_freq_1 = 4.877104e9;\nconst float meas_freq_1 = 6.445530e9;\nconst float drive_freq_2 = 6.622207e9;\nconst float meas_freq_2 = 6.549556e9;\nconst float drive_freq_3 = 4.933233e9;\nconst float meas_freq_3 = 6.396270e9;\nconst float drive_freq_4 = 5.262015e9;\nconst float meas_freq_4 = 7.118465e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q4_drive, -0.418824);\n set_frequency(q4_drive, (get_frequency(q4_drive) + -1689765.0));\n delay[35dt] q4_drive;\n barrier q2_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.001964) q[2];\ntdg q[2];\ncz q[1], q[2];\nswap q[1], q[4];\nry(1.129796) q[0];\ny q[0];\ncz q[1], q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs a readout of qubit 2 by opening a dedicated readout ring window\n// RO_RING, playing a constant measurement pulse of complex amplitude 0.2 for 288 dt on the\n// q2_meas frame, and capturing the response on the q2_acq frame into the classical bit __cx_m.\n// It then enters a fixed-duration control window BOX_WIN on qubit 2 and inserts a variable\n// delay __cx_pad so that any subsequent action can be right-aligned as late as possible within\n// that window. If the captured bit __cx_m is true, it applies a corrective drive pulse on the\n// q2_drive frame: a Gaussian waveform with amplitude 0.85, duration 73 dt, and sigma 40 dt. If\n// __cx_m is false, only the padding delay occurs and no corrective pulse is played.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000023\n// Contains: timing + classical + openpulse resources\n\nqubit[5] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[5] bg_m;\nbit[5] bg_m2;\nbit[5] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.526581e9;\nconst float meas_freq_0 = 6.172911e9;\nconst float drive_freq_1 = 4.877104e9;\nconst float meas_freq_1 = 6.445530e9;\nconst float drive_freq_2 = 6.622207e9;\nconst float meas_freq_2 = 6.549556e9;\nconst float drive_freq_3 = 4.933233e9;\nconst float meas_freq_3 = 6.396270e9;\nconst float drive_freq_4 = 5.262015e9;\nconst float meas_freq_4 = 7.118465e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n extern port d4;\n extern port m4;\n extern port a4;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n frame q4_drive = newframe(d4, drive_freq_4, 0.0);\n frame q4_meas = newframe(m4, meas_freq_4, 0.0);\n frame q4_acq = newframe(a4, meas_freq_4, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q4_drive, -0.418824);\n set_frequency(q4_drive, (get_frequency(q4_drive) + -1689765.0));\n delay[35dt] q4_drive;\n barrier q2_drive, q4_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\nbg_m[4] = 0;\nbg_m2[4] = 0;\nsyndrome_b[4] = 0;\n\n// --- gate-level + timing background circuit ---\nrz(-0.001964) q[2];\ntdg q[2];\ncz q[1], q[2];\nswap q[1], q[4];\nry(1.129796) q[0];\ny q[0];\ncz q[1], q[0];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// late_as_possible_conditional | right_align_correction: Measure first, then in a fixed BOX_WIN right-align a corrective pulse using stretch (late as possible).\nbit __cx_m;\nbox[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 288dt); play(q2_meas, __cx_ro); __cx_m = capture(q2_acq, __cx_ro); } }\nstretch __cx_pad;\nbox[BOX_WIN] {\n delay[__cx_pad] q[2];\n if (__cx_m) {\n cal {\n waveform __cx_p = gaussian(0.85+0.0im, 73dt, 40dt);\n play(q2_drive, __cx_p);\n }\n }\n}\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[5] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n__cc_out[4] = measure q[4];\n// === MEASUREMENT_END ===\n", "completion": "// late_as_possible_conditional | right_align_correction: Measure first, then in a fixed BOX_WIN right-align a corrective pulse using stretch (late as possible).\nbit __cx_m;\nbox[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 288dt); play(q2_meas, __cx_ro); __cx_m = capture(q2_acq, __cx_ro); } }\nstretch __cx_pad;\nbox[BOX_WIN] {\n delay[__cx_pad] q[2];\n if (__cx_m) {\n cal {\n waveform __cx_p = gaussian(0.85+0.0im, 73dt, 40dt);\n play(q2_drive, __cx_p);\n }\n }\n}\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_24", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000024\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.373352e9;\nconst float meas_freq_0 = 6.181034e9;\nconst float drive_freq_1 = 6.468834e9;\nconst float meas_freq_1 = 6.275584e9;\nconst float drive_freq_2 = 6.362729e9;\nconst float meas_freq_2 = 6.179321e9;\nconst float drive_freq_3 = 5.066771e9;\nconst float meas_freq_3 = 7.387105e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q1_drive, 0.115357);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -2950827.0));\n delay[22dt] q1_drive;\n barrier q0_drive, q1_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[0], q[3];\ndelay[17ns] q[1];\nswap q[0], q[3];\nsdg q[1];\ncz q[1], q[3];\ns q[2];\nt q[3];\ncz q[2], q[3];\nrx(0.527952) q[2];\nrz(0.914001) q[2];\ntdg q[0];\ndelay[58dt] q[1];\nz q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet performs an active reset loop on qubit 1, attempting up to 6 iterations tracked\n// by the 32-bit counter __cx_left. In each iteration it runs a readout ring box of duration\n// RO_RING by playing a constant measurement pulse of complex amplitude 0.2 on the q1_meas\n// frame for 289 dt and capturing the response on the q1_acq frame into the bit __cx_m; if the\n// captured bit indicates success, the loop exits early. If the measurement indicates failure,\n// it updates the floating-point variable gain using adaptive_update with inputs step, the\n// remaining-tries counter, and the current gain, then applies a Gaussian drive pulse on\n// q1_drive with duration 125 dt and sigma 40 dt whose amplitude is 0.85 scaled by the updated\n// gain, followed by a 20 dt delay on qubit 1 before decrementing the remaining-tries counter.\n// After the loop finishes, it stores the final measurement result __cx_m into bg_m at index 1.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000024\n// Contains: timing + classical + openpulse resources\n\nqubit[4] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[4] bg_m;\nbit[4] bg_m2;\nbit[4] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.373352e9;\nconst float meas_freq_0 = 6.181034e9;\nconst float drive_freq_1 = 6.468834e9;\nconst float meas_freq_1 = 6.275584e9;\nconst float drive_freq_2 = 6.362729e9;\nconst float meas_freq_2 = 6.179321e9;\nconst float drive_freq_3 = 5.066771e9;\nconst float meas_freq_3 = 7.387105e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n extern port d3;\n extern port m3;\n extern port a3;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n frame q3_drive = newframe(d3, drive_freq_3, 0.0);\n frame q3_meas = newframe(m3, meas_freq_3, 0.0);\n frame q3_acq = newframe(a3, meas_freq_3, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q1_drive, 0.115357);\n set_frequency(q1_drive, (get_frequency(q1_drive) + -2950827.0));\n delay[22dt] q1_drive;\n barrier q0_drive, q1_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\nbg_m[3] = 0;\nbg_m2[3] = 0;\nsyndrome_b[3] = 0;\n\n// --- gate-level + timing background circuit ---\nswap q[0], q[3];\ndelay[17ns] q[1];\nswap q[0], q[3];\nsdg q[1];\ncz q[1], q[3];\ns q[2];\nt q[3];\ncz q[2], q[3];\nrx(0.527952) q[2];\nrz(0.914001) q[2];\ntdg q[0];\ndelay[58dt] q[1];\nz q[1];\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// timeout_active_reset_with_update | bounded_tries_timeout: Try active reset up to 6 times; each iteration updates gain via adaptive_update; stop early on success.\nbit __cx_m;\nint[32] __cx_left;\n__cx_left = 6;\nwhile (__cx_left > 0) {\n box[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 289dt); play(q1_meas, __cx_ro); __cx_m = capture(q1_acq, __cx_ro); } }\n if (!__cx_m) { break; }\n gain = adaptive_update(step, __cx_left, gain);\n cal { waveform __cx_x = gaussian(scale(0.85+0.0im, gain), 125dt, 40dt); play(q1_drive, __cx_x); }\n __cx_left = __cx_left - 1;\n delay[20dt] q[1];\n}\nbg_m[1] = __cx_m;\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[4] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n__cc_out[3] = measure q[3];\n// === MEASUREMENT_END ===\n", "completion": "// timeout_active_reset_with_update | bounded_tries_timeout: Try active reset up to 6 times; each iteration updates gain via adaptive_update; stop early on success.\nbit __cx_m;\nint[32] __cx_left;\n__cx_left = 6;\nwhile (__cx_left > 0) {\n box[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 289dt); play(q1_meas, __cx_ro); __cx_m = capture(q1_acq, __cx_ro); } }\n if (!__cx_m) { break; }\n gain = adaptive_update(step, __cx_left, gain);\n cal { waveform __cx_x = gaussian(scale(0.85+0.0im, gain), 125dt, 40dt); play(q1_drive, __cx_x); }\n __cx_left = __cx_left - 1;\n delay[20dt] q[1];\n}\nbg_m[1] = __cx_m;\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"} {"task_id": "complex_test/complex_task_25", "domain": "complex", "prompt": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000025\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.277573e9;\nconst float meas_freq_0 = 6.692865e9;\nconst float drive_freq_1 = 6.275991e9;\nconst float meas_freq_1 = 7.306481e9;\nconst float drive_freq_2 = 5.053938e9;\nconst float meas_freq_2 = 6.776574e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.532840);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 2315236.0));\n delay[34dt] q0_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nrx(1.185801) q[1];\nrz(-0.015988) q[2];\nry(1.154772) q[1];\ndelay[21ns] q[0];\nsdg q[2];\nrx(-1.087586) q[2];\ncz q[1], q[2];\ncx q[1], q[2];\ny q[0];\nrx(-0.887737) q[0];\nry(0.564654) q[1];\nswap q[1], q[2];\ncz q[2], q[0];\nbarrier q;\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// TODO(core task): The snippet uses qubit q0 as an ancilla to perform a toy parity-check–like syndrome\n// extraction on data qubits q1 and q2: it applies a Hadamard to q0, then two controlled-NOTs\n// from q0 onto q1 and q2, and inserts a barrier across all qubits. It then runs a readout-ring\n// window in calibration space where a constant measurement pulse of complex amplitude 0.2 and\n// duration 274 dt is played on the q0 measurement frame and the response is captured on the q0\n// acquisition frame into a temporary bit. That captured syndrome bit is stored into syndrome_b\n// at index 0, and if it is 1 an X correction is applied to q1. Finally, q2 is padded with an\n// explicit idle delay of 51 dt to help align scheduling.\n\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n\n// Task: Fill in the core task. Output ONLY the QASM statements that should appear\n// between CORE_TASK_START and CORE_TASK_END. Do not output the markers or any explanation.\n", "canonical_solution": "OPENQASM 3;\ninclude \"stdgates.inc\";\n\n// Complex background 000025\n// Contains: timing + classical + openpulse resources\n\nqubit[3] q;\n\n// ---- classical registers / counters (available to core tasks) ----\nbit[3] bg_m;\nbit[3] bg_m2;\nbit[3] syndrome_b;\nbool flag;\nint[32] i;\nint[32] step;\nint[32] tries;\nint[32] pc;\nuint[32] mask;\nfloat[64] gain;\n\n// One generic extern hook for 'controller-side' update logic\nextern adaptive_update(int[32], int[32], float[64]) -> float[64];\n\n// ---- timing-friendly constants (core tasks may reuse) ----\nconst duration BG_IDLE = 52ns;\nconst duration RO_RING = 37us;\nconst duration BOX_WIN = 251dt;\n\ndefcalgrammar \"openpulse\";\n\nconst float drive_freq_0 = 5.277573e9;\nconst float meas_freq_0 = 6.692865e9;\nconst float drive_freq_1 = 6.275991e9;\nconst float meas_freq_1 = 7.306481e9;\nconst float drive_freq_2 = 5.053938e9;\nconst float meas_freq_2 = 6.776574e9;\n\ncal {\n // --- declare ports ---\n extern port d0;\n extern port m0;\n extern port a0;\n extern port d1;\n extern port m1;\n extern port a1;\n extern port d2;\n extern port m2;\n extern port a2;\n\n // --- extern waveform templates (common) ---\n extern gaussian(complex[float[32]] amp, duration d, duration sigma) -> waveform;\n extern drag(complex[float[32]] amp, duration d, duration sigma, float[32] beta) -> waveform;\n extern constant(complex[float[32]] amp, duration d) -> waveform;\n extern sine(complex[float[32]] amp, duration d, float[64] frequency, angle phase) -> waveform;\n extern gaussian_square(complex[float[32]] amp, duration d, duration square_width, duration sigma) -> waveform;\n\n // --- extern capture/discriminate hooks (for measure-style tasks) ---\n extern capture(frame capture_frame, waveform filter) -> bit;\n extern capture_v1(frame capture_frame, duration d) -> waveform;\n extern discriminate(complex[float[64]] iq) -> bit;\n\n // --- create frames ---\n frame q0_drive = newframe(d0, drive_freq_0, 0.0);\n frame q0_meas = newframe(m0, meas_freq_0, 0.0);\n frame q0_acq = newframe(a0, meas_freq_0, 0.0);\n frame q1_drive = newframe(d1, drive_freq_1, 0.0);\n frame q1_meas = newframe(m1, meas_freq_1, 0.0);\n frame q1_acq = newframe(a1, meas_freq_1, 0.0);\n frame q2_drive = newframe(d2, drive_freq_2, 0.0);\n frame q2_meas = newframe(m2, meas_freq_2, 0.0);\n frame q2_acq = newframe(a2, meas_freq_2, 0.0);\n\n // --- background pulse actions (VERY LIGHTWEIGHT; no play) ---\n shift_phase(q0_drive, 0.532840);\n set_frequency(q0_drive, (get_frequency(q0_drive) + 2315236.0));\n delay[34dt] q0_drive;\n}\n\n// --- classical init (lightweight) ---\nflag = false;\nstep = 0;\ntries = 0;\npc = 0;\nmask = 0;\ngain = 1.0;\nbg_m[0] = 0;\nbg_m2[0] = 0;\nsyndrome_b[0] = 0;\nbg_m[1] = 0;\nbg_m2[1] = 0;\nsyndrome_b[1] = 0;\nbg_m[2] = 0;\nbg_m2[2] = 0;\nsyndrome_b[2] = 0;\n\n// --- gate-level + timing background circuit ---\nrx(1.185801) q[1];\nrz(-0.015988) q[2];\nry(1.154772) q[1];\ndelay[21ns] q[0];\nsdg q[2];\nrx(-1.087586) q[2];\ncz q[1], q[2];\ncx q[1], q[2];\ny q[0];\nrx(-0.887737) q[0];\nry(0.564654) q[1];\nswap q[1], q[2];\ncz q[2], q[0];\nbarrier q;\n\n// --- timing context: a fixed control window (for DD / readout ring) ---\nbox[BOX_WIN] {\n delay[BG_IDLE] q[0];\n // independent idle on another qubit to encourage parallel scheduling\n delay[BG_IDLE] q[1];\n}\n\n// === CORE_TASK_START ===\n// syndrome_feedforward_idle_scheduling | parity_check_like: Toy parity-check: entangle ancilla, measure syndrome, feedforward X on a data qubit; schedule idle padding.\nh q[0];\ncx q[0], q[1];\ncx q[0], q[2];\nbarrier q;\nbit __cx_s;\nbox[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 274dt); play(q0_meas, __cx_ro); __cx_s = capture(q0_acq, __cx_ro); } }\nsyndrome_b[0] = __cx_s;\nif (__cx_s) {\n x q[1];\n}\ndelay[51dt] q[2];\n// === CORE_TASK_END ===\n\n// === MEASUREMENT_START ===\nbit[3] __cc_out;\n__cc_out[0] = measure q[0];\n__cc_out[1] = measure q[1];\n__cc_out[2] = measure q[2];\n// === MEASUREMENT_END ===\n", "completion": "// syndrome_feedforward_idle_scheduling | parity_check_like: Toy parity-check: entangle ancilla, measure syndrome, feedforward X on a data qubit; schedule idle padding.\nh q[0];\ncx q[0], q[1];\ncx q[0], q[2];\nbarrier q;\nbit __cx_s;\nbox[RO_RING] { cal { waveform __cx_ro = constant(0.2+0.0im, 274dt); play(q0_meas, __cx_ro); __cx_s = capture(q0_acq, __cx_ro); } }\nsyndrome_b[0] = __cx_s;\nif (__cx_s) {\n x q[1];\n}\ndelay[51dt] q[2];\n", "test": "from scripts.evaluator import evaluate_qasm_completion\n\n\ndef check(returned_code, golden_code, domain=None):\n \"\"\"Return True when returned_code has the correct QASM timeline/distribution.\"\"\"\n return evaluate_qasm_completion(\n golden_code=golden_code,\n returned_code=returned_code,\n domain=domain,\n ).ok\n"}