FA-95561 / Shipping rate zone lookup / Open access
Hundredweight: many tiny pieces qualify · case 01
Shipments padded with many one-pound pieces reach hundredweight pricing.
ROOT CAUSE
The minimum average piece weight rule is missing.
VERIFIED REPAIR
Require total >= 10 lb times the number of pieces.
Unsuccessful approach: An inclusive average test rejects shipments averaging exactly 10 lb.
Case contract
pieces lb; each piece rounds up to a whole lb and the shipment total is their sum. Qualifies when there are at least 2 pieces, total >= 200 lb and average piece weight >= 10 lb (total >= 10*n); otherwise ["PARCEL", total]. Charge = ceil(total * cents per cwt / 100) for zone (rates list zones 2-8), at least min_piece * pieces. Return [total, charge].
Why this case matters
Hundredweight programs price qualifying multi-piece shipments by aggregate weight.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(pieces, zone, rates, min_piece):
ws = [math.ceil(w) for w in pieces]
total = sum(ws)
n = len(ws)
if n < 2 or total < 200:
return ['PARCEL', total]
rate = rates[zone - 2]
charge = -(-total * rate // 100)
return [total, max(charge, min_piece * n)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['generated mix 6', [[10, 10.4, 10.4], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 500], ['PARCEL', 32]]], [['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['generated mix 9', [[19.2, 19.2], 7, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], ['PARCEL', 40]], ['generated mix 17', [[11, 10], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 21]]], [['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['minimum charge', [[100, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 5000], [200, 10000]], ['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['generated mix 20', [[110.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], ['PARCEL', 111]], ['generated mix 28', [[1.4, 2], 7, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 500], ['PARCEL', 4]]], [['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['minimum charge', [[100, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 5000], [200, 10000]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['generated mix 31', [[100.5, 99.9], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], [201, 11339]], ['generated mix 39', [[40.9, 40.9, 50.5, 40.5, 40.5, 40.5, 40.5, 40.5, 50.5, 40.9, 41.5, 50.5, 40.9, 40.9, 50.5, 40.5, 50.5, 41.5, 40.5, 50.5], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], [882, 60000]]], [['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['generated mix 42', [[76.3, 76.3, 66.3], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], [221, 18000]], ['generated mix 50', [[150, 150], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], [300, 13536]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| light average | [200, 76500] | ['PARCEL', 200] | Failed |
| rounded pieces reach average | [250, 14103] | [250, 14103] | Passed |
| per piece round | [202, 8155] | [202, 8155] | Passed |
| single piece | ['PARCEL', 250] | ['PARCEL', 250] | Passed |
| average exactly 10 | [200, 9024] | [200, 9024] | Passed |
| two exact | [200, 15110] | [200, 15110] | Passed |
| threshold via rounding | [200, 8074] | [200, 8074] | Passed |
| generated mix 6 | ['PARCEL', 32] | ['PARCEL', 32] | Passed |
SHA-256 / f3d4740ed80e32f51b8e79f85c0cad4c9b1805f86c8718e61b9478c3de22c053
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(pieces, zone, rates, min_piece):
ws = [math.ceil(w) for w in pieces]
total = sum(ws)
n = len(ws)
if n < 2 or total < 200 or total / n <= 10:
return ['PARCEL', total]
rate = rates[zone - 2]
charge = -(-total * rate // 100)
return [total, max(charge, min_piece * n)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['generated mix 6', [[10, 10.4, 10.4], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 500], ['PARCEL', 32]]], [['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['generated mix 9', [[19.2, 19.2], 7, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], ['PARCEL', 40]], ['generated mix 17', [[11, 10], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 21]]], [['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['minimum charge', [[100, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 5000], [200, 10000]], ['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['generated mix 20', [[110.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], ['PARCEL', 111]], ['generated mix 28', [[1.4, 2], 7, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 500], ['PARCEL', 4]]], [['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['minimum charge', [[100, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 5000], [200, 10000]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['generated mix 31', [[100.5, 99.9], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], [201, 11339]], ['generated mix 39', [[40.9, 40.9, 50.5, 40.5, 40.5, 40.5, 40.5, 40.5, 50.5, 40.9, 41.5, 50.5, 40.9, 40.9, 50.5, 40.5, 50.5, 41.5, 40.5, 50.5], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], [882, 60000]]], [['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['generated mix 42', [[76.3, 76.3, 66.3], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], [221, 18000]], ['generated mix 50', [[150, 150], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], [300, 13536]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| light average | ['PARCEL', 200] | ['PARCEL', 200] | Passed |
| rounded pieces reach average | ['PARCEL', 250] | [250, 14103] | Failed |
| per piece round | [202, 8155] | [202, 8155] | Passed |
| single piece | ['PARCEL', 250] | ['PARCEL', 250] | Passed |
| average exactly 10 | ['PARCEL', 200] | [200, 9024] | Failed |
| two exact | [200, 15110] | [200, 15110] | Passed |
| threshold via rounding | [200, 8074] | [200, 8074] | Passed |
| generated mix 6 | ['PARCEL', 32] | ['PARCEL', 32] | Passed |
SHA-256 / e1bc40f31b41a418c03680370c863ffa25c2f9b97c22709abadd0720207bed7d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(pieces, zone, rates, min_piece):
ws = [math.ceil(w) for w in pieces]
total = sum(ws)
n = len(ws)
if n < 2 or total < 200 or total < 10 * n:
return ['PARCEL', total]
rate = rates[zone - 2]
charge = -(-total * rate // 100)
return [total, max(charge, min_piece * n)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['generated mix 6', [[10, 10.4, 10.4], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 500], ['PARCEL', 32]]], [['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['generated mix 9', [[19.2, 19.2], 7, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], ['PARCEL', 40]], ['generated mix 17', [[11, 10], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 21]]], [['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['minimum charge', [[100, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 5000], [200, 10000]], ['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['generated mix 20', [[110.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], ['PARCEL', 111]], ['generated mix 28', [[1.4, 2], 7, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 500], ['PARCEL', 4]]], [['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['minimum charge', [[100, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 5000], [200, 10000]], ['two exact', [[100, 100], 8, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 15110]], ['threshold via rounding', [[99.5, 100], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [200, 8074]], ['generated mix 31', [[100.5, 99.9], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], [201, 11339]], ['generated mix 39', [[40.9, 40.9, 50.5, 40.5, 40.5, 40.5, 40.5, 40.5, 50.5, 40.9, 41.5, 50.5, 40.9, 40.9, 50.5, 40.5, 50.5, 41.5, 40.5, 50.5], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 3000], [882, 60000]]], [['light average', [[150, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 200]], ['rounded pieces reach average', [[9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2, 9.2], 5, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [250, 14103]], ['many one pound pieces', [[120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 4, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], ['PARCEL', 210]], ['per piece round', [[100.2, 100.2], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], [202, 8155]], ['single piece', [[250], 2, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 1500], ['PARCEL', 250]], ['average exactly 10', [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 100], [200, 9024]], ['generated mix 42', [[76.3, 76.3, 66.3], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], [221, 18000]], ['generated mix 50', [[150, 150], 3, [4037, 4512, 5093, 5641, 6218, 6907, 7555], 6000], [300, 13536]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| light average | ['PARCEL', 200] | ['PARCEL', 200] | Passed |
| rounded pieces reach average | [250, 14103] | [250, 14103] | Passed |
| per piece round | [202, 8155] | [202, 8155] | Passed |
| single piece | ['PARCEL', 250] | ['PARCEL', 250] | Passed |
| average exactly 10 | [200, 9024] | [200, 9024] | Passed |
| two exact | [200, 15110] | [200, 15110] | Passed |
| threshold via rounding | [200, 8074] | [200, 8074] | Passed |
| generated mix 6 | ['PARCEL', 32] | ['PARCEL', 32] | Passed |
SHA-256 / 15d41e818be9208ad4dfcb7b8ba1b1181aef59735aca7f9c46e59fbb1dc3412f
Verification & scope
Stipulated qualification and rate rules. 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:52:14.870443+00:00.
Case digest / 1cc5d3c1494d81519a60ba40167828cd87461f8efbf456ff7061c645885956d1