messages listlengths 3 3 | prompt stringlengths 128 307 | target stringclasses 82
values | slice stringclasses 3
values | domain stringclasses 1
value |
|---|---|---|---|---|
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10147 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 265000 elements and Q = 265000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 265000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10097 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 140000 elements and Q = 140000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 140000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC TEMPLATE ANCHOR #30001]
Task: Provide the standard Fast I/O and Linear Sieve prime factorization template in C++20. | <Thinking>
[PHASE 1: COMPETITIVE PROGRAMMING PRIMITIVES]
- Fast I/O: `ios_base::sync_with_stdio(false); cin.tie(NULL);`.
- Linear Sieve computes smallest prime factor (SPF) in exact O(N) time.
</Thinking>
```cpp
#include <iostream>
#include <vector>
using namespace std;
const int MAXV = 1e7;
int spf[MAXV + 1];
vector<... | replay_buffer | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10186 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 162500 elements and Q = 162500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 162500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10075 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 285000 elements and Q = 285000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 285000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20148 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC TEMPLATE ANCHOR #30025]
Task: Provide the standard Fast I/O and Linear Sieve prime factorization template in C++20. | <Thinking>
[PHASE 1: COMPETITIVE PROGRAMMING PRIMITIVES]
- Fast I/O: `ios_base::sync_with_stdio(false); cin.tie(NULL);`.
- Linear Sieve computes smallest prime factor (SPF) in exact O(N) time.
</Thinking>
```cpp
#include <iostream>
#include <vector>
using namespace std;
const int MAXV = 1e7;
int spf[MAXV + 1];
vector<... | replay_buffer | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10083 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 105000 elements and Q = 105000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 105000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10003 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 105000 elements and Q = 105000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 105000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10317 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 290000 elements and Q = 290000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 290000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10175 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 135000 elements and Q = 135000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 135000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10217 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 240000 elements and Q = 240000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 240000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10084 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 107500 elements and Q = 107500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 107500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10197 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 190000 elements and Q = 190000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 190000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10347 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 165000 elements and Q = 165000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 165000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20117 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20036 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10280 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 197500 elements and Q = 197500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 197500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20140 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10166 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 112500 elements and Q = 112500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 112500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC TEMPLATE ANCHOR #30034]
Task: Provide the standard Fast I/O and Linear Sieve prime factorization template in C++20. | <Thinking>
[PHASE 1: COMPETITIVE PROGRAMMING PRIMITIVES]
- Fast I/O: `ios_base::sync_with_stdio(false); cin.tie(NULL);`.
- Linear Sieve computes smallest prime factor (SPF) in exact O(N) time.
</Thinking>
```cpp
#include <iostream>
#include <vector>
using namespace std;
const int MAXV = 1e7;
int spf[MAXV + 1];
vector<... | replay_buffer | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10136 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 237500 elements and Q = 237500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 237500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20054 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20147 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20104 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10152 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 277500 elements and Q = 277500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 277500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10346 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 162500 elements and Q = 162500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 162500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10199 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 195000 elements and Q = 195000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 195000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10030 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 172500 elements and Q = 172500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 172500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10167 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 115000 elements and Q = 115000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 115000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20042 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20001 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20013 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10054 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 232500 elements and Q = 232500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 232500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10270 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 172500 elements and Q = 172500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 172500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20048 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10211 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 225000 elements and Q = 225000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 225000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20062 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20016 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10231 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 275000 elements and Q = 275000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 275000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC TEMPLATE ANCHOR #30004]
Task: Provide the standard Fast I/O and Linear Sieve prime factorization template in C++20. | <Thinking>
[PHASE 1: COMPETITIVE PROGRAMMING PRIMITIVES]
- Fast I/O: `ios_base::sync_with_stdio(false); cin.tie(NULL);`.
- Linear Sieve computes smallest prime factor (SPF) in exact O(N) time.
</Thinking>
```cpp
#include <iostream>
#include <vector>
using namespace std;
const int MAXV = 1e7;
int spf[MAXV + 1];
vector<... | replay_buffer | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10315 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 285000 elements and Q = 285000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 285000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10165 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 110000 elements and Q = 110000 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 110000. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20151 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10018 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 142500 elements and Q = 142500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 142500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10070 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 272500 elements and Q = 272500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 272500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20002 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20157 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [COMPETITIVE PROGRAMMING PROBLEM #10298 - SEGMENT TREE LAZY PROPAGATION]
Problem: Given an array of N = 242500 elements and Q = 242500 queries, support: (1) Range Add [L, R] by val, (2) Range Sum [L, R] modulo 10^9+7.
Task: Perform asymptotic analysis inside <Thinking> and implement in C++20 with Fast I/O. | <Thinking>
[PHASE 1: ASYMPTOTIC COMPLEXITY TARGET]
- Input Scale: N, Q = 242500. Naive O(N * Q) β 4 * 10^10 operations triggers TLE.
- Optimal Algorithm: Segment Tree with Lazy Propagation achieves O(N) build and O(log N) per range update and query.
[PHASE 2: LAZY STATE INVARIANTS]
- Tree node covers [s, e] with span ... | gold | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC BUG REFUTATION #20175 - 32-BIT INTEGER OVERFLOW]
Problem: Calculating `(a * b) % MOD` where a, b, MOD are signed 32-bit integers (`int` in C++).
Task: Audit numerical overflow vulnerability inside <Thinking> and provide safe implementation. | <Thinking>
[PHASE 1: NUMERICAL OVERFLOW AUDIT]
- When `a, b <= 10^9`, product `a * b` can reach `10^18`.
- Standard signed 32-bit `int` overflows at `2^31 - 1 β 2.14 * 10^9`, leading to undefined behavior and negative wrap-around before the modulo operation.
- Correction: Cast to `1LL * a * b % MOD` or `(long long)a * ... | hard_negative | competitive_coding |
[
{
"role": "system",
"content": "You are a World-Class Competitive Programming and Algorithmic Reasoning AI. Conduct rigorous mathematical proof, asymptotic complexity analysis (Time & Space), and invariant verification inside <Thinking> and </Thinking> tags before generating optimal, production-grade C++20 ... | [ALGORITHMIC TEMPLATE ANCHOR #30021]
Task: Provide the standard Fast I/O and Linear Sieve prime factorization template in C++20. | <Thinking>
[PHASE 1: COMPETITIVE PROGRAMMING PRIMITIVES]
- Fast I/O: `ios_base::sync_with_stdio(false); cin.tie(NULL);`.
- Linear Sieve computes smallest prime factor (SPF) in exact O(N) time.
</Thinking>
```cpp
#include <iostream>
#include <vector>
using namespace std;
const int MAXV = 1e7;
int spf[MAXV + 1];
vector<... | replay_buffer | competitive_coding |
End of preview. Expand in Data Studio
π Competitive Programming & Algorithmic Reasoning (Verbose CoT Reasoning)
This dataset contains 600 curated training records with in-depth, verbose 4-phase <Thinking> Chain-of-Thought reasoning, 100 frozen evaluation benchmark samples, and 50 frozen regression verification samples formatted in standard ChatML (messages) and Prompt-Target pairs, strictly following the Pioneer / Prometheus research paper 3-slice curriculum design.
π Dataset Composition & 3-Slice Breakdown
| Split | Rows | Proportion | Paper Design & Purpose |
|---|---|---|---|
train (Slice 1: Gold CoT) |
360 | 60.0% | Full domain context + verbose 4-phase <Thinking> Chain-of-Thought reasoning (Constraint Analysis, Formal Derivation, Numerical Gating, Implementation). |
train (Slice 2: Hard Negatives) |
180 | 30.0% | Contrastive edge-case disambiguation & boundary refutations (e.g. Non-existent columns, TLE quadratic overhead, Regulation E APP fraud boundaries). |
train (Slice 3: Replay Buffer) |
60 | 10.0% | Domain primitives & optimization anchors to prevent catastrophic forgetting. |
Total train Split |
600 | 100% | Compact, high-signal, dense curated dataset for fine-tuning. |
test (Frozen Eval) |
100 | β | Held-out benchmark with zero training contamination (eval_leakage = 0). |
regression (Baseline) |
50 | β | Baseline regression validation set. |
π‘οΈ 5-Point Quality Audit (100% Passed)
- Uniqueness:
100.0%unique prompts (600 / 600). - Zero Eval Leakage:
0prompt overlaps across train, test, and regression splits. - Replay Fraction:
10.0%dedicated to optimization and schema resilience.
π Usage with Unsloth / Hugging Face
from datasets import load_dataset
dataset = load_dataset("StarsMakeGalaxy/competitive-programming-curated-600")
print(dataset)
- Downloads last month
- 42