Alphacode Pass 3 Meta
Input: $ARGUMENTS
Overview
Pass 3 reasons about the solution from outside the solution. Catches bugs testing misses: incorrect problem interpretation, flawed greedy proofs, missed constraints, subtle off-by-one errors. Treats the solution as an artifact to audit.
Prerequisite: Complete Pass 1 (/ape) and ideally Pass 2 (/api).
Steps
Step 1: Re-read the Problem Statement
- Read problem statement again, fresh
- Compare your understanding to what’s actually written
- Did you solve the asked problem or a different one?
- Common misreadings: “at most K” vs “exactly K”, “distinct” vs “not necessarily distinct”, 0-indexed vs 1-indexed, “non-decreasing” vs “strictly increasing”
Step 2: Audit Algorithm Correctness
- Greedy: State exchange argument explicitly. Can’t state it? Greedy may be wrong.
- DP: Verify recurrence — base cases, transitions cover all cases, no missing states
- Graph: Verify assumptions — connected? directed? weighted? negative weights?
- Any: Construct a case where it would fail IF wrong. Can’t? Test harder.
Step 3: Check Off-by-One Errors
- Array indexing: 0-based vs 1-based consistency
- Loop bounds:
< Nvs<= N - Binary search:
lo < hivslo <= hi,midvsmid+1 - Interval endpoints: inclusive vs exclusive
- Modular arithmetic:
(a - b) % MODcan be negative
Step 4: Stress Test with Adversarial Inputs
- All elements equal / sorted / reverse sorted
- Maximum values on all constraints simultaneously
- Star graph, chain graph, complete graph
- Single-character strings
- Check: within time? Memory? Output format exact?
Step 5: Consider Alternative Approaches
- Completely different, simpler approach available?
- Worth implementing as cross-check?
- Two approaches agree → high confidence. Disagree → find which is wrong.
Step 6: Confidence Assessment
META-REVIEW:
Problem interpretation: [verified / uncertain at X]
Algorithm correctness: [proven / argued / hoped]
Edge cases: [all covered / gaps at X]
Off-by-one audit: [clean / fixed N issues]
Stress test: [passed / failed at X]
Confidence: [high / medium / low]
Action: [submit / fix X first / rethink]
When to Use
- Before submitting a competitive programming solution
- After Wrong Answer, to find the bug
- When solution passes examples but confidence is low
Verification
- Problem re-read after solution written
- Correctness argued (not just tested)
- Off-by-one systematically checked
- Adversarial inputs tested
- Confidence honestly assessed