FAILURE MAP
← Case archive

FA-5646 / Combinatorics / Open access

Rectangular grid all square count · case 01

Only the unit-square placements are counted.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Only the unit-square placements are counted.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum((rows-s+1)*(cols-s+1) for s in range(1,min(rows,cols)+1))

Unsuccessful approach: The largest square size is excluded from the placement sum.

Case contract

Nonnegative integer counts. Permutation and combination counts are zero when a requested selection exceeds the available objects. Shape sizes satisfy the preconditions stated below. rows and cols are nonnegative cell counts; count all axis-aligned square placements of every positive integer side length. Exact operational definition: sum((rows-s+1)*(cols-s+1) for s in range(1,min(rows,cols)+1))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Combinatorics results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(rows, cols):
    return rows*cols
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 3)', solve(*(2, 3)), 8)
check('fixture 2: (1, 4)', solve(*(1, 4)), 4)
check('fixture 3: (0, 4)', solve(*(0, 4)), 0)
check('fixture 4: (3, 3)', solve(*(3, 3)), 14)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: (2, 3)68Failed
fixture 2: (1, 4)44Passed
fixture 3: (0, 4)00Passed
fixture 4: (3, 3)914Failed

SHA-256 / ef3aadbbabe179e3ada8702c03c071158b2a85ceee590cccb33d4eead2612577

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(rows, cols):
    return sum((rows-s+1)*(cols-s+1) for s in range(1,min(rows,cols)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 3)', solve(*(2, 3)), 8)
check('fixture 2: (1, 4)', solve(*(1, 4)), 4)
check('fixture 3: (0, 4)', solve(*(0, 4)), 0)
check('fixture 4: (3, 3)', solve(*(3, 3)), 14)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: (2, 3)68Failed
fixture 2: (1, 4)04Failed
fixture 3: (0, 4)00Passed
fixture 4: (3, 3)1314Failed

SHA-256 / 980a5bf6b74c97b6f3dce39256de220d25f2412fa6204ee4a08bfc86e6289b38

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(rows, cols):
    return sum((rows-s+1)*(cols-s+1) for s in range(1,min(rows,cols)+1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 3)', solve(*(2, 3)), 8)
check('fixture 2: (1, 4)', solve(*(1, 4)), 4)
check('fixture 3: (0, 4)', solve(*(0, 4)), 0)
check('fixture 4: (3, 3)', solve(*(3, 3)), 14)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: (2, 3)88Passed
fixture 2: (1, 4)44Passed
fixture 3: (0, 4)00Passed
fixture 4: (3, 3)1414Passed

SHA-256 / 500ba89f6207bbc78085b7205e2fcbf2310fc2e6f75fcb25bd224f8c3c292597

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:51.864503+00:00.

Case digest / 5542dfbbf3732136e35bfaf948e1314b5755202ee6347c1307ddc32c9b16335c